diff options
66 files changed, 459 insertions, 241 deletions
@@ -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 @@ -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 5f9167442..b566e4d12 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 afd5cbeb9..e31bb6fd9 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 1cbe7ee00..a96daa4df 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 1673662f9..76ab6cd08 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 9a20ea28b..e985fa49f 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 5cf5efa33..809b0e10e 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 2ee51a5e6..42cf2c8c3 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 1d756c721..b19ce5cb2 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 b42689a26..50fdac236 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 a5343c9c7..aacb813b3 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 11867c602..0a1c80a41 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 d0e8b3a05..cf83d7107 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 0282b83c4..10ec1cc58 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 dabef27ef..3a204033e 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 1c8223124..e6c114781 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 017f30934..571e05568 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 ba65a0e1d..f3f8bb872 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 2d2f242a0..ae71070d9 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 d23532735..9b0a1d139 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 6264710db..807259dee 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 fbcb12330..e94c05260 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 f86664f15..85d4a967b 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 79dbb462f..c833550bf 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 a79820252..9bdfc10d8 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 a013d141f..98226ae81 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 d6ffd3b6c..96a61e60f 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 4bae72476..ac427dc09 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 89e3208a6..ddddf72b3 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 5e1c886c0..d2b50b4d8 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 a92befafb..9bd11d4d8 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 456c433fd..91726b1b2 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 e15e61a3e..9bfe90176 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 0dc7191d3..d3aefaaf4 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 25c51999f..fcc7f48ce 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 2b79d2293..3d32db50a 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 b48079429..2d7a08816 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 0238f7ebb..1cc880462 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 1c2e00f7b..ced29a198 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 e15ec399c..c0b5b9d35 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 8f476c19e..bd1dad6f3 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 7b9f41ed4..61b2846ac 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 f6ce14530..78b0c0090 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 1c6e90774..99a5f823c 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 8ec5d4c24..82041ab33 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 43b119c7c..177a1a2cd 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 c5d439853..61e91400c 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 e3e2d3a56..bc9707350 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 16b0a3e5a..f0b3bf0ae 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 87ba63032..47949c694 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 121a1fa1d..db4325556 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 ea10adeb4..56ad3e36b 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 8651ecd72..8ad484fc3 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 f54a7be0b..7331262c9 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 50e44597e..ae5141d80 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 98a612d06..d82f328b7 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 89aba3985..6ba334bce 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 c9b63a36a..878108ddd 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 6422ba940..6ee0ceb1a 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 0110aa010..14a115abf 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 321db7f8a..27a905f88 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 321db7f8a..27a905f88 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 4ad581804..c95869e89 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 f2e2021f0..4401fd1ed 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 72136f1ce..0172b3562 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 $@ $< |