summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in158
-rw-r--r--Makerules27
-rw-r--r--Rules.mak4
-rw-r--r--libc/sysdeps/linux/Makefile.commonarch9
-rw-r--r--libpthread/linuxthreads.old/Makefile.in16
-rw-r--r--libpthread/linuxthreads/Makefile.in16
6 files changed, 147 insertions, 83 deletions
diff --git a/Makefile.in b/Makefile.in
index 8dfaaebfc..d116e48a6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -15,6 +15,8 @@ noconfig_targets := menuconfig config oldconfig silentoldconfig randconfig \
include $(top_builddir)Rules.mak
sub_headers := headers
+#suspicious_dependency:=include/bits
+
ifeq ($(HAVE_DOT_CONFIG),y)
all: pregen libs
@@ -36,11 +38,17 @@ include $(top_srcdir)extra/locale/Makefile.in
# last included to catch all the objects added by others (locales/threads)
include $(top_srcdir)libc/Makefile.in
-include/bits/uClibc_config.h: extra/config/conf .config
- $(Q)$(INSTALL) -d $(dir $@)
- $(Q)@$< -o $(top_srcdir)extra/Configs/Config.in
- $(top_srcdir)extra/scripts/conf-header.sh .config > include/bits/uClibc_config.h
-
+# If the .config changes then we have to make sure that our includes are
+# updated properly. This would normally work by saying that the headers
+# have uClibc_config.h as prerequisite but since we _symlink_ the headers
+# and do not (?) want to rely on 'make -L' we better update them right here,
+# on spot to save us from alot of hazzle.
+include/bits/uClibc_config.h: extra/config/conf .config $(top_srcdir)extra/scripts/conf-header.sh | include/bits
+ @$(disp_gen)
+ @#superfluous: $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)@$< -s $(top_srcdir)extra/Configs/Config.in
+ $(Q)$(top_srcdir)extra/scripts/conf-header.sh .config > $@
+ $(Q)$(MAKE) headers-y
# For the moment, we have to keep re-running this target
# because the fix includes scripts rely on pre-processers
@@ -59,49 +67,81 @@ ifneq ($(TARGET_SUBARCH),)
HEADERS_BITS_SUBARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/*.h))
endif
HEADERS_BITS_COMMON := $(filter-out $(HEADERS_BITS_ARCH) $(HEADERS_BITS_SUBARCH),$(HEADERS_BITS_COMMON))
-headers: include/bits/uClibc_config.h
- $(Q)$(MAKE) headers-y
- $(Q)\
- set -e; \
- if [ -e libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h ] ; then \
- $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h include/ ; \
- else \
- $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h include/ ; \
- fi; \
- for f in dl-osinfo.h hp-timing.h ; do \
- $(LN) -fs ../libc/sysdeps/linux/common/$$f include/ ; \
- done
- $(Q)\
- cd include/bits; \
- set -e; \
- for i in $(HEADERS_BITS_COMMON) ; do \
- $(LN) -fs ../../libc/sysdeps/linux/common/bits/$$i .; \
- done; \
- for i in $(HEADERS_BITS_ARCH) ; do \
- $(LN) -fs ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$$i .; \
- done; \
- for i in $(HEADERS_BITS_SUBARCH) ; do \
- $(LN) -fs ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/$$i .; \
- done
- $(Q)\
- cd include/sys; \
- set -e; \
- for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
- $(LN) -fs $$i .; \
- done; \
- if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
- for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
- $(LN) -fs $$i .; \
- done; \
- fi
-ifeq ($(UCLIBC_HAS_LOCALE),y)
- $(MAKE) -C extra/locale locale_headers
+
+HEADERS_SYS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/sys/*.h))
+HEADERS_SYS_ARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h))
+HEADERS_SYS_COMMON := $(filter-out $(HEADERS_SYS_ARCH),$(HEADERS_SYS_COMMON))
+
+ALL_HEADERS_COMMON := include/fpu_control.h include/dl-osinfo.h \
+ include/hp-timing.h
+ALL_HEADERS_BITS_COMMON := $(addprefix include/bits/,$(HEADERS_BITS_COMMON))
+ALL_HEADERS_BITS_ARCH := $(addprefix include/bits/,$(HEADERS_BITS_ARCH))
+ifneq ($(TARGET_SUBARCH),)
+ALL_HEADERS_BITS_SUBARCH := $(addprefix include/bits/,$(HEADERS_BITS_SUBARCH))
+else
+ALL_HEADERS_BITS_SUBARCH :=
endif
+ALL_HEADERS_SYS_COMMON := $(addprefix include/sys/,$(HEADERS_SYS_COMMON))
+ALL_HEADERS_SYS_ARCH := $(addprefix include/sys/,$(HEADERS_SYS_ARCH))
+
+target-headers-sysdep := \
+ $(ALL_HEADERS_COMMON) \
+ $(ALL_HEADERS_BITS_COMMON) \
+ $(ALL_HEADERS_BITS_ARCH) \
+ $(ALL_HEADERS_BITS_SUBARCH) \
+ $(ALL_HEADERS_SYS_COMMON) \
+ $(ALL_HEADERS_SYS_ARCH)
+
+include/fpu_control.h:
+ @$(disp_ln)
+ $(Q)[ -r libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) ] && \
+ $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@ || \
+ $(LN) -fs ../libc/sysdeps/linux/common/$(@F) $@
+
+include/dl-osinfo.h include/hp-timing.h:
+ $(do_ln) ../libc/sysdeps/linux/common/$(@F) $@
+
+$(ALL_HEADERS_BITS_COMMON):
+ $(do_ln) ../../libc/sysdeps/linux/common/bits/$(@F) $@
+
+$(ALL_HEADERS_BITS_ARCH):
+ $(do_ln) ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(@F) $@
+
+ifneq ($(TARGET_SUBARCH),)
+$(ALL_HEADERS_BITS_SUBARCH):
+ $(do_ln) ../../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/$(@F) $@
+endif
+
+ifneq ($(strip $(ALL_HEADERS_SYS_COMMON)),)
+$(ALL_HEADERS_SYS_COMMON):
+ $(do_ln) ../../libc/sysdeps/linux/common/sys/$(@F) $@
+endif
+
+ifneq ($(strip $(ALL_HEADERS_SYS_ARCH)),)
+$(ALL_HEADERS_SYS_ARCH):
+ $(do_ln) ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/$(@F) $@
+endif
+
+$(target-headers-sysdep): | include/bits
+
+sysdep_common_headers-clean:
+ $(RM) $(ALL_HEADERS_COMMON)
+headers_clean-y += sysdep_common_headers-clean
+
+# The headers. Arch specific headers are specified via ARCH_HEADERS in
+# libc/sysdeps/linux/$(TARGET_ARCH)/Makefile.arch which appends those via
+# libc/sysdeps/linux/Makefile.commonarch to headers-y
+headers-y += $(target-headers-sysdep)
+
+headers: include/bits/uClibc_config.h
+ $(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
+pregen: include/bits/sysnum.h headers
-pregen: headers
- $(Q)\
- set -e; \
+include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh
+ $(Q)$(INSTALL) -d $(@D)
+ @$(disp_gen)
+ $(Q)set -e; \
cd $(top_builddir); \
tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \
[ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \
@@ -368,33 +408,30 @@ headers:
endif # ifeq ($(HAVE_DOT_CONFIG),y)
include/bits:
- $(INSTALL) -d include/bits
+ @$(disp_mkdir)
+ $(Q)$(INSTALL) -d $@
# configuration
# ---------------------------------------------------------------------------
-extra/config/conf extra/config/mconf: include/bits
-# TODO: this results in "make[1]: `conf' is up to date" printed
-# on every rebuild, because extra/config/conf is already built
-# on previous make run. Make it "test -x $@ || ..." (simple & a bit wrong)
-# or "make -q -C extra/config $(notdir $@) || ..." (less readable)?
+extra/config/conf extra/config/mconf: $(suspicious_dependency)
$(Q)$(MAKE) -C extra/config $(notdir $@)
-menuconfig: extra/config/mconf include/bits
+menuconfig: extra/config/mconf $(suspicious_dependency)
$(Q)./extra/config/mconf extra/Configs/Config.in
-config: extra/config/conf include/bits
+config: extra/config/conf $(suspicious_dependency)
$(Q)./extra/config/conf extra/Configs/Config.in
-oldconfig: extra/config/conf include/bits
+oldconfig: extra/config/conf $(suspicious_dependency)
$(Q)./extra/config/conf -o extra/Configs/Config.in
-silentoldconfig: extra/config/conf include/bits
+silentoldconfig: extra/config/conf $(suspicious_dependency)
$(Q)./extra/config/conf -s extra/Configs/Config.in
-randconfig: extra/config/conf include/bits
+randconfig: extra/config/conf $(suspicious_dependency)
$(Q)./extra/config/conf -r extra/Configs/Config.in
-allyesconfig: extra/config/conf include/bits
+allyesconfig: extra/config/conf $(suspicious_dependency)
$(Q)./extra/config/conf -y extra/Configs/Config.in
sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
@@ -403,10 +440,10 @@ allyesconfig: extra/config/conf include/bits
sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
$(Q)./extra/config/conf -o extra/Configs/Config.in
-allnoconfig: extra/config/conf include/bits
+allnoconfig: extra/config/conf $(suspicious_dependency)
$(Q)./extra/config/conf -n extra/Configs/Config.in
-defconfig: extra/config/conf include/bits
+defconfig: extra/config/conf $(suspicious_dependency)
$(Q)./extra/config/conf -d extra/Configs/Config.in \
-D extra/Configs/defconfigs/$(ARCH)
@@ -414,8 +451,7 @@ clean:
$(Q)$(RM) -r lib include/bits
$(RM) ldso/*/*.a libpthread/*/*.a libc/*.a libcrypt/*.a libintl/*.a \
libm/*.a libnsl/*.a libpthread/*.a libresolv/*.a librt/*.a \
- libutil/*.a lib/*.a \
- include/fpu_control.h include/dl-osinfo.h include/hp-timing.h
+ libutil/*.a lib/*.a
$(MAKE) objclean-y headers_clean-y
$(MAKE) -s -C test clean
$(MAKE) -C utils utils_clean
diff --git a/Makerules b/Makerules
index b8ef1be59..b068651ba 100644
--- a/Makerules
+++ b/Makerules
@@ -71,6 +71,10 @@ pur_disp_strip = echo " "STRIP $(STRIP_FLAGS) $@
pur_disp_t_strip = echo " "STRIP $(STRIP_FLAGS) $@
pur_disp_ar = echo " "AR $(ARFLAGS) $@
pur_disp_ld = echo " "LD $(1)
+pur_disp_ln = echo " "LN $@
+pur_disp_mkdir = echo " "MKDIR $@
+pur_disp_gen = echo " "GEN $@
+pur_disp_unifdef = echo " "UNIFDEF $@
sil_disp_compile.c = true
sil_disp_compile.i = true
@@ -83,6 +87,10 @@ sil_disp_strip = true
sil_disp_t_strip = true
sil_disp_ar = true
sil_disp_ld = true
+sil_disp_ln = true
+sil_disp_mkdir = true
+sil_disp_gen = true
+sil_disp_unifdef = true
ver_disp_compile.c = echo $(cmd_compile.c)
ver_disp_compile.i = echo $(cmd_compile.i)
@@ -95,6 +103,10 @@ ver_disp_strip = echo $(cmd_strip)
ver_disp_t_strip = echo $(cmd_t_strip)
ver_disp_ar = echo $(cmd_ar)
ver_disp_ld =
+ver_disp_ln =
+ver_disp_mkdir =
+ver_disp_gen =
+ver_disp_unifdef = echo $(cmd_unifdef)
disp_compile.c = $($(DISP)_disp_compile.c)
disp_compile.i = $($(DISP)_disp_compile.i)
@@ -107,6 +119,10 @@ disp_strip = $($(DISP)_disp_strip)
disp_t_strip = $($(DISP)_disp_t_strip)
disp_ar = $($(DISP)_disp_ar)
disp_ld = $($(DISP)_disp_ld)
+disp_ln = $($(DISP)_disp_ln)
+disp_mkdir = $($(DISP)_disp_mkdir)
+disp_gen = $($(DISP)_disp_gen)
+disp_unifdef = $($(DISP)_disp_unifdef)
any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
@@ -143,6 +159,13 @@ cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^
cmd_t_strip = $(STRIPTOOL) $(STRIP_FLAGS) $@
cmd_ar = $(AR) $(ARFLAGS) $@ $^
+# special suckage alert. We try to avoid --check-symlink-times thus we touch
+# the link-target.
+define do_ln
+ @$(disp_ln)
+ $(Q)$(LN) -fs
+endef
+
compile.c = @$(call maybe_exec,compile.c)
compile.i = $(call maybe_exec,compile.i)
compile.s = $(call maybe_exec,compile.s)
@@ -152,6 +175,7 @@ compile-m = @$(disp_compile-m) ; $(cmd_compile-m)
do_strip = @$(disp_strip) ; $(cmd_strip)
do_t_strip= @$(disp_t_strip) ; $(cmd_t_strip)
do_ar = @$(disp_ar) ; $(cmd_ar)
+do_unifdef= @$(disp_unifdef) ; $(cmd_unifdef)
define compile.u
@$(disp_compile.u) ; $(cmd_compile.u)
@@ -244,9 +268,6 @@ $(ldso):
$(libc):
@cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(MAJOR_VERSION),%,$(notdir $@))
-$(headers_dep): $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh
- $(Q)cd $(top_builddir); $(MAKE) pregen
-
CRT := crt1
ifeq ($(HAVE_SHARED)$(UCLIBC_FORMAT_SHARED_FLAT),y)
diff --git a/Rules.mak b/Rules.mak
index 66f4a6c01..8382691d8 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -44,6 +44,8 @@ TAR = tar
STRIP_FLAGS ?= -x -R .note -R .comment
+UNIFDEF := $(top_builddir)extra/scripts/unifdef -UUCLIBC_INTERNAL
+
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
BUILD_CFLAGS = -O2 -Wall
@@ -175,7 +177,7 @@ ifeq ($(TARGET_ARCH),i386)
# -O1 -march=pentium3, -Os -msse etc are known to be affected.
# TODO: conditionally bump to 4
# (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13685)
- OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
+ OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=4,)
# Choice of alignment (please document why!)
# -falign-labels: in-line labels
diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
index 74b9660b5..ff3e90aa7 100644
--- a/libc/sysdeps/linux/Makefile.commonarch
+++ b/libc/sysdeps/linux/Makefile.commonarch
@@ -28,13 +28,10 @@ ifneq ($(ARCH_HEADERS),)
ARCH_HEADERS_IN := $(patsubst %,../libc/sysdeps/linux/$(TARGET_ARCH)/%,$(ARCH_HEADERS))
ARCH_HEADERS_OUT := $(patsubst %,$(top_builddir)include/%,$(ARCH_HEADERS))
-headers-y += arch_headers
-arch_headers:
- $(SECHO) $(LN) -fs $(ARCH_HEADERS) $(top_builddir)include/
- @for h in $(ARCH_HEADERS_IN) ; do \
- $(LN) -fs $$h $(top_builddir)include/ ; \
- done
+$(ARCH_HEADERS_OUT):
+ $(do_ln) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@
+headers-y += $(ARCH_HEADERS_OUT)
headers_clean-y += arch_headers_clean
arch_headers_clean:
$(RM) $(ARCH_HEADERS_OUT)
diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in
index fe7503bae..2608599ca 100644
--- a/libpthread/linuxthreads.old/Makefile.in
+++ b/libpthread/linuxthreads.old/Makefile.in
@@ -108,14 +108,18 @@ $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
$(do_ar)
$(do_t_strip)
-linuxthreads_headers:
- $(Q)$(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
- $(Q)$(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
- $(Q)$(INSTALL) -d $(top_builddir)include/bits
- $(Q)$(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
+include/pthread.h:
+ $(do_ln) ../$(PTDIR)/sysdeps/pthread/$(@F) $(top_builddir)$@
+include/semaphore.h:
+ $(do_ln) ../$(PTDIR)/$(@F) $(top_builddir)$@
+include/bits/pthreadtypes.h: | include/bits
+ $(do_ln) ../../$(PTDIR)/sysdeps/pthread/bits/$(@F) $(top_builddir)$@
+linuxthreads_headers: include/pthread.h include/semaphore.h \
+ include/bits/pthreadtypes.h
linuxthreads_headers_clean:
- $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
+ $(RM) $(top_builddir)include/pthread.h \
+ $(top_builddir)include/semaphore.h \
$(top_builddir)include/bits/pthreadtypes.h
libpthread_clean:
diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in
index d51da51fa..5508847c2 100644
--- a/libpthread/linuxthreads/Makefile.in
+++ b/libpthread/linuxthreads/Makefile.in
@@ -121,14 +121,18 @@ $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
$(do_ar)
$(do_t_strip)
-linuxthreads_headers:
- $(Q)$(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
- $(Q)$(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
- $(Q)$(INSTALL) -d $(top_builddir)include/bits
- $(Q)$(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
+include/pthread.h:
+ $(do_ln) ../$(PTDIR)/sysdeps/pthread/$(@F) $(top_builddir)$@
+include/semaphore.h:
+ $(do_ln) ../$(PTDIR)/$(@F) $(top_builddir)$@
+include/bits/pthreadtypes.h: | include/bits
+ $(do_ln) ../../$(PTDIR)/sysdeps/pthread/bits/$(@F) $(top_builddir)$@
+linuxthreads_headers: include/pthread.h include/semaphore.h \
+ include/bits/pthreadtypes.h
linuxthreads_headers_clean:
- $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
+ $(RM) $(top_builddir)include/pthread.h \
+ $(top_builddir)include/semaphore.h \
$(top_builddir)include/bits/pthreadtypes.h
libpthread_clean: