OSDN Git Service

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