summaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2014-09-15 22:13:07 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2014-09-16 22:42:06 +0200
commit41537a770b46f2376e74af58ba4885749339e81e (patch)
treec939e7dd15fc1ae1dc9be19f9bd9cf5dd6f016fd /Makerules
parent143b7505a2cc505e94bde9b82cad4f695d15433d (diff)
buildsys: fix IS_IN_lib*
define NOT_IN_libc / IS_IN_libxxx appropriately to fix pthread_once Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules32
1 files changed, 29 insertions, 3 deletions
diff --git a/Makerules b/Makerules
index 05d9548cb..85f21ea1a 100644
--- a/Makerules
+++ b/Makerules
@@ -26,6 +26,27 @@ $(lib-a-y): | $(top_builddir)lib
endif
objs: all_objs
+# apply unconditional per-directory flags
+define add_IS_IN_lib
+ifneq ($(strip $(2)),)
+__add_IS_IN_lib := $(subst $(top_builddir),,$(2))
+$$(__add_IS_IN_lib): CFLAGS-for-library-members:=$(CFLAGS-$(1)) -DIN_LIB=$(word 1,$(subst /, ,$(1)))
+endif
+endef
+$(eval $(call add_IS_IN_lib,rtld,$(ldso-y)))
+$(eval $(call add_IS_IN_lib,libc,$(libc-y) $(libc-static-y) $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y)))
+$(eval $(call add_IS_IN_lib,libcrypt,$(libcrypt-a-y) $(libcrypt-so-y)))
+$(eval $(call add_IS_IN_lib,libdl,$(libdl-a-y) $(libdl-so-y)))
+$(eval $(call add_IS_IN_lib,libintl,$(libintl-a-y) $(libintl-so-y)))
+$(eval $(call add_IS_IN_lib,libm,$(libm-a-y) $(libm-so-y)))
+$(eval $(call add_IS_IN_lib,libnsl,$(libnsl-a-y) $(libnsl-so-y)))
+$(eval $(call add_IS_IN_lib,libpthread/$(PTNAME),$(libpthread-a-y) $(libpthread-so-y) $(libpthread-nonshared-y)))
+$(eval $(call add_IS_IN_lib,libpthread/$(PTNAME)_db,$(libthread_db-a-y) $(libthread_db-so-y)))
+$(eval $(call add_IS_IN_lib,libresolv,$(libresolv-a-y) $(libresolv-so-y)))
+$(eval $(call add_IS_IN_lib,librt,$(librt-a-y) $(librt-so-y)))
+$(eval $(call add_IS_IN_lib,libutil,$(libutil-a-y) $(libutil-so-y)))
+$(eval $(call add_IS_IN_lib,libubacktrace,$(libubacktrace-a-y) $(libubacktrace-so-y)))
+
shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
$(libcrypt-so-y) $(libdl-so-y) \
$(libintl-so-y) $(libm-so-y) $(libnsl-so-y) \
@@ -228,14 +249,19 @@ maybe_exec = \
#collect_multi_flags = $(CFLAGS-$(notdir $(d))) $(CFLAGS-$(notdir $(patsubst %/,%,$(dir $(d)))))
collect_multi_flags = $(CFLAGS-$(notdir $(patsubst %/,%,$(dir $(d)))))
+#sub_srcdir = $(word 1,$(filter-out lib extra locale libpthread,$(wordlist 1,2,$(subst /, ,$(subst $(top_srcdir),,$(dir $<))))))
+
CFLAGS_gen.dep = -MT $@ -MD -MP -MF $(dir $@).$(notdir $@).dep
-cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) \
+cmd_compile.c = $(CC) -c $< -o $@ \
+ $(filter-out $(CFLAGS-OMIT-$(notdir $<)), \
+ $(CFLAGS) \
+ $(CFLAGS-for-library-members) \
$(CFLAGS-$(suffix $@)) \
- $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(<D)))) \
- $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) \
+ $(CFLAGS-y-$(subst $(top_srcdir),,$(<D))) \
$(CFLAGS-$(notdir $<)) \
$(CFLAGS-$(notdir $@)) \
+ ) \
$(CFLAGS_gen.dep)
cmd_compile.i = $(cmd_compile.c:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
cmd_compile.s = $(cmd_compile.c:-c=-S)