summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-08-17 19:17:00 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-08-17 19:17:00 +0200
commit49d8a0e9c6e32701c7eca91a1204237d3a334e38 (patch)
tree500e0c09a66970494dffbfe3a36f958762d22f99
parent7f779e7937cca133ea5f2d18c154c6564516fd9f (diff)
support building out-of-tree
Handle O= Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--Makefile11
-rw-r--r--Makefile.help1
-rw-r--r--Makefile.in142
-rw-r--r--Makerules53
-rw-r--r--Rules.mak32
-rw-r--r--extra/config/Makefile87
-rw-r--r--extra/config/Makefile.kconfig4
-rw-r--r--extra/config/conf.c19
-rw-r--r--extra/config/confdata.c70
-rw-r--r--extra/config/expr.h82
-rw-r--r--extra/config/lex.zconf.c_shipped7
-rwxr-xr-xextra/config/lxdialog/check-lxdialog.sh2
-rw-r--r--extra/config/qconf.cc2
-rw-r--r--extra/config/zconf.l7
-rw-r--r--extra/config/zconf.tab.c_shipped2
-rw-r--r--extra/locale/Makefile.in59
-rw-r--r--extra/locale/gen_wc8bit.c293
-rw-r--r--extra/locale/gen_wctype.c65
-rw-r--r--ldso/ldso/Makefile.in2
-rw-r--r--ldso/libdl/Makefile.in2
-rw-r--r--libc/inet/Makefile.in2
-rw-r--r--libc/inet/rpc/Makefile.in2
-rw-r--r--libc/misc/assert/Makefile.in2
-rw-r--r--libc/misc/ctype/Makefile.in2
-rw-r--r--libc/misc/dirent/Makefile.in2
-rw-r--r--libc/misc/elf/Makefile.in2
-rw-r--r--libc/misc/error/Makefile.in2
-rw-r--r--libc/misc/file/Makefile.in2
-rw-r--r--libc/misc/fnmatch/Makefile.in2
-rw-r--r--libc/misc/ftw/Makefile.in2
-rw-r--r--libc/misc/glob/Makefile.in2
-rw-r--r--libc/misc/gnu/Makefile.in2
-rw-r--r--libc/misc/internals/Makefile.in2
-rw-r--r--libc/misc/locale/Makefile.in2
-rw-r--r--libc/misc/mntent/Makefile.in2
-rw-r--r--libc/misc/pthread/Makefile.in2
-rw-r--r--libc/misc/regex/Makefile.in2
-rw-r--r--libc/misc/search/Makefile.in2
-rw-r--r--libc/misc/statfs/Makefile.in2
-rw-r--r--libc/misc/syslog/Makefile.in2
-rw-r--r--libc/misc/sysvipc/Makefile.in2
-rw-r--r--libc/misc/time/Makefile.in2
-rw-r--r--libc/misc/ttyent/Makefile.in2
-rw-r--r--libc/misc/utmp/Makefile.in2
-rw-r--r--libc/misc/wchar/Makefile.in2
-rw-r--r--libc/misc/wctype/Makefile.in2
-rw-r--r--libc/misc/wordexp/Makefile.in2
-rw-r--r--libc/pwd_grp/Makefile.in2
-rw-r--r--libc/signal/Makefile.in2
-rw-r--r--libc/stdio/Makefile.in2
-rw-r--r--libc/stdlib/Makefile.in2
-rw-r--r--libc/stdlib/malloc-simple/Makefile.in2
-rw-r--r--libc/stdlib/malloc-standard/Makefile.in2
-rw-r--r--libc/stdlib/malloc/Makefile.in2
-rw-r--r--libc/string/Makefile.in2
-rw-r--r--libc/sysdeps/linux/Makefile.commonarch3
-rw-r--r--libc/sysdeps/linux/Makefile.in2
-rw-r--r--libc/termios/Makefile.in2
-rw-r--r--libc/unistd/Makefile.in2
-rw-r--r--libcrypt/Makefile.in2
-rw-r--r--libintl/Makefile.in2
-rw-r--r--libm/Makefile.in2
-rw-r--r--libnsl/Makefile.in2
-rw-r--r--libpthread/Makefile.in4
-rw-r--r--libpthread/linuxthreads.old/Makefile.in25
-rw-r--r--libpthread/linuxthreads.old_db/Makefile.in12
-rw-r--r--libpthread/linuxthreads/Makefile.in27
-rw-r--r--libpthread/linuxthreads_db/Makefile.in12
-rw-r--r--libresolv/Makefile.in2
-rw-r--r--librt/Makefile.in2
-rw-r--r--libutil/Makefile.in2
-rw-r--r--utils/Makefile.in1
72 files changed, 683 insertions, 433 deletions
diff --git a/Makefile b/Makefile
index 793ca7879..a1547ab28 100644
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,12 @@
#
top_srcdir=./
-top_builddir=./
-#include $(top_builddir)Rules.mak
-#all: libs
-include Makefile.in
+top_builddir=$(if $(O),$(O),.)/
+export top_builddir
+
+# We do not need built-in implicit rules
+MAKEFLAGS += -r
+
+include $(top_srcdir)Makefile.in
include $(top_srcdir)Makerules
include $(top_srcdir)Makefile.help
diff --git a/Makefile.help b/Makefile.help
index 3a8432870..586cccd6a 100644
--- a/Makefile.help
+++ b/Makefile.help
@@ -42,6 +42,7 @@ help:
@echo ' release - create a distribution tarball'
@echo
@echo 'Environment variables:'
+ @echo ' O=<abspath> - Use <abspath> as object directory'
@echo ' V="" - Quiet build (default)'
@echo ' V=1 - Verbose build'
@echo ' V=2 - Very verbose build'
diff --git a/Makefile.in b/Makefile.in
index 13e222101..f02b6bd55 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -14,16 +14,21 @@ noconfig_targets := menuconfig config oldconfig silentoldconfig randconfig \
defconfig allyesconfig allnoconfig \
release dist tags help
-include $(top_builddir)Rules.mak
+include $(top_srcdir)Rules.mak
sub_headers := headers
+ifndef KCONFIG_CONFIG
+KCONFIG_CONFIG := $(top_builddir).config
+endif
+export KCONFIG_CONFIG
+
ifeq ($(HAVE_DOT_CONFIG),y)
all: pregen libs
libs: pregen
# In this section, we need .config
--include .config.cmd
+-include $(top_builddir).config.cmd
else # ifeq ($(HAVE_DOT_CONFIG),y)
@@ -55,16 +60,17 @@ ifeq ($(HAVE_DOT_CONFIG),y)
# 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
+$(top_builddir)include/bits/uClibc_config.h: $(top_builddir)extra/config/conf $(KCONFIG_CONFIG) $(top_srcdir)extra/scripts/conf-header.sh | $(top_builddir)include/bits $(top_builddir)include/config
@$(disp_gen)
$(Q)@$< -s $(top_srcdir)extra/Configs/Config.in
- $(Q)$(top_srcdir)extra/scripts/conf-header.sh .config > $@
+ $(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@
$(Q)$(MAKE) headers-y
# The above doesn't work for threads, though. Just using check-symlinks for now.
# XXX: FIXME: this is ugly
MAKEFLAGS += -L
-include/config/linuxthreads/old.h include/config/linuxthreads/new.h:
+
+$(top_builddir)include/config/linuxthreads/old.h $(top_builddir)include/config/linuxthreads/new.h:
@true
# For the moment, we have to keep re-running this target
@@ -89,17 +95,18 @@ HEADERS_SYS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common
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))
+ALL_HEADERS_COMMON := $(top_builddir)include/fpu_control.h \
+ $(top_builddir)include/dl-osinfo.h \
+ $(top_builddir)include/hp-timing.h
+ALL_HEADERS_BITS_COMMON := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_COMMON))
+ALL_HEADERS_BITS_ARCH := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_ARCH))
ifneq ($(TARGET_SUBARCH),)
-ALL_HEADERS_BITS_SUBARCH := $(addprefix include/bits/,$(HEADERS_BITS_SUBARCH))
+ALL_HEADERS_BITS_SUBARCH := $(addprefix $(top_builddir)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))
+ALL_HEADERS_SYS_COMMON := $(addprefix $(top_builddir)include/sys/,$(HEADERS_SYS_COMMON))
+ALL_HEADERS_SYS_ARCH := $(addprefix $(top_builddir)include/sys/,$(HEADERS_SYS_ARCH))
target-headers-sysdep := \
$(ALL_HEADERS_COMMON) \
@@ -109,37 +116,37 @@ target-headers-sysdep := \
$(ALL_HEADERS_SYS_COMMON) \
$(ALL_HEADERS_SYS_ARCH)
-include/fpu_control.h:
+$(top_builddir)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) $@
+ $(Q)[ -r $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) ] && \
+ $(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@ || \
+ $(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@
-include/dl-osinfo.h include/hp-timing.h:
- $(do_ln) ../libc/sysdeps/linux/common/$(@F) $@
+$(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h:
+ $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@
$(ALL_HEADERS_BITS_COMMON):
- $(do_ln) ../../libc/sysdeps/linux/common/bits/$(@F) $@
+ $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common/bits/$(@F) $@
$(ALL_HEADERS_BITS_ARCH):
- $(do_ln) ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(@F) $@
+ $(do_ln) $(call rel_srcdir)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) $@
+ $(do_ln) $(call rel_srcdir)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) $@
+ $(do_ln) $(call rel_srcdir)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) $@
+ $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/sys/$(@F) $@
endif
-$(target-headers-sysdep): | include/bits
+$(target-headers-sysdep): | $(top_builddir)include/bits $(top_builddir)include/sys
sysdep_common_headers-clean:
$(RM) $(ALL_HEADERS_COMMON)
@@ -150,22 +157,21 @@ headers_clean-y += sysdep_common_headers-clean
# libc/sysdeps/linux/Makefile.commonarch to headers-y
headers-y += $(target-headers-sysdep)
-headers: include/bits/uClibc_config.h
-
-pregen: include/bits/sysnum.h headers
+headers: $(top_builddir)include/bits/uClibc_config.h
+subdirs: $(addprefix $(top_builddir),$(subdirs))
+pregen: $(top_builddir)include/bits/sysnum.h headers subdirs
-include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh
+$(top_builddir)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 || true`; \
- [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \
- KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) $(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \
- if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
+ tmp=`mktemp $(top_builddir)include/bits/sysnum.h.XXXXXX 2>/dev/null || true`; \
+ [ -z "$$tmp" ] && tmp='$(top_builddir)include/bits/sysnum.h.new'; \
+ KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir="$(top_builddir)" CC="$(CC) $(CPU_CFLAGS)" $(SHELL) $< > $$tmp; \
+ if cmp $(top_builddir)include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
$(RM) $$tmp; \
else \
- mv -f $$tmp include/bits/sysnum.h; \
+ mv -f $$tmp $(top_builddir)include/bits/sysnum.h; \
fi
@# Ugly linux specific hack..
$(Q)if grep -q __NR_ $@; then true; else \
@@ -380,70 +386,70 @@ hostutils:
install_hostutils: hostutils
$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils utils_install DOTHOST=.host
-include/bits include/config:
- @$(disp_mkdir)
- $(Q)$(INSTALL) -d $@
+$(addprefix $(top_builddir),include/bits include/sys include/config extra/config/lxdialog extra/locale $(subdirs)):
+ $(do_mkdir)
# configuration
# ---------------------------------------------------------------------------
-extra/config/conf extra/config/mconf: | include/config
- $(Q)$(MAKE) -C extra/config $(notdir $@)
+$(top_builddir)extra/config/conf $(top_builddir)extra/config/mconf: | $(top_builddir)include/config $(top_builddir)extra/config/lxdialog
+ $(Q)$(MAKE) -C extra/config $(@F)
-menuconfig: extra/config/mconf
- $(Q)./extra/config/mconf extra/Configs/Config.in
+menuconfig: $(top_builddir)extra/config/mconf
+ $(Q)$(top_builddir)extra/config/mconf extra/Configs/Config.in
-config: extra/config/conf
- $(Q)./extra/config/conf extra/Configs/Config.in
+config: $(top_builddir)extra/config/conf
+ $(Q)$(top_builddir)extra/config/conf extra/Configs/Config.in
-oldconfig: extra/config/conf
- $(Q)./extra/config/conf -o extra/Configs/Config.in
+oldconfig: $(top_builddir)extra/config/conf
+ $(Q)$(top_builddir)extra/config/conf -o extra/Configs/Config.in
-silentoldconfig: extra/config/conf
- $(Q)./extra/config/conf -s extra/Configs/Config.in
+silentoldconfig: $(top_builddir)extra/config/conf
+ $(Q)$(top_builddir)extra/config/conf -s extra/Configs/Config.in
-randconfig: extra/config/conf
- $(Q)./extra/config/conf -r extra/Configs/Config.in
+randconfig: $(top_builddir)extra/config/conf
+ $(Q)$(top_builddir)extra/config/conf -r extra/Configs/Config.in
-allyesconfig: extra/config/conf
- $(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
- $(SED) -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
- $(SED) -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
- $(SED) -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
- $(Q)./extra/config/conf -o extra/Configs/Config.in
+allyesconfig: $(top_builddir)extra/config/conf
+ $(Q)$(top_builddir)extra/config/conf -y extra/Configs/Config.in
+ $(SED) -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" \
+ -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" \
+ -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" \
+ -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" \
+ -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" \
+ $(KCONFIG_CONFIG)
+ $(Q)$(top_builddir)extra/config/conf -o extra/Configs/Config.in
-allnoconfig: extra/config/conf
- $(Q)./extra/config/conf -n extra/Configs/Config.in
+allnoconfig: $(top_builddir)extra/config/conf
+ $(Q)$(top_builddir)extra/config/conf -n extra/Configs/Config.in
-defconfig: extra/config/conf
- $(Q)./extra/config/conf -d extra/Configs/Config.in \
+defconfig: $(top_builddir)extra/config/conf
+ $(Q)$(top_builddir)extra/config/conf -d extra/Configs/Config.in \
-D extra/Configs/defconfigs/$(ARCH)
include_clean:
- $(Q)$(RM) include/fpu_control.h include/dl-osinfo.h include/hp-timing.h
+ $(Q)$(RM) $(top_builddir)include/fpu_control.h $(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h
@set -e; \
for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
- $(RM) include/sys/$$i; \
+ $(RM) $(top_builddir)include/sys/$$i; \
done; \
if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
- $(RM) include/sys/$$i; \
+ $(RM) $(top_builddir)include/sys/$$i; \
done; \
fi
clean: include_clean
- $(Q)$(RM) -r lib include/bits
+ $(Q)$(RM) -r $(top_builddir)lib $(top_builddir)include/bits
@$(MAKE) -C utils utils_clean
+$(MAKE) -s -C test clean
- @$(RM) include/linux include/asm*
+ @$(RM) $(top_builddir)include/linux $(top_builddir)include/asm*
$(Q)$(RM) $(top_builddir)extra/scripts/unifdef
$(Q)$(RM) -r $(LOCAL_INSTALL_PATH)
distclean: clean
-find . \( -name core -o -name \*.orig -o -name \*~ -o -name .\*.dep \) -exec $(RM) {} \;
- $(RM) .config .config.old .config.cmd
- $(RM) extra/locale/*.tgz
+ $(RM) $(top_builddir).config $(top_builddir).config.old $(top_builddir).config.cmd
+ $(RM) $(top_builddir)extra/locale/*.tgz
$(MAKE) -C extra/config distclean
dist release:
diff --git a/Makerules b/Makerules
index d21e6da95..e449dae1d 100644
--- a/Makerules
+++ b/Makerules
@@ -6,10 +6,10 @@
PHONY := FORCE
-.PHONY: dummy $(PHONY) \
+.PHONY: dummy $(PHONY) subdirs \
all check test $(clean_targets) \
config dist menuconfig oldconfig release \
- subdirs utils help
+ utils help
# order is important, the stripping uses STRIP_FLAGS for lib-so, but not for lib-a
ifeq ($(HAVE_SHARED),y)
@@ -54,6 +54,9 @@ headers-y: $(headers-y)
MAKEFLAGS += --no-print-directory
SHELL_SET_X := set +x
+define rel_srcdir
+ $(shell $(CONFIG_SHELL) $(top_srcdir)/extra/scripts/relative_path.sh $(@D) .)
+endef
ifneq ($(findstring s,$(MAKEFLAGS)),)
export MAKE_IS_SILENT := y
SECHO := -@false
@@ -72,7 +75,7 @@ Q := @
endif
endif
-show_objs = $(subst ../,,$@)
+show_objs = $(subst $(top_builddir),,$(subst ../,,$@))
pur_disp_compile.c = echo " "CC $(show_objs)
pur_disp_compile.i = echo " "CPP $(show_objs)
@@ -88,10 +91,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 $@
+pur_disp_ln = echo " "LN $(show_objs)
+pur_disp_mkdir = echo " "MKDIR $(show_objs)
+pur_disp_gen = echo " "GEN $(show_objs)
+pur_disp_unifdef = echo " "UNIFDEF $(show_objs)
pur_disp_rm = echo " "CLEAN $(@:_clean=)
sil_disp_compile.c = true
@@ -205,6 +208,10 @@ define do_ln
$(Q)$(LN) -fs
endef
+define do_mkdir
+ @$(disp_mkdir)
+ $(Q)$(INSTALL) -d $@
+endef
define do_rm
@$(disp_rm)
@@ -237,8 +244,8 @@ define compile.u
@$(disp_compile.u) ; $(cmd_compile.u)
@$(disp_t_strip)
endef
-cmd_hcompile.u = $(HOSTCC) $^ $(DEPS-$(notdir $@)) -o $@ $(BUILD_LDFLAGS) $(BUILD_LDFLAGS-$(notdir $(^D))) $(BUILD_LDFLAGS-$(notdir $@)) $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
-cmd_hcompile.o = $(HOSTCC) $^ $(DEPS-$(notdir $@)) -c -o $@ $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
+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 $@))
+cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o $@ $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
define link.so
$(Q)$(INSTALL) -d $(dir $@)
@@ -294,20 +301,20 @@ endef
CFLAGS-.os+=$(PICFLAG)
CFLAGS-.oS+=$(PICFLAG) -DSHARED
-%.o: %.c FORCE ; $(compile.c)
-%.os: %.c FORCE ; $(compile.c)
-%.oS: %.c FORCE ; $(compile.c)
-%.o: %.S FORCE ; $(compile.S)
-%.os: %.S FORCE ; $(compile.S)
-%.oS: %.S FORCE ; $(compile.S)
-%.o: %.s FORCE ; $(compile.S)
-%.os: %.s FORCE ; $(compile.S)
-%.oS: %.s FORCE ; $(compile.S)
-%.i: %.c FORCE ; $(compile.i)
-%.i: %.S FORCE ; $(compile.i)
-%.s: %.c FORCE ; $(compile.s)
-%.s: %.S FORCE ; $(compile.s)
-%.dep:
+$(top_builddir)%.o: $(top_srcdir)%.c FORCE ; $(compile.c)
+$(top_builddir)%.os: $(top_srcdir)%.c FORCE ; $(compile.c)
+$(top_builddir)%.oS: $(top_srcdir)%.c FORCE ; $(compile.c)
+$(top_builddir)%.o: $(top_srcdir)%.S FORCE ; $(compile.S)
+$(top_builddir)%.os: $(top_srcdir)%.S FORCE ; $(compile.S)
+$(top_builddir)%.oS: $(top_srcdir)%.S FORCE ; $(compile.S)
+$(top_builddir)%.o: $(top_srcdir)%.s FORCE ; $(compile.S)
+$(top_builddir)%.os: $(top_srcdir)%.s FORCE ; $(compile.S)
+$(top_builddir)%.oS: $(top_srcdir)%.s FORCE ; $(compile.S)
+$(top_builddir)%.i: $(top_srcdir)%.c FORCE ; $(compile.i)
+$(top_builddir)%.i: $(top_srcdir)%.S FORCE ; $(compile.i)
+$(top_builddir)%.s: $(top_srcdir)%.c FORCE ; $(compile.s)
+$(top_builddir)%.s: $(top_srcdir)%.S FORCE ; $(compile.s)
+$(top_builddir)%.dep:
$(top_builddir)lib/interp.c: | $(sub_headers)
$(Q)$(INSTALL) -d $(dir $@)
diff --git a/Rules.mak b/Rules.mak
index fcadb8a20..37430bb85 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -528,9 +528,9 @@ endif
NOSTDLIB_CFLAGS:=$(call check_gcc,-nostdlib,)
# Collect all CFLAGS components
-CFLAGS := -include $(top_builddir)include/libc-symbols.h \
+CFLAGS := -include $(top_srcdir)include/libc-symbols.h \
$(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
- -nostdinc -I$(top_builddir)include -I. \
+ -nostdinc -I$(top_builddir)include -I$(top_srcdir)include -I. \
-I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
CFLAGS += $(subst ",, $(UCLIBC_EXTRA_CFLAGS))
@@ -607,16 +607,16 @@ else
PTNAME := linuxthreads
endif
endif
-PTDIR := $(top_builddir)libpthread/$(PTNAME)
+PTDIR := libpthread/$(PTNAME)
# set up system dependencies include dirs (NOTE: order matters!)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-PTINC:= -I$(PTDIR) \
- -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
- -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \
- -I$(PTDIR)/sysdeps/unix/sysv/linux \
- -I$(PTDIR)/sysdeps/pthread \
- -I$(PTDIR)/sysdeps/pthread/bits \
- -I$(PTDIR)/sysdeps/generic \
+PTINC:= -I$(top_srcdir)$(PTDIR) \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/$(TARGET_ARCH) \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/pthread \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/pthread/bits \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/generic \
-I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \
-I$(top_srcdir)ldso/include
#
@@ -638,12 +638,12 @@ gcc_tls_test_fail:
endif
else
PTINC := \
- -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
- -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \
- -I$(PTDIR)/sysdeps/unix/sysv/linux \
- -I$(PTDIR)/sysdeps/pthread \
- -I$(PTDIR) \
- -I$(top_builddir)libpthread
+ -I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/$(TARGET_ARCH) \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux \
+ -I$(top_srcdir)$(PTDIR)/sysdeps/pthread \
+ -I$(top_srcdir)$(PTDIR) \
+ -I$(top_srcdir)libpthread
endif
CFLAGS+=$(PTINC)
else
diff --git a/extra/config/Makefile b/extra/config/Makefile
index 836f1f9f1..7d8a1e4ad 100644
--- a/extra/config/Makefile
+++ b/extra/config/Makefile
@@ -1,45 +1,86 @@
-obj := .
-src := .
-top_srcdir=../../
-top_builddir=../../
-srctree := .
-include $(top_builddir)Rules.mak
+top_srcdir ?= ../../
-include Makefile.kconfig
+include $(top_srcdir)Rules.mak
+include $(top_srcdir)Makerules
+
+# ugh
+top_srcdir:=$(shell cd $(top_srcdir) && pwd)/
+ifdef O
+top_builddir ?= ../../
+else
+top_builddir = ../../
+endif
+srctree := $(top_srcdir)
+src := extra/config
+obj := $(top_builddir)$(src)
+
+generated := $(patsubst %_shipped,%,$(wildcard *_shipped))
+generated := $(addprefix $(obj)/,$(generated:.c=.o))
+
+include $(top_srcdir)extra/config/Makefile.kconfig
+PHONY += $(always)
+chk-lxdialog := $(top_srcdir)$(src)/lxdialog/check-lxdialog.sh
+check-lxdialog := cd $(obj) && $(chk-lxdialog)
+HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) -c '$(check-lxdialog) -ccflags')
+HOST_LOADLIBES = $(shell $(CONFIG_SHELL) -c '$(check-lxdialog) -ldflags $(HOSTCC)')
+HOST_EXTRACFLAGS += -DLOCALE
+HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) -c '$(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)')
+
+# do not create temporary object in the readonly srctree
+$(obj)/dochecklxdialog:
+ $(Q)cd $(obj) && $(CONFIG_SHELL) $(chk-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
+HOSTCFLAGS_lex.zconf.o := -I$(top_srcdir)$(src)
+HOSTCFLAGS_zconf.tab.o := -I$(top_srcdir)$(src)
+conf-objs := $(addprefix $(obj)/,$(conf-objs))
+mconf-objs := $(addprefix $(obj)/,$(mconf-objs))
+kxgettext-objs := $(addprefix $(obj)/,$(kxgettext-objs))
ifeq ($(findstring mconf,$(MAKECMDGOALS)),mconf)
hostprogs-y += mconf
endif
--include .depend
-.depend: $(wildcard *.h *.c)
- $(Q)$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) -MM *.c > .depend 2>/dev/null || :
+#BUILD_CFLAGS-config = -W -Wall -pedantic
+#BUILD_CFLAGS-lxdialog = -W -Wall -pedantic
__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
-host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
+host-csingle:= $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
host-cmulti := $(foreach m,$(__hostprogs),\
$(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
-$(host-csingle): %: %.c
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< $(HOST_LOADLIBES) -o $@
+conf mconf kxgettext: %: $(obj)/%
+$(obj)/conf $(obj)/mconf $(obj)/kxgettext: BUILD_LDFLAGS=$(HOST_LOADLIBES)
+$(obj)/conf: $(conf-objs)
+ $(hcompile.u)
+$(obj)/mconf: $(mconf-objs)
+ $(hcompile.u)
+$(obj)/kxgettext: $(kxgettext-objs)
+ $(hcompile.u)
-$(host-cmulti): %: $(host-cobjs) $(host-cshlib)
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $($@-objs) $(HOST_LOADLIBES) -o $@
+$(host-csingle) $(host-cmulti) $(host-cobjs): BUILD_CFLAGS=$(HOST_EXTRACFLAGS) \
+ $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F))
-$(host-cobjs): %.o: %.c
- $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) -c $< -o $@
+host-cobjs.nogen := $(filter-out $(generated),$(host-cobjs))
+host-cobjs.generated := $(filter $(generated),$(host-cobjs))
-$(obj)/%:: $(src)/%_shipped
- $(Q)cat $< > $@
+$(host-cobjs.nogen): $(obj)/%.o: $(top_srcdir)$(src)/%.c
+ $(hcompile.o)
+$(host-cobjs.generated): $(obj)/%.o: $(obj)/%.c
+ $(hcompile.o)
+ifndef LKC_GENPARSER
+$(obj)/%:: $(top_srcdir)$(src)/%_shipped
+ @$(disp_gen)
+ $(Q)cat $< > $@
+endif
clean:
- $(Q)rm -f $(clean-files) conf
+ $(do_rm) $(clean-files) conf
distclean: clean
- $(Q)rm -f $(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \
+ $(do_rm) $(lxdialog) $(conf-objs) $(mconf-objs) \
+ $(kxgettext-objs) \
$(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \
.depend
- $(Q)rm -r -f $(top_builddir)include/config
+ $(do_rm) -r $(top_builddir)include/config
FORCE:
-.PHONY: FORCE clean distclean
+.PHONY: FORCE clean distclean $(always)
diff --git a/extra/config/Makefile.kconfig b/extra/config/Makefile.kconfig
index fa1a7d565..fa8c2dd9c 100644
--- a/extra/config/Makefile.kconfig
+++ b/extra/config/Makefile.kconfig
@@ -4,7 +4,11 @@
PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
+ifdef KBUILD_KCONFIG
+Kconfig := $(KBUILD_KCONFIG)
+else
Kconfig := arch/$(SRCARCH)/Kconfig
+endif
xconfig: $(obj)/qconf
$< $(Kconfig)
diff --git a/extra/config/conf.c b/extra/config/conf.c
index 02b2600c2..d623ed1d3 100644
--- a/extra/config/conf.c
+++ b/extra/config/conf.c
@@ -11,6 +11,7 @@
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <sys/time.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
@@ -432,6 +433,7 @@ int main(int ac, char **av)
{
int opt;
const char *name;
+ const char *configname = conf_get_configname();
struct stat tmpstat;
setlocale(LC_ALL, "");
@@ -464,9 +466,22 @@ int main(int ac, char **av)
input_mode = set_yes;
break;
case 'r':
+ {
+ struct timeval now;
+ unsigned int seed;
+
+ /*
+ * Use microseconds derived seed,
+ * compensate for systems where it may be zero
+ */
+ gettimeofday(&now, NULL);
+
+ seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
+ srand(seed);
+
input_mode = set_random;
- srand(time(NULL));
break;
+ }
case 'h':
printf(_("See README for usage info\n"));
exit(0);
@@ -484,7 +499,7 @@ int main(int ac, char **av)
conf_parse(name);
//zconfdump(stdout);
if (sync_kconfig) {
- if (stat(".config", &tmpstat)) {
+ if (stat(configname, &tmpstat)) {
fprintf(stderr, _("***\n"
"*** You have not yet configured!\n"
"*** (missing .config file)\n"
diff --git a/extra/config/confdata.c b/extra/config/confdata.c
index 9da48ebdc..281dd0024 100644
--- a/extra/config/confdata.c
+++ b/extra/config/confdata.c
@@ -11,6 +11,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <libgen.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
@@ -553,7 +554,7 @@ int conf_write(const char *name)
int conf_split_config(void)
{
- char *name, path[128];
+ char *name, path[128], opwd[512];
char *s, *d, c;
struct symbol *sym;
struct stat sb;
@@ -564,7 +565,9 @@ int conf_split_config(void)
name = "include/config/auto.conf";
conf_read_simple(name, S_DEF_AUTO);
- if (chdir("include/config"))
+ if (getcwd(opwd, sizeof(opwd)) == NULL)
+ return 1;
+ if (chdir(dirname(strdup(name))))
return 1;
res = 0;
@@ -658,7 +661,7 @@ int conf_split_config(void)
close(fd);
}
out:
- if (chdir("../.."))
+ if (chdir(opwd))
return 1;
return res;
@@ -666,6 +669,7 @@ out:
int conf_write_autoconf(void)
{
+ char opwd[512];
struct symbol *sym;
const char *str;
char *name;
@@ -673,6 +677,10 @@ int conf_write_autoconf(void)
time_t now;
int i, l;
+ if (getcwd(opwd, sizeof(opwd)) == NULL)
+ return 1;
+ if (chdir(dirname(strdup(conf_get_configname()))))
+ return 1;
sym_clear_all_valid();
file_write_dep("include/config/auto.conf.cmd");
@@ -780,7 +788,7 @@ int conf_write_autoconf(void)
*/
if (rename(".tmpconfig", name))
return 1;
-
+ chdir(opwd);
return 0;
}
@@ -841,7 +849,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
default:
continue;
}
- if (!sym_is_choice(sym) || mode != def_random)
+ if (!(sym_is_choice(sym) && mode == def_random))
sym->flags |= SYMBOL_DEF_USER;
break;
default:
@@ -850,33 +858,53 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
}
- if (modules_sym)
- sym_calc_value(modules_sym);
+ sym_clear_all_valid();
if (mode != def_random)
return;
-
+ /*
+ * We have different type of choice blocks.
+ * If curr.tri equal to mod then we can select several
+ * choice symbols in one block.
+ * In this case we do nothing.
+ * If curr.tri equal yes then only one symbol can be
+ * selected in a choice block and we set it to yes,
+ * and the rest to no.
+ */
for_all_symbols(i, csym) {
if (sym_has_value(csym) || !sym_is_choice(csym))
continue;
sym_calc_value(csym);
+
+ if (csym->curr.tri != yes)
+ continue;
+
prop = sym_get_choice_prop(csym);
- def = -1;
- while (1) {
- cnt = 0;
- expr_list_for_each_sym(prop->expr, e, sym) {
- if (sym->visible == no)
- continue;
- if (def == cnt++) {
- csym->def[S_DEF_USER].val = sym;
- break;
- }
+
+ /* count entries in choice block */
+ cnt = 0;
+ expr_list_for_each_sym(prop->expr, e, sym)
+ cnt++;
+
+ /*
+ * find a random value and set it to yes,
+ * set the rest to no so we have only one set
+ */
+ def = (rand() % cnt);
+
+ cnt = 0;
+ expr_list_for_each_sym(prop->expr, e, sym) {
+ if (def == cnt++) {
+ sym->def[S_DEF_USER].tri = yes;
+ csym->def[S_DEF_USER].val = sym;
+ }
+ else {
+ sym->def[S_DEF_USER].tri = no;
}
- if (def >= 0 || cnt < 2)
- break;
- def = (rand() % cnt) + 1;
}
csym->flags |= SYMBOL_DEF_USER;
+ /* clear VALID to get value calculated */
+ csym->flags &= ~(SYMBOL_VALID);
}
}
diff --git a/extra/config/expr.h b/extra/config/expr.h
index 9d4cba1c0..6408fefae 100644
--- a/extra/config/expr.h
+++ b/extra/config/expr.h
@@ -65,9 +65,13 @@ enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
};
+/* enum values are used as index to symbol.def[] */
enum {
S_DEF_USER, /* main user value */
- S_DEF_AUTO,
+ S_DEF_AUTO, /* values read from auto.conf */
+ S_DEF_DEF3, /* Reserved for UI usage */
+ S_DEF_DEF4, /* Reserved for UI usage */
+ S_DEF_COUNT
};
struct symbol {
@@ -75,7 +79,7 @@ struct symbol {
char *name;
enum symbol_type type;
struct symbol_value curr;
- struct symbol_value def[4];
+ struct symbol_value def[S_DEF_COUNT];
tristate visible;
int flags;
struct property *prop;
@@ -84,42 +88,64 @@ struct symbol {
#define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
-#define SYMBOL_CONST 0x0001
-#define SYMBOL_CHECK 0x0008
-#define SYMBOL_CHOICE 0x0010
-#define SYMBOL_CHOICEVAL 0x0020
-#define SYMBOL_VALID 0x0080
-#define SYMBOL_OPTIONAL 0x0100
-#define SYMBOL_WRITE 0x0200
-#define SYMBOL_CHANGED 0x0400
-#define SYMBOL_AUTO 0x1000
-#define SYMBOL_CHECKED 0x2000
-#define SYMBOL_WARNED 0x8000
-#define SYMBOL_DEF 0x10000
-#define SYMBOL_DEF_USER 0x10000
-#define SYMBOL_DEF_AUTO 0x20000
-#define SYMBOL_DEF3 0x40000
-#define SYMBOL_DEF4 0x80000
+#define SYMBOL_CONST 0x0001 /* symbol is const */
+#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
+#define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */
+#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
+#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
+#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
+#define SYMBOL_WRITE 0x0200 /* ? */
+#define SYMBOL_CHANGED 0x0400 /* ? */
+#define SYMBOL_AUTO 0x1000 /* value from environment variable */
+#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
+#define SYMBOL_WARNED 0x8000 /* warning has been issued */
+
+/* Set when symbol.def[] is used */
+#define SYMBOL_DEF 0x10000 /* First bit of SYMBOL_DEF */
+#define SYMBOL_DEF_USER 0x10000 /* symbol.def[S_DEF_USER] is valid */
+#define SYMBOL_DEF_AUTO 0x20000 /* symbol.def[S_DEF_AUTO] is valid */
+#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
+#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 257
#define SYMBOL_HASHMASK 0xff
+/* A property represent the config options that can be associated
+ * with a config "symbol".
+ * Sample:
+ * config FOO
+ * default y
+ * prompt "foo prompt"
+ * select BAR
+ * config BAZ
+ * int "BAZ Value"
+ * range 1..255
+ */
enum prop_type {
- P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE,
- P_SELECT, P_RANGE, P_ENV
+ P_UNKNOWN,
+ P_PROMPT, /* prompt "foo prompt" or "BAZ Value" */
+ P_COMMENT, /* text associated with a comment */
+ P_MENU, /* prompt associated with a menuconfig option */
+ P_DEFAULT, /* default y */
+ P_CHOICE, /* choice value */
+ P_SELECT, /* select BAR */
+ P_RANGE, /* range 7..100 (for a symbol) */
+ P_ENV, /* value from environment variable */
};
struct property {
- struct property *next;
- struct symbol *sym;
- enum prop_type type;
- const char *text;
+ struct property *next; /* next property - null if last */
+ struct symbol *sym; /* the symbol for which the property is associated */
+ enum prop_type type; /* type of property */
+ const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
struct expr_value visible;
- struct expr *expr;
- struct menu *menu;
- struct file *file;
- int lineno;
+ struct expr *expr; /* the optional conditional part of the property */
+ struct menu *menu; /* the menu the property are associated with
+ * valid for: P_SELECT, P_RANGE, P_CHOICE,
+ * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */
+ struct file *file; /* what file was this property defined */
+ int lineno; /* what lineno was this property defined */
};
#define for_all_properties(sym, st, tok) \
diff --git a/extra/config/lex.zconf.c_shipped b/extra/config/lex.zconf.c_shipped
index 09a1ec8e3..f6e38b689 100644
--- a/extra/config/lex.zconf.c_shipped
+++ b/extra/config/lex.zconf.c_shipped
@@ -2370,11 +2370,14 @@ void zconf_nextfile(const char *name)
current_buf = buf;
if (file->flags & FILE_BUSY) {
- printf("recursive scan (%s)?\n", name);
+ printf("%s:%d: do not source '%s' from itself\n",
+ zconf_curname(), zconf_lineno(), name);
exit(1);
}
if (file->flags & FILE_SCANNED) {
- printf("file %s already scanned?\n", name);
+ printf("%s:%d: file '%s' is already sourced from '%s'\n",
+ zconf_curname(), zconf_lineno(), name,
+ file->parent->name);
exit(1);
}
file->flags |= FILE_BUSY;
diff --git a/extra/config/lxdialog/check-lxdialog.sh b/extra/config/lxdialog/check-lxdialog.sh
index 5552154cb..fcef0f59d 100755
--- a/extra/config/lxdialog/check-lxdialog.sh
+++ b/extra/config/lxdialog/check-lxdialog.sh
@@ -52,7 +52,7 @@ EOF
}
usage() {
- printf "Usage: $0 [-check compiler options|-header|-library]\n"
+ printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n"
}
if [ $# -eq 0 ]; then
diff --git a/extra/config/qconf.cc b/extra/config/qconf.cc
index ec3b5bb1e..ec89fd7ff 100644
--- a/extra/config/qconf.cc
+++ b/extra/config/qconf.cc
@@ -1648,7 +1648,7 @@ void ConfigMainWindow::showIntro(void)
void ConfigMainWindow::showAbout(void)
{
static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
- "Bug reports and feature request can also be entered at http://bugs.uClibc.org/\n");
+ "Bug reports and feature request can also be entered at https://bugs.uClibc.org/\n");
QMessageBox::information(this, "qconf", str);
}
diff --git a/extra/config/zconf.l b/extra/config/zconf.l
index 5164ef7ce..21ff69c9a 100644
--- a/extra/config/zconf.l
+++ b/extra/config/zconf.l
@@ -314,11 +314,14 @@ void zconf_nextfile(const char *name)
current_buf = buf;
if (file->flags & FILE_BUSY) {
- printf("recursive scan (%s)?\n", name);
+ printf("%s:%d: do not source '%s' from itself\n",
+ zconf_curname(), zconf_lineno(), name);
exit(1);
}
if (file->flags & FILE_SCANNED) {
- printf("file %s already scanned?\n", name);
+ printf("%s:%d: file '%s' is already sourced from '%s'\n",
+ zconf_curname(), zconf_lineno(), name,
+ file->parent->name);
exit(1);
}
file->flags |= FILE_BUSY;
diff --git a/extra/config/zconf.tab.c_shipped b/extra/config/zconf.tab.c_shipped
index 08223ec4c..aa9cc2877 100644
--- a/extra/config/zconf.tab.c_shipped
+++ b/extra/config/zconf.tab.c_shipped
@@ -1281,7 +1281,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
}
}
#endif /* YYERROR_VERBOSE */
-
+
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
diff --git a/extra/locale/Makefile.in b/extra/locale/Makefile.in
index 66e14fba9..dd62071ba 100644
--- a/extra/locale/Makefile.in
+++ b/extra/locale/Makefile.in
@@ -19,7 +19,7 @@ BUILD_CFLAGS-locale-common := \
BUILD_CFLAGS-gen_wc8bit := $(BUILD_CFLAGS-locale-common) -DCTYPE_PACKED=1
BUILD_CFLAGS-gen_wctype := $(BUILD_CFLAGS-locale-common)
-BUILD_CFLAGS-gen_ldc :=
+BUILD_CFLAGS-gen_ldc := -I$(locale_OUT)
ifeq ($(UCLIBC_HAS_WCHAR),y)
BUILD_CFLAGS-gen_wc8bit += -DDO_WIDE_CHAR=1
BUILD_CFLAGS-gen_ldc += -D__WCHAR_ENABLED=1
@@ -34,11 +34,12 @@ DEPH-locale := $(top_builddir)include/bits/uClibc_config.h
DEPH-gen_collate := $(DEPH-locale)
DEPH-gen_ldc := $(addprefix $(locale_OUT)/,c8tables.h wctables.h locale_tables.h locale_collate.h) $(DEPH-locale)
DEPH-gen_locale := $(addprefix $(locale_OUT)/,c8tables.h) $(DEPH-locale)
-DEPH-gen_wc8bit := $(top_builddir)/include/bits/uClibc_ctype.h $(DEPH-locale)
-DEPH-gen_wctype := $(top_builddir)/include/bits/uClibc_ctype.h $(DEPH-locale)
+DEPH-gen_wc8bit := $(top_builddir)include/bits/uClibc_ctype.h $(DEPH-locale)
+DEPH-gen_wctype := $(top_builddir)include/bits/uClibc_ctype.h $(DEPH-locale)
locale_HOBJ := gen_collate gen_ldc gen_locale gen_wc8bit gen_wctype
locale_HOBJ := $(addprefix $(locale_OUT)/,$(locale_HOBJ))
+$(locale_HOBJ): | $(locale_OUT)
locale_SRC := $(locale_OUT)/locale_data.c
locale_OBJ := $(locale_OUT)/locale_data.o
@@ -49,9 +50,24 @@ CFLAGS-locale_data.c := -D__WCHAR_ENABLED -I$(locale_OUT) -I$(locale_DIR)
headers: $(locale_headers-y)
libc-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
-
libc-nomulti-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
+$(locale_OUT)%.o: $(locale_OUT)%.c FORCE ; $(compile.c)
+$(locale_OUT)%.os: $(locale_OUT)%.c FORCE ; $(compile.c)
+$(locale_OUT)%.oS: $(locale_OUT)%.c FORCE ; $(compile.c)
+$(locale_OUT)%.o: $(locale_OUT)%.S FORCE ; $(compile.S)
+$(locale_OUT)%.os: $(locale_OUT)%.S FORCE ; $(compile.S)
+$(locale_OUT)%.oS: $(locale_OUT)%.S FORCE ; $(compile.S)
+$(locale_OUT)%.o: $(locale_OUT)%.s FORCE ; $(compile.S)
+$(locale_OUT)%.os: $(locale_OUT)%.s FORCE ; $(compile.S)
+$(locale_OUT)%.oS: $(locale_OUT)%.s FORCE ; $(compile.S)
+$(locale_OUT)%.i: $(locale_OUT)%.c FORCE ; $(compile.i)
+$(locale_OUT)%.i: $(locale_OUT)%.S FORCE ; $(compile.i)
+$(locale_OUT)%.s: $(locale_OUT)%.c FORCE ; $(compile.s)
+$(locale_OUT)%.s: $(locale_OUT)%.S FORCE ; $(compile.s)
+$(locale_OUT)%.dep:
+
+
locale_headers: headers $(top_builddir)include/bits/uClibc_locale_data.h
# make sure that the host system has locales (this check is ok for uClibc/glibc)
@@ -64,7 +80,7 @@ $(locale_OUT)/codesets.txt:
echo " "; \
echo "You do not have a codesets.txt file. Please create this "; \
echo "file in the $(locale_OUT) directory by running something like: "; \
- echo " cd $(locale_DIR)/ && find charmaps -name \"*.pairs\" > \\"; \
+ echo " find $(PWD)/$(locale_DIR)/charmaps -name \"*.pairs\" > \\"; \
echo " $@"; \
echo "and then edit that file to disable/enable the codesets you wish to support. "; \
echo " "; \
@@ -91,10 +107,19 @@ else
$(locale_OUT)/codesets.txt:
@$(disp_gen)
ifeq ($(UCLIBC_BUILD_MINIMAL_LOCALE),y)
- $(Q)echo "charmaps/ASCII.pairs" > $@ ; \
- $(Q)echo "charmaps/ISO-8859-1.pairs" >> $@
+ $(Q)echo "$(PWD)/$(locale_DIR)/charmaps/ASCII.pairs" > $@ ; \
+ $(Q)echo "$(PWD)/$(locale_DIR)/charmaps/ISO-8859-1.pairs" >> $@
else
- $(Q)(cd $(locale_DIR)/ && find charmaps/ -name '*.pairs' | sort ) > $@
+ $(Q)set -e; \
+ tmp=`mktemp $@.XXXXXX 2>/dev/null || true`; \
+ [ -z "$$tmp" ] && tmp='$@.new'; \
+ find $(PWD)/$(locale_DIR)/charmaps/ -name '*.pairs' | \
+ sort > $$tmp; \
+ if cmp $@ $$tmp >/dev/null 2>&1; then \
+ $(RM) $$tmp; \
+ else \
+ mv -f $$tmp $@; \
+ fi
endif
# the lines beginning w/ '#-' are mandatory
@@ -144,18 +169,16 @@ endif
# grep fopen *.c
$(locale_OUT)/c8tables.h: $(locale_OUT)/gen_wc8bit $(locale_OUT)/codesets.txt
@$(disp_gen)
- $(Q)(cd $(<D) && ./$(<F) `cat $(word 2,$(^F))`)
+ $(Q)$< `cat $(word 2,$^)` > $@
# Warning! Beware tr_TR toupper/tolower exceptions!
$(locale_OUT)/wctables.h: $(locale_OUT)/gen_wctype
@$(disp_gen)
- $(Q)(cd $(<D) || exit 1 ; \
- ./$(<F) $(FLAG-locale-verbose) en_US || \
- ./$(<F) $(FLAG-locale-verbose) en_US.UTF-8 || \
- ./$(<F) $(FLAG-locale-verbose) en_US.iso8859-1 || \
- ./$(<F) $(FLAG-locale-verbose) en_GB || \
- ./$(<F) $(FLAG-locale-verbose) en_GB.UTF-8 \
- )
+ $(Q)$< $(FLAG-locale-verbose) en_US > $@ || \
+ $< $(FLAG-locale-verbose) en_US.UTF-8 > $@ || \
+ $< $(FLAG-locale-verbose) en_US.iso8859-1 > $@ || \
+ $< $(FLAG-locale-verbose) en_GB > $@ || \
+ $< $(FLAG-locale-verbose) en_GB.UTF-8 > $@
$(locale_OUT)/locale_tables.h: $(locale_OUT)/gen_locale $(locale_OUT)/locales.txt
@$(disp_gen)
@@ -174,13 +197,13 @@ $(locale_OUT)/locale_collate.h: $(locale_OUT)/gen_collate $(locale_OUT)/locale_t
$(locale_OUT)/$(LOCALE_DATA_FILENAME):
ifeq ($(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA),y)
- ( cd $(dir $@); $(WGET) http://www.uclibc.org/downloads/$(notdir $@) )
+ ( cd $(@D); $(WGET) http://www.uclibc.org/downloads/$(@F) )
endif
ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y)
$(locale_SRC): $(locale_OUT)/$(LOCALE_DATA_FILENAME)
- zcat $< | $(TAR) -xv -C $(dir $@) -f -
+ zcat $< | $(TAR) -xv -C $(@D) -f -
touch $@
# we use the one in locale_DIR
#$(RM) $(locale_OUT)/locale_mmap.h
diff --git a/extra/locale/gen_wc8bit.c b/extra/locale/gen_wc8bit.c
index 126cd1ace..349f7cf7c 100644
--- a/extra/locale/gen_wc8bit.c
+++ b/extra/locale/gen_wc8bit.c
@@ -20,6 +20,8 @@
#endif
#include "include/bits/uClibc_ctype.h"
+/* TODO: maybe support -v like gen_wctype.c */
+#define verbose_msg(msg...) if (verbose) fprintf(stderr, msg)
/* #define CTYPE_PACKED */
#define UPLOW_IDX_SHIFT 3
@@ -80,7 +82,6 @@ typedef struct {
int main(int argc, char **argv)
{
FILE *fp;
- FILE *out;
charset_data csd[30];
unsigned long max_wchar;
unsigned char *p;
@@ -125,81 +126,75 @@ int main(int argc, char **argv)
pclose(fp);
}
- if (!(out = fopen("c8tables.h","w"))) {
- printf("cannot open output file 'c8tables.h'!\n");
- return EXIT_FAILURE;
- }
-
#if 0
if (argc == 1) {
/* User requested 8-bit codesets, but didn't list any... */
/* Allow to build, just so this feature can be left on in config. */
- fprintf(out, "#ifdef __CTYPE_HAS_8_BIT_LOCALES\n");
- fprintf(out, "#warning ignoring 8 bit codesets request"
+ printf("#ifdef __CTYPE_HAS_8_BIT_LOCALES\n");
+ printf("#warning ignoring 8 bit codesets request"
" as no codesets specified.\n");
- fprintf(out, "#endif\n");
- fprintf(out, "#undef __CTYPE_HAS_8_BIT_LOCALES\n\n");
+ printf("#endif\n");
+ printf("#undef __CTYPE_HAS_8_BIT_LOCALES\n\n");
- fprintf(out, "#define __LOCALE_DATA_NUM_CODESETS\t\t0\n");
- fprintf(out, "#define __LOCALE_DATA_CODESET_LIST\t\t\"\"\n");
- fclose(out);
+ printf("#define __LOCALE_DATA_NUM_CODESETS\t\t0\n");
+ printf("#define __LOCALE_DATA_CODESET_LIST\t\t\"\"\n");
return EXIT_SUCCESS;
}
-/* fprintf(out, "#define __CTYPE_HAS_8_BIT_LOCALES\t1\n\n"); */
- fprintf(out, "#ifdef __CTYPE_HAS_8_BIT_LOCALES\n\n");
+/* printf("#define __CTYPE_HAS_8_BIT_LOCALES\t1\n\n"); */
+ printf("#ifdef __CTYPE_HAS_8_BIT_LOCALES\n\n");
#endif
if (argc == 1) {
- fprintf(out, "#undef __CTYPE_HAS_8_BIT_LOCALES\n\n");
+ printf("#undef __CTYPE_HAS_8_BIT_LOCALES\n\n");
- fprintf(out, "#define __LOCALE_DATA_NUM_CODESETS\t\t0\n");
- fprintf(out, "#define __LOCALE_DATA_CODESET_LIST\t\t\"\"\n");
+ printf("#define __LOCALE_DATA_NUM_CODESETS\t\t0\n");
+ printf("#define __LOCALE_DATA_CODESET_LIST\t\t\"\"\n");
} else {
- fprintf(out, "#define __CTYPE_HAS_8_BIT_LOCALES\t\t1\n\n");
+ printf("#define __CTYPE_HAS_8_BIT_LOCALES\t\t1\n\n");
}
- fprintf(out, "#define __LOCALE_DATA_Cctype_IDX_SHIFT\t%d\n", CTYPE_IDX_SHIFT);
- fprintf(out, "#define __LOCALE_DATA_Cctype_IDX_LEN\t\t%d\n", CTYPE_IDX_LEN);
+ printf("#define __LOCALE_DATA_Cctype_IDX_SHIFT\t%d\n", CTYPE_IDX_SHIFT);
+ printf("#define __LOCALE_DATA_Cctype_IDX_LEN\t\t%d\n", CTYPE_IDX_LEN);
#ifdef CTYPE_PACKED
- fprintf(out, "#define __LOCALE_DATA_Cctype_ROW_LEN\t\t%d\n", CTYPE_ROW_LEN >> 1);
- fprintf(out, "#define __LOCALE_DATA_Cctype_PACKED\t\t1\n");
+ printf("#define __LOCALE_DATA_Cctype_ROW_LEN\t\t%d\n", CTYPE_ROW_LEN >> 1);
+ printf("#define __LOCALE_DATA_Cctype_PACKED\t\t1\n");
#else
- fprintf(out, "#define __LOCALE_DATA_Cctype_ROW_LEN\t\t%d\n", CTYPE_ROW_LEN);
- fprintf(out, "#undef __LOCALE_DATA_Cctype_PACKED\n");
+ printf("#define __LOCALE_DATA_Cctype_ROW_LEN\t\t%d\n", CTYPE_ROW_LEN);
+ printf("#undef __LOCALE_DATA_Cctype_PACKED\n");
#endif
- fprintf(out, "\n#define __LOCALE_DATA_Cuplow_IDX_SHIFT\t%d\n", UPLOW_IDX_SHIFT);
- fprintf(out, "#define __LOCALE_DATA_Cuplow_IDX_LEN\t\t%d\n", UPLOW_IDX_LEN);
- fprintf(out, "#define __LOCALE_DATA_Cuplow_ROW_LEN\t\t%d\n", UPLOW_ROW_LEN);
+ printf("\n#define __LOCALE_DATA_Cuplow_IDX_SHIFT\t%d\n", UPLOW_IDX_SHIFT);
+ printf("#define __LOCALE_DATA_Cuplow_IDX_LEN\t\t%d\n", UPLOW_IDX_LEN);
+ printf("#define __LOCALE_DATA_Cuplow_ROW_LEN\t\t%d\n", UPLOW_ROW_LEN);
#ifdef DO_WIDE_CHAR
- fprintf(out, "\n#define __LOCALE_DATA_Cc2wc_IDX_LEN\t\t%d\n", C2WC_IDX_LEN);
- fprintf(out, "#define __LOCALE_DATA_Cc2wc_IDX_SHIFT\t\t%d\n", C2WC_IDX_SHIFT);
- fprintf(out, "#define __LOCALE_DATA_Cc2wc_ROW_LEN\t\t%d\n", C2WC_ROW_LEN);
+ printf("\n#define __LOCALE_DATA_Cc2wc_IDX_LEN\t\t%d\n", C2WC_IDX_LEN);
+ printf("#define __LOCALE_DATA_Cc2wc_IDX_SHIFT\t\t%d\n", C2WC_IDX_SHIFT);
+ printf("#define __LOCALE_DATA_Cc2wc_ROW_LEN\t\t%d\n", C2WC_ROW_LEN);
#endif
- fprintf(out, "\ntypedef struct {\n");
- fprintf(out, "\tunsigned char idx8ctype[%d];\n", CTYPE_IDX_LEN);
- fprintf(out, "\tunsigned char idx8uplow[%d];\n", UPLOW_IDX_LEN);
+ printf("\ntypedef struct {\n");
+ printf("\tunsigned char idx8ctype[%d];\n", CTYPE_IDX_LEN);
+ printf("\tunsigned char idx8uplow[%d];\n", UPLOW_IDX_LEN);
#ifdef DO_WIDE_CHAR
- fprintf(out, "\tunsigned char idx8c2wc[%d];\n", C2WC_IDX_LEN);
- fprintf(out, "\tunsigned char idx8wc2c[%d];\n", II_LEN);
+ printf("\tunsigned char idx8c2wc[%d];\n", C2WC_IDX_LEN);
+ printf("\tunsigned char idx8wc2c[%d];\n", II_LEN);
#endif
- fprintf(out, "} __codeset_8_bit_t;\n\n");
+ printf("} __codeset_8_bit_t;\n\n");
- fprintf(out, "#ifdef WANT_DATA\n\n");
- fprintf(out, "static const __codeset_8_bit_t codeset_8_bit[%d] = {\n", argc-1);
+ printf("#ifdef WANT_DATA\n\n");
+ printf("static const __codeset_8_bit_t codeset_8_bit[%d] = {\n", argc-1);
max_wchar = 0x7f;
numsets = 0;
codeset_index[0] = 0;
while (--argc) {
if (!(fp = fopen(*++argv,"r"))) {
- printf("cannot open file \"%s\"\n", *argv);
+ fprintf(stderr, "cannot open file \"%s\"\n", *argv);
return EXIT_FAILURE;
}
- printf("processing %s... ", *argv);
+ fprintf(stderr, "processing %s... ", *argv);
{
char *s0;
@@ -225,12 +220,12 @@ int main(int argc, char **argv)
/* } */
if (numsets >= sizeof(codeset_index)) {
- printf("error - too many codesets!\n");
+ fprintf(stderr, "error - too many codesets!\n");
return EXIT_FAILURE;
}
if (codeset_list_end + n + 1 + numsets + 1 + 1 >= 256) {
- printf("error - codeset list to big!\n");
+ fprintf(stderr, "error - codeset list to big!\n");
return EXIT_FAILURE;
}
@@ -239,7 +234,7 @@ int main(int argc, char **argv)
codeset_list_end += (n+1);
codeset_list[codeset_list_end - 1] = 0;
- fprintf(out, "\t{ /* %.*s */", n, s0);
+ printf("\t{ /* %.*s */", n, s0);
}
memset(&csd[numsets], 0, sizeof(charset_data));
@@ -251,7 +246,7 @@ int main(int argc, char **argv)
while (fgets(buf,sizeof(buf),fp)) {
if ((2 != sscanf(buf, "{ %lx , %lx", &c, &wc))
|| (c >= 256) || (wc > MAX_WCHAR)) {
- printf("error: scanf failure! \"%s\"\n", buf);
+ fprintf(stderr, "error: scanf failure! \"%s\"\n", buf);
return EXIT_FAILURE;
}
@@ -259,7 +254,7 @@ int main(int argc, char **argv)
if (c <= 0x7f) { /* check the 7bit entries but don't store */
if (c != wc) {
- printf("error: c != wc in %s\n", buf);
+ fprintf(stderr, "error: c != wc in %s\n", buf);
return EXIT_FAILURE;
}
csd[numsets].c2w[c] = wc;
@@ -276,7 +271,7 @@ int main(int argc, char **argv)
}
++lines;
}
- printf("%d lines ", lines);
+ fprintf(stderr, "%d lines ", lines);
for (i = 0 ; i <= MAX_WCHAR ; i += (1 << TT_SHIFT)) {
p = &csd[numsets].w2c[i];
@@ -304,17 +299,17 @@ int main(int argc, char **argv)
++ti_num;
}
csd[numsets].ii[i >> TI_SHIFT] = j;
-/* printf("%d ", i >> TI_SHIFT); */
+/* fprintf(stderr, "%d ", i >> TI_SHIFT); */
}
#if 1
- fprintf(out, "\n\t\t/* idx8ctype data */\n\t\t{");
+ printf("\n\t\t/* idx8ctype data */\n\t\t{");
for (i = 128 ; i < 256 ; i++) {
wchar_t c;
unsigned int d;
/* if (!(i & 0x7)) { */
-/* fprintf(out, "\n"); */
+/* printf("\n"); */
/* } */
c = csd[numsets].c2w[i];
@@ -371,7 +366,7 @@ int main(int argc, char **argv)
}
if (j == n_ctype_rows) { /* new entry */
if (++n_ctype_rows > 256) {
- printf("error -- to many ctype rows!\n");
+ fprintf(stderr, "error -- to many ctype rows!\n");
return EXIT_FAILURE;
}
memcpy(p, row, CTYPE_ROW_LEN);
@@ -380,23 +375,23 @@ int main(int argc, char **argv)
if (!((i >> CTYPE_IDX_SHIFT) & 0x7)
&& (i != (127 + CTYPE_ROW_LEN))
) {
- fprintf(out, "\n\t\t ");
+ printf("\n\t\t ");
}
- fprintf(out, " %#4x,", j);
+ printf(" %#4x,", j);
}
#else
- fprintf(out, " %#4x,", d);
+ printf(" %#4x,", d);
#endif
}
#endif
- fprintf(out, " }");
+ printf(" }");
#if 1
- fprintf(out, ",\n\t\t/* idx8uplow data */\n\t\t{");
+ printf(",\n\t\t/* idx8uplow data */\n\t\t{");
for (i = 128 ; i < 256 ; i++) {
wchar_t c, u, l;
/* if (!(i & 0x7)) { */
-/* fprintf(out, "\n"); */
+/* printf("\n"); */
/* } */
c = csd[numsets].c2w[i];
if ((c != 0) || 1) {
@@ -414,7 +409,7 @@ int main(int argc, char **argv)
/* if ((((u-i) < CHAR_MIN) || ((u-i) > CHAR_MAX)) */
/* || (((i-l) < CHAR_MIN) || ((i-l) > CHAR_MAX)) */
/* ) { */
-/* printf("error - uplow diff out of range! %d %ld %ld\n", */
+/* fprintf(stderr, "error - uplow diff out of range! %d %ld %ld\n", */
/* i, u, l); */
/* return EXIT_FAILURE; */
/* } */
@@ -430,7 +425,7 @@ int main(int argc, char **argv)
}
if (j == n_uplow_rows) { /* new entry */
if (++n_uplow_rows > 256) {
- printf("error -- to many uplow rows!\n");
+ fprintf(stderr, "error -- to many uplow rows!\n");
return EXIT_FAILURE;
}
memcpy(p, row, UPLOW_ROW_LEN);
@@ -439,21 +434,21 @@ int main(int argc, char **argv)
if (!((i >> UPLOW_IDX_SHIFT) & 0x7)
&& (i != (127 + UPLOW_ROW_LEN))
) {
- fprintf(out, "\n\t\t ");
+ printf("\n\t\t ");
}
- fprintf(out, " %#4x,", j);
+ printf(" %#4x,", j);
}
#elif 0
if (!(i & 0x7) && i) {
- fprintf(out, "\n");
+ printf("\n");
}
- fprintf(out, " %4ld,", (l==i) ? (u-i) : (i-l));
-/* fprintf(out, " %4ld,", (l==i) ? u : l); */
+ printf(" %4ld,", (l==i) ? (u-i) : (i-l));
+/* printf(" %4ld,", (l==i) ? u : l); */
#else
if ((u != i) || (l != i)) {
#if 0
- fprintf(out, " %#08lx, %#08lx, %#08lx, %#08lx, %#08lx, %#08lx, \n",
+ printf(" %#08lx, %#08lx, %#08lx, %#08lx, %#08lx, %#08lx, \n",
(unsigned long) i,
(unsigned long) c,
(unsigned long) l,
@@ -462,7 +457,7 @@ int main(int argc, char **argv)
(unsigned long) towupper(c));
#else
- fprintf(out, " %#08lx, %8ld, %d, %8ld, %d, %#08lx\n",
+ printf(" %#08lx, %8ld, %d, %8ld, %d, %#08lx\n",
(unsigned long) i,
(long) (l - i),
iswupper(c),
@@ -474,15 +469,15 @@ int main(int argc, char **argv)
#endif
}
}
- fprintf(out, " }");
+ printf(" }");
#endif
#ifndef DO_WIDE_CHAR
- fprintf(out,"\n");
+ printf("\n");
#else /* DO_WIDE_CHAR */
#if 1
- fprintf(out, ",\n\t\t/* idx8c2wc data */\n\t\t{");
+ printf(",\n\t\t/* idx8c2wc data */\n\t\t{");
for (i = 128 ; i < 256 ; i++) {
#if 1
wrow[i & (C2WC_ROW_LEN-1)] = csd[numsets].c2w[i];
@@ -496,7 +491,7 @@ int main(int argc, char **argv)
}
if (j == n_c2wc_rows) { /* new entry */
if (++n_c2wc_rows > 256) {
- printf("error -- to many c2wc rows!\n");
+ fprintf(stderr, "error -- to many c2wc rows!\n");
return EXIT_FAILURE;
}
memcpy(p, (char *) wrow, 2*C2WC_ROW_LEN);
@@ -505,107 +500,107 @@ int main(int argc, char **argv)
if (!((i >> C2WC_IDX_SHIFT) & 0x7)
&& (i != (127 + C2WC_ROW_LEN))
) {
- fprintf(out, "\n\t\t ");
+ printf("\n\t\t ");
}
- fprintf(out, " %#4x,", j);
+ printf(" %#4x,", j);
}
#else
if (!(i & 0x7) && i) {
- fprintf(out, "\n");
+ printf("\n");
}
- fprintf(out, " %#6lx,", csd[numsets].c2w[i]);
+ printf(" %#6lx,", csd[numsets].c2w[i]);
#endif
}
- fprintf(out, " },\n");
+ printf(" },\n");
#endif
#if 1
-/* fprintf(out, "\nII_LEN = %d\n", II_LEN); */
- fprintf(out, "\t\t/* idx8wc2c data */\n\t\t{");
+/* fprintf(stderr, "\nII_LEN = %d\n", II_LEN); */
+ printf("\t\t/* idx8wc2c data */\n\t\t{");
for (i = 0 ; i < II_LEN ; i++) {
if (!(i & 0x7) && i) {
- fprintf(out, "\n\t\t ");
+ printf("\n\t\t ");
}
- fprintf(out, " %#4x,", csd[numsets].ii[i]);
+ printf(" %#4x,", csd[numsets].ii[i]);
}
- fprintf(out, " }\n");
+ printf(" }\n");
#endif
#endif /* DO_WIDE_CHAR */
- fprintf(out, "\t},\n");
+ printf("\t},\n");
}
++numsets;
- printf("done\n");
+ fprintf(stderr, "done\n");
}
- fprintf(out, "};\n");
- fprintf(out, "\n#endif /* WANT_DATA */\n");
+ printf("};\n");
+ printf("\n#endif /* WANT_DATA */\n");
#ifdef DO_WIDE_CHAR
- fprintf(out, "\n");
- fprintf(out, "#define __LOCALE_DATA_Cwc2c_DOMAIN_MAX\t%#x\n", RANGE);
- fprintf(out, "#define __LOCALE_DATA_Cwc2c_TI_SHIFT\t\t%d\n", TI_SHIFT);
- fprintf(out, "#define __LOCALE_DATA_Cwc2c_TT_SHIFT\t\t%d\n", TT_SHIFT);
- fprintf(out, "#define __LOCALE_DATA_Cwc2c_II_LEN\t\t%d\n", II_LEN);
- fprintf(out, "#define __LOCALE_DATA_Cwc2c_TI_LEN\t\t%d\n", ti_num << TI_SHIFT);
- fprintf(out, "#define __LOCALE_DATA_Cwc2c_TT_LEN\t\t%d\n", tt_num << TT_SHIFT);
- fprintf(out, "\n");
-
- fprintf(out, "\n#define __LOCALE_DATA_Cwc2c_TBL_LEN\t\t%d\n",
+ printf("\n");
+ printf("#define __LOCALE_DATA_Cwc2c_DOMAIN_MAX\t%#x\n", RANGE);
+ printf("#define __LOCALE_DATA_Cwc2c_TI_SHIFT\t\t%d\n", TI_SHIFT);
+ printf("#define __LOCALE_DATA_Cwc2c_TT_SHIFT\t\t%d\n", TT_SHIFT);
+ printf("#define __LOCALE_DATA_Cwc2c_II_LEN\t\t%d\n", II_LEN);
+ printf("#define __LOCALE_DATA_Cwc2c_TI_LEN\t\t%d\n", ti_num << TI_SHIFT);
+ printf("#define __LOCALE_DATA_Cwc2c_TT_LEN\t\t%d\n", tt_num << TT_SHIFT);
+ printf("\n");
+
+ printf("\n#define __LOCALE_DATA_Cwc2c_TBL_LEN\t\t%d\n",
(ti_num << TI_SHIFT) + (tt_num << TT_SHIFT));
- fprintf(out, "#ifdef WANT_DATA\n\n");
- fprintf(out, "static const unsigned char __LOCALE_DATA_Cwc2c_data[%d] = {\n",
+ printf("#ifdef WANT_DATA\n\n");
+ printf("static const unsigned char __LOCALE_DATA_Cwc2c_data[%d] = {\n",
(ti_num << TI_SHIFT) + (tt_num << TT_SHIFT));
- fprintf(out, "\t/* ti_table */\n\t");
+ printf("\t/* ti_table */\n\t");
for (i=0 ; i < ti_num << TI_SHIFT ; i++) {
if (!(i & 7) && i) {
- fprintf(out, "\n\t");
+ printf("\n\t");
}
- fprintf(out, " %#4x,", ti[i]);
+ printf(" %#4x,", ti[i]);
}
- fprintf(out, "\n");
- fprintf(out, "\t/* tt_table */\n\t");
+ printf("\n");
+ printf("\t/* tt_table */\n\t");
for (i=0 ; i < tt_num << TT_SHIFT ; i++) {
if (!(i & 7) && i) {
- fprintf(out, "\n\t");
+ printf("\n\t");
}
- fprintf(out, " %#4x,", tt[i]);
+ printf(" %#4x,", tt[i]);
}
- fprintf(out, "\n};\n");
+ printf("\n};\n");
- fprintf(out, "\n#endif /* WANT_DATA */\n");
+ printf("\n#endif /* WANT_DATA */\n");
#endif /* DO_WIDE_CHAR */
- fprintf(out, "\n#define __LOCALE_DATA_Cuplow_TBL_LEN\t\t%d\n",
+ printf("\n#define __LOCALE_DATA_Cuplow_TBL_LEN\t\t%d\n",
n_uplow_rows * UPLOW_ROW_LEN);
- fprintf(out, "\n#ifdef WANT_DATA\n\n");
+ printf("\n#ifdef WANT_DATA\n\n");
- fprintf(out, "\nstatic const unsigned char __LOCALE_DATA_Cuplow_data[%d] = {\n",
+ printf("\nstatic const unsigned char __LOCALE_DATA_Cuplow_data[%d] = {\n",
n_uplow_rows * UPLOW_ROW_LEN);
p = uplow_tbl;
for (j=0 ; j < n_uplow_rows ; j++) {
- fprintf(out, "\t");
+ printf("\t");
for (i=0 ; i < UPLOW_ROW_LEN ; i++) {
- fprintf(out, " %#4x,", (unsigned int)((unsigned char) p[i]));
+ printf(" %#4x,", (unsigned int)((unsigned char) p[i]));
}
- fprintf(out, "\n");
+ printf("\n");
p += UPLOW_ROW_LEN;
}
- fprintf(out, "};\n");
+ printf("};\n");
- fprintf(out, "\n#endif /* WANT_DATA */\n");
- fprintf(out, "\n#define __LOCALE_DATA_Cctype_TBL_LEN\t\t%d\n",
+ printf("\n#endif /* WANT_DATA */\n");
+ printf("\n#define __LOCALE_DATA_Cctype_TBL_LEN\t\t%d\n",
#ifdef CTYPE_PACKED
n_ctype_rows * CTYPE_ROW_LEN / 2
#else
n_ctype_rows * CTYPE_ROW_LEN
#endif
);
- fprintf(out, "\n#ifdef WANT_DATA\n\n");
+ printf("\n#ifdef WANT_DATA\n\n");
- fprintf(out, "\nstatic const unsigned char __LOCALE_DATA_Cctype_data[%d] = {\n",
+ printf("\nstatic const unsigned char __LOCALE_DATA_Cctype_data[%d] = {\n",
#ifdef CTYPE_PACKED
n_ctype_rows * CTYPE_ROW_LEN / 2
#else
@@ -614,59 +609,59 @@ int main(int argc, char **argv)
);
p = ctype_tbl;
for (j=0 ; j < n_ctype_rows ; j++) {
- fprintf(out, "\t");
+ printf("\t");
for (i=0 ; i < CTYPE_ROW_LEN ; i++) {
#ifdef CTYPE_PACKED
- fprintf(out, " %#4x,", (unsigned int)(p[i] + (p[i+1] << 4)));
+ printf(" %#4x,", (unsigned int)(p[i] + (p[i+1] << 4)));
++i;
#else
- fprintf(out, " %#4x,", (unsigned int)p[i]);
+ printf(" %#4x,", (unsigned int)p[i]);
#endif
}
- fprintf(out, "\n");
+ printf("\n");
p += CTYPE_ROW_LEN;
}
- fprintf(out, "};\n");
+ printf("};\n");
- fprintf(out, "\n#endif /* WANT_DATA */\n");
+ printf("\n#endif /* WANT_DATA */\n");
#ifdef DO_WIDE_CHAR
- fprintf(out, "\n#define __LOCALE_DATA_Cc2wc_TBL_LEN\t\t%d\n",
+ printf("\n#define __LOCALE_DATA_Cc2wc_TBL_LEN\t\t%d\n",
n_c2wc_rows * C2WC_ROW_LEN);
- fprintf(out, "\n#ifdef WANT_DATA\n\n");
+ printf("\n#ifdef WANT_DATA\n\n");
- fprintf(out, "\nstatic const unsigned short __LOCALE_DATA_Cc2wc_data[%d] = {\n",
+ printf("\nstatic const unsigned short __LOCALE_DATA_Cc2wc_data[%d] = {\n",
n_c2wc_rows * C2WC_ROW_LEN);
p = (unsigned char *) c2wc_tbl;
for (j=0 ; j < n_c2wc_rows ; j++) {
- fprintf(out, "\t");
+ printf("\t");
for (i=0 ; i < C2WC_ROW_LEN ; i++) {
- fprintf(out, " %#6x,", (unsigned int)(((unsigned short *)p)[i]));
+ printf(" %#6x,", (unsigned int)(((unsigned short *)p)[i]));
}
- fprintf(out, "\n");
+ printf("\n");
p += 2*C2WC_ROW_LEN;
}
- fprintf(out, "};\n");
- fprintf(out, "\n#endif /* WANT_DATA */\n");
+ printf("};\n");
+ printf("\n#endif /* WANT_DATA */\n");
#endif /* DO_WIDE_CHAR */
- fprintf(out, "\n\n");
+ printf("\n\n");
- fprintf(out, "#define __LOCALE_DATA_NUM_CODESETS\t\t%d\n", numsets);
- fprintf(out, "#define __LOCALE_DATA_CODESET_LIST \\\n\t\"");
+ printf("#define __LOCALE_DATA_NUM_CODESETS\t\t%d\n", numsets);
+ printf("#define __LOCALE_DATA_CODESET_LIST \\\n\t\"");
for (i=0 ; i < numsets ; i++) {
- fprintf(out, "\\x%02x", numsets + 1 + (unsigned char) codeset_index[i]);
+ printf("\\x%02x", numsets + 1 + (unsigned char) codeset_index[i]);
if (((i & 7) == 7) && (i + 1 < numsets)) {
- fprintf(out, "\" \\\n\t\"");
+ printf("\" \\\n\t\"");
}
}
- fprintf(out, "\" \\\n\t\"\\0\"");
+ printf("\" \\\n\t\"\\0\"");
for (i=0 ; i < numsets ; i++) {
- fprintf(out, " \\\n\t\"%s\\0\"",
+ printf(" \\\n\t\"%s\\0\"",
codeset_list + ((unsigned char)codeset_index[i]));
}
- fprintf(out, "\n\n");
+ printf("\n\n");
for (i=0 ; i < numsets ; i++) {
char buf[30];
char *z;
@@ -676,24 +671,22 @@ int main(int argc, char **argv)
*z = '_';
}
}
- fprintf(out, "#define __CTYPE_HAS_CODESET_%s\n", buf);
+ printf("#define __CTYPE_HAS_CODESET_%s\n", buf);
}
#ifdef DO_WIDE_CHAR
- fprintf(out, "#define __CTYPE_HAS_CODESET_UTF_8\n");
+ printf("#define __CTYPE_HAS_CODESET_UTF_8\n");
#endif /* DO_WIDE_CHAR */
#if 0
- fprintf(out, "\n#endif /* __CTYPE_HAS_8_BIT_LOCALES */\n\n");
+ printf("\n#endif /* __CTYPE_HAS_8_BIT_LOCALES */\n\n");
#endif
- fclose(out);
-
total_size = 0;
#ifdef DO_WIDE_CHAR
- printf("tt_num = %d ti_num = %d\n", tt_num, ti_num);
- printf("max_wchar = %#lx\n", max_wchar);
+ fprintf(stderr, "tt_num = %d ti_num = %d\n", tt_num, ti_num);
+ fprintf(stderr, "max_wchar = %#lx\n", max_wchar);
- printf("size is %d * %d + %d * %d + %d * %d = %d\n",
+ fprintf(stderr, "size is %d * %d + %d * %d + %d * %d = %d\n",
tt_num, 1 << TT_SHIFT, ti_num, 1 << TI_SHIFT,
((MAX_WCHAR >> (TT_SHIFT + TI_SHIFT)) + 1), numsets,
j = tt_num * (1 << TT_SHIFT) + ti_num * (1 << TI_SHIFT)
@@ -707,26 +700,26 @@ int main(int argc, char **argv)
i = 1;
#endif
- printf("ctype - CTYPE_IDX_SHIFT = %d -- %d * %d + %d * %d = %d\n",
+ fprintf(stderr, "ctype - CTYPE_IDX_SHIFT = %d -- %d * %d + %d * %d = %d\n",
CTYPE_IDX_SHIFT, numsets, CTYPE_IDX_LEN, n_ctype_rows, CTYPE_ROW_LEN / i,
j = numsets * CTYPE_IDX_LEN + n_ctype_rows * CTYPE_ROW_LEN / i);
total_size += j;
- printf("uplow - UPLOW_IDX_SHIFT = %d -- %d * %d + %d * %d = %d\n",
+ fprintf(stderr, "uplow - UPLOW_IDX_SHIFT = %d -- %d * %d + %d * %d = %d\n",
UPLOW_IDX_SHIFT, numsets, UPLOW_IDX_LEN, n_uplow_rows, UPLOW_ROW_LEN,
j = numsets * UPLOW_IDX_LEN + n_uplow_rows * UPLOW_ROW_LEN);
total_size += j;
#ifdef DO_WIDE_CHAR
- printf("c2wc - C2WC_IDX_SHIFT = %d -- %d * %d + 2 * %d * %d = %d\n",
+ fprintf(stderr, "c2wc - C2WC_IDX_SHIFT = %d -- %d * %d + 2 * %d * %d = %d\n",
C2WC_IDX_SHIFT, numsets, C2WC_IDX_LEN, n_c2wc_rows, C2WC_ROW_LEN,
j = numsets * C2WC_IDX_LEN + 2 * n_c2wc_rows * C2WC_ROW_LEN);
total_size += j;
#endif /* DO_WIDE_CHAR */
- printf("total size = %d\n", total_size);
+ fprintf(stderr, "total size = %d\n", total_size);
/* for (i=0 ; i < numsets ; i++) { */
/* printf("codeset_index[i] = %d codeset_list[ci[i]] = \"%s\"\n", */
diff --git a/extra/locale/gen_wctype.c b/extra/locale/gen_wctype.c
index fde30a0a5..b5d7e3911 100644
--- a/extra/locale/gen_wctype.c
+++ b/extra/locale/gen_wctype.c
@@ -103,42 +103,42 @@ typedef struct {
static unsigned verbose;
#define verbose_msg(msg...) if (verbose) fprintf(stderr, msg)
-void output_table(FILE *fp, const char *name, table_data *tbl)
+void output_table(const char *name, table_data *tbl)
{
size_t i;
- fprintf(fp, "#define __LOCALE_DATA_WC%s_II_LEN %7u\n", name, tbl->ii_len);
- fprintf(fp, "#define __LOCALE_DATA_WC%s_TI_LEN %7u\n", name, tbl->ti_len);
- fprintf(fp, "#define __LOCALE_DATA_WC%s_UT_LEN %7u\n", name, tbl->ut_len);
+ printf("#define __LOCALE_DATA_WC%s_II_LEN %7u\n", name, tbl->ii_len);
+ printf("#define __LOCALE_DATA_WC%s_TI_LEN %7u\n", name, tbl->ti_len);
+ printf("#define __LOCALE_DATA_WC%s_UT_LEN %7u\n", name, tbl->ut_len);
- fprintf(fp, "#define __LOCALE_DATA_WC%s_II_SHIFT %7u\n", name, tbl->ii_shift);
- fprintf(fp, "#define __LOCALE_DATA_WC%s_TI_SHIFT %7u\n", name, tbl->ti_shift);
+ printf("#define __LOCALE_DATA_WC%s_II_SHIFT %7u\n", name, tbl->ii_shift);
+ printf("#define __LOCALE_DATA_WC%s_TI_SHIFT %7u\n", name, tbl->ti_shift);
- fprintf(fp, "\n#ifdef WANT_WC%s_data\n", name);
+ printf("\n#ifdef WANT_WC%s_data\n", name);
i = tbl->ii_len + tbl->ti_len + tbl->ut_len;
- fprintf(fp, "\nstatic const unsigned char __LOCALE_DATA_WC%s_data[%zu] = {", name, i);
+ printf("\nstatic const unsigned char __LOCALE_DATA_WC%s_data[%zu] = {", name, i);
for (i = 0; i < tbl->ii_len; i++) {
if (i % 12 == 0) {
- fprintf(fp, "\n");
+ printf("\n");
}
- fprintf(fp, " %#04x,", tbl->ii[i]);
+ printf(" %#04x,", tbl->ii[i]);
}
for (i = 0; i < tbl->ti_len; i++) {
if (i % 12 == 0) {
- fprintf(fp, "\n");
+ printf("\n");
}
- fprintf(fp, " %#04x,", tbl->ti[i]);
+ printf(" %#04x,", tbl->ti[i]);
}
for (i = 0; i < tbl->ut_len; i++) {
if (i % 12 == 0) {
- fprintf(fp, "\n");
+ printf("\n");
}
- fprintf(fp, " %#04x,", tbl->ut[i]);
+ printf(" %#04x,", tbl->ut[i]);
}
- fprintf(fp, "\n};\n\n");
+ printf("\n};\n\n");
- fprintf(fp, "#endif /* WANT_WC%s_data */\n\n", name);
+ printf("#endif /* WANT_WC%s_data */\n\n", name);
}
static void dump_table_data(table_data *tbl)
@@ -676,36 +676,27 @@ int main(int argc, char **argv)
}
if (built) {
- FILE *fp;
-
- if (!(fp = fopen("wctables.h", "w"))) {
- verbose_msg("cannot open output file 'wctables.h'!\n");
- return EXIT_FAILURE;
- }
-
- fprintf(fp, "#define __LOCALE_DATA_WC_TABLE_DOMAIN_MAX %#8lx\n\n",
+ printf("#define __LOCALE_DATA_WC_TABLE_DOMAIN_MAX %#8lx\n\n",
(unsigned long) RANGE);
- output_table(fp, "ctype", &cttable);
- output_table(fp, "uplow", &ultable);
+ output_table("ctype", &cttable);
+ output_table("uplow", &ultable);
#warning fix the upper bound on the upper/lower tables... save 200 bytes or so
- fprintf(fp, "#define __LOCALE_DATA_WCuplow_diffs %7u\n", ul_count);
- fprintf(fp, "\n#ifdef WANT_WCuplow_diff_data\n\n");
- fprintf(fp, "\nstatic const short __LOCALE_DATA_WCuplow_diff_data[%zu] = {",
+ printf("#define __LOCALE_DATA_WCuplow_diffs %7u\n", ul_count);
+ printf("\n#ifdef WANT_WCuplow_diff_data\n\n");
+ printf("\nstatic const short __LOCALE_DATA_WCuplow_diff_data[%zu] = {",
2 * (size_t) ul_count);
for (i = 0; i < ul_count; i++) {
if (i % 4 == 0) {
- fprintf(fp, "\n");
+ printf("\n");
}
- fprintf(fp, " %6d, %6d,", uldiff[i].u, uldiff[i].l);
+ printf(" %6d, %6d,", uldiff[i].u, uldiff[i].l);
}
- fprintf(fp, "\n};\n\n");
- fprintf(fp, "#endif /* WANT_WCuplow_diff_data */\n\n");
-
-/* output_table(fp, "comb", &combtable); */
-/* output_table(fp, "width", &widthtable); */
+ printf("\n};\n\n");
+ printf("#endif /* WANT_WCuplow_diff_data */\n\n");
- fclose(fp);
+/* output_table("comb", &combtable); */
+/* output_table("width", &widthtable); */
}
return !built;
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index b8af95fe3..a74c36e5e 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += ldso/ldso/$(TARGET_ARCH)
+
CFLAGS-ldso := -DNOT_IN_libc -DIS_IN_rtld $(SSP_DISABLE_FLAGS)
# This stuff will not work with -fomit-frame-pointer
diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in
index 3d55e423a..077b8b3ea 100644
--- a/ldso/libdl/Makefile.in
+++ b/ldso/libdl/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += ldso/libdl
+
CFLAGS-libdl := -DNOT_IN_libc -DIS_IN_libdl $(SSP_ALL_CFLAGS)
CFLAGS-libdl += -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include -I$(top_srcdir)ldso/ldso
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
index 87d3203b8..cf689d806 100644
--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/inet
+
include $(top_srcdir)libc/inet/rpc/Makefile.in
INET_DIR := $(top_srcdir)libc/inet
diff --git a/libc/inet/rpc/Makefile.in b/libc/inet/rpc/Makefile.in
index 1d1081b5b..b498f92d7 100644
--- a/libc/inet/rpc/Makefile.in
+++ b/libc/inet/rpc/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/inet/rpc
+
CFLAGS-rpc := -fno-strict-aliasing
ifneq ($(UCLIBC_HAS_FULL_RPC),y)
diff --git a/libc/misc/assert/Makefile.in b/libc/misc/assert/Makefile.in
index 22dfeeb12..1e08c1610 100644
--- a/libc/misc/assert/Makefile.in
+++ b/libc/misc/assert/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/assert
+
CSRC := __assert.c
MISC_ASSERT_DIR := $(top_srcdir)libc/misc/assert
diff --git a/libc/misc/ctype/Makefile.in b/libc/misc/ctype/Makefile.in
index 3f307f093..f4705e1d5 100644
--- a/libc/misc/ctype/Makefile.in
+++ b/libc/misc/ctype/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/ctype
+
# multi source ctype.c
COM_SRC := \
isalnum.c isalpha.c iscntrl.c isdigit.c \
diff --git a/libc/misc/dirent/Makefile.in b/libc/misc/dirent/Makefile.in
index b3a017896..daeefb7e1 100644
--- a/libc/misc/dirent/Makefile.in
+++ b/libc/misc/dirent/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/dirent
+
CSRC := alphasort.c closedir.c dirfd.c opendir.c readdir.c rewinddir.c \
scandir.c seekdir.c telldir.c readdir_r.c versionsort.c
diff --git a/libc/misc/elf/Makefile.in b/libc/misc/elf/Makefile.in
index 4c5d9c8b7..1b594dee6 100644
--- a/libc/misc/elf/Makefile.in
+++ b/libc/misc/elf/Makefile.in
@@ -4,6 +4,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/elf
+
libc_a_CSRC = dl-support.c dl-core.c dl-iterate-phdr.c
CFLAGS-dl-iterate-phdr.c=-D_GNU_SOURCE -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include
CFLAGS-dl-core.c=-I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include
diff --git a/libc/misc/error/Makefile.in b/libc/misc/error/Makefile.in
index d0e60a28c..fe0d0c1b9 100644
--- a/libc/misc/error/Makefile.in
+++ b/libc/misc/error/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/error
+
CSRC :=
ifeq ($(UCLIBC_HAS_BSD_ERR),y)
CSRC += err.c
diff --git a/libc/misc/file/Makefile.in b/libc/misc/file/Makefile.in
index 43b639cc5..cb6c85549 100644
--- a/libc/misc/file/Makefile.in
+++ b/libc/misc/file/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/file
+
MISC_FILE_DIR := $(top_srcdir)libc/misc/file
MISC_FILE_OUT := $(top_builddir)libc/misc/file
diff --git a/libc/misc/fnmatch/Makefile.in b/libc/misc/fnmatch/Makefile.in
index ac9076dd2..75746ef2b 100644
--- a/libc/misc/fnmatch/Makefile.in
+++ b/libc/misc/fnmatch/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/fnmatch
+
ifeq ($(UCLIBC_HAS_FNMATCH_OLD),y)
CSRC := fnmatch_old.c
else
diff --git a/libc/misc/ftw/Makefile.in b/libc/misc/ftw/Makefile.in
index bceab2124..389ad792d 100644
--- a/libc/misc/ftw/Makefile.in
+++ b/libc/misc/ftw/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/ftw
+
CSRC := ftw.c
ifeq ($(UCLIBC_HAS_LFS),y)
CSRC += ftw64.c
diff --git a/libc/misc/glob/Makefile.in b/libc/misc/glob/Makefile.in
index b7a2afcac..346dff316 100644
--- a/libc/misc/glob/Makefile.in
+++ b/libc/misc/glob/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/glob
+
ifeq ($(UCLIBC_HAS_GNU_GLOB),y)
CSRC := glob.c
ifeq ($(UCLIBC_HAS_LFS),y)
diff --git a/libc/misc/gnu/Makefile.in b/libc/misc/gnu/Makefile.in
index c3a98e8cc..d4a59004d 100644
--- a/libc/misc/gnu/Makefile.in
+++ b/libc/misc/gnu/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/gnu
+
CSRC := obstack.c
MISC_GNU_DIR := $(top_srcdir)libc/misc/gnu
diff --git a/libc/misc/internals/Makefile.in b/libc/misc/internals/Makefile.in
index 230e6e7a9..39bc8d51a 100644
--- a/libc/misc/internals/Makefile.in
+++ b/libc/misc/internals/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/internals
+
CFLAGS-__uClibc_main.c := $(SSP_DISABLE_FLAGS)
CSRC := tempname.c errno.c __errno_location.c __h_errno_location.c
diff --git a/libc/misc/locale/Makefile.in b/libc/misc/locale/Makefile.in
index 689bd0bc3..566939804 100644
--- a/libc/misc/locale/Makefile.in
+++ b/libc/misc/locale/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/locale
+
# multi source locale.c
CSRC := setlocale.c localeconv.c _locale_init.c nl_langinfo.c
ifeq ($(UCLIBC_HAS_LOCALE),y)
diff --git a/libc/misc/mntent/Makefile.in b/libc/misc/mntent/Makefile.in
index 36cbe6702..62bbdc95b 100644
--- a/libc/misc/mntent/Makefile.in
+++ b/libc/misc/mntent/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/mntent
+
CSRC := mntent.c
MISC_MNTENT_DIR := $(top_srcdir)libc/misc/mntent
diff --git a/libc/misc/pthread/Makefile.in b/libc/misc/pthread/Makefile.in
index 68e17e9ce..ceea1c21b 100644
--- a/libc/misc/pthread/Makefile.in
+++ b/libc/misc/pthread/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/pthread
+
MISC_PTHREAD_DIR := $(top_srcdir)libc/misc/pthread
MISC_PTHREAD_OUT := $(top_builddir)libc/misc/pthread
diff --git a/libc/misc/regex/Makefile.in b/libc/misc/regex/Makefile.in
index 4a2e53fa2..f9af23007 100644
--- a/libc/misc/regex/Makefile.in
+++ b/libc/misc/regex/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/regex
+
ifeq ($(UCLIBC_HAS_REGEX_OLD),y)
CSRC := regex_old.c
else
diff --git a/libc/misc/search/Makefile.in b/libc/misc/search/Makefile.in
index 495c3cf9e..f8f846749 100644
--- a/libc/misc/search/Makefile.in
+++ b/libc/misc/search/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/search
+
CSRC := hsearch.c
# multi source _tsearch.c
diff --git a/libc/misc/statfs/Makefile.in b/libc/misc/statfs/Makefile.in
index 1c4fa839b..a7929a5c7 100644
--- a/libc/misc/statfs/Makefile.in
+++ b/libc/misc/statfs/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/statfs
+
CSRC := statvfs.c fstatvfs.c
ifeq ($(UCLIBC_HAS_LFS),y)
ifeq ($(UCLIBC_LINUX_SPECIFIC),y)
diff --git a/libc/misc/syslog/Makefile.in b/libc/misc/syslog/Makefile.in
index 90c18e6c1..b666f8c72 100644
--- a/libc/misc/syslog/Makefile.in
+++ b/libc/misc/syslog/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/syslog
+
CSRC := syslog.c
MISC_SYSLOG_DIR := $(top_srcdir)libc/misc/syslog
diff --git a/libc/misc/sysvipc/Makefile.in b/libc/misc/sysvipc/Makefile.in
index c3807c07c..e7f3a08a8 100644
--- a/libc/misc/sysvipc/Makefile.in
+++ b/libc/misc/sysvipc/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/sysvipc
+
CSRC := ftok.c __syscall_ipc.c
# multi source sem.c
diff --git a/libc/misc/time/Makefile.in b/libc/misc/time/Makefile.in
index 41934873a..238170eb9 100644
--- a/libc/misc/time/Makefile.in
+++ b/libc/misc/time/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/time
+
CSRC := adjtime.c
ifeq ($(UCLIBC_SUSV3_LEGACY),y)
CSRC += ftime.c
diff --git a/libc/misc/ttyent/Makefile.in b/libc/misc/ttyent/Makefile.in
index d20f7adbc..659fa7c1f 100644
--- a/libc/misc/ttyent/Makefile.in
+++ b/libc/misc/ttyent/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/ttyent
+
CSRC := getttyent.c
MISC_TTYENT_DIR := $(top_srcdir)libc/misc/ttyent
diff --git a/libc/misc/utmp/Makefile.in b/libc/misc/utmp/Makefile.in
index fcc830692..5837171cb 100644
--- a/libc/misc/utmp/Makefile.in
+++ b/libc/misc/utmp/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/utmp
+
CSRC := utent.c wtent.c
MISC_UTMP_DIR := $(top_srcdir)libc/misc/utmp
diff --git a/libc/misc/wchar/Makefile.in b/libc/misc/wchar/Makefile.in
index e72e31ecc..0258f9f53 100644
--- a/libc/misc/wchar/Makefile.in
+++ b/libc/misc/wchar/Makefile.in
@@ -16,6 +16,8 @@
# wcsftime
#
+subdirs += libc/misc/wchar
+
# multi source wchar.c
CSRC := btowc.c wctob.c mbsinit.c mbrlen.c mbrtowc.c wcrtomb.c mbsrtowcs.c \
wcsrtombs.c _wchar_utf8sntowcs.c _wchar_wcsntoutf8s.c \
diff --git a/libc/misc/wctype/Makefile.in b/libc/misc/wctype/Makefile.in
index e62c731bd..f7c4ddd87 100644
--- a/libc/misc/wctype/Makefile.in
+++ b/libc/misc/wctype/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/wctype
+
# multi source _wctype.c
COM_SRC := \
iswalnum.c iswalpha.c iswcntrl.c iswdigit.c iswgraph.c \
diff --git a/libc/misc/wordexp/Makefile.in b/libc/misc/wordexp/Makefile.in
index 262f039ed..8d2f50ba0 100644
--- a/libc/misc/wordexp/Makefile.in
+++ b/libc/misc/wordexp/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/misc/wordexp
+
CSRC := wordexp.c
MISC_WORDEXP_DIR := $(top_srcdir)libc/misc/wordexp
diff --git a/libc/pwd_grp/Makefile.in b/libc/pwd_grp/Makefile.in
index 6805ffebd..6e183cc1c 100644
--- a/libc/pwd_grp/Makefile.in
+++ b/libc/pwd_grp/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/pwd_grp
+
PWDGRP_DIR := $(top_srcdir)libc/pwd_grp
PWDGRP_OUT := $(top_builddir)libc/pwd_grp
diff --git a/libc/signal/Makefile.in b/libc/signal/Makefile.in
index 8e904535a..f768b7019 100644
--- a/libc/signal/Makefile.in
+++ b/libc/signal/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/signal
+
CSRC := allocrtsig.c killpg.c raise.c sigaction.c sigaddset.c sigandset.c \
sigblock.c sigdelset.c sigempty.c sigfillset.c siggetmask.c \
sigisempty.c sigismem.c sigjmp.c signal.c \
diff --git a/libc/stdio/Makefile.in b/libc/stdio/Makefile.in
index b9aecac5f..634b9a47d 100644
--- a/libc/stdio/Makefile.in
+++ b/libc/stdio/Makefile.in
@@ -8,6 +8,8 @@
# Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
#
+subdirs += libc/stdio
+
# SUSv3 functions
CSRC := \
fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \
diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
index d12156876..eea0bb166 100644
--- a/libc/stdlib/Makefile.in
+++ b/libc/stdlib/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/stdlib
+
include $(top_srcdir)libc/stdlib/malloc/Makefile.in
include $(top_srcdir)libc/stdlib/malloc-simple/Makefile.in
include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in
diff --git a/libc/stdlib/malloc-simple/Makefile.in b/libc/stdlib/malloc-simple/Makefile.in
index 4762d5744..0c050a235 100644
--- a/libc/stdlib/malloc-simple/Makefile.in
+++ b/libc/stdlib/malloc-simple/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/stdlib/malloc-simple
+
STDLIB_MALLOC_SIMPLE_DIR := $(top_srcdir)libc/stdlib/malloc-simple
STDLIB_MALLOC_SIMPLE_OUT := $(top_builddir)libc/stdlib/malloc-simple
diff --git a/libc/stdlib/malloc-standard/Makefile.in b/libc/stdlib/malloc-standard/Makefile.in
index 32884d10e..eb08f2699 100644
--- a/libc/stdlib/malloc-standard/Makefile.in
+++ b/libc/stdlib/malloc-standard/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/stdlib/malloc-standard
+
# calloc.c can be found at uClibc/libc/stdlib/calloc.c
# valloc.c can be found at uClibc/libc/stdlib/valloc.c
CSRC := malloc.c calloc.c realloc.c free.c memalign.c mallopt.c mallinfo.c
diff --git a/libc/stdlib/malloc/Makefile.in b/libc/stdlib/malloc/Makefile.in
index 11b250dee..aff48a9ec 100644
--- a/libc/stdlib/malloc/Makefile.in
+++ b/libc/stdlib/malloc/Makefile.in
@@ -7,6 +7,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/stdlib/malloc
+
CSRC := malloc.c calloc.c free.c realloc.c memalign.c \
heap_alloc.c heap_alloc_at.c heap_free.c
diff --git a/libc/string/Makefile.in b/libc/string/Makefile.in
index f0fa5b075..08a1856b7 100644
--- a/libc/string/Makefile.in
+++ b/libc/string/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/string/$(TARGET_ARCH) libc/string/generic
+
#
# Arch specific fun
#
diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
index 2dad073ad..10cfc12c3 100644
--- a/libc/sysdeps/linux/Makefile.commonarch
+++ b/libc/sysdeps/linux/Makefile.commonarch
@@ -28,11 +28,10 @@ arch_clean:
ifneq ($(ARCH_HEADERS),)
-ARCH_HEADERS_IN := $(patsubst %,../libc/sysdeps/linux/$(TARGET_ARCH)/%,$(ARCH_HEADERS))
ARCH_HEADERS_OUT := $(patsubst %,$(top_builddir)include/%,$(ARCH_HEADERS))
$(ARCH_HEADERS_OUT):
- $(do_ln) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@
+ $(do_ln) -fs $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@
headers-y += $(ARCH_HEADERS_OUT)
headers_clean-y += arch_headers_clean
diff --git a/libc/sysdeps/linux/Makefile.in b/libc/sysdeps/linux/Makefile.in
index c2d35a0cf..dd91f215f 100644
--- a/libc/sysdeps/linux/Makefile.in
+++ b/libc/sysdeps/linux/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/sysdeps/linux/$(TARGET_ARCH) libc/sysdeps/linux/common
+
# order is relevant
-include $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/Makefile.arch
include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/termios/Makefile.in b/libc/termios/Makefile.in
index c77ee60e4..5e9d4fd48 100644
--- a/libc/termios/Makefile.in
+++ b/libc/termios/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/termios
+
TERMIOS_DIR := $(top_srcdir)libc/termios
TERMIOS_OUT := $(top_builddir)libc/termios
diff --git a/libc/unistd/Makefile.in b/libc/unistd/Makefile.in
index b4c5130a9..d830d8115 100644
--- a/libc/unistd/Makefile.in
+++ b/libc/unistd/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libc/unistd
+
UNISTD_DIR := $(top_srcdir)libc/unistd
UNISTD_OUT := $(top_builddir)libc/unistd
diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in
index f394c413e..34eb1193c 100644
--- a/libcrypt/Makefile.in
+++ b/libcrypt/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libcrypt
+
CFLAGS-libcrypt := -DNOT_IN_libc -DIS_IN_libcrypt $(SSP_ALL_CFLAGS)
LDFLAGS-libcrypt.so := $(LDFLAGS)
diff --git a/libintl/Makefile.in b/libintl/Makefile.in
index d4da42c2a..eba867fd3 100644
--- a/libintl/Makefile.in
+++ b/libintl/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libintl
+
CFLAGS-libintl := -DNOT_IN_libc -DIS_IN_libintl $(SSP_ALL_CFLAGS)
LDFLAGS-libintl.so := $(LDFLAGS)
diff --git a/libm/Makefile.in b/libm/Makefile.in
index 6b8224600..d17d64fae 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -20,6 +20,8 @@
# by Erik Andersen <andersen@codepoet.org>
#
+subdirs += libm
+
CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS)
CFLAGS-libm += -D_IEEE_LIBM
diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in
index 03a7703f2..fac88ce55 100644
--- a/libnsl/Makefile.in
+++ b/libnsl/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libnsl
+
CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS)
LDFLAGS-libnsl.so := $(LDFLAGS) $(call link.asneeded,-lc)
diff --git a/libpthread/Makefile.in b/libpthread/Makefile.in
index bda935b5b..d1f8528a9 100644
--- a/libpthread/Makefile.in
+++ b/libpthread/Makefile.in
@@ -6,6 +6,6 @@
#
ifneq ($(PTNAME),)
-include $(PTDIR)/Makefile.in
-include $(PTDIR)_db/Makefile.in
+include $(top_srcdir)$(PTDIR)/Makefile.in
+include $(top_srcdir)$(PTDIR)_db/Makefile.in
endif
diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in
index d504b9999..2fed1dafd 100644
--- a/libpthread/linuxthreads.old/Makefile.in
+++ b/libpthread/linuxthreads.old/Makefile.in
@@ -6,6 +6,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libpthread/linuxthreads.old
+
CFLAGS-dir_linuxthreads.old := -DNOT_IN_libc -DIS_IN_libpthread
CFLAGS-linuxthreads.old := $(CFLAGS-dir_linuxthreads.old) $(SSP_ALL_CFLAGS)
@@ -102,22 +104,23 @@ $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
$(Q)$(RM) $@
$(do_ar)
-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): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+$(top_builddir)include/pthread.h:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
+$(top_builddir)include/semaphore.h:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
+$(top_builddir)include/bits/pthreadtypes.h: | $(top_builddir)include/bits
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
+
+linuxthreads_headers := $(top_builddir)include/pthread.h \
+ $(top_builddir)include/semaphore.h \
+ $(top_builddir)include/bits/pthreadtypes.h
+$(linuxthreads_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h))
headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers)
objclean-y += libpthread_clean
headers_clean-y += linuxthreads_headers_clean
linuxthreads_headers_clean:
- $(do_rm) $(addprefix $(top_builddir),$(linuxthreads_headers))
+ $(do_rm) $(linuxthreads_headers)
libpthread_clean:
$(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
diff --git a/libpthread/linuxthreads.old_db/Makefile.in b/libpthread/linuxthreads.old_db/Makefile.in
index 1c89a9f0e..2f9077905 100644
--- a/libpthread/linuxthreads.old_db/Makefile.in
+++ b/libpthread/linuxthreads.old_db/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libpthread/linuxthreads.old_db
+
# Get the thread include dependencies and shared object name
CFLAGS-linuxthreads.old_db := -DNOT_IN_libc -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
@@ -59,18 +61,18 @@ $(top_builddir)lib/libthread_db.a: $(libthread_db-a-y)
$(Q)$(RM) $@
$(do_ar)
-include/thread_db.h:
- $(do_ln) ../$(PTDIR)_db/$(@F) $(top_builddir)$@
+$(top_builddir)include/thread_db.h:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)_db/$(@F) $@
-linuxthreads_db_headers := include/thread_db.h
-$(linuxthreads_db_headers): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+linuxthreads_db_headers := $(top_builddir)include/thread_db.h
+$(linuxthreads_db_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h))
headers-$(PTHREADS_DEBUG_SUPPORT) += $(linuxthreads_db_headers)
objclean-y += libthread_db_clean
headers_clean-y += linuxthreads_db_headers_clean
linuxthreads_db_headers_clean:
- $(do_rm) $(top_builddir)include/thread_db.h
+ $(do_rm) $(linuxthreads_db_headers)
libthread_db_clean:
$(do_rm) $(addprefix $(libthread_db_OUT)/*., o os oS a)
diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in
index 947dea917..7ed3ec510 100644
--- a/libpthread/linuxthreads/Makefile.in
+++ b/libpthread/linuxthreads/Makefile.in
@@ -6,6 +6,10 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libpthread/linuxthreads/sysdeps/$(TARGET_ARCH)
+subdirs += libpthread/linuxthreads/sysdeps/unix/sysv/linux
+subdirs += libpthread/linuxthreads/sysdeps/pthread
+
CFLAGS-dir_linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread
CFLAGS-linuxthreads := $(CFLAGS-dir_linuxthreads) $(SSP_ALL_CFLAGS)
@@ -115,22 +119,23 @@ $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
$(Q)$(RM) $@
$(do_ar)
-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): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+$(top_builddir)include/pthread.h:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
+$(top_builddir)include/semaphore.h:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
+$(top_builddir)include/bits/pthreadtypes.h: | $(top_builddir)include/bits
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
+
+linuxthreads_headers := $(top_builddir)include/pthread.h \
+ $(top_builddir)include/semaphore.h \
+ $(top_builddir)include/bits/pthreadtypes.h
+$(linuxthreads_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h))
headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers)
objclean-y += libpthread_clean
headers_clean-y += linuxthreads_headers_clean
linuxthreads_headers_clean:
- $(do_rm) $(addprefix $(top_builddir),$(linuxthreads_headers))
+ $(do_rm) $(linuxthreads_headers)
libpthread_clean:
$(do_rm) $(addprefix $(libpthread_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*. */*/*. */*/*/*.,$(d)$(e))))
diff --git a/libpthread/linuxthreads_db/Makefile.in b/libpthread/linuxthreads_db/Makefile.in
index a57cb8461..5804922de 100644
--- a/libpthread/linuxthreads_db/Makefile.in
+++ b/libpthread/linuxthreads_db/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libpthread/linuxthreads_db
+
# Get the thread include dependencies and shared object name
CFLAGS-linuxthreads_db := -DNOT_IN_libc -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
@@ -59,18 +61,18 @@ $(top_builddir)lib/libthread_db.a: $(libthread_db-a-y)
$(Q)$(RM) $@
$(do_ar)
-include/thread_db.h:
- $(do_ln) ../$(PTDIR)_db/$(@F) $(top_builddir)$@
+$(top_builddir)include/thread_db.h:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)_db/$(@F) $@
-linuxthreads_db_headers := include/thread_db.h
-$(linuxthreads_db_headers): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+linuxthreads_db_headers := $(top_builddir)include/thread_db.h
+$(linuxthreads_db_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h))
headers-$(PTHREADS_DEBUG_SUPPORT) += $(linuxthreads_db_headers)
objclean-y += libthread_db_clean
headers_clean-y += linuxthreads_db_headers_clean
linuxthreads_db_headers_clean:
- $(do_rm) $(top_builddir)include/thread_db.h
+ $(do_rm) $(linuxthreads_db_headers)
libthread_db_clean:
$(do_rm) $(addprefix $(libthread_db_OUT)/*., o os oS a)
diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in
index 5ccfeebbf..b7475d757 100644
--- a/libresolv/Makefile.in
+++ b/libresolv/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libresolv
+
CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv $(SSP_ALL_CFLAGS)
LDFLAGS-libresolv.so := $(LDFLAGS) $(call link.asneeded,-lc)
diff --git a/librt/Makefile.in b/librt/Makefile.in
index 1def9003d..aaa19185a 100644
--- a/librt/Makefile.in
+++ b/librt/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += librt
+
CFLAGS-librt := -DNOT_IN_libc -DIS_IN_librt $(SSP_ALL_CFLAGS)
LDFLAGS-librt.so := $(LDFLAGS) $(call link.asneeded,-lc)
diff --git a/libutil/Makefile.in b/libutil/Makefile.in
index 67d973859..a5abdfaba 100644
--- a/libutil/Makefile.in
+++ b/libutil/Makefile.in
@@ -5,6 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+subdirs += libutil
+
CFLAGS-libutil := -DNOT_IN_libc -DIS_IN_libutil $(SSP_ALL_CFLAGS)
LDFLAGS-libutil.so := $(LDFLAGS)
diff --git a/utils/Makefile.in b/utils/Makefile.in
index 446973ea3..5e1628231 100644
--- a/utils/Makefile.in
+++ b/utils/Makefile.in
@@ -4,6 +4,7 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+subdirs += utils
# "make utils" flags