#--------------------------------------------------------------
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
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
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
-@ 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
@ 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
# 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; \
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 \
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
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.
#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
#--------------------------------------------------------
# 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
# have a chance of winning.
CFLAGS += $(CFLAGS_EXTRA)
-%.o: %.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
-
.PHONY: dummy
-
.EXPORT_ALL_VARIABLES:
# 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)
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 $@ $<
+
# 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)
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) +=
$(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 $@ $<
+
# 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)
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:= \
\
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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
$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR): $(LIBCOREUTILS_OBJS)
$(AR) -ro $@ $(LIBCOREUTILS_OBJS)
+
+$(LIBCOREUTILS_DIR)%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
# 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 \
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 \
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))
$(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 $@
# 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)
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 \
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 \
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
# 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)
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 \
$(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 $@ $<
+
# 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)
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)
$(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 $@
# 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)
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
$(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 $@ $<
+
#
# 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
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))
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)/'
###
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:
# 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)
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
$(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 $@ $<
+
# 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)
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
$(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 $@ $<
+
-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
-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
-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
-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
-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
-du .. > logfile.gnu
-busybox du .. > logfile.bb
+[ -n "$d" ] || d=..
+du "$d" > logfile.gnu
+busybox du "$d" > logfile.bb
cmp logfile.gnu logfile.bb
-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
-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
-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
-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
-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
-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
#!/bin/sh
-PATH=$(dirname $(pwd)):$PATH
+[ -n "$srcdir" ] || srcdir=$(pwd)
+[ -n "$bindir" ] || bindir=$(dirname $(pwd))
+PATH=$bindir:$PATH
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
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
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
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
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
-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
-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
-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
-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
-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
-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
# 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)
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
$(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 $@ $<