2 # Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
5 .SUFFIXES: .c .S .o .os .oS .so .a .s .i
9 .PHONY: dummy $(PHONY) subdirs \
10 all check test $(clean_targets) \
11 config dist menuconfig oldconfig release \
14 # order is important, the stripping uses STRIP_FLAGS for lib-so, but not for lib-a
15 ifeq ($(HAVE_SHARED),y)
16 .LIBPATTERNS: "lib%.so"
17 libs: $(lib-so-y) $(lib-a-y)
18 $(lib-so-y): | $(interp)
20 .LIBPATTERNS: "lib%.a"
21 ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
25 $(lib-a-y): | $(top_builddir)lib
29 # apply unconditional per-directory flags
31 ifneq ($(strip $(2)),)
32 __add_IS_IN_lib := $(2)
33 $$(__add_IS_IN_lib): CFLAGS-for-library-members:=$(CFLAGS-$(1)) -DIN_LIB=$(word 1,$(subst /, ,$(1)))
36 $(eval $(call add_IS_IN_lib,rtld,$(ldso-y)))
37 $(eval $(call add_IS_IN_lib,libc,$(libc-y) $(libc-static-y) $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y)))
38 $(eval $(call add_IS_IN_lib,libcrypt,$(libcrypt-a-y) $(libcrypt-so-y)))
39 $(eval $(call add_IS_IN_lib,libdl,$(libdl-a-y) $(libdl-so-y)))
40 $(eval $(call add_IS_IN_lib,libintl,$(libintl-a-y) $(libintl-so-y)))
41 $(eval $(call add_IS_IN_lib,libm,$(libm-a-y) $(libm-so-y)))
42 $(eval $(call add_IS_IN_lib,libnsl,$(libnsl-a-y) $(libnsl-so-y)))
43 $(eval $(call add_IS_IN_lib,libpthread/$(PTNAME),$(libpthread-a-y) $(libpthread-so-y) $(libpthread-nonshared-y)))
44 $(eval $(call add_IS_IN_lib,libpthread/$(PTNAME)_db,$(libthread_db-a-y) $(libthread_db-so-y)))
45 $(eval $(call add_IS_IN_lib,libresolv,$(libresolv-a-y) $(libresolv-so-y)))
46 $(eval $(call add_IS_IN_lib,librt,$(librt-a-y) $(librt-so-y)))
47 $(eval $(call add_IS_IN_lib,libutil,$(libutil-a-y) $(libutil-so-y)))
48 $(eval $(call add_IS_IN_lib,libubacktrace,$(libubacktrace-a-y) $(libubacktrace-so-y)))
50 shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
51 $(libcrypt-so-y) $(libdl-so-y) \
52 $(libintl-so-y) $(libm-so-y) $(libnsl-so-y) \
53 $(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \
54 $(libresolv-so-y) $(librt-so-y) \
56 $(libutil-so-y) $(libubacktrace-so-y)
58 ar_objs = $(libc-y) $(libc-static-y) $(libcrypt-a-y) \
59 $(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \
60 $(libpthread-a-y) $(libthread_db-a-y) \
61 $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y)
63 ar_objs := $(ar_objs:.o=.os)
65 flat_objs = $(lib-gdb-y)
67 ifeq ($(HAVE_SHARED),y)
68 all_objs: $(sort $(shared_objs) $(ar_objs))
72 $(shared_objs) $(ar_objs): | $(sub_headers)
74 define objects_with_syms
75 $(foreach o,$(2),$(if $(shell $(NM) $(1) $(o) | grep .),$(o)))
78 headers-y: $(headers-y)
81 MAKEFLAGS += --no-print-directory
84 $(shell $(CONFIG_SHELL) $(top_srcdir)/extra/scripts/relative_path.sh $(@D) .)
86 ifneq ($(findstring s,$(MAKEFLAGS)),)
87 export MAKE_IS_SILENT := y
92 export MAKE_IS_SILENT := n
94 ifneq ($(V)$(VERBOSE),)
96 DISP := bri# brief, like pur but with defines
109 show_objs = $(subst $(top_builddir),,$(subst ../,,$@))
114 $(subst $(comma), ,$(subst -Wl$(comma),,$(filter -Wl%,$(1))))
117 pur_disp_compile.c = echo " "CC $(show_objs)
118 pur_disp_compile.i = echo " "CPP $(show_objs)
119 pur_disp_compile.s = echo " "CC-S $(show_objs)
120 pur_disp_compile.u = echo " "CC $(show_objs)
121 pur_disp_compile.S = echo " "AS $(show_objs)
122 pur_disp_compile.m = $(pur_disp_compile.c)
123 pur_disp_compile.mi= echo " "CPP-m $(show_objs)
124 pur_disp_compile-m = echo " "CC-m $(show_objs)
125 pur_disp_hcompile.u= echo " "HOSTCC $(show_objs)
126 pur_disp_hcompile.o= echo " "HOSTCC-o $(show_objs)
127 pur_disp_strip = echo " "STRIP $(STRIP_FLAGS) $@
128 pur_disp_t_strip = echo " "STRIP $(STRIP_FLAGS) $@
129 pur_disp_ar = echo " "AR $(ARFLAGS) $@
130 pur_disp_ld = echo " "LD $(1)
131 pur_disp_ln = echo " "LN $(show_objs)
132 pur_disp_mkdir = echo " "MKDIR $(show_objs)
133 pur_disp_gen = echo " "GEN $(show_objs)
134 pur_disp_install = echo " "INSTALL $(1)
135 pur_disp_unifdef = echo " "UNIFDEF $(show_objs)
136 pur_disp_rm = echo " "CLEAN $(subst CLEAN_,,$(patsubst HEADERCLEAN_%,include \(%\),$@))
138 sil_disp_compile.c = true
139 sil_disp_compile.i = true
140 sil_disp_compile.s = true
141 sil_disp_compile.u = true
142 sil_disp_compile.S = true
143 sil_disp_compile.m = true
144 sil_disp_compile.mi= true
145 sil_disp_compile-m = true
146 sil_disp_hcompile.u= true
147 sil_disp_hcompile.o= true
148 sil_disp_strip = true
149 sil_disp_t_strip = true
153 sil_disp_mkdir = true
155 sil_disp_install = true
156 sil_disp_unifdef = true
159 bri_disp_compile.c = $(pur_disp_compile.c) $(call show_defs,$(cmd_compile.c))
160 bri_disp_compile.i = $(pur_disp_compile.i) $(call show_defs,$(cmd_compile.i))
161 bri_disp_compile.s = $(pur_disp_compile.s) $(call show_defs,$(cmd_compile.s))
162 bri_disp_compile.u = $(pur_disp_compile.u) $(call show_defs,$(cmd_compile.u))
163 bri_disp_compile.S = $(pur_disp_compile.S) $(call show_defs,$(cmd_compile.S))
164 bri_disp_compile.m = $(pur_disp_compile.m) $(call show_defs,$(cmd_compile.m))
165 bri_disp_compile.mi = $(pur_disp_compile.mi) $(call show_defs,$(cmd_compile.mi))
166 bri_disp_compile-m = $(pur_disp_compile-m) $(call show_defs,$(cmd_compile-m))
167 bri_disp_hcompile.u = $(pur_disp_hcompile.u) $(call show_defs,$(cmd_hcompile.u))
168 bri_disp_hcompile.o = $(pur_disp_hcompile.o) $(call show_defs,$(cmd_hcompile.o))
169 bri_disp_strip = $(pur_disp_strip)
170 bri_disp_t_strip = $(pur_disp_t_strip)
171 bri_disp_ar = $(pur_disp_ar)
172 bri_disp_ld = $(pur_disp_ld) $(call show_ldflags,$(cmd_ld))
173 bri_disp_ln = $(pur_disp_ln)
174 bri_disp_mkdir = $(pur_disp_mkdir)
175 bri_disp_gen = $(pur_disp_gen)
176 bri_disp_install = $(pur_disp_install)
177 bri_disp_unifdef = $(pur_disp_unifdef)
178 bri_disp_rm = $(pur_disp_rm)
180 esc=$(subst ','\'',$(1))
182 ver_disp_compile.c = echo '$(call esc,$(cmd_compile.c))'
183 ver_disp_compile.i = echo '$(call esc,$(cmd_compile.i))'
184 ver_disp_compile.s = echo '$(call esc,$(cmd_compile.s))'
185 ver_disp_compile.u = echo '$(call esc,$(cmd_compile.u))'
186 ver_disp_compile.S = echo '$(call esc,$(cmd_compile.S))'
187 ver_disp_compile.m = echo '$(call esc,$(cmd_compile.m))'
188 ver_disp_compile.mi= echo '$(call esc,$(cmd_compile.mi))'
189 ver_disp_compile-m = echo '$(call esc,$(cmd_compile-m))'
190 ver_disp_hcompile.u= echo '$(call esc,$(cmd_hcompile.u))'
191 ver_disp_hcompile.o= echo '$(call esc,$(cmd_hcompile.o))'
192 ver_disp_strip = echo '$(call esc,$(cmd_strip))'
193 ver_disp_t_strip = echo '$(call esc,$(cmd_t_strip))'
194 ver_disp_ar = echo '$(call esc,$(cmd_ar))'
200 ver_disp_unifdef = echo '$(call esc,$(cmd_unifdef))'
203 disp_compile.c = $($(DISP)_disp_compile.c)
204 disp_compile.i = $($(DISP)_disp_compile.i)
205 disp_compile.s = $($(DISP)_disp_compile.s)
206 disp_compile.u = $($(DISP)_disp_compile.u)
207 disp_compile.S = $($(DISP)_disp_compile.S)
208 disp_compile.m = $($(DISP)_disp_compile.m)
209 disp_compile.mi= $($(DISP)_disp_compile.mi)
210 disp_compile-m = $($(DISP)_disp_compile-m)
211 disp_hcompile.u= $($(DISP)_disp_hcompile.u)
212 disp_hcompile.o= $($(DISP)_disp_hcompile.o)
213 disp_strip = $($(DISP)_disp_strip)
214 disp_t_strip = $($(DISP)_disp_t_strip)
215 disp_ar = $($(DISP)_disp_ar)
216 disp_ld = $($(DISP)_disp_ld)
217 disp_ln = $($(DISP)_disp_ln)
218 disp_mkdir = $($(DISP)_disp_mkdir)
219 disp_gen = $($(DISP)_disp_gen)
220 disp_install = $($(DISP)_disp_install)
221 disp_unifdef = $($(DISP)_disp_unifdef)
222 disp_rm = $($(DISP)_disp_rm)
224 any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
226 # ../foo/bar/baz.ext -> foo_bar_baz.ext
227 variablify = $(subst /,_,$(subst $(top_builddir),,$(1)))
228 # strip the top_builddir off everything to make the *string* idempotent for -C
229 dirify = $(subst $(top_builddir),,$(patsubst -L$(top_builddir)%,-L%,$(patsubst -I$(top_builddir)%,-I%,$(1))))
231 # True if not identical. Neither order nor whitespace nor identical flags
234 $(strip $(filter-out $(call dirify,$(cmd_$(call variablify,$(1)))), \
235 $(call dirify,$(cmd_$(call variablify,$(@))))) \
236 $(filter-out $(call dirify,$(cmd_$(call variablify,$(@)))), \
237 $(call dirify,$(cmd_$(call variablify,$(1))))))
239 # Rebuild if any prerequisite, the used CC or flags changed.
240 # Previously used flags are stored in the corresponding .%.dep files
242 $(if $(strip $(compare_flags) $(any-prereq)), \
246 echo 'cmd_$(call variablify,$@) := $(call dirify,$(cmd_$(call variablify,$1)))' >> $(dir $@).$(notdir $@).dep)
248 # collect flags of domulti prereqs
249 #collect_multi_flags = $(CFLAGS-$(notdir $(d))) $(CFLAGS-$(notdir $(patsubst %/,%,$(dir $(d)))))
250 collect_multi_flags = $(CFLAGS-$(notdir $(patsubst %/,%,$(dir $(d)))))
252 #sub_srcdir = $(word 1,$(filter-out lib extra locale libpthread,$(wordlist 1,2,$(subst /, ,$(subst $(top_srcdir),,$(dir $<))))))
254 CFLAGS_gen.dep = -MT $@ -MD -MP -MF $(dir $@).$(notdir $@).dep
256 cmd_compile.c = $(CC) -c $< -o $@ \
257 $(filter-out $(CFLAGS-OMIT-$(notdir $<)), \
259 $(CFLAGS-for-library-members) \
260 $(CFLAGS-$(suffix $@)) \
261 $(CFLAGS-y-$(subst $(top_srcdir),,$(<D))) \
262 $(CFLAGS-$(notdir $<)) \
263 $(CFLAGS-$(notdir $@)) \
266 cmd_compile.i = $(cmd_compile.c:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
267 cmd_compile.s = $(cmd_compile.c:-c=-S)
268 cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
269 cmd_compile.S = $(filter-out -std=%, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
270 cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
271 cmd_compile.mi= $(cmd_compile.m:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
273 cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) $(sort $(foreach d,$(^:$(top_srcdir)=),$(collect_multi_flags)))
274 cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^
275 cmd_t_strip = $(STRIPTOOL) $(STRIP_FLAGS) $@
276 cmd_ar = $(AR) $(ARFLAGS) $@ $(call objects_with_syms,,$^)
303 compile.c = @$(call maybe_exec,compile.c)
304 compile.i = $(call maybe_exec,compile.i)
305 compile.s = $(call maybe_exec,compile.s)
306 compile.S = @$(call maybe_exec,compile.S)
307 compile.m = @$(call maybe_exec,compile.m)
308 compile.mi= $(call maybe_exec,compile.mi)
309 compile-m = @$(disp_compile-m) ; $(cmd_compile-m) && $(cmd_t_strip)
310 do_strip = @$(disp_strip) ; $(cmd_strip)
311 do_t_strip= @$(disp_t_strip) ; $(cmd_t_strip)
312 do_unifdef= @$(disp_unifdef) ; $(cmd_unifdef)
313 hcompile.u= @$(disp_hcompile.u); $(cmd_hcompile.u)
314 hcompile.o= @$(disp_hcompile.o); $(cmd_hcompile.o)
317 @$(disp_ar) ; $(cmd_ar)
321 @$(disp_compile.u) ; $(cmd_compile.u)
324 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 $@))
325 cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o $@ $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
329 $(Q)$(CC) -nostdlib -nostartfiles -shared -Wl,-z,combreloc \
330 -Wl,-z,relro -Wl,--hash-style=gnu -Wl,-z,defs \
331 -Wl,--verbose 2>&1 | LC_ALL=C \
332 $(SED) -e '/^=========/,/^=========/!d;/^=========/d' \
333 -e 's/\. = .* + SIZEOF_HEADERS;/& $(SYMBOL_PREFIX)_begin = . - SIZEOF_HEADERS;/' > $@.lds
337 $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1)
339 $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \
340 -Wl,-soname=$(notdir $@).$(2) \
341 $(CFLAG_-nostdlib) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
342 -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \
343 $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
344 $(Q)$(LN) -sf $(1) $@.$(2)
345 $(Q)$(LN) -sf $(1) $@
348 # CRT files needed by link-flat.so
349 LINK_FLAT_CRTS := $(top_builddir)lib/Scrt1.o $(top_builddir)lib/crti.o \
350 $(top_builddir)lib/crtn.o
352 # Create a shared flat library from the archive named by the first dependency.
353 # $@ names the shared library's .gdb file, not the flat file itself.
354 # (This is because the .gdb suffix makes the ELF file more distinctive
355 # than the suffixless flat file.)
357 # Argument 1 is the shared library file -- i.e. $(@:.gdb=) -- and argument 2
358 # is the shared library identifier. If it wasn't for $(disp_ld), we could
359 # avoid passing $(@:.gdb=) as an argument and use $(@:.gdb=) instead of $(1).
361 # This is so far only used for libc, for which we want to link the entire
362 # libgcc into the shared object.
366 $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(CFLAG_-nostdlib) -o $(1) \
367 -Wl,-elf2flt -Wl,-shared-lib-id,$(2) $(top_builddir)lib/Scrt1.o \
368 $(top_builddir)/lib/crti.o -Wl,--whole-archive $(firstword $^) \
369 $(LIBGCC) -Wl,--no-whole-archive $(LIBS-$(notdir $@)) $(LIBGCC) \
370 $(top_builddir)/lib/crtn.o
374 $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1)
377 $(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \
378 $(CFLAG_-nostdlib) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
380 $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
381 $(Q)$(LN) -sf $(1) $@.$(2)
382 $(Q)$(LN) -sf $(1) $@
385 CFLAGS-.os+=$(PICFLAG)
386 CFLAGS-.oS+=$(PICFLAG) -DSHARED
388 $(top_builddir)%.o: $(top_srcdir)%.c FORCE ; $(compile.c)
389 $(top_builddir)%.os: $(top_srcdir)%.c FORCE | pregen; $(compile.c)
390 $(top_builddir)%.oS: $(top_srcdir)%.c FORCE | pregen; $(compile.c)
391 $(top_builddir)%.o: $(top_srcdir)%.S FORCE ; $(compile.S)
392 $(top_builddir)%.os: $(top_srcdir)%.S FORCE | pregen; $(compile.S)
393 $(top_builddir)%.oS: $(top_srcdir)%.S FORCE | pregen; $(compile.S)
394 $(top_builddir)%.o: $(top_srcdir)%.s FORCE ; $(compile.S)
395 $(top_builddir)%.os: $(top_srcdir)%.s FORCE ; $(compile.S)
396 $(top_builddir)%.oS: $(top_srcdir)%.s FORCE | pregen; $(compile.S)
397 $(top_builddir)%.i: $(top_srcdir)%.c FORCE | pregen; $(compile.i)
398 $(top_builddir)%.i: $(top_srcdir)%.S FORCE | pregen; $(compile.i)
399 $(top_builddir)%.s: $(top_srcdir)%.c FORCE | pregen; $(compile.s)
400 $(top_builddir)%.s: $(top_srcdir)%.S FORCE | pregen; $(compile.s)
401 $(top_builddir)%.dep:
403 $(top_builddir)lib/interp.c: | $(top_builddir)lib
404 $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@.tmp
405 $(Q)echo "#include <features.h>" >> $@.tmp
406 $(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \
407 "(\".interp\"))) =\""$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UCLIBC_LDSO)"\";" >> $@.tmp
408 $(Q)$(SED) -i -e 's://:/:g' $@.tmp
411 $(interp): $(top_builddir)lib/interp.c | $(sub_headers)
413 $(Q)$(STRIPTOOL) -x -R .note -R .comment $@
416 $(Q)cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(ABI_VERSION),%,$(notdir $@))
418 $(Q)cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(ABI_VERSION),%,$(notdir $@))
422 ifeq ($(HAVE_SHARED)$(UCLIBC_FORMAT_SHARED_FLAT),y)
423 CRTS=$(top_builddir)lib/$(CRT).o $(top_builddir)lib/S$(CRT).o
425 CRTS=$(top_builddir)lib/$(CRT).o
428 ASFLAGS-$(CRT).o := -DL_$(CRT)
429 ASFLAGS-S$(CRT).o := $(PIEFLAG) -DL_S$(CRT)
430 $(CRTS): $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(CRT).S
432 $(Q)$(STRIPTOOL) -x -R .note -R .comment $@
434 ifeq ($(UCLIBC_CTOR_DTOR),y)
435 CTOR_TARGETS=$(top_builddir)lib/crti.o $(top_builddir)lib/crtn.o
440 ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
441 CRTRELOC=$(top_builddir)lib/crtreloc.o
442 $(CRTRELOC): $(top_builddir)lib/%.o : $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/%.c
446 ifneq ($(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/initfini.c),)
447 CFLAGS-initfini.s := -S -g0 $(PICFLAG) -fno-inline-functions -finhibit-size-directive
448 $(top_builddir)lib/initfini.s: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/initfini.c | $(top_builddir)lib
451 $(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s | $(top_builddir)lib
452 $(Q)sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
453 gawk -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
456 $(top_builddir)lib/crti.S: $(top_builddir)lib/initfini.s $(top_builddir)lib/defs.h
457 $(Q)sed -n -e '1,/@HEADER_ENDS/p' \
458 -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
459 -e '/@TRAILER_BEGINS/,$$p' $< > $@
461 $(top_builddir)lib/crtn.S: $(top_builddir)lib/initfini.s
462 $(Q)sed -n -e '1,/@HEADER_ENDS/p' \
463 -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
464 -e '/@TRAILER_BEGINS/,$$p' $< > $@
466 $(CTOR_TARGETS): $(top_builddir)lib/%.o : $(top_builddir)lib/%.S
467 $(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
469 $(CTOR_TARGETS): $(top_builddir)lib/%.o : $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/%.S
470 $(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
473 #ifeq ($(TARGET_ARCH),nios)
474 #CRTS_COMPAT := $(top_builddir)lib/crt0.o
476 # ln -fs crt1.o $(top_builddir)lib/crt0.o
481 startfiles = $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC)
482 $(crt-y): $(startfiles)
483 $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC): | headers
484 $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) $(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES) : | $(top_builddir)lib
486 $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
490 $(top_builddir)lib/libpthread_nonshared.a: $(libpthread-nonshared-y)
494 files.dep := $(libc-a-y) $(libc-so-y) $(libc-nonshared-y) \
495 $(libm-a-y) $(libm-so-y) \
496 $(libpthread-a-y) $(libpthread-so-y) $(libpthread-nonshared-y) \
497 $(libthread_db-a-y) $(libthread_db-so-y) $(libpthread-generated-y) \
498 $(START_FILE-libpthread.so) $(END_FILE-libpthread.so) \
499 $(PTHREAD_INITFINI:.c=.s) \
500 $(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \
501 $(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
502 $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \
503 $(libubacktrace-a-y) $(libubacktrace-so-y)
505 $(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \
506 $(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \
507 $(patsubst %.os,%.os.dep,$(filter %.os,$(files.dep))) \
508 $(patsubst %.oS,%.oS.dep,$(filter %.oS,$(files.dep)))
509 # Oh, and prepend a dot to the basename so i don't have to change my habit of
510 # calling 'size thefile.o*'
511 .depends.dep := $(foreach f,$(.depends.dep),$(dir $(f)).$(notdir $(f)))
512 .depends.dep := $(wildcard $(.depends.dep))
516 clean: objclean-y headers_clean-y
517 realclean: clean menuconfig-clean-y
518 $(Q)$(RM) $(.depends.dep)
520 objclean-y: $(objclean-y)
521 headers_clean-y: $(headers_clean-y)
523 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
524 ifneq ($(strip $(.depends.dep)),)
526 -include $(.depends.dep)