static-object.mk 914 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # This file is included several times in a row, once for each element of
  2. # $(iter-items). On each inclusion, we advance $o to the next element.
  3. o := $(firstword $(iter-items))
  4. iter-items := $(filter-out $o,$(iter-items))
  5. base := $(basename $(notdir $o))
  6. # Copy c_flags to a rule-specific copy and use the copy, to avoid the
  7. # following rules being affected by later changes to c_flags in the
  8. # including file.
  9. c_flags-$o := $(c_flags)
  10. ifeq ($(suffix $o),.c)
  11. $(base)$(objext): $o
  12. $(gcc_compile) $(c_flags-$<) -c $< $(vis_hide)
  13. else
  14. ifneq ($(suffix $o),.S)
  15. ifneq ($(suffix $o),.asm)
  16. $(error Unsupported file type: $o)
  17. endif
  18. endif
  19. as_flags-$o := -xassembler$(if $(filter .S,$(suffix $o)),-with-cpp)
  20. $(base)$(objext): $o $(base).vis
  21. $(gcc_compile) -c $(as_flags-$<) -include $*.vis $<
  22. $(base).vis: $(base)_s$(objext)
  23. $(gen-hide-list)
  24. $(base)_s$(objext): $o
  25. $(gcc_s_compile) -c $(as_flags-$<) $<
  26. endif