Makerules 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. #
  2. # Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
  3. #
  4. .SUFFIXES: .c .S .o .os .oS .so .a .s .i
  5. PHONY := FORCE
  6. .PHONY: dummy $(PHONY) subdirs \
  7. all check test $(clean_targets) \
  8. config dist menuconfig oldconfig release \
  9. utils help
  10. # order is important, the stripping uses STRIP_FLAGS for lib-so, but not for lib-a
  11. ifeq ($(HAVE_SHARED),y)
  12. .LIBPATTERNS: "lib%.so"
  13. libs: $(lib-so-y) $(lib-a-y)
  14. $(lib-so-y): | $(interp)
  15. else
  16. .LIBPATTERNS: "lib%.a"
  17. ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
  18. libs: $(lib-gdb-y)
  19. endif
  20. libs: $(lib-a-y)
  21. endif
  22. objs: all_objs
  23. shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
  24. $(libcrypt-so-y) $(libdl-so-y) \
  25. $(libintl-so-y) $(libm-so-y) $(libnsl-so-y) \
  26. $(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \
  27. $(libresolv-so-y) $(librt-so-y) \
  28. $(ldso-y) \
  29. $(libutil-so-y)
  30. ar_objs = $(libc-y) $(libc-static-y) $(libcrypt-a-y) \
  31. $(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \
  32. $(libpthread-a-y) $(libthread_db-a-y) \
  33. $(libresolv-a-y) $(librt-a-y) $(libutil-a-y)
  34. ifeq ($(DOPIC),y)
  35. ar_objs := $(ar_objs:.o=.os)
  36. endif
  37. flat_objs = $(lib-gdb-y)
  38. ifeq ($(HAVE_SHARED),y)
  39. all_objs: $(sort $(shared_objs) $(ar_objs))
  40. else
  41. all_objs: $(ar_objs)
  42. endif
  43. $(shared_objs) $(ar_objs): | $(sub_headers)
  44. headers-y: $(headers-y)
  45. @true
  46. MAKEFLAGS += --no-print-directory
  47. SHELL_SET_X := set +x
  48. define rel_srcdir
  49. $(shell $(CONFIG_SHELL) $(top_srcdir)/extra/scripts/relative_path.sh $(@D) .)
  50. endef
  51. ifneq ($(findstring s,$(MAKEFLAGS)),)
  52. export MAKE_IS_SILENT := y
  53. SECHO := -@false
  54. DISP := sil
  55. Q := @
  56. else
  57. export MAKE_IS_SILENT := n
  58. SECHO := @echo
  59. ifneq ($(V)$(VERBOSE),)
  60. SHELL_SET_X := set -x
  61. DISP := ver
  62. Q :=
  63. else
  64. DISP := pur
  65. Q := @
  66. endif
  67. endif
  68. show_objs = $(subst $(top_builddir),,$(subst ../,,$@))
  69. pur_disp_compile.c = echo " "CC $(show_objs)
  70. pur_disp_compile.i = echo " "CPP $(show_objs)
  71. pur_disp_compile.s = echo " "CC-S $(show_objs)
  72. pur_disp_compile.u = echo " "CC $(show_objs)
  73. pur_disp_compile.S = echo " "AS $(show_objs)
  74. pur_disp_compile.m = $(pur_disp_compile.c)
  75. pur_disp_compile.mi= echo " "CPP-m $(show_objs)
  76. pur_disp_compile-m = echo " "CC-m $(show_objs)
  77. pur_disp_hcompile.u= echo " "HOSTCC $(show_objs)
  78. pur_disp_hcompile.o= echo " "HOSTCC-o $(show_objs)
  79. pur_disp_strip = echo " "STRIP $(STRIP_FLAGS) $@
  80. pur_disp_t_strip = echo " "STRIP $(STRIP_FLAGS) $@
  81. pur_disp_ar = echo " "AR $(ARFLAGS) $@
  82. pur_disp_ld = echo " "LD $(1)
  83. pur_disp_ln = echo " "LN $(show_objs)
  84. pur_disp_mkdir = echo " "MKDIR $(show_objs)
  85. pur_disp_gen = echo " "GEN $(show_objs)
  86. pur_disp_unifdef = echo " "UNIFDEF $(show_objs)
  87. pur_disp_rm = echo " "CLEAN $(@:_clean=)
  88. sil_disp_compile.c = true
  89. sil_disp_compile.i = true
  90. sil_disp_compile.s = true
  91. sil_disp_compile.u = true
  92. sil_disp_compile.S = true
  93. sil_disp_compile.m = true
  94. sil_disp_compile.mi= true
  95. sil_disp_compile-m = true
  96. sil_disp_hcompile.u= true
  97. sil_disp_hcompile.o= true
  98. sil_disp_strip = true
  99. sil_disp_t_strip = true
  100. sil_disp_ar = true
  101. sil_disp_ld = true
  102. sil_disp_ln = true
  103. sil_disp_mkdir = true
  104. sil_disp_gen = true
  105. sil_disp_unifdef = true
  106. sil_disp_rm = true
  107. ver_disp_compile.c = echo $(cmd_compile.c)
  108. ver_disp_compile.i = echo $(cmd_compile.i)
  109. ver_disp_compile.s = echo $(cmd_compile.s)
  110. ver_disp_compile.u = echo $(cmd_compile.u)
  111. ver_disp_compile.S = echo $(cmd_compile.S)
  112. ver_disp_compile.m = echo $(cmd_compile.m)
  113. ver_disp_compile.mi= echo $(cmd_compile.mi)
  114. ver_disp_compile-m = echo $(cmd_compile-m)
  115. ver_disp_hcompile.u= echo $(cmd_hcompile.u)
  116. ver_disp_hcompile.o= echo $(cmd_hcompile.o)
  117. ver_disp_strip = echo $(cmd_strip)
  118. ver_disp_t_strip = echo $(cmd_t_strip)
  119. ver_disp_ar = echo $(cmd_ar)
  120. ver_disp_ld =
  121. ver_disp_ln =
  122. ver_disp_mkdir =
  123. ver_disp_gen =
  124. ver_disp_unifdef = echo $(cmd_unifdef)
  125. ver_disp_rm =
  126. disp_compile.c = $($(DISP)_disp_compile.c)
  127. disp_compile.i = $($(DISP)_disp_compile.i)
  128. disp_compile.s = $($(DISP)_disp_compile.s)
  129. disp_compile.u = $($(DISP)_disp_compile.u)
  130. disp_compile.S = $($(DISP)_disp_compile.S)
  131. disp_compile.m = $($(DISP)_disp_compile.m)
  132. disp_compile.mi= $($(DISP)_disp_compile.mi)
  133. disp_compile-m = $($(DISP)_disp_compile-m)
  134. disp_hcompile.u= $($(DISP)_disp_hcompile.u)
  135. disp_hcompile.o= $($(DISP)_disp_hcompile.o)
  136. disp_strip = $($(DISP)_disp_strip)
  137. disp_t_strip = $($(DISP)_disp_t_strip)
  138. disp_ar = $($(DISP)_disp_ar)
  139. disp_ld = $($(DISP)_disp_ld)
  140. disp_ln = $($(DISP)_disp_ln)
  141. disp_mkdir = $($(DISP)_disp_mkdir)
  142. disp_gen = $($(DISP)_disp_gen)
  143. disp_unifdef = $($(DISP)_disp_unifdef)
  144. disp_rm = $($(DISP)_disp_rm)
  145. any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
  146. # ../foo/bar/baz.ext -> foo_bar_baz.ext
  147. variablify = $(subst /,_,$(subst $(top_builddir),,$(1)))
  148. # strip the top_builddir off everything to make the *string* idempotent for -C
  149. dirify = $(subst $(top_builddir),,$(patsubst -L$(top_builddir)%,-L%,$(patsubst -I$(top_builddir)%,-I%,$(1))))
  150. # True if not identical. Neither order nor whitespace nor identical flags
  151. # matter.
  152. compare_flags = \
  153. $(strip $(filter-out $(call dirify,$(cmd_$(call variablify,$(1)))), \
  154. $(call dirify,$(cmd_$(call variablify,$(@))))) \
  155. $(filter-out $(call dirify,$(cmd_$(call variablify,$(@)))), \
  156. $(call dirify,$(cmd_$(call variablify,$(1))))))
  157. # Rebuild if any prerequisite, the used CC or flags changed.
  158. # Previously used flags are stored in the corresponding .%.dep files
  159. maybe_exec = \
  160. $(if $(strip $(compare_flags) $(any-prereq)), \
  161. @set -e; \
  162. $(disp_$(1)); \
  163. $(cmd_$(1)); \
  164. echo 'cmd_$(call variablify,$@) := $(call dirify,$(cmd_$(call variablify,$1)))' >> $(dir $@).$(notdir $@).dep)
  165. CFLAGS_gen.dep = -MT $@ -MD -MP -MF $(dir $@).$(notdir $@).dep
  166. cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) \
  167. $(CFLAGS-$(suffix $@)) \
  168. $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(<D)))) \
  169. $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) \
  170. $(CFLAGS-$(notdir $<)) \
  171. $(CFLAGS-$(notdir $@)) \
  172. $(CFLAGS_gen.dep)
  173. cmd_compile.i = $(cmd_compile.c:-c=-E -dD $(EXTRA_CPPFLAGS))
  174. cmd_compile.s = $(cmd_compile.c:-c=-S)
  175. cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
  176. cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
  177. cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
  178. cmd_compile.mi= $(cmd_compile.m:-c=-E -dD $(EXTRA_CPPFLAGS))
  179. cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@))
  180. cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^
  181. cmd_t_strip = $(STRIPTOOL) $(STRIP_FLAGS) $@
  182. cmd_ar = $(AR) $(ARFLAGS) $@ $^
  183. define do_ln
  184. @$(disp_ln)
  185. $(Q)$(LN) -fs
  186. endef
  187. define do_mkdir
  188. @$(disp_mkdir)
  189. $(Q)$(INSTALL) -d $@
  190. endef
  191. define do_rm
  192. @$(disp_rm)
  193. $(Q)$(RM)
  194. endef
  195. define do_awk
  196. @$(disp_gen)
  197. $(Q)$(AWK) -f
  198. endef
  199. define do_sed
  200. @$(disp_gen)
  201. $(Q)$(SED)
  202. endef
  203. compile.c = @$(call maybe_exec,compile.c)
  204. compile.i = $(call maybe_exec,compile.i)
  205. compile.s = $(call maybe_exec,compile.s)
  206. compile.S = @$(call maybe_exec,compile.S)
  207. compile.m = @$(call maybe_exec,compile.m)
  208. compile.mi= $(call maybe_exec,compile.mi)
  209. compile-m = @$(disp_compile-m) ; $(cmd_compile-m) && $(cmd_t_strip)
  210. do_strip = @$(disp_strip) ; $(cmd_strip)
  211. do_t_strip= @$(disp_t_strip) ; $(cmd_t_strip)
  212. do_unifdef= @$(disp_unifdef) ; $(cmd_unifdef)
  213. hcompile.u= @$(disp_hcompile.u); $(cmd_hcompile.u)
  214. hcompile.o= @$(disp_hcompile.o); $(cmd_hcompile.o)
  215. define do_ar
  216. @$(disp_ar) ; $(cmd_ar)
  217. @$(do_t_strip)
  218. endef
  219. define compile.u
  220. @$(disp_compile.u) ; $(cmd_compile.u)
  221. @$(disp_t_strip)
  222. endef
  223. cmd_hcompile.u = $(HOSTCC) $(filter-out $(PHONY),$^) $(DEPS-$(notdir $@)) -o $@ $(BUILD_LDFLAGS) $(BUILD_LDFLAGS-$(notdir $(^D))) $(BUILD_LDFLAGS-$(notdir $@)) $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
  224. cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o $@ $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
  225. define link.so
  226. $(Q)$(INSTALL) -d $(dir $@)
  227. $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1)
  228. @$(disp_ld)
  229. $(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \
  230. $(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
  231. -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \
  232. $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
  233. $(Q)$(LN) -sf $(1) $@.$(2)
  234. $(Q)$(LN) -sf $(1) $@
  235. endef
  236. # CRT files needed by link-flat.so
  237. LINK_FLAT_CRTS := $(top_builddir)lib/Scrt1.o $(top_builddir)lib/crti.o \
  238. $(top_builddir)lib/crtn.o
  239. # Create a shared flat library from the archive named by the first dependency.
  240. # $@ names the shared library's .gdb file, not the flat file itself.
  241. # (This is because the .gdb suffix makes the ELF file more distinctive
  242. # than the suffixless flat file.)
  243. #
  244. # Argument 1 is the shared library file -- i.e. $(@:.gdb=) -- and argument 2
  245. # is the shared library identifier. If it wasn't for $(disp_ld), we could
  246. # avoid passing $(@:.gdb=) as an argument and use $(@:.gdb=) instead of $(1).
  247. #
  248. # This is so far only used for libc, for which we want to link the entire
  249. # libgcc into the shared object.
  250. define link-flat.so
  251. $(Q)$(INSTALL) -d $(dir $@)
  252. $(Q)$(RM) $(1) $@
  253. @$(disp_ld)
  254. $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(NOSTDLIB_CFLAGS) -o $(1) \
  255. -Wl,-elf2flt -Wl,-shared-lib-id,$(2) $(top_builddir)lib/Scrt1.o \
  256. $(top_builddir)/lib/crti.o -Wl,--whole-archive $(firstword $^) \
  257. $(LIBGCC) -Wl,--no-whole-archive $(LIBS-$(notdir $@)) $(LIBGCC) \
  258. $(top_builddir)/lib/crtn.o
  259. endef
  260. define linkm.so
  261. $(Q)$(INSTALL) -d $(dir $@)
  262. $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1)
  263. $(do_strip)
  264. @$(disp_ld)
  265. $(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \
  266. $(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
  267. $^ \
  268. $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
  269. $(Q)$(LN) -sf $(1) $@.$(2)
  270. $(Q)$(LN) -sf $(1) $@
  271. endef
  272. CFLAGS-.os+=$(PICFLAG)
  273. CFLAGS-.oS+=$(PICFLAG) -DSHARED
  274. $(top_builddir)%.o: $(top_srcdir)%.c FORCE ; $(compile.c)
  275. $(top_builddir)%.os: $(top_srcdir)%.c FORCE ; $(compile.c)
  276. $(top_builddir)%.oS: $(top_srcdir)%.c FORCE ; $(compile.c)
  277. $(top_builddir)%.o: $(top_srcdir)%.S FORCE ; $(compile.S)
  278. $(top_builddir)%.os: $(top_srcdir)%.S FORCE ; $(compile.S)
  279. $(top_builddir)%.oS: $(top_srcdir)%.S FORCE ; $(compile.S)
  280. $(top_builddir)%.o: $(top_srcdir)%.s FORCE ; $(compile.S)
  281. $(top_builddir)%.os: $(top_srcdir)%.s FORCE ; $(compile.S)
  282. $(top_builddir)%.oS: $(top_srcdir)%.s FORCE ; $(compile.S)
  283. $(top_builddir)%.i: $(top_srcdir)%.c FORCE ; $(compile.i)
  284. $(top_builddir)%.i: $(top_srcdir)%.S FORCE ; $(compile.i)
  285. $(top_builddir)%.s: $(top_srcdir)%.c FORCE ; $(compile.s)
  286. $(top_builddir)%.s: $(top_srcdir)%.S FORCE ; $(compile.s)
  287. $(top_builddir)%.dep:
  288. $(top_builddir)lib/interp.c: | $(sub_headers)
  289. $(Q)$(INSTALL) -d $(dir $@)
  290. $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@
  291. $(Q)echo "#include <features.h>" >> $@
  292. $(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \
  293. "(\".interp\"))) =\""$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)"\";" >> $@
  294. $(interp): $(top_builddir)lib/interp.c
  295. $(compile.c)
  296. $(Q)$(STRIPTOOL) -x -R .note -R .comment $@
  297. $(ldso):
  298. @cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(MAJOR_VERSION),%,$(notdir $@))
  299. $(libc):
  300. @cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(MAJOR_VERSION),%,$(notdir $@))
  301. CRT := crt1
  302. ifeq ($(HAVE_SHARED)$(UCLIBC_FORMAT_SHARED_FLAT),y)
  303. CRTS=$(top_builddir)lib/$(CRT).o $(top_builddir)lib/S$(CRT).o
  304. else
  305. CRTS=$(top_builddir)lib/$(CRT).o
  306. endif
  307. ASFLAGS-$(CRT).o := -DL_$(CRT)
  308. ASFLAGS-S$(CRT).o := $(PIEFLAG) -DL_S$(CRT)
  309. $(CRTS): $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(CRT).S
  310. $(Q)$(INSTALL) -d $(dir $@)
  311. $(compile.S)
  312. $(Q)$(STRIPTOOL) -x -R .note -R .comment $@
  313. ifeq ($(UCLIBC_CTOR_DTOR),y)
  314. CTOR_TARGETS=$(top_builddir)lib/crti.o $(top_builddir)lib/crtn.o
  315. else
  316. CTOR_TARGETS:=
  317. endif
  318. ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
  319. CRTRELOC=$(top_builddir)lib/crtreloc.o
  320. $(CRTRELOC): $(top_builddir)lib/%.o : $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/%.c
  321. $(Q)$(INSTALL) -d $(dir $@)
  322. $(compile.c)
  323. endif
  324. ifneq ($(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/initfini.c),)
  325. CFLAGS-initfini.s := -S -g0 $(PICFLAG) -fno-inline-functions -finhibit-size-directive
  326. $(top_builddir)lib/initfini.s: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/initfini.c
  327. $(compile.c)
  328. $(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s
  329. $(Q)sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
  330. gawk -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
  331. $(Q)mv $@.tmp $@
  332. $(top_builddir)lib/crti.S: $(top_builddir)lib/initfini.s $(top_builddir)lib/defs.h
  333. $(Q)sed -n -e '1,/@HEADER_ENDS/p' \
  334. -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
  335. -e '/@TRAILER_BEGINS/,$$p' $< > $@
  336. $(top_builddir)lib/crtn.S: $(top_builddir)lib/initfini.s
  337. $(Q)sed -n -e '1,/@HEADER_ENDS/p' \
  338. -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
  339. -e '/@TRAILER_BEGINS/,$$p' $< > $@
  340. $(CTOR_TARGETS): $(top_builddir)lib/%.o : $(top_builddir)lib/%.S
  341. $(Q)$(INSTALL) -d $(dir $@)
  342. $(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
  343. else
  344. $(CTOR_TARGETS): $(top_builddir)lib/%.o : $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/%.S
  345. $(Q)$(INSTALL) -d $(dir $@)
  346. $(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
  347. endif
  348. #ifeq ($(TARGET_ARCH),nios)
  349. #CRTS_COMPAT := $(top_builddir)lib/crt0.o
  350. #$(CRTS_COMPAT):
  351. # ln -fs crt1.o $(top_builddir)lib/crt0.o
  352. #else
  353. CRTS_COMPAT :=
  354. #endif
  355. $(crt-y): $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC)
  356. $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC): | headers
  357. $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
  358. $(Q)$(INSTALL) -d $(dir $@)
  359. $(Q)$(RM) $@
  360. $(do_ar)
  361. $(top_builddir)lib/libpthread_nonshared.a: $(libpthread-nonshared-y)
  362. $(Q)$(INSTALL) -d $(dir $@)
  363. $(Q)$(RM) $@
  364. $(do_ar)
  365. files.dep := $(libc-a-y) $(libc-so-y) $(libc-nonshared-y) \
  366. $(libm-a-y) $(libm-so-y) \
  367. $(libpthread-a-y) $(libpthread-so-y) $(libpthread-nonshared-y) \
  368. $(libthread_db-a-y) $(libthread_db-so-y) \
  369. $(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \
  370. $(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
  371. $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y)
  372. .depends.dep := \
  373. $(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \
  374. $(patsubst %.os,%.os.dep,$(filter %.os,$(files.dep))) \
  375. $(patsubst %.oS,%.oS.dep,$(filter %.oS,$(files.dep)))
  376. # Oh, and prepend a dot to the basename so i don't have to change my habit of
  377. # calling 'size thefile.o*'
  378. .depends.dep := $(foreach f,$(.depends.dep),$(dir $(f)).$(notdir $(f)))
  379. .depends.dep := $(wildcard $(.depends.dep))
  380. FORCE:
  381. clean: objclean-y headers_clean-y
  382. realclean: clean
  383. $(Q)$(RM) $(.depends.dep)
  384. objclean-y: $(objclean-y)
  385. headers_clean-y: $(headers_clean-y)
  386. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  387. ifneq ($(strip $(.depends.dep)),)
  388. .NOEXPORT:
  389. -include $(.depends.dep)
  390. endif
  391. endif
  392. # vi: ft=make :