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/