123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- #
- # Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
- #
- .SUFFIXES: .c .S .o .os .oS .so .a .s .i
- # order is important, the stripping uses STRIP_FLAGS for lib-so, but not for lib-a
- ifeq ($(HAVE_SHARED),y)
- .LIBPATTERNS: "lib%.so"
- libs: lib-so-y lib-a-y
- objs: shared_objs ar_objs
- else
- .LIBPATTERNS: "lib%.a"
- libs: lib-a-y
- objs: ar_objs
- endif
- shared_objs-y = $(lduClibc-so-y) $(libc-so-y) $(libc-nonshared-y) $(libdl-so-y)
- shared_objs-y += $(libcrypt-so-y) $(libintl-so-y) $(libm-so-y) $(libnsl-so-y) $(libpthread-so-y)
- shared_objs-y += $(libresolv-so-y) $(librt-so-y) $(libutil-so-y)
- ar_objs-y = $(libc-a-y) $(libcrypt-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y)
- ar_objs-y += $(libpthread-a-y) $(libresolv-a-y) $(librt-a-y) $(libutil-a-y)
- shared_objs: $(shared_objs-y)
- ifeq ($(DOPIC),y)
- ar_objs: $(ar_objs-y:.o=.os)
- else
- ar_objs: $(ar_objs-y)
- endif
- headers-y: $(headers-y)
- ld-uClibc-y: $(ld-uClibc-y)
- interp-y: $(interp)
- pre-y: interp-y ld-uClibc-y
- libc-y: pre-y $(libc) crt-y
- lib-a-y: headers_root crt-y $(lib-a-y)
- lib-so-y: libc-y $(lib-so-y)
- headers_root:
- @cd $(top_builddir); $(MAKE) headers
- ifneq ($(findstring s,$(MAKEFLAGS)),)
- DISP := sil
- Q := @
- else
- ifneq ($(V)$(VERBOSE),)
- DISP := ver
- Q :=
- else
- DISP := pur
- Q := @
- endif
- endif
- show_objs = $(subst ../,,$@)
- pur_disp_compile.c = echo " "CC $(show_objs)
- pur_disp_compile.S = echo " "AS $(show_objs)
- pur_disp_compile.m = $(pur_disp_compile.c)
- pur_disp_compile-m = echo " "CC-m $(show_objs)
- pur_disp_strip = echo " "STRIP $(STRIP_FLAGS) $@:*
- pur_disp_ar = echo " "AR $(ARFLAGS) $@
- pur_disp_ld = echo " "LD $(1)
- sil_disp_compile.c = true
- sil_disp_compile.S = true
- sil_disp_compile.m = true
- sil_disp_compile-m = true
- sil_disp_strip = true
- sil_disp_ar = true
- sil_disp_ld = true
- ver_disp_compile.c = echo $(cmd_compile.c)
- ver_disp_compile.S = echo $(cmd_compile.S)
- ver_disp_compile.m = echo $(cmd_compile.m)
- ver_disp_compile-m = echo $(cmd_compile-m)
- ver_disp_strip = echo $(cmd_strip)
- ver_disp_ar = echo $(cmd_ar)
- ver_disp_ld =
- disp_compile.c = $($(DISP)_disp_compile.c)
- disp_compile.S = $($(DISP)_disp_compile.S)
- disp_compile.m = $($(DISP)_disp_compile.m)
- disp_compile-m = $($(DISP)_disp_compile-m)
- disp_strip = $($(DISP)_disp_strip)
- disp_ar = $($(DISP)_disp_ar)
- disp_ld = $($(DISP)_disp_ld)
- cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@))
- cmd_compile.S = $(cmd_compile.c) $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
- cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
- cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $@)) $(CFLAGS-multi-y)
- cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^
- cmd_ar = $(AR) $(ARFLAGS) $@ $^
- compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
- compile.E = $(cmd_compile.c:-c=-E)
- compile.S = @$(disp_compile.S) ; $(cmd_compile.S)
- compile.m = @$(disp_compile.m) ; $(cmd_compile.m)
- compile-m = @$(disp_compile-m) ; $(cmd_compile-m)
- do_strip = @$(disp_strip) ; $(cmd_strip)
- do_ar = @$(disp_ar) ; $(cmd_ar)
- define link.so
- $(Q)$(INSTALL) -d $(dir $@)
- $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1)
- @$(disp_ld)
- $(Q)$(LD) $(LDFLAGS-$(notdir $@)) -soname=$(notdir $@).$(2) \
- -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
- --whole-archive $(firstword $^) --no-whole-archive \
- $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
- $(Q)$(LN) -sf $(1) $@.$(2)
- $(Q)$(LN) -sf $(1) $@
- endef
- CFLAGS-.os+=$(PICFLAG)
- CFLAGS-.oS+=$(PICFLAG) -DSHARED
- %.o: %.c ; $(compile.c)
- %.os: %.c ; $(compile.c)
- %.oS: %.c ; $(compile.c)
- %.o: %.S ; $(compile.S)
- %.os: %.S ; $(compile.S)
- %.o: %.s ; $(compile.S)
- %.os: %.s ; $(compile.S)
- %.E: %.c ; $(compile.E)
- %.E: %.S ; $(compile.E)
- #ifeq ($(HAVE_ELF),y)
- CRT=crt1
- #else
- #CRT=crt0
- #endif
- ifeq ($(HAVE_SHARED),y)
- CRTS=$(top_builddir)lib/$(CRT).o $(top_builddir)lib/S$(CRT).o
- else
- CRTS=$(top_builddir)lib/$(CRT).o
- endif
- $(top_builddir)lib/$(CRT).o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(CRT).S
- $(Q)$(INSTALL) -d $(dir $@)
- $(compile.S) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
- @$(disp_strip) $(show_objs)
- $(Q)$(STRIPTOOL) -x -R .note -R .comment $@
- $(top_builddir)lib/S$(CRT).o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(CRT).S
- $(Q)$(INSTALL) -d $(dir $@)
- $(compile.S) $(PIEFLAG) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
- @$(disp_strip) $(show_objs)
- $(Q)$(STRIPTOOL) -x -R .note -R .comment $@
- CTOR_TARGETS=$(top_builddir)lib/crti.o $(top_builddir)lib/crtn.o
- ifeq ($(UCLIBC_CTOR_DTOR),y)
- $(top_builddir)lib/crti.o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/crti.S
- $(Q)$(INSTALL) -d $(dir $@)
- $(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
- $(top_builddir)lib/crtn.o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/crtn.S
- $(Q)$(INSTALL) -d $(dir $@)
- $(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
- else
- $(CTOR_TARGETS):
- $(Q)$(INSTALL) -d $(top_builddir)lib
- $(do_ar)
- endif
- crt-y: $(crt-y)
- $(crt-y): $(CRTS) $(CTOR_TARGETS)
- $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
- $(Q)$(INSTALL) -d $(dir $@)
- $(do_ar)
- .PHONY: dummy create
- clean: objclean-y headers_clean-y
- objclean-y: $(objclean-y)
- headers_clean-y: $(headers_clean-y)
|