summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2004-10-08 07:46:08 +0000
committerEric Andersen2004-10-08 07:46:08 +0000
commit7daa076d3e24e84ce1f4e9b6133783816575c4c8 (patch)
treee81ce57a92acc0653374e1d262039562855d16ec
parent2842659cc02233274ca165ffb83a31b161d815cd (diff)
downloadbusybox-7daa076d3e24e84ce1f4e9b6133783816575c4c8.zip
busybox-7daa076d3e24e84ce1f4e9b6133783816575c4c8.tar.gz
egor duda writes:
Hi! I've created a patch to busybox' build system to allow building it in separate tree in a manner similar to kbuild from kernel version 2.6. That is, one runs command like 'make O=/build/some/where/for/specific/target/and/options' and everything is built in this exact directory, provided that it exists. I understand that applyingc such invasive changes during 'release candidates' stage of development is at best unwise. So, i'm currently asking for comments about this patch, starting from whether such thing is needed at all to whether it coded properly. 'make check' should work now, and one make creates Makefile in build directory, so one can run 'make' in build directory after that. One possible caveat is that if we build in some directory other than source one, the source directory should be 'distclean'ed first. egor
-rw-r--r--Makefile145
-rw-r--r--Rules.mak10
-rw-r--r--applets/Makefile12
-rw-r--r--applets/Makefile.in11
-rw-r--r--archival/Makefile12
-rw-r--r--archival/Makefile.in6
-rw-r--r--archival/libunarchive/Makefile12
-rw-r--r--archival/libunarchive/Makefile.in6
-rw-r--r--console-tools/Makefile12
-rw-r--r--console-tools/Makefile.in6
-rw-r--r--coreutils/Makefile12
-rw-r--r--coreutils/Makefile.in7
-rw-r--r--coreutils/libcoreutils/Makefile13
-rw-r--r--coreutils/libcoreutils/Makefile.in7
-rw-r--r--debianutils/Makefile12
-rw-r--r--debianutils/Makefile.in7
-rw-r--r--editors/Makefile12
-rw-r--r--editors/Makefile.in6
-rw-r--r--findutils/Makefile12
-rw-r--r--findutils/Makefile.in6
-rw-r--r--init/Makefile12
-rw-r--r--init/Makefile.in6
-rw-r--r--libbb/Makefile10
-rw-r--r--libbb/Makefile.in18
-rw-r--r--libpwdgrp/Makefile10
-rw-r--r--libpwdgrp/Makefile.in7
-rw-r--r--loginutils/Makefile10
-rw-r--r--loginutils/Makefile.in6
-rw-r--r--miscutils/Makefile10
-rw-r--r--miscutils/Makefile.in7
-rw-r--r--modutils/Makefile10
-rw-r--r--modutils/Makefile.in6
-rw-r--r--networking/Makefile10
-rw-r--r--networking/Makefile.in7
-rw-r--r--networking/libiproute/Makefile10
-rw-r--r--networking/libiproute/Makefile.in6
-rw-r--r--networking/udhcp/Makefile10
-rw-r--r--networking/udhcp/Makefile.in5
-rw-r--r--procps/Makefile10
-rw-r--r--procps/Makefile.in6
-rw-r--r--scripts/config/Makefile40
-rw-r--r--shell/Makefile10
-rw-r--r--shell/Makefile.in6
-rw-r--r--sysklogd/Makefile10
-rw-r--r--sysklogd/Makefile.in6
-rw-r--r--testsuite/du/du-h-works5
-rw-r--r--testsuite/du/du-k-works5
-rw-r--r--testsuite/du/du-l-works5
-rw-r--r--testsuite/du/du-m-works5
-rw-r--r--testsuite/du/du-s-works5
-rw-r--r--testsuite/du/du-works5
-rw-r--r--testsuite/head/head-n-works5
-rw-r--r--testsuite/head/head-works5
-rw-r--r--testsuite/ls/ls-1-works5
-rw-r--r--testsuite/ls/ls-h-works5
-rw-r--r--testsuite/ls/ls-l-works5
-rw-r--r--testsuite/ls/ls-s-works5
-rwxr-xr-xtestsuite/runtest18
-rw-r--r--testsuite/sort/sort-n-works5
-rw-r--r--testsuite/sort/sort-r-works5
-rw-r--r--testsuite/sort/sort-works5
-rw-r--r--testsuite/tail/tail-n-works5
-rw-r--r--testsuite/tail/tail-works5
-rw-r--r--testsuite/xargs/xargs-works5
-rw-r--r--util-linux/Makefile10
-rw-r--r--util-linux/Makefile.in8
66 files changed, 459 insertions, 241 deletions
diff --git a/Makefile b/Makefile
index 29897ef..3e2b3ef 100644
--- a/Makefile
+++ b/Makefile
@@ -22,37 +22,112 @@
#--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig clean distclean \
- release tags
-TOPDIR=./
-include Rules.mak
+ release tags
+
+ifndef TOPDIR
+TOPDIR=$(CURDIR)/
+endif
+ifndef top_srcdir
+top_srcdir=$(CURDIR)
+endif
+ifndef top_builddir
+top_builddir=$(CURDIR)
+endif
+
+srctree=$(top_srcdir)
+vpath %/Config.in $(srctree)
+
+include $(top_builddir)/Rules.mak
DIRS:=applets archival archival/libunarchive coreutils console-tools \
debianutils editors findutils init miscutils modutils networking \
networking/libiproute networking/udhcp procps loginutils shell \
sysklogd util-linux libpwdgrp coreutils/libcoreutils libbb
+SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
+
ifeq ($(strip $(CONFIG_SELINUX)),y)
CFLAGS += -I/usr/include/selinux
LIBRARIES += -lsecure
endif
-CONFIG_CONFIG_IN = sysdeps/$(TARGET_OS)/Config.in
-CONFIG_DEFCONFIG = sysdeps/$(TARGET_OS)/defconfig
+CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
+CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig
+
+ALL_DIRS:= $(DIRS) scripts/config
+ALL_MAKEFILES:=$(patsubst %,%/Makefile,$(ALL_DIRS))
+
+ifeq ($(KBUILD_SRC),)
+
+ifdef O
+ ifeq ("$(origin O)", "command line")
+ KBUILD_OUTPUT := $(O)
+ endif
+endif
+
+# That's our default target when none is given on the command line
+.PHONY: _all
+_all:
+
+ifneq ($(KBUILD_OUTPUT),)
+# Invoke a second make in the output directory, passing relevant variables
+# check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(wildcard $(KBUILD_OUTPUT)),, \
+ $(error output directory "$(saved-output)" does not exist))
+
+.PHONY: $(MAKECMDGOALS)
+
+$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile
+ $(MAKE) -C $(KBUILD_OUTPUT) \
+ top_srcdir=$(CURDIR) \
+ top_builddir=$(KBUILD_OUTPUT) \
+ TOPDIR=$(KBUILD_OUTPUT) \
+ KBUILD_SRC=$(CURDIR) \
+ -f $(CURDIR)/Makefile $@
+
+$(KBUILD_OUTPUT)/Rules.mak:
+ @echo > $@
+ @echo top_srcdir=$(CURDIR) >> $@
+ @echo top_builddir=$(KBUILD_OUTPUT) >> $@
+ @echo include $(top_srcdir)/Rules.mak >> $@
+
+$(KBUILD_OUTPUT)/Makefile:
+ @echo > $@
+ @echo top_srcdir=$(CURDIR) >> $@
+ @echo top_builddir=$(KBUILD_OUTPUT) >> $@
+ @echo KBUILD_SRC='$$(top_srcdir)' >> $@
+ @echo include '$$(KBUILD_SRC)'/Makefile >> $@
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifneq ($(KBUILD_OUTPUT),)
+endif # ifeq ($(KBUILD_SRC),)
+
+ifeq ($(skip-makefile),)
+
+_all: all
ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
all: busybox busybox.links doc
+all_tree: $(ALL_MAKEFILES)
+
+$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
+ d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
+
# In this section, we need .config
--include .config.cmd
-include $(patsubst %,%/Makefile.in, $(DIRS))
--include $(TOPDIR).depend
+-include $(top_builddir)/.config.cmd
+include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
+-include $(top_builddir)/.depend
-busybox: .depend include/config.h $(libraries-y)
+busybox: $(ALL_MAKEFILES) .depend include/config.h $(libraries-y)
$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
$(STRIPCMD) $@
-busybox.links: applets/busybox.mkll include/config.h
+busybox.links: $(top_srcdir)/applets/busybox.mkll include/config.h $(top_srcdir)/include/applets.h
- $(SHELL) $^ >$@
install: applets/install.sh busybox busybox.links
@@ -75,14 +150,18 @@ uninstall: busybox.links
install-hardlinks: applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX) --hardlinks
+check: busybox
+ bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
+ $(top_srcdir)/testsuite/runtest
# Documentation Targets
doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
-docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod
- - ( cat docs/busybox_header.pod; \
- docs/autodocifier.pl include/usage.h; \
- cat docs/busybox_footer.pod ) > docs/busybox.pod
+docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod
+ -mkdir -p docs
+ - ( cat $(top_srcdir)/docs/busybox_header.pod; \
+ $(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h; \
+ cat $(top_srcdir)/docs/busybox_footer.pod ) > docs/busybox.pod
docs/BusyBox.txt: docs/busybox.pod
@echo
@@ -99,7 +178,7 @@ docs/BusyBox.1: docs/busybox.pod
docs/BusyBox.html: docs/busybox.net/BusyBox.html
- mkdir -p docs
-@ rm -f docs/BusyBox.html
- -@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
+ -@ cp docs/busybox.net/BusyBox.html docs/BusyBox.html
docs/busybox.net/BusyBox.html: docs/busybox.pod
-@ mkdir -p docs/busybox.net
@@ -108,20 +187,19 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod
-@ rm -f pod2htm*
# The nifty new buildsystem stuff
-scripts/mkdep: scripts/mkdep.c
- $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
+scripts/mkdep: $(top_srcdir)/scripts/mkdep.c
+ $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
-scripts/split-include: scripts/split-include.c
- $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
+scripts/split-include: $(top_srcdir)/scripts/split-include.c
+ $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
.depend: scripts/mkdep
rm -f .depend .hdepend;
mkdir -p include/config;
- $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
scripts/mkdep -I include -- \
- `find -name \*.c -print | sed -e "s,^./,,"` >> .depend;
+ `find $(top_srcdir) -name \*.c -print | sed -e "s,^./,,"` >> .depend;
scripts/mkdep -I include -- \
- `find -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
+ `find $(top_srcdir) -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
depend dep: include/config.h .depend
@@ -130,13 +208,10 @@ include/config/MARKER: depend scripts/split-include
@ touch include/config/MARKER
include/config.h: .config
- @if [ ! -x ./scripts/config/conf ] ; then \
+ @if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
$(MAKE) -C scripts/config conf; \
fi;
- @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
-
-%.o: %.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+ @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
finished2:
@echo
@@ -150,12 +225,16 @@ all: menuconfig
# configuration
# ---------------------------------------------------------------------------
-scripts/config/conf:
+$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
+ d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
+
+scripts/config/conf: scripts/config/Makefile Rules.mak
$(MAKE) -C scripts/config conf
-@if [ ! -f .config ] ; then \
cp $(CONFIG_DEFCONFIG) .config; \
fi
-scripts/config/mconf:
+
+scripts/config/mconf: scripts/config/Makefile Rules.mak
$(MAKE) -C scripts/config ncurses conf mconf
-@if [ ! -f .config ] ; then \
cp $(CONFIG_DEFCONFIG) .config; \
@@ -187,9 +266,6 @@ allnoconfig: scripts/config/conf
defconfig: scripts/config/conf
@./scripts/config/conf -d $(CONFIG_CONFIG_IN)
-check: busybox
- cd testsuite && ./runtest
-
clean:
- rm -f docs/busybox.dvi docs/busybox.ps \
docs/busybox.pod docs/busybox.net/busybox.html \
@@ -232,7 +308,8 @@ tags:
endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
-.PHONY: dummy subdirs release distclean clean config oldconfig \
- menuconfig tags check test depend
+endif # ifeq ($(skip-makefile),)
+.PHONY: dummy subdirs release distclean clean config oldconfig \
+ menuconfig tags check test depend buildtree
diff --git a/Rules.mak b/Rules.mak
index 43cf242..63b80f3 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -42,7 +42,7 @@ LD = $(CROSS)ld
NM = $(CROSS)nm
STRIP = $(CROSS)strip
CPP = $(CC) -E
-MAKEFILES = $(TOPDIR).config
+# MAKEFILES = $(top_builddir)/.config
# What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc.
@@ -80,7 +80,7 @@ BB_SRC_DIR=
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
-CFLAGS=-I$(TOPDIR)include
+CFLAGS=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
ARFLAGS=-r
#--------------------------------------------------------
@@ -102,7 +102,7 @@ endif
# Pull in the user's busybox configuration
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
--include $(TOPDIR).config
+-include $(top_builddir)/.config
endif
# A nifty macro to make testing gcc features easier
@@ -189,12 +189,8 @@ endif
# have a chance of winning.
CFLAGS += $(CFLAGS_EXTRA)
-%.o: %.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
-
.PHONY: dummy
-
.EXPORT_ALL_VARIABLES:
diff --git a/applets/Makefile b/applets/Makefile
index 5f91674..b566e4d 100644
--- a/applets/Makefile
+++ b/applets/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/applets
APPLETS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir).depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/applets/Makefile.in b/applets/Makefile.in
index afd5cbe..e31bb6f 100644
--- a/applets/Makefile.in
+++ b/applets/Makefile.in
@@ -19,18 +19,19 @@
APPLETS_AR:=applets.a
ifndef $(APPLETS_DIR)
-APPLETS_DIR:=$(TOPDIR)applets/
+APPLETS_DIR:=$(top_builddir)/applets/
endif
+srcdir=$(top_srcdir)/applets
APPLET_SRC:=applets.c busybox.c
APPLET_OBJ:= $(patsubst %.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
-
-
libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
-$(APPLET_OBJ): $(TOPDIR).config
-
$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ)
$(AR) -ro $@ $(APPLET_OBJ)
+$(APPLET_OBJ): $(top_builddir)/.config
+$(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/archival/Makefile b/archival/Makefile
index 1cbe7ee..a96daa4 100644
--- a/archival/Makefile
+++ b/archival/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
ARCHIVAL_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+srcdir=$(top_srcdir)/archival
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/archival/Makefile.in b/archival/Makefile.in
index 1673662..76ab6cd 100644
--- a/archival/Makefile.in
+++ b/archival/Makefile.in
@@ -19,8 +19,9 @@
ARCHIVAL_AR:=archival.a
ifndef $(ARCHIVAL_DIR)
-ARCHIVAL_DIR:=$(TOPDIR)archival/
+ARCHIVAL_DIR:=$(top_builddir)/archival/
endif
+srcdir=$(top_srcdir)/archival
ARCHIVAL-y:=
ARCHIVAL-$(CONFIG_APT_GET) +=
@@ -42,3 +43,6 @@ libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
$(AR) -ro $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
+$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/archival/libunarchive/Makefile b/archival/libunarchive/Makefile
index 9a20ea2..e985fa4 100644
--- a/archival/libunarchive/Makefile
+++ b/archival/libunarchive/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../../
+top_srcdir=../..
+top_builddir=../..
+srcdir=$(top_srcdir)/archival/libunarchive
LIBUNARCHIVE_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in
index 5cf5efa..809b0e1 100644
--- a/archival/libunarchive/Makefile.in
+++ b/archival/libunarchive/Makefile.in
@@ -19,8 +19,9 @@
LIBUNARCHIVE_AR:=libunarchive.a
ifndef $(LIBUNARCHIVE_DIR)
-LIBUNARCHIVE_DIR:=$(TOPDIR)archival/libunarchive/
+LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive/
endif
+srcdir=$(top_srcdir)/archvial/libunarchive
LIBUNARCHIVE-y:= \
\
@@ -78,3 +79,6 @@ libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
$(AR) -ro $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
+$(LIBUNARCHIVA_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/console-tools/Makefile b/console-tools/Makefile
index 2ee51a5..42cf2c8 100644
--- a/console-tools/Makefile
+++ b/console-tools/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/console/tools
CONSOLETOOLS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/console-tools/Makefile.in b/console-tools/Makefile.in
index 1d756c7..b19ce5c 100644
--- a/console-tools/Makefile.in
+++ b/console-tools/Makefile.in
@@ -19,8 +19,9 @@
CONSOLETOOLS_AR:=console-tools.a
ifndef $(CONSOLETOOLS_DIR)
-CONSOLETOOLS_DIR:=$(TOPDIR)console-tools/
+CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/
endif
+srcdir=$(top_srcdir)/console-tools
CONSOLETOOLS_DIR-y:=
CONSOLETOOLS_DIR-$(CONFIG_CHVT) += chvt.o
@@ -38,3 +39,6 @@ libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
$(AR) -ro $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
+$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/coreutils/Makefile b/coreutils/Makefile
index b42689a..50fdac2 100644
--- a/coreutils/Makefile
+++ b/coreutils/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/coreutils
SHELLUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/coreutils/Makefile.in b/coreutils/Makefile.in
index a5343c9..aacb813 100644
--- a/coreutils/Makefile.in
+++ b/coreutils/Makefile.in
@@ -19,8 +19,9 @@
COREUTILS_AR:=coreutils.a
ifndef $(COREUTILS_DIR)
-COREUTILS_DIR:=$(TOPDIR)coreutils/
+COREUTILS_DIR:=$(top_builddir)/coreutils/
endif
+srcdir=$(top_srcdir)/coreutils
COREUTILS-y:=
COREUTILS-$(CONFIG_BASENAME) += basename.o
@@ -91,3 +92,7 @@ libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(AR) -ro $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
+
+$(COREUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/coreutils/libcoreutils/Makefile b/coreutils/libcoreutils/Makefile
index 11867c6..0a1c80a 100644
--- a/coreutils/libcoreutils/Makefile
+++ b/coreutils/libcoreutils/Makefile
@@ -17,13 +17,16 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../../
+top_srcdir=../..
+top_builddir=../..
+srcdir=$(top_srcdir)/coreutils/libcoreutils
LIBCOREUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
+
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/coreutils/libcoreutils/Makefile.in b/coreutils/libcoreutils/Makefile.in
index d0e8b3a..cf83d71 100644
--- a/coreutils/libcoreutils/Makefile.in
+++ b/coreutils/libcoreutils/Makefile.in
@@ -19,8 +19,9 @@
LIBCOREUTILS_AR:=libcoreutils.a
ifndef $(LIBCOREUTILS_DIR)
-LIBCOREUTILS_DIR:=$(TOPDIR)coreutils/libcoreutils/
+LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils/
endif
+srcdir=$(top_srcdir)/coreutils/libcoreutils
LIBCOREUTILS_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c xgetoptfile_sort_uniq.c
@@ -30,3 +31,7 @@ libraries-y+=$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR)
$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR): $(LIBCOREUTILS_OBJS)
$(AR) -ro $@ $(LIBCOREUTILS_OBJS)
+
+$(LIBCOREUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/debianutils/Makefile b/debianutils/Makefile
index 0282b83..10ec1cc 100644
--- a/debianutils/Makefile
+++ b/debianutils/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/debianutils
DEBIANUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/debianutils/Makefile.in b/debianutils/Makefile.in
index dabef27..3a20403 100644
--- a/debianutils/Makefile.in
+++ b/debianutils/Makefile.in
@@ -19,9 +19,9 @@
DEBIANUTILS_AR:=debianutils.a
ifndef $(DEBIANUTILS_DIR)
-DEBIANUTILS_DIR:=$(TOPDIR)debianutils/
+DEBIANUTILS_DIR:=$(top_builddir)/debianutils/
endif
-
+srcdir=$(top_srcdir)/debianutils
DEBIANUTILS-y:=
DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
@@ -36,3 +36,6 @@ libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR)
$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
$(AR) -ro $@ $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
+$(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/editors/Makefile b/editors/Makefile
index 1c82231..e6c1147 100644
--- a/editors/Makefile
+++ b/editors/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/editors
EDITOR_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/editors/Makefile.in b/editors/Makefile.in
index 017f309..571e055 100644
--- a/editors/Makefile.in
+++ b/editors/Makefile.in
@@ -19,8 +19,9 @@
EDITOR_AR:=editors.a
ifndef $(EDITOR_DIR)
-EDITOR_DIR:=$(TOPDIR)editors/
+EDITOR_DIR:=$(top_builddir)/editors/
endif
+srcdir=$(top_srcdir)/editors
EDITOR-y:=
EDITOR-$(CONFIG_AWK) += awk.o
@@ -42,3 +43,6 @@ endif
$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
$(AR) -ro $@ $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
+$(EDITOR_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/findutils/Makefile b/findutils/Makefile
index ba65a0e..f3f8bb8 100644
--- a/findutils/Makefile
+++ b/findutils/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/findutils
FINDUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/findutils/Makefile.in b/findutils/Makefile.in
index 2d2f242..ae71070 100644
--- a/findutils/Makefile.in
+++ b/findutils/Makefile.in
@@ -19,8 +19,9 @@
FINDUTILS_AR:=findutils.a
ifndef $(FINDUTILS_DIR)
-FINDUTILS_DIR:=$(TOPDIR)findutils/
+FINDUTILS_DIR:=$(top_builddir)/findutils/
endif
+srcdir=$(top_srcdir)/findutils
FINDUTILS-y:=
FINDUTILS-$(CONFIG_FIND) += find.o
@@ -32,3 +33,6 @@ libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR)
$(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
$(AR) -ro $@ $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
+$(FINDUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/init/Makefile b/init/Makefile
index d235327..9b0a1d1 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/init
INIT_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
+include $(srcdir)/Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/init/Makefile.in b/init/Makefile.in
index 6264710..807259d 100644
--- a/init/Makefile.in
+++ b/init/Makefile.in
@@ -19,8 +19,9 @@
INIT_AR:=init.a
ifndef $(INIT_DIR)
-INIT_DIR:=$(TOPDIR)init/
+INIT_DIR:=$(top_builddir)/init/
endif
+srcdir=$(top_srcdir)/init
INIT-y:=
INIT-$(CONFIG_HALT) += halt.o
@@ -56,3 +57,6 @@ libraries-y+=$(INIT_DIR)$(INIT_AR)
$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y))
$(AR) -ro $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y))
+$(INIT_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/libbb/Makefile b/libbb/Makefile
index fbcb123..e94c052 100644
--- a/libbb/Makefile
+++ b/libbb/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/libbb
LIBBB_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/libbb/Makefile.in b/libbb/Makefile.in
index f86664f..85d4a96 100644
--- a/libbb/Makefile.in
+++ b/libbb/Makefile.in
@@ -16,12 +16,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
LIBBB_AR:=libbb.a
ifndef $(LIBBB_DIR)
-LIBBB_DIR:=$(TOPDIR)libbb/
+LIBBB_DIR:=$(top_builddir)/libbb/
endif
+srcdir=$(top_srcdir)/libbb
LIBBB_SRC:= \
bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \
@@ -51,7 +50,7 @@ LIBBB_SRC:= \
LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC))
-LIBBB_MSRC0:=$(LIBBB_DIR)messages.c
+LIBBB_MSRC0:=$(srcdir)/messages.c
LIBBB_MOBJ0:=full_version.o \
memory_exhausted.o invalid_date.o io_error.o \
write_error.o name_longer_than_foo.o unknown.o \
@@ -60,19 +59,19 @@ LIBBB_MOBJ0:=full_version.o \
securetty_file.o motd_file.o \
msg_standard_input.o msg_standard_output.o shell_file.o
-LIBBB_MSRC1:=$(LIBBB_DIR)xfuncs.c
+LIBBB_MSRC1:=$(srcdir)/xfuncs.c
LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \
xfopen.o xopen.o xread.o xread_all.o xread_char.o \
xferror.o xferror_stdout.o xfflush_stdout.o strlen.o
-LIBBB_MSRC2:=$(LIBBB_DIR)printf.c
+LIBBB_MSRC2:=$(srcdir)/printf.c
LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o
-LIBBB_MSRC3:=$(LIBBB_DIR)xgetularg.c
+LIBBB_MSRC3:=$(srcdir)/xgetularg.c
LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \
xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o
-LIBBB_MSRC4:=$(LIBBB_DIR)/safe_strtol.c
+LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
@@ -88,6 +87,9 @@ $(LIBBB_DIR)$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \
$(AR) -ro $@ $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \
$(LIBBB_MOBJS2) $(LIBBB_MOBJS3) $(LIBBB_MOBJS4)
+$(LIBBB_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
$(LIBBB_MOBJS0): $(LIBBB_MSRC0)
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
diff --git a/libpwdgrp/Makefile b/libpwdgrp/Makefile
index 79dbb46..c833550 100644
--- a/libpwdgrp/Makefile
+++ b/libpwdgrp/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/libpwgrp
LIBPWDGRP_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/libpwdgrp/Makefile.in b/libpwdgrp/Makefile.in
index a798202..9bdfc10 100644
--- a/libpwdgrp/Makefile.in
+++ b/libpwdgrp/Makefile.in
@@ -19,11 +19,12 @@
LIBPWDGRP_AR:=libpwdgrp.a
ifndef $(LIBPWDGRP_DIR)
-LIBPWDGRP_DIR:=$(TOPDIR)libpwdgrp/
+LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp/
endif
+srcdir=$(top_srcdir)/libpwdgrp
-LIBPWDGRP_MSRC0:=$(LIBPWDGRP_DIR)pwd_grp.c
+LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c
LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \
fgetpwent.o fgetgrent.o getpwnam_r.o getgrnam_r.o getpwuid_r.o \
getgrgid_r.o getpwuid.o getgrgid.o getpwnam.o getgrnam.o getpw.o \
@@ -31,7 +32,7 @@ LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \
initgroups.o putpwent.o putgrent.o
LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)%, $(LIBPWDGRP_MOBJ0-y))
-LIBPWDGRP_MSRC1:=$(LIBPWDGRP_DIR)pwd_grp.c
+LIBPWDGRP_MSRC1:=$(srcdir)/pwd_grp.c
LIBPWDGRP_MOBJ1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent.o __parsegrent.o \
__pgsreader.o fgetspent_r.o fgetspent.o sgetspent_r.o getspnam_r.o \
getspnam.o getspent_r.o getspent.o sgetspent.o \
diff --git a/loginutils/Makefile b/loginutils/Makefile
index a013d14..98226ae 100644
--- a/loginutils/Makefile
+++ b/loginutils/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/loginutils
LOGINUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/loginutils/Makefile.in b/loginutils/Makefile.in
index d6ffd3b..96a61e6 100644
--- a/loginutils/Makefile.in
+++ b/loginutils/Makefile.in
@@ -19,8 +19,9 @@
LOGINUTILS_AR:=loginutils.a
ifndef LOGINUTILS_DIR
-LOGINUTILS_DIR:=$(TOPDIR)loginutils/
+LOGINUTILS_DIR:=$(top_builddir)/loginutils/
endif
+srcdir=$(top_srcdir)/loginutils
LOGINUTILS-y:=
LOGINUTILS-$(CONFIG_ADDGROUP) += addgroup.o
@@ -51,3 +52,6 @@ endif
$(LOGINUTILS_DIR)$(LOGINUTILS_AR): $(patsubst %,$(LOGINUTILS_DIR)%, $(LOGINUTILS-y))
$(AR) -ro $@ $(patsubst %,$(LOGINUTILS_DIR)%, $(LOGINUTILS-y))
+$(LOGINUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/miscutils/Makefile b/miscutils/Makefile
index 4bae724..ac427dc 100644
--- a/miscutils/Makefile
+++ b/miscutils/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/miscutils
MISCUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/miscutils/Makefile.in b/miscutils/Makefile.in
index 89e3208..ddddf72 100644
--- a/miscutils/Makefile.in
+++ b/miscutils/Makefile.in
@@ -19,9 +19,9 @@
MISCUTILS_AR:=miscutils.a
ifndef $(MISCUTILS_DIR)
-MISCUTILS_DIR:=$(TOPDIR)miscutils/
+MISCUTILS_DIR:=$(top_builddir)/miscutils/
endif
-
+srcdir=$(top_srcdir)/miscutils
MISCUTILS-y:=
MISCUTILS-$(CONFIG_ADJTIMEX) += adjtimex.o
@@ -50,3 +50,6 @@ endif
$(MISCUTILS_DIR)$(MISCUTILS_AR): $(patsubst %,$(MISCUTILS_DIR)%, $(MISCUTILS-y))
$(AR) -ro $@ $(patsubst %,$(MISCUTILS_DIR)%, $(MISCUTILS-y))
+$(MISCUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/modutils/Makefile b/modutils/Makefile
index 5e1c886..d2b50b4 100644
--- a/modutils/Makefile
+++ b/modutils/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/modutils
MODUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/modutils/Makefile.in b/modutils/Makefile.in
index a92befa..9bd11d4 100644
--- a/modutils/Makefile.in
+++ b/modutils/Makefile.in
@@ -19,8 +19,9 @@
MODUTILS_AR:=modutils.a
ifndef $(MODUTILS_DIR)
-MODUTILS_DIR:=$(TOPDIR)modutils/
+MODUTILS_DIR:=$(top_builddir)/modutils/
endif
+srcdir=$(top_srcdir)/modutils
MODUTILS-y:=
MODUTILS-$(CONFIG_INSMOD) += insmod.o
@@ -33,3 +34,6 @@ libraries-y+=$(MODUTILS_DIR)$(MODUTILS_AR)
$(MODUTILS_DIR)$(MODUTILS_AR): $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y))
$(AR) -ro $@ $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y))
+$(MODUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/networking/Makefile b/networking/Makefile
index 456c433..91726b1 100644
--- a/networking/Makefile
+++ b/networking/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/networking
NETWORKING_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/networking/Makefile.in b/networking/Makefile.in
index e15e61a..9bfe901 100644
--- a/networking/Makefile.in
+++ b/networking/Makefile.in
@@ -19,9 +19,9 @@
NETWORKING_AR:=networking.a
ifndef $(NETWORKING_DIR)
-NETWORKING_DIR:=$(TOPDIR)networking/
+NETWORKING_DIR:=$(top_builddir)/networking/
endif
-
+srcdir=$(top_srcdir)/networking
NETWORKING-y:=
NETWORKING-$(CONFIG_ARPING) += arping.o
NETWORKING-$(CONFIG_FTPGET) += ftpgetput.o
@@ -63,3 +63,6 @@ endif
$(NETWORKING_DIR)$(NETWORKING_AR): $(patsubst %,$(NETWORKING_DIR)%, $(NETWORKING-y))
$(AR) -ro $@ $(patsubst %,$(NETWORKING_DIR)%, $(NETWORKING-y))
+$(NETWORKING_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/networking/libiproute/Makefile b/networking/libiproute/Makefile
index 0dc7191..d3aefaa 100644
--- a/networking/libiproute/Makefile
+++ b/networking/libiproute/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../../
+top_srcdir=../..
+top_builddir=../..
+srcdir=$(top_srcdir)/networking/libiproute
LIBIPROUTE_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/networking/libiproute/Makefile.in b/networking/libiproute/Makefile.in
index 25c5199..fcc7f48 100644
--- a/networking/libiproute/Makefile.in
+++ b/networking/libiproute/Makefile.in
@@ -19,8 +19,9 @@
LIBIPROUTE_AR:=libiproute.a
ifndef $(LIBIPROUTE_DIR)
-LIBIPROUTE_DIR:=$(TOPDIR)networking/libiproute/
+LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute/
endif
+srcdir=$(top_srcdir)/networking/libiproute
LIBIPROUTE-$(CONFIG_IP) += \
ip_parse_common_args.o \
@@ -78,3 +79,6 @@ libraries-y+=$(LIBIPROUTE_DIR)$(LIBIPROUTE_AR)
$(LIBIPROUTE_DIR)$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)%, $(LIBIPROUTE-y))
$(AR) -ro $@ $(patsubst %,$(LIBIPROUTE_DIR)%, $(LIBIPROUTE-y))
+$(LIBIPROUTE_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/networking/udhcp/Makefile b/networking/udhcp/Makefile
index 2b79d22..3d32db5 100644
--- a/networking/udhcp/Makefile
+++ b/networking/udhcp/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../../
+top_srcdir=../..
+top_builddir=../..
+srcdir=$(top_srcdir)/networking/udhcp
UDHCP_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/networking/udhcp/Makefile.in b/networking/udhcp/Makefile.in
index b480794..2d7a088 100644
--- a/networking/udhcp/Makefile.in
+++ b/networking/udhcp/Makefile.in
@@ -19,8 +19,9 @@
UDHCP_AR:=udhcp.a
ifndef $(UDHCP_DIR)
-UDHCP_DIR:=$(TOPDIR)networking/udhcp/
+UDHCP_DIR:=$(top_builddir)/networking/udhcp/
endif
+srcdir=$(top_srcdir)/networking/udhcp
#ok, so I forgot how to do an or, but this is a quick and dirty hack
ifeq ($(CONFIG_UDHCPC), y)
@@ -48,6 +49,6 @@ libraries-y+=$(UDHCP_DIR)$(UDHCP_AR)
$(UDHCP_DIR)$(UDHCP_AR): $(UDHCP_OBJS)
$(AR) -ro $@ $(UDHCP_OBJS)
-$(UDHCP_OBJS): %.o : %.c
+$(UDHCP_OBJS): $(UDHCP_DIR)%.o : $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DIN_BUSYBOX -c $< -o $@
diff --git a/procps/Makefile b/procps/Makefile
index 0238f7e..1cc8804 100644
--- a/procps/Makefile
+++ b/procps/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/procps
PROCPS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/procps/Makefile.in b/procps/Makefile.in
index 1c2e00f..ced29a1 100644
--- a/procps/Makefile.in
+++ b/procps/Makefile.in
@@ -19,8 +19,9 @@
PROCPS_AR:=procps.a
ifndef $(PROCPS_DIR)
-PROCPS_DIR:=$(TOPDIR)procps/
+PROCPS_DIR:=$(top_builddir)/procps/
endif
+srcdir=$(top_srcdir)/procps
PROCPS-y:=
PROCPS-$(CONFIG_FREE) += free.o
@@ -37,3 +38,6 @@ libraries-y+=$(PROCPS_DIR)$(PROCPS_AR)
$(PROCPS_DIR)$(PROCPS_AR): $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y))
$(AR) -ro $@ $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y))
+$(PROCPS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/scripts/config/Makefile b/scripts/config/Makefile
index e15ec39..c0b5b9d 100644
--- a/scripts/config/Makefile
+++ b/scripts/config/Makefile
@@ -2,8 +2,10 @@
#
# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
-TOPDIR=../../
-include $(TOPDIR)Rules.mak
+top_srcdir=../..
+top_builddir=../..
+srcdir=$(top_srcdir)/scripts/config
+include $(top_builddir)/Rules.mak
all: ncurses conf mconf
@@ -33,7 +35,8 @@ endif
CONF_SRC =conf.c
MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
SHARED_SRC=zconf.tab.c
-SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
+SHARED_DEPS:=$(srcdir)/lkc.h $(srcdir)/lkc_proto.h \
+ lkc_defs.h $(srcdir)/expr.h zconf.tab.h
CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
@@ -44,13 +47,13 @@ conf: $(CONF_OBJS) $(SHARED_OBJS)
mconf: $(MCONF_OBJS) $(SHARED_OBJS)
$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
-$(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
+$(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
-$(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
+$(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
$(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
-lkc_defs.h: lkc_proto.h
+lkc_defs.h: $(srcdir)/lkc_proto.h
@sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
###
@@ -61,29 +64,30 @@ lkc_defs.h: lkc_proto.h
ifdef LKC_GENPARSER
-%.tab.c %.tab.h: %.y
+%.tab.c %.tab.h: $(srcdir)/%.y
bison -t -d -v -b $* -p $(notdir $*) $<
-lex.%.c: %.l
+lex.%.c: $(srcdir)/%.l
flex -P$(notdir $*) -o$@ $<
else
lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
- $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
-
-lex.zconf.c: lex.zconf.c_shipped
- cp lex.zconf.c_shipped lex.zconf.c
+ $(HOSTCC) $(HOSTCFLAGS) -I$(srcdir) -c $< -o $@
-zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
- $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
+lex.zconf.c: $(srcdir)/lex.zconf.c_shipped
+ cp $< $@
-zconf.tab.c: zconf.tab.c_shipped
- cp zconf.tab.c_shipped zconf.tab.c
+zconf.tab.c: $(srcdir)/zconf.tab.c_shipped
+ cp $< $@
-zconf.tab.h: zconf.tab.h_shipped
- cp zconf.tab.h_shipped zconf.tab.h
+zconf.tab.h: $(srcdir)/zconf.tab.h_shipped
+ cp $< $@
endif
+zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \
+ $(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS)
+ $(HOSTCC) $(HOSTCFLAGS) -I$(srcdir) -I. -c $< -o $@
+
.PHONY: ncurses
ncurses:
diff --git a/shell/Makefile b/shell/Makefile
index 8f476c1..bd1dad6 100644
--- a/shell/Makefile
+++ b/shell/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_builddir=..
+srcdir=$(top_srcdir)/shell
SHELL_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/shell/Makefile.in b/shell/Makefile.in
index 7b9f41e..61b2846 100644
--- a/shell/Makefile.in
+++ b/shell/Makefile.in
@@ -19,8 +19,9 @@
SHELL_AR:=shell.a
ifndef $(SHELL_DIR)
-SHELL_DIR:=$(TOPDIR)shell/
+SHELL_DIR:=$(top_builddir)/shell/
endif
+srcdir=$(top_srcdir)/shell
SHELLT-y:=
SHELLT-$(CONFIG_ASH) += ash.o
@@ -34,3 +35,6 @@ libraries-y+=$(SHELL_DIR)$(SHELL_AR)
$(SHELL_DIR)$(SHELL_AR): $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y))
$(AR) -ro $@ $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y))
+$(SHELL_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/sysklogd/Makefile b/sysklogd/Makefile
index f6ce145..78b0c00 100644
--- a/sysklogd/Makefile
+++ b/sysklogd/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_buildddir=..
+srcdir=$(top_srcdir)/sysklogd
SYSKLOGD_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/sysklogd/Makefile.in b/sysklogd/Makefile.in
index 1c6e907..99a5f82 100644
--- a/sysklogd/Makefile.in
+++ b/sysklogd/Makefile.in
@@ -19,8 +19,9 @@
SYSKLOGD_AR:=sysklogd.a
ifndef $(SYSKLOGD_DIR)
-SYSKLOGD_DIR:=$(TOPDIR)sysklogd/
+SYSKLOGD_DIR:=$(top_builddir)/sysklogd/
endif
+srcdir=$(top_srcdir)/sysklogd
SYSKLOGD-:=
SYSKLOGD-$(CONFIG_KLOGD) += klogd.o
@@ -33,3 +34,6 @@ libraries-y+=$(SYSKLOGD_DIR)$(SYSKLOGD_AR)
$(SYSKLOGD_DIR)$(SYSKLOGD_AR): $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y))
$(AR) -ro $@ $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y))
+$(SYSKLOGD_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
diff --git a/testsuite/du/du-h-works b/testsuite/du/du-h-works
index 8ec5d4c..82041ab 100644
--- a/testsuite/du/du-h-works
+++ b/testsuite/du/du-h-works
@@ -1,3 +1,4 @@
-du -h .. > logfile.gnu
-busybox du -h .. > logfile.bb
+[ -n "$d" ] || d=..
+du -h "$d" > logfile.gnu
+busybox du -h "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-k-works b/testsuite/du/du-k-works
index 43b119c..177a1a2 100644
--- a/testsuite/du/du-k-works
+++ b/testsuite/du/du-k-works
@@ -1,3 +1,4 @@
-du -k .. > logfile.gnu
-busybox du -k .. > logfile.bb
+[ -n "$d" ] || d=..
+du -k "$d" > logfile.gnu
+busybox du -k "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-l-works b/testsuite/du/du-l-works
index c5d4398..61e9140 100644
--- a/testsuite/du/du-l-works
+++ b/testsuite/du/du-l-works
@@ -1,3 +1,4 @@
-du -l .. > logfile.gnu
-busybox du -l .. > logfile.bb
+[ -n "$d" ] || d=..
+du -l "$d" > logfile.gnu
+busybox du -l "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-m-works b/testsuite/du/du-m-works
index e3e2d3a..bc97073 100644
--- a/testsuite/du/du-m-works
+++ b/testsuite/du/du-m-works
@@ -1,3 +1,4 @@
-du -m .. > logfile.gnu
-busybox du -m .. > logfile.bb
+[ -n "$d" ] || d=..
+du -m "$d" > logfile.gnu
+busybox du -m "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-s-works b/testsuite/du/du-s-works
index 16b0a3e..f0b3bf0 100644
--- a/testsuite/du/du-s-works
+++ b/testsuite/du/du-s-works
@@ -1,3 +1,4 @@
-du -s .. > logfile.gnu
-busybox du -s .. > logfile.bb
+[ -n "$d" ] || d=..
+du -s "$d" > logfile.gnu
+busybox du -s "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-works b/testsuite/du/du-works
index 87ba630..47949c6 100644
--- a/testsuite/du/du-works
+++ b/testsuite/du/du-works
@@ -1,3 +1,4 @@
-du .. > logfile.gnu
-busybox du .. > logfile.bb
+[ -n "$d" ] || d=..
+du "$d" > logfile.gnu
+busybox du "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/head/head-n-works b/testsuite/head/head-n-works
index 121a1fa..db43255 100644
--- a/testsuite/head/head-n-works
+++ b/testsuite/head/head-n-works
@@ -1,3 +1,4 @@
-head -n 2 ../README > logfile.gnu
-busybox head -n 2 ../README > logfile.bb
+[ -n "$d" ] || d=..
+head -n 2 "$d/README" > logfile.gnu
+busybox head -n 2 "$d/README" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/head/head-works b/testsuite/head/head-works
index ea10ade..56ad3e3 100644
--- a/testsuite/head/head-works
+++ b/testsuite/head/head-works
@@ -1,3 +1,4 @@
-head ../README > logfile.gnu
-busybox head ../README > logfile.bb
+[ -n "$d" ] || d=..
+head "$d/README" > logfile.gnu
+busybox head "$d/README" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-1-works b/testsuite/ls/ls-1-works
index 8651ecd..8ad484f 100644
--- a/testsuite/ls/ls-1-works
+++ b/testsuite/ls/ls-1-works
@@ -1,3 +1,4 @@
-ls -1 .. > logfile.gnu
-busybox ls -1 .. > logfile.bb
+[ -n "$d" ] || d=..
+ls -1 "$d" > logfile.gnu
+busybox ls -1 "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-h-works b/testsuite/ls/ls-h-works
index f54a7be..7331262 100644
--- a/testsuite/ls/ls-h-works
+++ b/testsuite/ls/ls-h-works
@@ -1,3 +1,4 @@
-ls -h .. > logfile.gnu
-busybox ls -h .. > logfile.bb
+[ -n "$d" ] || d=..
+ls -h "$d" > logfile.gnu
+busybox ls -h "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-l-works b/testsuite/ls/ls-l-works
index 50e4459..ae5141d 100644
--- a/testsuite/ls/ls-l-works
+++ b/testsuite/ls/ls-l-works
@@ -1,3 +1,4 @@
-ls -l .. > logfile.gnu
-busybox ls -l .. > logfile.bb
+[ -n "$d" ] || d=..
+ls -l "$d" > logfile.gnu
+busybox ls -l "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-s-works b/testsuite/ls/ls-s-works
index 98a612d..d82f328 100644
--- a/testsuite/ls/ls-s-works
+++ b/testsuite/ls/ls-s-works
@@ -1,3 +1,4 @@
-ls -1s .. > logfile.gnu
-busybox ls -1s .. > logfile.bb
+[ -n "$d" ] || d=..
+ls -1s "$d" > logfile.gnu
+busybox ls -1s "$d" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/runtest b/testsuite/runtest
index 89aba39..6ba334b 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -1,6 +1,8 @@
#!/bin/sh
-PATH=$(dirname $(pwd)):$PATH
+[ -n "$srcdir" ] || srcdir=$(pwd)
+[ -n "$bindir" ] || bindir=$(dirname $(pwd))
+PATH=$bindir:$PATH
run_applet_testcase ()
{
@@ -13,7 +15,7 @@ run_applet_testcase ()
local uc_applet=$(echo $applet | tr a-z A-Z)
local testname=$(basename $testcase)
- if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
+ if grep -q "^# CONFIG_${uc_applet} is not set$" $bindir/.config; then
echo UNTESTED: $testname
return 0
fi
@@ -21,7 +23,7 @@ run_applet_testcase ()
if grep -q "^# FEATURE: " $testcase; then
local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
- if grep -q "^# ${feature} is not set$" ../.config; then
+ if grep -q "^# ${feature} is not set$" $bindir/.config; then
echo UNTESTED: $testname
return 0
fi
@@ -31,7 +33,7 @@ run_applet_testcase ()
mkdir -p tmp
pushd tmp >/dev/null
- sh -x -e ../$testcase >.logfile.txt 2>&1
+ d=$srcdir sh -x -e $testcase >.logfile.txt 2>&1
if [ $? != 0 ] ; then
echo FAIL: $testname
@@ -58,8 +60,8 @@ run_applet_tests ()
local status=0
- for testcase in $applet/*; do
- if [ "$testcase" = "$applet/CVS" ]; then
+ for testcase in $srcdir/$applet/*; do
+ if [ "$testcase" = "$srcdir/$applet/CVS" ]; then
continue
fi
@@ -84,11 +86,11 @@ fi
if [ $# -ne 0 ]; then
applets="$@"
else
- applets="*"
+ applets=$(ls $srcdir)
fi
for applet in $applets; do
- if [ "$applet" != CVS -a -d "$applet" ]; then
+ if [ "$applet" != CVS -a -d "$srcdir/$applet" ]; then
if run_applet_tests $applet; then
:
else
diff --git a/testsuite/sort/sort-n-works b/testsuite/sort/sort-n-works
index c9b63a3..878108d 100644
--- a/testsuite/sort/sort-n-works
+++ b/testsuite/sort/sort-n-works
@@ -1,3 +1,4 @@
-sort -n ../README > logfile.gnu
-busybox sort -n ../README > logfile.bb
+[ -n "$d" ] || d=..
+sort -n "$d/README" > logfile.gnu
+busybox sort -n "$d/README" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/sort/sort-r-works b/testsuite/sort/sort-r-works
index 6422ba9..6ee0ceb 100644
--- a/testsuite/sort/sort-r-works
+++ b/testsuite/sort/sort-r-works
@@ -1,3 +1,4 @@
-sort -r ../README > logfile.gnu
-busybox sort -r ../README > logfile.bb
+[ -n "$d" ] || d=..
+sort -r "$d/README" > logfile.gnu
+busybox sort -r "$d/README" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/sort/sort-works b/testsuite/sort/sort-works
index 0110aa0..14a115a 100644
--- a/testsuite/sort/sort-works
+++ b/testsuite/sort/sort-works
@@ -1,3 +1,4 @@
-sort ../README > logfile.gnu
-busybox sort ../README > logfile.bb
+[ -n "$d" ] || d=..
+sort "$d/README" > logfile.gnu
+busybox sort "$d/README" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/tail/tail-n-works b/testsuite/tail/tail-n-works
index 321db7f..27a905f 100644
--- a/testsuite/tail/tail-n-works
+++ b/testsuite/tail/tail-n-works
@@ -1,3 +1,4 @@
-tail -n 2 ../README > logfile.gnu
-busybox tail -n 2 ../README > logfile.bb
+[ -n "$d" ] || d=..
+tail -n 2 "$d/README" > logfile.gnu
+busybox tail -n 2 "$d/README" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/tail/tail-works b/testsuite/tail/tail-works
index 321db7f..27a905f 100644
--- a/testsuite/tail/tail-works
+++ b/testsuite/tail/tail-works
@@ -1,3 +1,4 @@
-tail -n 2 ../README > logfile.gnu
-busybox tail -n 2 ../README > logfile.bb
+[ -n "$d" ] || d=..
+tail -n 2 "$d/README" > logfile.gnu
+busybox tail -n 2 "$d/README" > logfile.bb
cmp logfile.gnu logfile.bb
diff --git a/testsuite/xargs/xargs-works b/testsuite/xargs/xargs-works
index 4ad5818..c95869e 100644
--- a/testsuite/xargs/xargs-works
+++ b/testsuite/xargs/xargs-works
@@ -1,3 +1,4 @@
-find -name \*works -type f | xargs md5sum > logfile.gnu
-find -name \*works -type f | busybox xargs md5sum > logfile.bb
+[ -n "$d" ] || d=..
+find "$d" -name \*works -type f | xargs md5sum > logfile.gnu
+find "$d" -name \*works -type f | busybox xargs md5sum > logfile.bb
diff -u logfile.gnu logfile.bb
diff --git a/util-linux/Makefile b/util-linux/Makefile
index f2e2021..4401fd1 100644
--- a/util-linux/Makefile
+++ b/util-linux/Makefile
@@ -17,13 +17,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-TOPDIR:= ../
+top_srcdir=..
+top_buildddir=..
+srcdir=$(top_srcdir)/util-linux
UTILLINUX_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
+include $(top_builddir)/Rules.mak
+include $(top_builddir)/.config
include Makefile.in
all: $(libraries-y)
--include $(TOPDIR).depend
+-include $(top_builddir)/.depend
clean:
rm -f *.o *.a $(AR_TARGET)
diff --git a/util-linux/Makefile.in b/util-linux/Makefile.in
index 72136f1..0172b35 100644
--- a/util-linux/Makefile.in
+++ b/util-linux/Makefile.in
@@ -19,8 +19,9 @@
UTILLINUX_AR:=util-linux.a
ifndef $(UTILLINUX_DIR)
-UTILLINUX_DIR:=$(TOPDIR)util-linux/
+UTILLINUX_DIR:=$(top_builddir)/util-linux/
endif
+srcdir=$(top_srcdir)/util-linux
UTILLINUX-:=
UTILLINUX-$(CONFIG_DMESG) +=dmesg.o
@@ -49,10 +50,13 @@ libraries-y+=$(UTILLINUX_DIR)$(UTILLINUX_AR)
$(UTILLINUX_DIR)$(UTILLINUX_AR): $(patsubst %,$(UTILLINUX_DIR)%, $(UTILLINUX-y))
$(AR) -ro $@ $(patsubst %,$(UTILLINUX_DIR)%, $(UTILLINUX-y))
+$(UTILLINUX_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
ifneq ($(strip $(CONFIG_LFS)),y)
ifeq ($(strip $(FDISK_SUPPORT_LARGE_DISKS)),y)
-$(UTILLINUX_DIR)fdisk.o: $(UTILLINUX_DIR)fdisk.c
+$(UTILLINUX_DIR)fdisk.o: $(srcdir)/fdisk.c
$(CC) $(CFLAGS) \
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
$(EXTRA_CFLAGS) -c -o $@ $<