and then install such links at runtime with one of "busybox --install" (for
hardlinks) or "busybox --install -s" (for symlinks).
+If you built busybox as shared object which uses libbusybox.so and have not
+yet installed the binary but want to run tests, then set your LD_LIBRARY_PATH
+accordingly before running the executable:
+
+ export LD_LIBRARY_PATH=`pwd`
+ ./busybox
+
Building out-of-tree:
=====================
configurations from the same source directory, requires the ability to
put the temporary files somewhere else.
-To build out of tree, use the O=$BUILDPATH option during the configuration
-step, as in:
+To build out of tree, cd to the empty directory and do this instead:
+
+ make -f /path/to/source/Makefile allyesconfig
+ make
+ make install
+
+Alternately, use the O=$BUILDPATH option during the configuration step, as in:
make O=/some/empty/directory allyesconfig
cd /some/empty/directory
(Note, O= requires an absolute path.)
-Alternately, cd to the empty directory and do this instead:
-
- make top_srcdir=/path/to/source -f /path/to/source/Makefile allyesconfig
- make
- make install
More Information:
=================
#--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig allbareconfig \
- clean distclean \
release tags
# the toplevel sourcedir
ifndef top_srcdir
-top_srcdir=$(CURDIR)
+top_srcdir:=$(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd)
endif
# toplevel directory of the object-tree
ifndef top_builddir
-top_builddir=$(CURDIR)
+top_builddir:=$(CURDIR)
endif
export srctree=$(top_srcdir)
# That's our default target when none is given on the command line
.PHONY: _all
-_all:
-CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
+_all: all
-ifeq ($(KBUILD_SRC),)
+# see if we are in verbose mode
+ifdef VERBOSE
+ CHECK_VERBOSE := -v
+ PACKAGE_BE_VERBOSE := $(VERBOSE)
+endif
+ifdef V
+ CHECK_VERBOSE := -v
+ PACKAGE_BE_VERBOSE := $(V)
+endif
ifdef O
ifeq ("$(origin O)", "command line")
- KBUILD_OUTPUT := $(O)
- top_builddir := $(O)
+ PACKAGE_OUTPUTDIR := $(shell cd $(O) && pwd)
+ top_builddir := $(PACKAGE_OUTPUTDIR)
endif
else
# If no alternate output-dir was specified, we build in cwd
-# We are using KBUILD_OUTPUT nevertheless to make sure that we create
-# Rules.mak and the toplevel Makefile, in case they don't exist.
- KBUILD_OUTPUT := $(top_builddir)
+ PACKAGE_OUTPUTDIR := $(top_builddir)
endif
-ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
-# pull in OS specific commands like cp, mkdir, etc. early
+#######################################################################
+# Try to workaround bugs in make
+
+# Workaround for bugs in make-3.80
+# eval is broken if it is in a conditional
+
+#$ cat 3.80-eval-in-cond.mak
+#all:: ; @echo it
+#define Y
+# all:: ; @echo worked
+#endef
+#ifdef BAR
+#$(eval $(Y))
+#endif
+#$ make -f 3.80-eval-in-cond.mak
+#it
+#$ make -f 3.80-eval-in-cond.mak BAR=set
+#3.80-eval-in-cond.mak:5: *** missing `endif'. Stop.
+
+# This was fixed in December 2003.
+define check_gcc
+$(eval $(1)+=$(if $(2),$(if $(shell $(CC) $(2) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 && echo y),$(2),$(if $(3),$(3))),$(if $(3),$(3))))
+endef
+
+define check_ld
+$(eval $(1)+=$(if $(2),$(if $(shell $(LD) $(2) -o /dev/null -b binary /dev/null > /dev/null 2>&1 && echo y),$(shell echo \-Wl,$(2)),$(if $(3),$(3))),$(if $(3),$(3))))
+endef
+
+#######################################################################
+
+
-include $(top_srcdir)/Rules.mak
-endif
-# All object directories.
-OBJ_DIRS := $(DIRS)
-all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include)
-all_tree: $(all_tree)
+# Handle building out of tree
+ifneq ($(top_builddir),$(top_srcdir))
+all_tree := $(patsubst %,$(top_builddir)/%,$(DIRS) scripts scripts/config include include/config)
$(all_tree):
@mkdir -p "$@"
-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)),, \
+saved-output := $(PACKAGE_OUTPUTDIR)
+
+$(if $(wildcard $(PACKAGE_OUTPUTDIR)),, \
$(error output directory "$(saved-output)" does not exist))
.PHONY: $(MAKECMDGOALS)
-$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree
- $(Q)$(MAKE) -C $(KBUILD_OUTPUT) \
- top_srcdir=$(top_srcdir) \
- top_builddir=$(top_builddir) \
- KBUILD_SRC=$(top_srcdir) \
- -f $(CURDIR)/Makefile $@
-
-$(KBUILD_OUTPUT)/Rules.mak:
+$(PACKAGE_OUTPUTDIR)/Rules.mak:
@echo > $@
@echo top_srcdir=$(top_srcdir) >> $@
- @echo top_builddir=$(KBUILD_OUTPUT) >> $@
- @echo include $(top_srcdir)/Rules.mak >> $@
+ @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@
+ @echo include $$\(top_srcdir\)/Rules.mak >> $@
-$(KBUILD_OUTPUT)/Makefile:
+$(PACKAGE_OUTPUTDIR)/Makefile:
@echo > $@
@echo top_srcdir=$(top_srcdir) >> $@
- @echo top_builddir=$(KBUILD_OUTPUT) >> $@
- @echo KBUILD_SRC='$$(top_srcdir)' >> $@
- @echo include '$$(KBUILD_SRC)'/Makefile >> $@
+ @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@
+ @echo PACKAGE_SOURCEDIR='$$(top_srcdir)' >> $@
+ @echo include '$$(PACKAGE_SOURCEDIR)'/Makefile >> $@
-# Leave processing to above invocation of make
-skip-makefile := 1
-endif # ifneq ($(KBUILD_OUTPUT),)
-endif # ifeq ($(KBUILD_SRC),)
-ifeq ($(skip-makefile),)
+buildtree := $(all_tree) $(PACKAGE_OUTPUTDIR)/Rules.mak $(PACKAGE_OUTPUTDIR)/Makefile
# We only need a copy of the Makefile for the config targets and reuse
# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
-scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
- cp $< $@
+scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | $(buildtree)
+ @cp $(top_srcdir)/scripts/config/Makefile $@
-_all: all
+else
+all_tree := include/config
+$(all_tree):
+ @mkdir -p "$@"
+buildtree := $(all_tree)
+endif # ifneq ($(PACKAGE_OUTPUTDIR),$(top_srcdir))
help:
@echo 'Cleaning:'
@echo ' release - create a distribution tarball'
@echo ' sizes - show size of all enabled busybox symbols'
@echo
-
-
-include $(top_srcdir)/Rules.mak
+ @echo 'Make flags:'
+ @echo ' V=<number> - print verbose make output (default: unset)'
+ @echo ' 0 print CC invocations'
+ @echo ' 1'
+ @echo ' 2 also print when make enters a directory'
+ @echo ' 3 also verbosely print shell invocations'
ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
-
# Default target if none was requested explicitly
-all: defconfig menuconfig
+all: defconfig menuconfig ;
+ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
# warn if no configuration exists and we are asked to build a non-config target
.config:
@echo ""
@echo "No $(top_builddir)/$@ found!"
- @echo "Please refer to 'make help', section Configuration."
+ @echo "Please refer to 'make help', section Configuration."
@echo ""
@exit 1
+else
+# Avoid implicit rule to kick in by using an empty command
+.config: $(buildtree) ;
+endif
+endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
+
# configuration
# ---------------------------------------------------------------------------
+CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
+
scripts/config/conf: scripts/config/Makefile
$(Q)$(MAKE) -C scripts/config conf
- -@if [ ! -f .config ] ; then \
- touch .config; \
- fi
scripts/config/mconf: scripts/config/Makefile
$(Q)$(MAKE) -C scripts/config ncurses conf mconf
- -@if [ ! -f .config ] ; then \
- touch .config; \
- fi
menuconfig: scripts/config/mconf
@./scripts/config/mconf $(CONFIG_CONFIG_IN)
allyesconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
- sed -i -r -e "s/^(USING_CROSS_COMPILER)=.*/# \1 is not set/" .config
+ @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER)=.*/# \1 is not set/" .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
allnoconfig: scripts/config/conf
defconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
- sed -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
+ @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
-
allbareconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
- @sed -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
- @sed -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config
+ @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
+ @$(SED) -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config
@echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
-else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
-
-all: busybox busybox.links doc
+ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
-# In this section, we need .config
+# Load all Config.in
-include $(top_builddir)/.config.cmd
-include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
-endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
+endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
+
+# convert $(DIRS) to upper case. Use sed instead of tr since we're already
+# depending on it.
+DIRS_UPPER:=$(shell echo $(DIRS) | $(SED) 'h;y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/')
+
+# First populate the variables ..._OBJ-y ...OBJ-m et al
+$(foreach d,$(DIRS_UPPER),$(eval $(notdir $(d))-y:=))
+$(foreach d,$(DIRS_UPPER),$(eval $(notdir $(d))-m:=))
+
+include $(patsubst %,%/Makefile.in,$(SRC_DIRS))
--include $(top_builddir)/.config
+# Then we need the dependencies for ..._OBJ
+define dir_pattern.o
+ifeq ($(os),.os)
+# write patterns for both .os and .o
+$(if $($(1)_OBJ.os),$($(1)_OBJ.os:.os=.o): $(top_builddir)/$(2)/%.o: $(top_srcdir)/$(2)/%.c)
+endif
+$(if $($(1)_OBJ$(os)),$($(1)_OBJ$(os)): $(top_builddir)/$(2)/%$(os): $(top_srcdir)/$(2)/%.c)
+$(if $($(1)_OBJ),$($(1)_OBJ): $(top_builddir)/$(2)/%.o: $(top_srcdir)/$(2)/%.c)
+
+lib-obj-y+=$($(1)_OBJ) $($(1)_OBJ.o) $($(1)_OBJ.os)
+lib-mobj-y+=$($(1)_MOBJ.o) $($(1)_MOBJ.os)
+bin-obj-y+=$($(1)_OBJ:.os=.o) $($(1)_OBJ.o:.os=.o) $($(1)_OBJ.os:.os=.o)
+bin-mobj-y+=$($(1)_MOBJ.o:.osm=.om) $($(1)_MOBJ.os:.osm=.om)
+endef
+# The actual directory patterns for .o*
+$(foreach d,$(DIRS),$(eval $(call dir_pattern.o,$(subst /,_,$(d)),$(d))))
+
+ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
+# Finally pull in the dependencies (headers and other includes) of the
+# individual object files
-include $(top_builddir)/.depend
+# Everything is set.
+
+all: busybox busybox.links doc ;
+
+# Two modes of operation: legacy and IMA
+# Legacy mode builds each object through an individual invocation of CC
+# IMA compiles all sources at once (aka IPO aka IPA etc.)
+
ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
-libraries-y:=
+# We are not building .o
+bin-obj-y:=
+bin-mobj-y:=
# Which parts of the internal libs are requested?
# Per default we only want what was actually selected.
# -a denotes all while -y denotes the selected ones.
else # CONFIG_BUILD_AT_ONCE
# no --combine, build archives out of the individual .o
# This was the old way the binary was built.
-libbusybox-obj:=archival/libunarchive/libunarchive.a \
- networking/libiproute/libiproute.a \
- libpwdgrp/libpwdgrp.a \
- coreutils/libcoreutils/libcoreutils.a \
- libbb/libbb.a
-libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj))
+libbusybox-obj:=$(archival_libunarchive_OBJ$(os)) \
+ $(networking_libiproute_OBJ$(os)) \
+ $(libpwdgrp_MOBJ$(os)) \
+ $(coreutils_libcoreutils_OBJ$(os)) \
+ $(libbb_OBJ$(os)) $(libbb_MOBJ$(os))
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
-# linking against libbusybox, so don't build the .a already contained in the .so
-libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y))
+# linking against libbusybox, so don't build the .o already contained in the .so
+bin-obj-y:=$(filter-out $(libbusybox-obj) $(libbusybox-obj:.os=.o),$(bin-obj-y))
+bin-mobj-y:=$(filter-out $(libbusybox-obj) $(libbusybox-obj:.osm=.om),$(bin-mobj-y))
endif # CONFIG_FEATURE_SHARED_BUSYBOX
endif # CONFIG_BUILD_AT_ONCE
+# build an .a to keep .hash et al small
+$(if $(bin-obj-y)$(bin-mobj-y),$(eval applets.a:=$(bin-obj-y) $(bin-mobj-y)))
+ifdef applets.a
+applets.a: $(applets.a)
+ $(do_ar)
+bin-obj.a=applets.a
+endif
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
LD_LIBBUSYBOX:=libbusybox.so
$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
+endif # CONFIG_BUILD_LIBBUSYBOX
+
ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
-# --combine but not linking against libbusybox, so compile all
+# --combine but not linking against libbusybox, so compile lib*.c
BUSYBOX_SRC := $(LIBRARY_SRC)
BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
endif # !CONFIG_FEATURE_SHARED_BUSYBOX
else # CONFIG_BUILD_AT_ONCE
$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
endif # CONFIG_BUILD_AT_ONCE
-endif # CONFIG_BUILD_LIBBUSYBOX
+
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
LDBUSYBOX:=-L$(top_builddir) -lbusybox
ifndef MAJOR_VERSION
$(error MAJOR_VERSION needed for $@ is not defined)
endif
- $(do_link) $(LIB_CFLAGS) $(LIB_LDFLAGS) \
+ $(do_link) $(LIB_CFLAGS) $(LIB_LDFLAGS) $(CFLAGS_COMBINE) \
-Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
-Wl,-z,combreloc $(LIB_LDFLAGS) \
-o $(@) \
- -Wl,--start-group -Wl,--whole-archive \
+ -Wl,--start-group \
$(LIBRARY_DEFINE) $(^) \
- -Wl,--no-whole-archive -Wl,--end-group
- $(RM_F) $(DO_INSTALL_LIBS)
- for i in $(DO_INSTALL_LIBS); do $(LN_S) -v $(@) $$i ; done
+ -Wl,--end-group
+ @rm -f $(DO_INSTALL_LIBS)
+ @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
$(do_strip)
endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
-busybox: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(libraries-y)
- $(do_link) $(PROG_CFLAGS) \
- -o $@ -Wl,--start-group \
+busybox: $(top_builddir)/.depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(bin-obj.a)
+ $(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
+ $(foreach f,$(^:.o=.c),$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \
+ $(CFLAGS-$(@)) \
+ -o $@ -Wl,--start-group \
$(APPLETS_DEFINE) $(APPLET_SRC) \
- $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
+ $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) \
+ $(bin-obj.a) \
$(LDBUSYBOX) $(LIBRARIES) \
-Wl,--end-group
$(do_strip)
$(Q)-$(SHELL) $^ >$@
install: $(top_srcdir)/applets/install.sh busybox busybox.links
- DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
+ $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
$(SHELL) $< $(PREFIX) $(INSTALL_OPTS)
ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
@echo
endif
uninstall: busybox.links
- $(RM_F) $(PREFIX)/bin/busybox
- for i in `cat busybox.links` ; do $(RM_F) $(PREFIX)$$i; done
+ rm -f $(PREFIX)/bin/busybox
+ for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
ifneq ($(strip $(DO_INSTALL_LIBS)),n)
for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
- $(RM_F) $(PREFIX)$$i; \
+ rm -f $(PREFIX)$$i; \
done
endif
-# see if we are in verbose mode
-KBUILD_VERBOSE :=
-ifdef V
- ifeq ("$(origin V)", "command line")
- KBUILD_VERBOSE := $(V)
- endif
-endif
-ifneq ($(strip $(KBUILD_VERBOSE)),)
- CHECK_VERBOSE := -v
-# ARFLAGS+=v
-endif
check test: busybox
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
$(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
sizes:
- -$(RM_F) busybox
+ -rm -f busybox
$(MAKE) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
-f $(top_srcdir)/Makefile STRIPCMD=/bin/true
$(NM) --size-sort busybox
# Documentation Targets
-doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
+doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html ;
docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl
$(disp_doc)
$(Q)-mkdir -p docs
- $(Q)-( 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
+ $(Q)-( 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
$(disp_doc)
docs/BusyBox.html: docs/busybox.net/BusyBox.html
$(disp_doc)
$(Q)-mkdir -p docs
- $(Q)-$(RM_F) docs/BusyBox.html
+ $(Q)-rm -f docs/BusyBox.html
$(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
docs/busybox.net/BusyBox.html: docs/busybox.pod
$(Q)-mkdir -p docs/busybox.net
$(Q)-pod2html --noindex $< > \
docs/busybox.net/BusyBox.html
- $(Q)-$(RM_F) pod2htm*
+ $(Q)-rm -f pod2htm*
-# The nifty new buildsystem stuff
+# The nifty new dependency stuff
scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
- $(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
+ $(do_link.h)
DEP_INCLUDES := include/bb_config.h
$(Q)$(top_srcdir)/scripts/config/mkconfigs > $@
endif
-depend dep: .depend
-.depend: scripts/bb_mkdep $(DEP_INCLUDES)
+depend dep: $(top_builddir)/.depend ;
+$(top_builddir)/.depend: $(buildtree) scripts/bb_mkdep $(DEP_INCLUDES)
$(disp_gen)
- $(Q)$(RM_F) .depend
- $(Q)mkdir -p include/config
- $(Q)scripts/bb_mkdep -I $(top_srcdir)/include $(top_srcdir) > $@.tmp
+ $(Q)rm -f .depend
+ $(Q)scripts/bb_mkdep $(MKDEP_ARGS) \
+ -I $(top_srcdir)/include $(top_srcdir) > $@.tmp
$(Q)mv $@.tmp $@
include/bb_config.h: .config
- @if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
- $(MAKE) -C scripts/config conf; \
- fi;
+ $(disp_gen)
@$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
+endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
+
clean:
- - $(MAKE) -C scripts/config $@
- - $(RM_F) docs/busybox.dvi docs/busybox.ps \
+ - rm -f docs/busybox.dvi docs/busybox.ps \
docs/busybox.pod docs/busybox.net/busybox.html \
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.net/BusyBox.html busybox.links \
$(DO_INSTALL_LIBS) $(LIBBUSYBOX_SONAME) \
.config.old busybox
- - rm -rf _install testsuite/links
- - find . -name .\*.flags -exec $(RM_F) {} \;
- - find . -name \*.o -exec $(RM_F) {} \;
- - find . -name \*.a -exec $(RM_F) {} \;
- - find . -name \*.so -exec $(RM_F) {} \;
+ - rm -r -f _install testsuite/links
+ - find . -name .\*.flags -exec rm -f {} \;
+ - find . -name \*.o -exec rm -f {} \;
+ - find . -name \*.om -exec rm -f {} \;
+ - find . -name \*.os -exec rm -f {} \;
+ - find . -name \*.a -exec rm -f {} \;
distclean: clean
- - $(RM_F) scripts/bb_mkdep
- - rm -rf include/config $(DEP_INCLUDES)
- - find . -name .depend'*' -exec $(RM_F) {} \;
- $(RM_F) .config .config.old .config.cmd
+ - $(MAKE) -C scripts/config clean
+ - rm -f scripts/bb_mkdep
+ - rm -r -f include/config $(DEP_INCLUDES)
+ - find . -name .depend'*' -exec rm -f {} \;
+ rm -f .config .config.old .config.cmd
release: distclean #doc
cd ..; \
- rm -rf $(PROG)-$(VERSION); \
+ rm -r -f $(PROG)-$(VERSION); \
cp -a busybox $(PROG)-$(VERSION); \
\
find $(PROG)-$(VERSION)/ -type d \
-name .svn \
-print \
- -exec rm -rf {} \; ; \
+ -exec rm -r -f {} \; ; \
\
find $(PROG)-$(VERSION)/ -type f \
-name .\#* \
-print \
- -exec $(RM_F) {} \; ; \
+ -exec rm -f {} \; ; \
\
tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
tags:
ctags -R .
-
-endif # ifeq ($(skip-makefile),)
-
-.PHONY: dummy subdirs release distclean clean config oldconfig \
- menuconfig tags check test depend dep buildtree
+# keep these in sync with noconfig_targets above!
+.PHONY: dummy subdirs check test depend dep buildtree \
+ menuconfig config oldconfig randconfig \
+ defconfig allyesconfig allnoconfig allbareconfig \
+ clean distclean \
+ release tags
-include $(top_builddir)/.config
endif
+ifeq ($(MAKELEVEL),0)
+ifeq ($(HAVE_DOT_CONFIG),y)
+rules-mak-rules:=0
+endif
+endif
+
#--------------------------------------------------------
PROG := busybox
MAJOR_VERSION :=1
# If you are running a cross compiler, you will want to set 'CROSS'
# to something more interesting... Target architecture is determined
# by asking the CC compiler what arch it compiles things for, so unless
-# your compiler is broken, you should not need to specify TARGET_ARCH
+# your compiler is broken, you should not need to specify __TARGET_ARCH
CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
+#")
CC = $(CROSS)gcc
AR = $(CROSS)ar
AS = $(CROSS)as
NM = $(CROSS)nm
STRIP = $(CROSS)strip
CPP = $(CC) -E
-# MAKEFILES = $(top_builddir)/.config
-RM = rm
-RM_F = $(RM) -f
-LN = ln
-LN_S = $(LN) -s
-MKDIR = mkdir
-MKDIR_P = $(MKDIR) -p
-MV = mv
-CP = cp
+SED ?= sed
+AWK ?= awk
+
+
+ifdef PACKAGE_BE_VERBOSE
+PACKAGE_BE_VERBOSE := $(shell echo $(PACKAGE_BE_VERBOSE) | $(SED) "s/[[:alpha:]]*//g")
+endif
+# for make V=3 and above make $(shell) invocations verbose
+ifeq ($(if $(strip $(PACKAGE_BE_VERBOSE)),$(shell test $(PACKAGE_BE_VERBOSE) -gt 2 ; echo $$?),1),0)
+ SHELL+=-x
+ MKDEP_ARGS:=-w
+endif
# What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc.
# If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly.
-# For optimization overrides, it's better still to set OPTIMIZATION.
+# For optimization overrides, it's better still to set OPTIMIZATIONS.
CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
+#")
# To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs...
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
-CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
+CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include
ARFLAGS=cru
+
+# Get the CC MAJOR/MINOR version
# gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest
-# get the CC MAJOR/MINOR version
CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1))
CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1))
+# Note: spaces are significant here!
+# Check if CC version is equal to given MAJOR,MINOR. Returns empty if false.
+define cc_eq
+$(shell [ $(CC_MAJOR) -eq $(1) -a $(CC_MINOR) -eq $(2) ] && echo y)
+endef
+# Check if CC version is greater or equal than given MAJOR,MINOR
+define cc_ge
+$(shell [ $(CC_MAJOR) -ge $(1) -a $(CC_MINOR) -ge $(2) ] && echo y)
+endef
+# Check if CC version is less or equal than given MAJOR,MINOR
+define cc_le
+$(shell [ $(CC_MAJOR) -le $(1) -a $(CC_MINOR) -le $(2) ] && echo y)
+endef
+
+# Workaround bugs in make-3.80 for eval in conditionals
+define is_eq
+$(shell [ $(1) = $(2) ] 2> /dev/null && echo y)
+endef
+define is_neq
+$(shell [ $(1) != $(2) ] 2> /dev/null && echo y)
+endef
+
#--------------------------------------------------------
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
-ifeq ($(strip $(TARGET_ARCH)),)
-TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
+
+# TARGET_ARCH and TARGET_MACH will be passed verbatim to CC with recent
+# versions of make, so we use __TARGET_ARCH here.
+# Current builtin rules looks like that:
+# COMPILE.s = $(AS) $(ASFLAGS) $(TARGET_MACH)
+# COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+
+ifeq ($(strip $(__TARGET_ARCH)),)
+__TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
-e 's/arm.*/arm/g' \
)
endif
-# A nifty macro to make testing gcc features easier
-check_gcc=$(shell \
- if [ "$(1)" != "" ]; then \
- if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
- then echo "$(1)"; else echo "$(2)"; fi \
- fi)
-
-# A not very robust macro to check for available ld flags
-check_ld=$(shell \
- if [ "x$(1)" != "x" ]; then \
- $(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \
- fi)
-
-CFLAGS+=$(call check_gcc,-funsigned-char,)
-
-CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,)
+$(call check_gcc,CFLAGS,-funsigned-char,)
+$(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
#--------------------------------------------------------
# Arch specific compiler optimization stuff should go here.
# Unless you want to override the defaults, do not set anything
-# for OPTIMIZATION...
+# for OPTIMIZATIONS...
# use '-Os' optimization if available, else use -O2
-OPTIMIZATION:=$(call check_gcc,-Os,-O2)
+$(call check_gcc,OPTIMIZATIONS,-Os,-O2)
-ifeq ($(CONFIG_BUILD_AT_ONCE),y)
# gcc 2.95 exits with 0 for "unrecognized option"
-ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0)
- OPTIMIZATION+=$(call check_gcc,--combine,)
-endif
-OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
-PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
-endif # CONFIG_BUILD_AT_ONCE
+$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
+ $(if $(call cc_ge,3,0),\
+ $(call check_gcc,CFLAGS_COMBINE,--combine,)))
-LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,)
-#LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,)
-#LIB_LDFLAGS+=$(call check_ld,--as-needed,)
-#LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,)
+$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
+ $(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,))
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795
+#$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
+# $(call check_gcc,PROG_CFLAGS,-fwhole-program,))
+
+$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,)
+#$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,)
+#$(call check_ld,LIB_LDFLAGS,--as-needed,)
+#$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,)
+
+$(call check_ld,PROG_LDFLAGS,--gc-sections,)
# Some nice architecture specific optimizations
-ifeq ($(strip $(TARGET_ARCH)),arm)
- OPTIMIZATION+=-fstrict-aliasing
-endif
-ifeq ($(strip $(TARGET_ARCH)),i386)
- OPTIMIZATION+=$(call check_gcc,-march=i386,)
+ifeq ($(__TARGET_ARCH),arm)
+ OPTIMIZATIONS+=-fstrict-aliasing
+endif # arm
+
+$(if $(call is_eq,$(__TARGET_ARCH),i386),\
+ $(call check_gcc,OPTIMIZATIONS,-march=i386,))
+
# gcc-4.0 and older seem to suffer from these
-ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
- OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
- OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\
- -malign-functions=0 -malign-jumps=0 -malign-loops=0)
-endif # gcc-4.0 and older
+$(if $(call cc_le,4,0),\
+ $(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\
+ $(call check_gcc,OPTIMIZATIONS,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\
+ -malign-functions=0 -malign-jumps=0 -malign-loops=0))
# gcc-4.1 and beyond seem to benefit from these
-ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
- # turn off flags which hurt -Os
- OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,)
- OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,)
- OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,)
-
- OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,)
-endif # gcc-4.1 and beyond
-endif
-OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)
+# turn off flags which hurt -Os
+$(if $(call cc_ge,4,1),\
+ $(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\
+ $(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\
+ $(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\
+\
+ $(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,))
+
+$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
#
#--------------------------------------------------------
# prone to casual user adjustment.
#
-ifeq ($(strip $(CONFIG_LFS)),y)
+ifeq ($(CONFIG_LFS),y)
# For large file summit support
CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
endif
-ifeq ($(strip $(CONFIG_DMALLOC)),y)
+ifeq ($(CONFIG_DMALLOC),y)
# For testing mem leaks with dmalloc
CFLAGS+=-DDMALLOC
LIBRARIES:=-ldmalloc
else
- ifeq ($(strip $(CONFIG_EFENCE)),y)
+ ifeq ($(CONFIG_EFENCE),y)
LIBRARIES:=-lefence
endif
endif
-ifeq ($(strip $(CONFIG_DEBUG)),y)
+
+$(if $(call is_eq,$(CONFIG_DEBUG),y),\
+ $(call check_ld,LDFLAGS,--warn-common,),\
+ $(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
+ifeq ($(CONFIG_DEBUG),y)
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
- LDFLAGS += $(call check_ld,--warn-common,)
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
- LDFLAGS += $(call check_ld,--warn-common,)
- LDFLAGS += $(call check_ld,--sort-common,)
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
endif
-ifeq ($(strip $(CONFIG_STATIC)),y)
- PROG_CFLAGS += $(call check_gcc,-static,)
-endif
-CFLAGS_SHARED += $(call check_gcc,-shared,)
+$(if $(call is_eq,$(CONFIG_STATIC),y),\
+ $(call check_gcc,PROG_CFLAGS,-static,))
+
+$(call check_gcc,CFLAGS_SHARED,-shared,)
LIB_CFLAGS+=$(CFLAGS_SHARED)
-ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
- CFLAGS_PIC:= $(call check_gcc,-fPIC,)
-endif
+$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\
+ $(call check_gcc,CFLAGS_PIC,-fPIC,))
-ifeq ($(strip $(CONFIG_SELINUX)),y)
+ifeq ($(CONFIG_SELINUX),y)
LIBRARIES += -lselinux
endif
PREFIX:=`pwd`/_install
endif
-# Additional complications due to support for pristine source dir.
-# Include files in the build directory should take precedence over
-# the copy in top_srcdir, both during the compilation phase and the
-# shell script that finds the list of object files.
-# Work in progress by <ldoolitt@recycle.lbl.gov>.
-
-
-OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
CFLAGS += $(CROSS_CFLAGS)
ifdef BB_INIT_SCRIPT
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
INSTALL_OPTS=
endif
+
+#------------------------------------------------------------
+# object extensions
+
+# object potentially used in shared object
+ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
+# single-object extension
+os:=.os
+# multi-object extension
+om:=.osm
+else
+os:=.o
+om:=.om
+endif
+
#------------------------------------------------------------
# Make the output nice and tight
-MAKEFLAGS += --no-print-directory
+
+# for make V=2 and above, do print directory
+ifneq ($(shell test -n "$(strip $(PACKAGE_BE_VERBOSE))" && test $(PACKAGE_BE_VERBOSE) -gt 1 ; echo $$?),0)
+ MAKEFLAGS += --no-print-directory
+endif
+
+export MAKEOVERRIDES
export MAKE_IS_SILENT=n
ifneq ($(findstring s,$(MAKEFLAGS)),)
export MAKE_IS_SILENT=y
-SECHO := @-false
DISP := sil
Q := @
else
ifneq ($(V)$(VERBOSE),)
-SECHO := @-false
DISP := ver
Q :=
else
-SECHO := @echo
DISP := pur
Q := @
endif
endif
-show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
-pur_disp_compile.c = echo " "CC $(show_objs)
-pur_disp_compile.h = echo " "HOSTCC $(show_objs)
-pur_disp_strip = echo " "STRIP $(show_objs)
-pur_disp_link = echo " "LINK $(show_objs)
-pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs)
-sil_disp_compile.c = true
-sil_disp_compile.h = true
-sil_disp_strip = true
-sil_disp_link = true
-sil_disp_ar = true
-ver_disp_compile.c = echo $(cmd_compile.c)
-ver_disp_compile.h = echo $(cmd_compile.h)
-ver_disp_strip = echo $(cmd_strip)
-ver_disp_link = echo $(cmd_link)
-ver_disp_ar = echo $(cmd_ar)
+define show_objs
+ $(subst $(top_builddir)/,,$(subst ../,,$@))
+endef
+pur_disp_compile.c = @echo " "CC $(show_objs) ;
+pur_disp_compile.h = @echo " "HOSTCC $(show_objs) ;
+pur_disp_strip = @echo " "STRIP $(show_objs) ;
+pur_disp_link = @echo " "LINK $(show_objs) ;
+pur_disp_link.h = @echo " "HOSTLINK $(show_objs) ;
+pur_disp_ar = @echo " "AR $(ARFLAGS) $(show_objs) ;
+pur_disp_gen = @echo " "GEN $@ ;
+pur_disp_doc = @echo " "DOC $(subst docs/,,$@) ;
+pur_disp_bin = @echo " "BIN $(show_objs) ;
+sil_disp_compile.c = @
+sil_disp_compile.h = @
+sil_disp_strip = @
+sil_disp_link = @
+sil_disp_link.h = @
+sil_disp_ar = @
+sil_disp_gen = @
+sil_disp_doc = @
+sil_disp_bin = @
+ver_disp_compile.c =
+ver_disp_compile.h =
+ver_disp_strip =
+ver_disp_link =
+ver_disp_link.h =
+ver_disp_ar =
+ver_disp_gen =
+ver_disp_doc =
+ver_disp_bin =
disp_compile.c = $($(DISP)_disp_compile.c)
disp_compile.h = $($(DISP)_disp_compile.h)
disp_strip = $($(DISP)_disp_strip)
disp_link = $($(DISP)_disp_link)
+disp_link.h = $($(DISP)_disp_link.h)
disp_ar = $($(DISP)_disp_ar)
-disp_gen = $(SECHO) " "GEN $@ ; true
-disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true
-cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+disp_gen = $($(DISP)_disp_gen)
+disp_doc = $($(DISP)_disp_doc)
+disp_bin = $($(DISP)_disp_bin)
+# CFLAGS-dir == $(CFLAGS-$(notdir $(@D)))
+# CFLAGS-dir-file.o == $(CFLAGS-$(notdir $(@D))-$(notdir $(@F)))
+# CFLAGS-dir-file.c == $(CFLAGS-$(notdir $(<D))-$(notdir $(<F)))
+# all prerequesites == $(foreach fil,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(fil))))-$(notdir $(fil))))
+cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) -c -o $@ $< \
+ $(foreach f,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \
+ $(CFLAGS-$(notdir $(@D))-$(notdir $(@F))) \
+ $(CFLAGS-$(notdir $(@D)))
+cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
cmd_strip = $(STRIPCMD) $@
-cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS)
+cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) $(LDFLAGS)
+cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(HOST_LDFLAGS) $^ -o $@
cmd_ar = $(AR) $(ARFLAGS) $@ $^
-compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
-compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
-do_strip = @$(disp_strip) ; $(cmd_strip)
-do_link = @$(disp_link) ; $(cmd_link)
-do_ar = @$(disp_ar) ; $(cmd_ar)
+compile.c = $(disp_compile.c) $(cmd_compile.c)
+compile.m = $(disp_compile.c) $(cmd_compile.m)
+compile.h = $(disp_compile.h) $(cmd_compile.h)
+do_strip = $(disp_strip) $(cmd_strip)
+do_link = $(disp_link) $(cmd_link)
+do_link.h = $(disp_link.h) $(cmd_link.h)
+do_ar = $(disp_ar) $(cmd_ar)
+
+ifdef rules-mak-rules
+.SUFFIXES: .c .S .o .os .om .osm .oS .so .a .s .i .E
+
+# generic rules
+%.o: %.c ; $(compile.c)
+%.os: %.c ; $(compile.c) $(CFLAGS_PIC)
+%.o: ; $(compile.c)
+%.os: ; $(compile.c) $(CFLAGS_PIC)
+%.om: ; $(compile.m)
+%.osm: ; $(compile.m) $(CFLAGS_PIC)
+
+endif # rules-mak-rules
.PHONY: dummy
+
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-APPLETS_AR:=applets.a
-ifndef $(APPLETS_DIR)
-APPLETS_DIR:=$(top_builddir)/applets/
-endif
srcdir=$(top_srcdir)/applets
+objdir=$(top_builddir)/applets
-APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c)
-APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
+APPLETS_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c)
-APPLET_SRC-y+=$(APPLET_SRC)
-APPLET_SRC-a+=$(APPLET_SRC)
+APPLET_SRC-y+=$(APPLETS_SRC)
+APPLET_SRC-a+=$(APPLETS_SRC)
-libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
+applets_OBJ:=$(patsubst $(srcdir)/%.c,$(objdir)/%.o,$(APPLETS_SRC))
-$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ)
- $(do_ar)
-
-$(APPLET_OBJ): $(top_builddir)/.config
-$(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
for i in $DO_INSTALL_LIBS; do
rm -f $prefix/$libdir/$i || exit 1
if [ -f $i ]; then
- install -m 644 $i $prefix/$libdir/ || exit 1
+ cp -a $i $prefix/$libdir/ || exit 1
+ chmod 0644 $prefix/$libdir/$i || exit 1
fi
done
fi
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-ARCHIVAL_AR:=archival.a
-ifndef $(ARCHIVAL_DIR)
-ARCHIVAL_DIR:=$(top_builddir)/archival/
-endif
srcdir=$(top_srcdir)/archival
+objdir=$(top_builddir)/archival
-ARCHIVAL-y:=
-ARCHIVAL-$(CONFIG_APT_GET) +=
ARCHIVAL-$(CONFIG_AR) += ar.o
ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o
ARCHIVAL-$(CONFIG_UNLZMA) += unlzma.o
ARCHIVAL-$(CONFIG_UNCOMPRESS) += uncompress.o
ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
-ifneq ($(strip $(ARCHIVAL-y)),)
-libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
-endif
-
ARCHIVAL_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(ARCHIVAL-y))
ARCHIVAL_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(ARCHIVAL_SRC-y)
APPLET_SRC-a+=$(ARCHIVAL_SRC-a)
-$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
- $(do_ar)
+archival_OBJ:= $(patsubst %,$(objdir)/%,$(ARCHIVAL-y))
-$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
-#
-LIBUNARCHIVE_AR:=libunarchive.a
-ifndef $(LIBUNARCHIVE_DIR)
-LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive
-endif
srcdir=$(top_srcdir)/archival/libunarchive
-
-LIBUNARCHIVE-obj:=$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR)
-LIBUNARCHIVE-pic:=$(LIBUNARCHIVE_DIR)/$(subst .a,-pic.a,$(LIBUNARCHIVE_AR))
-
-libraries-y+=$(LIBUNARCHIVE-obj)
+objdir=$(top_builddir)/archival/libunarchive
LIBUNARCHIVE-y:= \
\
- data_skip.o \
- data_extract_all.o \
- data_extract_to_stdout.o \
- data_extract_to_buffer.o \
+ data_skip \
+ data_extract_all \
+ data_extract_to_stdout \
+ data_extract_to_buffer \
\
- filter_accept_all.o \
- filter_accept_list.o \
- filter_accept_reject_list.o \
+ filter_accept_all \
+ filter_accept_list \
+ filter_accept_reject_list \
\
- header_skip.o \
- header_list.o \
- header_verbose_list.o \
+ header_skip \
+ header_list \
+ header_verbose_list \
\
- archive_xread_all.o \
- archive_xread_all_eof.o \
+ archive_xread_all \
+ archive_xread_all_eof \
\
- seek_by_char.o \
- seek_by_jump.o \
+ seek_by_char \
+ seek_by_jump \
\
- data_align.o \
- find_list_entry.o \
- open_transformer.o \
- init_handle.o
+ data_align \
+ find_list_entry \
+ open_transformer \
+ init_handle
-GUNZIP_FILES:= check_header_gzip.o decompress_unzip.o
+GUNZIP_FILES:= check_header_gzip decompress_unzip
DPKG_FILES:= \
- get_header_ar.o \
- unpack_ar_archive.o \
- get_header_tar.o \
- filter_accept_list_reassign.o
+ get_header_ar \
+ unpack_ar_archive \
+ get_header_tar \
+ filter_accept_list_reassign
-LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
-LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
-LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma.o
-LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o
+LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar unpack_ar_archive
+LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2
+LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma
+LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio
LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES)
LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += $(DPKG_FILES)
-LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o
-LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o
-LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o
+LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz
+LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2 get_header_tar_bz2
+LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma get_header_tar_lzma
LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
-LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o
-LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
-LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
-LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
-LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
-LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o
-LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o
-LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o
-LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o
+LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress
+LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio
+LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio
+LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar
+LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2 get_header_tar_bz2
+LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma get_header_tar_lzma
+LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz
+LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress
+LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress
LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y))
-LIBUNARCHIVE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBUNARCHIVE-y)))
+LIBUNARCHIVE_SRC-y:=$(patsubst %,$(srcdir)/%.c,$(LIBUNARCHIVE-y))
LIBUNARCHIVE_SRC-a:=$(wildcard $(srcdir)/*.c)
LIBRARY_SRC-y+=$(LIBUNARCHIVE_SRC-y)
LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a)
-$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)/%,$(LIBUNARCHIVE-y))
- $(do_ar)
+archival_libunarchive_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBUNARCHIVE-y))
-$(LIBUNARCHIVE_DIR)/%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-CONSOLETOOLS_AR:=console-tools.a
-ifndef $(CONSOLETOOLS_DIR)
-CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/
-endif
srcdir=$(top_srcdir)/console-tools
+objdir=$(top_builddir)/console-tools
-CONSOLETOOLS-y:=
CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o
-CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o
+CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o
CONSOLETOOLS-$(CONFIG_DEALLOCVT) += deallocvt.o
-CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o
+CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o
CONSOLETOOLS-$(CONFIG_SETCONSOLE) += setconsole.o
-CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o
-CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o
-CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o
-CONSOLETOOLS-$(CONFIG_RESET) += reset.o
+CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o
+CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o
+CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o
+CONSOLETOOLS-$(CONFIG_RESET) += reset.o
CONSOLETOOLS-$(CONFIG_SETKEYCODES) += setkeycodes.o
-ifneq ($(strip $(CONSOLETOOLS-y)),)
-libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
-endif
+
CONSOLETOOLS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(CONSOLETOOLS-y))
CONSOLETOOLS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(CONSOLETOOLS_SRC-y)
APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a)
-$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS-y))
- $(do_ar)
+console-tools_OBJ:= $(patsubst %,$(objdir)/%,$(CONSOLETOOLS-y))
-$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-COREUTILS_AR:=coreutils.a
-ifndef $(COREUTILS_DIR)
-COREUTILS_DIR:=$(top_builddir)/coreutils/
-endif
srcdir=$(top_srcdir)/coreutils
+objdir=$(top_builddir)/coreutils
-COREUTILS-y:=
COREUTILS-$(CONFIG_BASENAME) += basename.o
COREUTILS-$(CONFIG_CAL) += cal.o
COREUTILS-$(CONFIG_CAT) += cat.o
COREUTILS-$(CONFIG_YES) += yes.o
COREUTILS-y:=$(sort $(COREUTILS-y))
-
-ifneq ($(strip $(COREUTILS-y)),)
-libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
-endif
+COREUTILS-m:=$(sort $(COREUTILS-m))
COREUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(COREUTILS-y))
COREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(COREUTILS_SRC-y)
APPLET_SRC-a+=$(COREUTILS_SRC-a)
-$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
- $(do_ar)
+coreutils_OBJ:= $(patsubst %,$(objdir)/%,$(COREUTILS-y))
-$(COREUTILS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
-#
-LIBCOREUTILS_AR:=libcoreutils.a
-ifndef $(LIBCOREUTILS_DIR)
-LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils
-endif
srcdir=$(top_srcdir)/coreutils/libcoreutils
+objdir=$(top_builddir)/coreutils/libcoreutils
-LIBCOREUTILS_ALL_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c
-
-LIBCOREUTILS-y:=
-LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o
-LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o
-LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat.o
-LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat.o
-LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat.o
+LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod
+LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod
+LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat
+LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat
+LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat
LIBCOREUTILS-y:=$(sort $(LIBCOREUTILS-y))
-LIBCOREUTILS_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBCOREUTILS-y)))
+LIBCOREUTILS_SRC-y:=$(patsubst %,$(srcdir)/%.c,$(LIBCOREUTILS-y))
LIBCOREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
LIBRARY_SRC-y+=$(LIBCOREUTILS_SRC-y)
LIBRARY_SRC-a+=$(LIBCOREUTILS_SRC-a)
-LIBCOREUTILS-multi-obj:=$(LIBCOREUTILS_DIR)/$(subst .a,-multi.o,$(LIBCOREUTILS_AR))
-LIBCOREUTILS-multi-pic:=$(LIBCOREUTILS_DIR)/$(subst .a,-pic.o,$(LIBCOREUTILS_AR))
-
-# We do not need to build an empty non-pic object/archive
-ifneq ($(strip $(LIBCOREUTILS-y)),)
-libraries-y+=$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR)
-endif
-# If we are building libbusybox.so _and_ we will use it ourselves then we
-# keep it as small as possible
-ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
-ifneq ($(strip $(LIBIPROUTE-y)),)
-libraries-m+=$(LIBCOREUTILS-multi-pic)
-endif
-endif
-
-LIBCOREUTILS_OBJS=$(patsubst %,$(LIBCOREUTILS_DIR)/%, $(LIBCOREUTILS-y))
-
-$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR): $(patsubst %,$(LIBCOREUTILS_DIR)/%,$(LIBCOREUTILS-y))
- $(do_ar)
-
-$(LIBCOREUTILS_DIR)/%.o: $(srcdir)/%.c
- $(compile.c)
+coreutils_libcoreutils_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBCOREUTILS-y))
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-DEBIANUTILS_AR:=debianutils.a
-ifndef $(DEBIANUTILS_DIR)
-DEBIANUTILS_DIR:=$(top_builddir)/debianutils/
-endif
srcdir=$(top_srcdir)/debianutils
+objdir=$(top_builddir)/debianutils
-DEBIANUTILS-y:=
DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o
DEBIANUTILS-$(CONFIG_READLINK) += readlink.o
DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
DEBIANUTILS-$(CONFIG_WHICH) += which.o
-ifneq ($(strip $(DEBIANUTILS-y)),)
-libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR)
-endif
DEBIANUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(DEBIANUTILS-y))
DEBIANUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(DEBIANUTILS_SRC-y)
APPLET_SRC-a+=$(DEBIANUTILS_SRC-a)
-$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
- $(do_ar)
+debianutils_OBJ:= $(patsubst %,$(objdir)/%,$(DEBIANUTILS-y))
-$(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-E2FSPROGS_AR:=e2fsprogs.a
-
-E2FSPROGS_DIR:=$(top_builddir)/e2fsprogs
-E2FSPROGS_SRC:=$(top_srcdir)/e2fsprogs
-
-E2FSPROGS_CFLAGS := -include $(E2FSPROGS_SRC)/e2fsbb.h
+srcdir:=$(top_srcdir)/e2fsprogs
+objdir:=$(top_builddir)/e2fsprogs
BLKID_SRC := cache.c dev.c devname.c devno.c blkid_getsize.c \
probe.c read.c resolve.c save.c tag.c
UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC))
UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS))
+
# for building out-of-tree we need to make sure that the directories to hold
# the object tree are created
-$(patsubst %,$(E2FSPROGS_DIR)/%, blkid e2fsck e2p ext2fs uuid):
+$(patsubst %,$(objdir)/%, blkid e2fsck e2p ext2fs uuid):
@mkdir -p "$@"
# make sure that the directories are order-only prerequisites. Otherwise we
# may have object files created after the timestamp of the directory was
# updated which would lead to spurious rebuilds (as some of the dentries
# may be older than the dir itself).
-$(patsubst %,$(E2FSPROGS_DIR)/%, $(BLKID_OBJS)):|$(E2FSPROGS_DIR)/blkid
-$(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSCK_OBJS)):|$(E2FSPROGS_DIR)/e2fsck
-$(patsubst %,$(E2FSPROGS_DIR)/%, $(E2P_OBJS)):|$(E2FSPROGS_DIR)/e2p
-$(patsubst %,$(E2FSPROGS_DIR)/%, $(EXT2FS_OBJS)):|$(E2FSPROGS_DIR)/ext2fs
-$(patsubst %,$(E2FSPROGS_DIR)/%, $(UUID_OBJS)):|$(E2FSPROGS_DIR)/uuid
+$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/%.c|$(objdir)/blkid
+$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/%.c|$(objdir)/e2fsck
+$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/%.c|$(objdir)/e2p
+$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/%.c|$(objdir)/ext2fs
+$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/%.c|$(objdir)/uuid
+
-E2FSPROGS-y:=
E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS)
E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS)
E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
E2FSPROGS-y:=$(sort $(E2FSPROGS-y))
-
-ifneq ($(strip $(E2FSPROGS-y)),)
-libraries-y+=$(E2FSPROGS_DIR)/$(E2FSPROGS_AR)
+ifneq ($(E2FSPROGS-y),)
+CFLAGS-e2fsprogs := -include $(srcdir)/e2fsbb.h
endif
-E2FSPROGS_SRC-y:=$(patsubst %.o,$(E2FSPROGS_SRC)/%.c,$(E2FSPROGS-y))
-E2FSPROGS_SRC-a:=$(wildcard $(E2FSPROGS_SRC)/*.c) $(patsubst %,$(E2FSPROGS_SRC)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS))
-APPLET_SRC-y+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-y)
-APPLET_SRC-a+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-a)
+E2FSPROGS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(E2FSPROGS-y))
+E2FSPROGS_SRC-a:=$(wildcard $(srcdir)/*.c) $(patsubst %,$(srcdir)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS))
+APPLET_SRC-y+=$(E2FSPROGS_SRC-y)
+APPLET_SRC-a+=$(E2FSPROGS_SRC-a)
+
+$(warning FIXME: change .c to include their stuff relative to $(srcdir))
+E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(srcdir)/%,blkid e2fsck e2p ext2fs uuid)
+CFLAGS-blkid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
+CFLAGS-e2fsck=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
+CFLAGS-e2p=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
+CFLAGS-ext2fs=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
+CFLAGS-uuid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
-# XXX: FIXME: change .c to include their stuff relative to $(E2FSPROGS_SRC)
-E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(E2FSPROGS_SRC)/%,blkid e2fsck e2p ext2fs uuid)
-APPLETS_DEFINE-y+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE)
-APPLETS_DEFINE-a+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE)
+APPLETS_DEFINE-y+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
+APPLETS_DEFINE-a+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
-$(E2FSPROGS_DIR)/$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y))
- $(do_ar)
+e2fsprogs_OBJ:= $(patsubst %,$(objdir)/%,$(E2FSPROGS-y))
-$(E2FSPROGS_DIR)/%.o: $(subst $(top_builddir),$(top_srcdir),$(E2FSPROGS_DIR)/%.c)
- $(compile.c) $(E2FSPROGS_CFLAGS)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-EDITOR_AR:=editors.a
-ifndef $(EDITOR_DIR)
-EDITOR_DIR:=$(top_builddir)/editors/
-endif
srcdir=$(top_srcdir)/editors
+objdir=$(top_builddir)/editors
-EDITOR-y:=
-EDITOR-$(CONFIG_AWK) += awk.o
-EDITOR-$(CONFIG_PATCH) += patch.o
-EDITOR-$(CONFIG_SED) += sed.o
-EDITOR-$(CONFIG_VI) += vi.o
-
-ifneq ($(strip $(EDITOR-y)),)
-libraries-y+=$(EDITOR_DIR)$(EDITOR_AR)
-endif
-
-EDITOR_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(EDITOR-y))
-EDITOR_SRC-a:=$(wildcard $(srcdir)/*.c)
-APPLET_SRC-y+=$(EDITOR_SRC-y)
-APPLET_SRC-a+=$(EDITOR_SRC-a)
+EDITORS-$(CONFIG_AWK) += awk.o
+EDITORS-$(CONFIG_PATCH) += patch.o
+EDITORS-$(CONFIG_SED) += sed.o
+EDITORS-$(CONFIG_VI) += vi.o
needlibm-y:=
needlibm-$(CONFIG_FEATURE_AWK_MATH) := y
ifeq ($(needlibm-y),y)
- LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES))
+ LIBRARIES := $(filter-out -lm,$(LIBRARIES)) -lm
endif
-$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
- $(do_ar)
+EDITOR_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(EDITORS-y))
+EDITOR_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(EDITOR_SRC-y)
+APPLET_SRC-a+=$(EDITOR_SRC-a)
+
+editors_OBJ:= $(patsubst %,$(objdir)/%,$(EDITORS-y))
-$(EDITOR_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-FINDUTILS_AR:=findutils.a
-ifndef $(FINDUTILS_DIR)
-FINDUTILS_DIR:=$(top_builddir)/findutils/
-endif
srcdir=$(top_srcdir)/findutils
+objdir=$(top_builddir)/findutils
-FINDUTILS-y:=
FINDUTILS-$(CONFIG_FIND) += find.o
FINDUTILS-$(CONFIG_GREP) += grep.o
FINDUTILS-$(CONFIG_XARGS) += xargs.o
-ifneq ($(strip $(FINDUTILS-y)),)
-libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR)
-endif
-
FINDUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(FINDUTILS-y))
FINDUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(FINDUTILS_SRC-y)
APPLET_SRC-a+=$(FINDUTILS_SRC-a)
-$(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
- $(do_ar)
+findutils_OBJ:= $(patsubst %,$(objdir)/%,$(FINDUTILS-y))
-$(FINDUTILS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-INIT_AR:=init.a
-ifndef $(INIT_DIR)
-INIT_DIR:=$(top_builddir)/init/
-endif
srcdir=$(top_srcdir)/init
+objdir=$(top_builddir)/init
-INIT-y:=
INIT-$(CONFIG_HALT) += halt.o
INIT-$(CONFIG_INIT) += init.o
INIT-$(CONFIG_MESG) += mesg.o
INIT-$(CONFIG_INIT_SHARED) += init_shared.o
-ifneq ($(strip $(INIT-y)),)
-libraries-y+=$(INIT_DIR)$(INIT_AR)
-endif
-
INIT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(INIT-y))
INIT_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(INIT_SRC-y)
APPLET_SRC-a+=$(INIT_SRC-a)
-$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y))
- $(do_ar)
+init_OBJ:= $(patsubst %,$(objdir)/%,$(INIT-y))
-$(INIT_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-ifndef $(LIBBB_DIR)
-LIBBB_DIR:=$(top_builddir)/libbb
-endif
srcdir=$(top_srcdir)/libbb
+objdir=$(top_builddir)/libbb
LIBBB-n:=
LIBBB-y:= \
herror_msg.c herror_msg_and_die.c \
human_readable.c inet_common.c inode_hash.c isdirectory.c \
kernel_version.c last_char_is.c login.c loop.c \
- make_directory.c md5.c mode_string.c mtab.c mtab_file.c \
+ make_directory.c md5.c mode_string.c mtab_file.c \
obscure.c parse_mode.c parse_number.c perror_msg.c \
perror_msg_and_die.c print_file.c get_console.c \
process_escape_sequence.c procps.c qmodule.c \
LIBBB-$(CONFIG_LOGIN)+= correct_password.c
-LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y))
+LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y) $(LIBBB-m))
# 1:N objects
LIBBB_MSRC0:=$(srcdir)/messages.c
-LIBBB_MOBJ0:=full_version.o \
- memory_exhausted.o invalid_date.o io_error.o \
- read_error.o write_error.o name_longer_than_foo.o unknown.o \
- can_not_create_raw_socket.o perm_denied_are_you_root.o \
- shadow_file.o passwd_file.o group_file.o gshadow_file.o nologin_file.o \
- securetty_file.o motd_file.o \
- msg_standard_input.o msg_standard_output.o shell_file.o \
- bb_dev_null.o bb_common_bufsiz1.o
-LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0))
+LIBBB_M0:=full_version \
+ memory_exhausted invalid_date io_error \
+ read_error write_error name_longer_than_foo unknown \
+ can_not_create_raw_socket perm_denied_are_you_root \
+ shadow_file passwd_file group_file gshadow_file nologin_file \
+ securetty_file motd_file \
+ msg_standard_input msg_standard_output shell_file \
+ bb_dev_null bb_common_bufsiz1
+LIBBB_MOBJ0:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M0))
$(LIBBB_MOBJ0):$(LIBBB_MSRC0)
- $(compile.c) -DL_$(notdir $*)
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_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1))
+LIBBB_M1:=xmalloc xrealloc xcalloc xstrdup xstrndup \
+ xfopen xopen xread xread_all xread_char \
+ xferror xferror_stdout xfflush_stdout strlen
+LIBBB_MOBJ1:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M1))
$(LIBBB_MOBJ1):$(LIBBB_MSRC1)
- $(compile.c) -DL_$(notdir $*)
LIBBB_MSRC2:=$(srcdir)/printf.c
-LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o
-LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2))
+LIBBB_M2:=bb_vfprintf bb_vprintf bb_fprintf bb_printf
+LIBBB_MOBJ2:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M2))
$(LIBBB_MOBJ2):$(LIBBB_MSRC2)
- $(compile.c) -DL_$(notdir $*)
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_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3))
+LIBBB_M3:=xgetularg_bnd_sfx xgetlarg_bnd_sfx getlarg10_sfx \
+ xgetularg_bnd xgetularg10_bnd xgetularg10
+LIBBB_MOBJ3:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M3))
$(LIBBB_MOBJ3):$(LIBBB_MSRC3)
- $(compile.c) -DL_$(notdir $*)
LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
-LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
-LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4))
+LIBBB_M4:=safe_strtoi safe_strtod safe_strtol safe_strtoul
+LIBBB_MOBJ4:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M4))
$(LIBBB_MOBJ4):$(LIBBB_MSRC4)
- $(compile.c) -DL_$(notdir $*)
LIBBB_MSRC5:=$(srcdir)/bb_pwd.c
-LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \
- bb_getug.o get_ug_id.o
-LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5))
+LIBBB_M5:=bb_xgetpwnam bb_xgetgrnam bb_getgrgid bb_getpwuid \
+ bb_getug get_ug_id
+LIBBB_MOBJ5:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M5))
$(LIBBB_MOBJ5):$(LIBBB_MSRC5)
- $(compile.c) -DL_$(notdir $*)
LIBBB_MSRC6:=$(srcdir)/llist.c
-LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o
-LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6))
+LIBBB_M6:=llist_add_to llist_add_to_end llist_free_one llist_free
+LIBBB_MOBJ6:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M6))
$(LIBBB_MOBJ6):$(LIBBB_MSRC6)
- $(compile.c) -DL_$(notdir $*)
# We need the names of the object files built from MSRC for the L_ defines
-LIBBB_ALL_MOBJ:=$(LIBBB_MOBJ0) $(LIBBB_MOBJ1) $(LIBBB_MOBJ2) $(LIBBB_MOBJ3) $(LIBBB_MOBJ4) $(LIBBB_MOBJ5) $(LIBBB_MOBJ6)
+LIBBB_ALL_MDEFS:=$(LIBBB_M0) $(LIBBB_M1) $(LIBBB_M2) $(LIBBB_M3) $(LIBBB_M4) $(LIBBB_M5) $(LIBBB_M6)
+
+# All multi objects
+libbb_MOBJ$(os):=$(LIBBB_MOBJ0) $(LIBBB_MOBJ1) $(LIBBB_MOBJ2) $(LIBBB_MOBJ3) $(LIBBB_MOBJ4) $(LIBBB_MOBJ5) $(LIBBB_MOBJ6)
LIBBB_ALL_MSRC:=$(LIBBB_MSRC0) $(LIBBB_MSRC1) $(LIBBB_MSRC2) $(LIBBB_MSRC3) \
$(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6)
-LIBBB-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC))
-
-LIBBB_AR:=$(LIBBB_DIR)/libbb.a
-libraries-y+=$(LIBBB_AR)
+LIBBB-y:=$(sort $(LIBBB-y))
needcrypt-y:=
ifneq ($(findstring $(srcdir)/pw_encrypt.c,$(LIBBB-y)),)
needcrypt-y:=y
-else
+endif
ifneq ($(findstring $(srcdir)/correct_password.c,$(LIBBB-y)),)
needcrypt-y:=y
endif
+ifeq ($(CONFIG_FEATURE_FULL_LIBBUSYBOX),y)
+needcrypt-y:=y
endif
ifeq ($(needcrypt-y),y)
endif
# all 1:1 objects
-LIBBB_OBJS:=$(patsubst $(srcdir)/%.c,$(LIBBB_DIR)/%.o, $(LIBBB-y))
-$(LIBBB_DIR)/%.o: $(srcdir)/%.c
- $(compile.c)
+libbb_OBJ$(os):=$(patsubst $(srcdir)/%.c,$(objdir)/%$(os),$(LIBBB-y))
+LIBBB_SRC-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC))
LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c)
-LIBRARY_SRC-y+=$(LIBBB-y)
+LIBRARY_SRC-y+=$(LIBBB_SRC-y)
LIBRARY_SRC-a+=$(LIBBB_SRC-a)
# all defines needed for 1:N objects
-LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBBB_ALL_MOBJ))))
+LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(LIBBB_ALL_MDEFS))
LIBRARY_DEFINE-y+=$(LIBBB_DEFINE-y)
LIBRARY_DEFINE-a+=$(LIBBB_DEFINE-y)
-$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_ALL_MOBJ)
- $(do_ar)
+ifeq ($(om),.osm)
+# XXX FIXME:
+# also create a pattern for the non-shared case
+$(LIBBB_MOBJ0:.osm=.om): $(LIBBB_MSRC0)
+$(LIBBB_MOBJ1:.osm=.om): $(LIBBB_MSRC1)
+$(LIBBB_MOBJ2:.osm=.om): $(LIBBB_MSRC2)
+$(LIBBB_MOBJ3:.osm=.om): $(LIBBB_MSRC3)
+$(LIBBB_MOBJ4:.osm=.om): $(LIBBB_MSRC4)
+$(LIBBB_MOBJ5:.osm=.om): $(LIBBB_MSRC5)
+$(LIBBB_MOBJ6:.osm=.om): $(LIBBB_MSRC6)
+endif
+
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-LIBPWDGRP_AR:=libpwdgrp.a
-ifndef $(LIBPWDGRP_DIR)
-LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp
-endif
srcdir=$(top_srcdir)/libpwdgrp
-
-LIBPWDGRP-obj:=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR)
-LIBPWDGRP-pic:=$(LIBPWDGRP_DIR)/$(subst .a,-pic.o,$(LIBPWDGRP_AR))
-
-libraries-y+=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR)
-libraries-m+=$(LIBPWDGRP-multi-pic)
+objdir=$(top_builddir)/libpwdgrp
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 \
- getpwent_r.o getgrent_r.o getpwent.o getgrent.o \
- initgroups.o putpwent.o putgrent.o
-LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ0-y))
+LIBPWDGRP_M0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r fgetgrent_r \
+ fgetpwent fgetgrent getpwnam_r getgrnam_r getpwuid_r \
+ getgrgid_r getpwuid getgrgid getpwnam getgrnam getpw \
+ getpwent_r getgrent_r getpwent getgrent \
+ initgroups putpwent putgrent
+LIBPWDGRP_MOBJ0=$(patsubst %,$(objdir)/%$(om),$(LIBPWDGRP_M0-y))
+$(LIBPWDGRP_MOBJ0): $(LIBPWDGRP_MSRC0)
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 \
- putspent.o __parsespent.o # getspuid_r.o getspuid.o
-LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ1-y))
+LIBPWDGRP_M1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent __parsegrent \
+ __pgsreader fgetspent_r fgetspent sgetspent_r getspnam_r \
+ getspnam getspent_r getspent sgetspent \
+ putspent __parsespent # getspuid_r getspuid
+LIBPWDGRP_MOBJ1=$(patsubst %,$(objdir)/%$(om),$(LIBPWDGRP_M1-y))
+$(LIBPWDGRP_MOBJ1): $(LIBPWDGRP_MSRC1)
-LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS0))))
-LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS1))))
+LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(LIBPWDGRP_M0-y))
+LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(LIBPWDGRP_M1-y))
LIBPWDGRP_SRC-y:=$(LIBPWDGRP_MSRC0)
LIBRARY_DEFINE-y+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y)
LIBRARY_DEFINE-a+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y)
+libpwdgrp_MOBJ$(os):=$(LIBPWDGRP_MOBJ0) $(LIBPWDGRP_MOBJ1)
-$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR): $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1)
- $(do_ar)
-
-$(LIBPWDGRP_MOBJS0): $(LIBPWDGRP_MSRC0)
- $(compile.c) -DL_$(notdir $*)
-
-$(LIBPWDGRP_MOBJS1): $(LIBPWDGRP_MSRC1)
- $(compile.c) -DL_$(notdir $*)
+ifeq ($(om),.osm)
+# XXX FIXME:
+# also create a pattern for the non-shared case
+$(LIBPWDGRP_MOBJ0:.osm=.om): $(LIBPWDGRP_MSRC0)
+$(LIBPWDGRP_MOBJ1:.osm=.om): $(LIBPWDGRP_MSRC1)
+endif
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-LOGINUTILS_AR:=loginutils.a
-ifndef LOGINUTILS_DIR
-LOGINUTILS_DIR:=$(top_builddir)/loginutils/
-endif
srcdir=$(top_srcdir)/loginutils
+objdir=$(top_builddir)/loginutils
-LOGINUTILS-y:=
LOGINUTILS-$(CONFIG_ADDGROUP) += addgroup.o
LOGINUTILS-$(CONFIG_ADDUSER) += adduser.o
LOGINUTILS-$(CONFIG_GETTY) += getty.o
LOGINUTILS-$(CONFIG_DELUSER) += deluser.o
LOGINUTILS-$(CONFIG_DELGROUP) += delgroup.o
-ifneq ($(strip $(LOGINUTILS-y)),)
-libraries-y+=$(LOGINUTILS_DIR)$(LOGINUTILS_AR)
-endif
LOGINUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(LOGINUTILS-y))
LOGINUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
needcrypt-$(CONFIG_SU) := y
needcrypt-$(CONFIG_SULOGIN) := y
needcrypt-$(CONFIG_VLOCK) := y
-
-
+ifeq ($(needcrypt-m),y)
+needcrypt-y:=y
+endif
ifeq ($(needcrypt-y),y)
LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
endif
-$(LOGINUTILS_DIR)$(LOGINUTILS_AR): $(patsubst %,$(LOGINUTILS_DIR)%, $(LOGINUTILS-y))
- $(do_ar)
+loginutils_OBJ:= $(patsubst %,$(objdir)/%,$(LOGINUTILS-y))
-$(LOGINUTILS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-MISCUTILS_AR:=miscutils.a
-ifndef $(MISCUTILS_DIR)
-MISCUTILS_DIR:=$(top_builddir)/miscutils/
-endif
srcdir=$(top_srcdir)/miscutils
+objdir=$(top_builddir)/miscutils
-MISCUTILS-y:=
MISCUTILS-$(CONFIG_ADJTIMEX) += adjtimex.o
MISCUTILS-$(CONFIG_CROND) += crond.o
MISCUTILS-$(CONFIG_CRONTAB) += crontab.o
MISCUTILS-$(CONFIG_TIME) += time.o
MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o
-ifneq ($(strip $(MISCUTILS-y)),)
-libraries-y+=$(MISCUTILS_DIR)$(MISCUTILS_AR)
+needlibm-y:=
+needlibm-$(CONFIG_DC) := y
+ifeq ($(needlibm-m),y)
+needlibm-y:=y
+endif
+ifeq ($(needlibm-y),y)
+ LIBRARIES := $(filter-out -lm,$(LIBRARIES)) -lm
endif
MISCUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MISCUTILS-y))
APPLET_SRC-y+=$(MISCUTILS_SRC-y)
APPLET_SRC-a+=$(MISCUTILS_SRC-a)
-needlibm-y:=
-needlibm-$(CONFIG_DC) := y
-
-ifeq ($(needlibm-y),y)
- LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES))
-endif
-
-$(MISCUTILS_DIR)$(MISCUTILS_AR): $(patsubst %,$(MISCUTILS_DIR)%, $(MISCUTILS-y))
- $(do_ar)
+miscutils_OBJ:= $(patsubst %,$(objdir)/%,$(MISCUTILS-y))
-$(MISCUTILS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-MODUTILS_AR:=modutils.a
-ifndef $(MODUTILS_DIR)
-MODUTILS_DIR:=$(top_builddir)/modutils/
-endif
srcdir=$(top_srcdir)/modutils
+objdir=$(top_builddir)/modutils
-MODUTILS-y:=
MODUTILS-$(CONFIG_INSMOD) += insmod.o
MODUTILS-$(CONFIG_LSMOD) += lsmod.o
MODUTILS-$(CONFIG_MODPROBE) += modprobe.o
MODUTILS-$(CONFIG_RMMOD) += rmmod.o
-ifneq ($(strip $(MODUTILS-y)),)
-libraries-y+=$(MODUTILS_DIR)$(MODUTILS_AR)
-endif
-
MODUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MODUTILS-y))
MODUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(MODUTILS_SRC-y)
APPLET_SRC-a+=$(MODUTILS_SRC-a)
-$(MODUTILS_DIR)$(MODUTILS_AR): $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y))
- $(do_ar)
+modutils_OBJ:= $(patsubst %,$(objdir)/%,$(MODUTILS-y))
-$(MODUTILS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-NETWORKING_AR:=networking.a
-ifndef $(NETWORKING_DIR)
-NETWORKING_DIR:=$(top_builddir)/networking/
-endif
srcdir=$(top_srcdir)/networking
+objdir=$(top_builddir)/networking
-NETWORKING-y:=
NETWORKING-$(CONFIG_ARPING) += arping.o
NETWORKING-$(CONFIG_DNSD) += dnsd.o
NETWORKING-$(CONFIG_ETHER_WAKE) += ether-wake.o
NETWORKING-$(CONFIG_ZCIP) += zcip.o
NETWORKING-y:=$(sort $(NETWORKING-y))
-ifneq ($(strip $(NETWORKING-y)),)
-libraries-y+=$(NETWORKING_DIR)$(NETWORKING_AR)
+NETWORKING-m:=$(sort $(NETWORKING-m))
+
+needcrypt-y:=
+needcrypt-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) := y
+ifeq ($(needcrypt-m),y)
+needcrypt-y:=y
+endif
+ifeq ($(needcrypt-y),y)
+ LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
endif
NETWORKING_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(NETWORKING-y))
LIBRARY_DEFINE-y+= -I$(top_srcdir)/networking
LIBRARY_DEFINE-a+= -I$(top_srcdir)/networking
-needcrypt-y:=
-needcrypt-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) := y
-
-ifeq ($(needcrypt-y),y)
- LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
-endif
-
-$(NETWORKING_DIR)$(NETWORKING_AR): $(patsubst %,$(NETWORKING_DIR)%, $(NETWORKING-y))
- $(do_ar)
+networking_OBJ:= $(patsubst %,$(objdir)/%,$(NETWORKING-y))
-$(NETWORKING_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
#
-LIBIPROUTE_AR:=libiproute.a
-ifndef $(LIBIPROUTE_DIR)
-LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute
-endif
srcdir=$(top_srcdir)/networking/libiproute
+objdir=$(top_builddir)/networking/libiproute
-LIBIPROUTE-y:=
LIBIPROUTE-$(CONFIG_IP) += \
- ip_parse_common_args.o \
- ipaddress.o \
- iplink.o \
- iproute.o \
- iptunnel.o \
- libnetlink.o \
- ll_addr.o \
- ll_map.o \
- ll_proto.o \
- ll_types.o \
- rt_names.o \
- rtm_map.o \
- utils.o
+ ip_parse_common_args \
+ ipaddress \
+ iplink \
+ iproute \
+ iptunnel \
+ libnetlink \
+ ll_addr \
+ ll_map \
+ ll_proto \
+ ll_types \
+ rt_names \
+ rtm_map \
+ utils
LIBIPROUTE-$(CONFIG_IPADDR) += \
- ip_parse_common_args.o \
- ipaddress.o \
- libnetlink.o \
- ll_addr.o \
- ll_map.o \
- ll_types.o \
- rt_names.o \
- utils.o
+ ip_parse_common_args \
+ ipaddress \
+ libnetlink \
+ ll_addr \
+ ll_map \
+ ll_types \
+ rt_names \
+ utils
LIBIPROUTE-$(CONFIG_IPLINK) += \
- ip_parse_common_args.o \
- ipaddress.o \
- iplink.o \
- libnetlink.o \
- ll_addr.o \
- ll_map.o \
- ll_types.o \
- rt_names.o \
- utils.o
+ ip_parse_common_args \
+ ipaddress \
+ iplink \
+ libnetlink \
+ ll_addr \
+ ll_map \
+ ll_types \
+ rt_names \
+ utils
LIBIPROUTE-$(CONFIG_IPROUTE) += \
- ip_parse_common_args.o \
- iproute.o \
- libnetlink.o \
- ll_map.o \
- rt_names.o \
- rtm_map.o \
- utils.o
+ ip_parse_common_args \
+ iproute \
+ libnetlink \
+ ll_map \
+ rt_names \
+ rtm_map \
+ utils
LIBIPROUTE-$(CONFIG_IPTUNNEL) += \
- ip_parse_common_args.o \
- iptunnel.o \
- rt_names.o \
- utils.o
+ ip_parse_common_args \
+ iptunnel \
+ rt_names \
+ utils
LIBIPROUTE-y:=$(sort $(LIBIPROUTE-y))
-LIBIPROUTE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBIPROUTE-y)))
+LIBIPROUTE_SRC-y:=$(patsubst %,$(srcdir)/%.c,$(LIBIPROUTE-y))
LIBIPROUTE_SRC-a:=$(wildcard $(srcdir)/*.c)
LIBRARY_SRC-y+=$(LIBIPROUTE_SRC-y)
LIBRARY_SRC-a+=$(LIBIPROUTE_SRC-a)
-LIBIPROUTE-obj:=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR)
+networking_libiproute_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBIPROUTE-y))
-# We do not need to build an empty non-pic object/archive
-ifneq ($(strip $(LIBIPROUTE-y)),)
-libraries-y+=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR)
-endif
-
-# If we are building libbusybox.so _and_ we will use it ourselves then we
-# keep it as small as possible
-ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
-ifneq ($(strip $(LIBIPROUTE-y)),)
-libraries-m+=$(LIBIPROUTE-multi-pic)
-endif
-endif
-
-$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)/%,$(LIBIPROUTE-y))
- $(do_ar)
-
-$(LIBIPROUTE_DIR)/%.o: $(srcdir)/%.c
- $(compile.c)
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
-#
-UDHCP_AR:=udhcp.a
-ifndef $(UDHCP_DIR)
-UDHCP_DIR:=$(top_builddir)/networking/udhcp/
-endif
srcdir=$(top_srcdir)/networking/udhcp
+objdir=$(top_builddir)/networking/udhcp
#ok, so I forgot how to do an or, but this is a quick and dirty hack
ifeq ($(strip $(CONFIG_UDHCPC)),y)
endif
endif
-UDHCP-y:=
-UDHCP-$(CONFIG_UDHCP_SHARED) += common.c options.c packet.c pidfile.c \
- signalpipe.c socket.c
-UDHCP-$(CONFIG_UDHCPC) += dhcpc.c clientpacket.c clientsocket.c \
- script.c
-UDHCP-$(CONFIG_UDHCPD) += dhcpd.c arpping.c files.c leases.c \
- serverpacket.c static_leases.c
-UDHCP-$(CONFIG_DUMPLEASES) += dumpleases.c
-UDHCP_OBJS:=$(patsubst %.c,$(UDHCP_DIR)%.o, $(UDHCP-y))
-
-ifneq ($(strip $(UDHCP-y)),)
-libraries-y+=$(UDHCP_DIR)$(UDHCP_AR)
-endif
+UDHCP__SHARED_FILES:=common.c options.c packet.c pidfile.c signalpipe.c socket.c
+UDHCP__UDHCPC_FILES:=dhcpc.c clientpacket.c clientsocket.c script.c
+UDHCP__UDHCPD_FILES:=dhcpd.c arpping.c files.c leases.c serverpacket.c \
+ static_leases.c
+UDHCP__DUMPLEASES_FILES:=dumpleases.c
+
+UDHCP-$(CONFIG_UDHCP_SHARED) += $(UDHCP__SHARED_FILES)
+UDHCP-$(CONFIG_UDHCPC) += $(UDHCP__UDHCPC_FILES)
+UDHCP-$(CONFIG_UDHCPD) += $(UDHCP__UDHCPD_FILES)
+UDHCP-$(CONFIG_DUMPLEASES) += $(UDHCP__DUMPLEASES_FILES)
-UDHCP-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y))
-UDHCP-a:=$(wildcard $(srcdir)/*.c)
-APPLET_SRC-y+=$(UDHCP-y)
-APPLET_SRC-a+=$(UDHCP-a)
+UDHCP_SRC-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y))
+UDHCP_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(UDHCP_SRC-y)
+APPLET_SRC-a+=$(UDHCP_SRC-a)
UDHCP_INCLUDES:=$(srcdir)
-APPLETS_DEFINE-y+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES)
-APPLETS_DEFINE-a+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES)
+#APPLETS_DEFINE-y+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX
+#APPLETS_DEFINE-a+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX
+
+CFLAGS-udhcp:= -I$(UDHCP_INCLUDES)
+
+# bug in make-3.80 prevents this:
+#define udhcp__flags
+#CFLAGS-udhcp-$(1):=-DIN_BUSYBOX
+#endef
+#
+#ifeq ($(CONFIG_UDHCP_SHARED),y)
+#$(foreach f,$(UDHCP__SHARED_FILES),$(eval $(call udhcp__flags,$(f))))
+#endif
+#ifeq ($(CONFIG_UDHCPC),y)
+#$(foreach f,$(UDHCP__UDHCPC_FILES),$(eval $(call udhcp__flags,$(f))))
+#endif
+#ifeq ($(CONFIG_UDHCPD),y)
+#$(foreach f,$(UDHCP__UDHCPD_FILES),$(eval $(call udhcp__flags,$(f))))
+#endif
+#ifeq ($(CONFIG_DUMPLEASES),y)
+#$(foreach f,$(UDHCP__DUMPLEASES_FILES),$(eval $(call udhcp__flags,$(f))))
+#endif
+
+ifeq ($(CONFIG_UDHCP_SHARED),y)
+CFLAGS-udhcp-common.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-options.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-packet.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-pidfile.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-signalpipe.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-socket.c:=-DIN_BUSYBOX
+endif
+ifeq ($(CONFIG_UDHCPC),y)
+CFLAGS-udhcp-dhcpc.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-clientpacket.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-clientsocket.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-script.c:=-DIN_BUSYBOX
+endif
+ifeq ($(CONFIG_UDHCPD),y)
+CFLAGS-udhcp-dhcpd.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-arpping.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-files.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-leases.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-serverpacket.c:=-DIN_BUSYBOX
+CFLAGS-udhcp-static_leases.c:=-DIN_BUSYBOX
+endif
+ifeq ($(CONFIG_DUMPLEASES),y)
+CFLAGS-udhcp-dumpleases.c:=-DIN_BUSYBOX
+endif
+
-$(UDHCP_DIR)$(UDHCP_AR): $(UDHCP_OBJS)
- $(do_ar)
+networking_udhcp_OBJ:=$(patsubst %.c,$(objdir)/%.o,$(UDHCP-y))
-$(UDHCP_OBJS): $(UDHCP_DIR)%.o : $(srcdir)/%.c
- $(compile.c) -DIN_BUSYBOX
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-PROCPS_AR:=procps.a
-ifndef $(PROCPS_DIR)
-PROCPS_DIR:=$(top_builddir)/procps/
-endif
srcdir=$(top_srcdir)/procps
+objdir=$(top_builddir)/procps
-PROCPS-y:=
PROCPS-$(CONFIG_FREE) += free.o
PROCPS-$(CONFIG_KILL) += kill.o
PROCPS-$(CONFIG_PIDOF) += pidof.o
PROCPS-$(CONFIG_UPTIME) += uptime.o
PROCPS-$(CONFIG_FUSER) += fuser.o
-ifneq ($(strip $(PROCPS-y)),)
-libraries-y+=$(PROCPS_DIR)$(PROCPS_AR)
-endif
PROCPS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(PROCPS-y))
PROCPS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(PROCPS_SRC-y)
APPLET_SRC-a+=$(PROCPS_SRC-a)
-$(PROCPS_DIR)$(PROCPS_AR): $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y))
- $(do_ar)
+procps_OBJ:= $(patsubst %,$(objdir)/%,$(PROCPS-y))
-$(PROCPS_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
conf: $(CONF_OBJS) $(SHARED_OBJS)
- $(SECHO) " "HOSTCC $@ ; true
- $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
+ $(do_link.h)
mconf: $(MCONF_OBJS) $(SHARED_OBJS)
- $(SECHO) " "HOSTCC $@ ; true
- $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
+ $(do_link.h) $(LIBS)
$(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
$(compile.h) -I.
$(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
- @[ -d $(@D) ] || mkdir -v $(@D)
+ @[ -d $(@D) ] || mkdir $(@D)
$(compile.h) $(HOSTNCURSES) -I.
lkc_defs.h: $(srcdir)/lkc_proto.h
- @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
+ @$(SED) < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
###
# The following requires flex/bison
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-SHELL_AR:=shell.a
-ifndef $(SHELL_DIR)
-SHELL_DIR:=$(top_builddir)/shell/
-endif
srcdir=$(top_srcdir)/shell
+objdir=$(top_builddir)/shell
-SHELLT-y:=
-SHELLT-$(CONFIG_ASH) += ash.o
-SHELLT-$(CONFIG_HUSH) += hush.o
-SHELLT-$(CONFIG_LASH) += lash.o
-SHELLT-$(CONFIG_MSH) += msh.o
-SHELLT-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o
+SHELL-$(CONFIG_ASH) += ash.o
+SHELL-$(CONFIG_HUSH) += hush.o
+SHELL-$(CONFIG_LASH) += lash.o
+SHELL-$(CONFIG_MSH) += msh.o
+SHELL-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o
-ifneq ($(strip $(SHELLT-y)),)
-libraries-y+=$(SHELL_DIR)$(SHELL_AR)
-endif
-SHELLT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SHELLT-y))
+SHELLT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SHELL-y))
SHELLT_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(SHELLT_SRC-y)
APPLET_SRC-a+=$(SHELLT_SRC-a)
-$(SHELL_DIR)$(SHELL_AR): $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y))
- $(do_ar)
+shell_OBJ:= $(patsubst %,$(objdir)/%,$(SHELL-y))
-$(SHELL_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-SYSKLOGD_AR:=sysklogd.a
-ifndef $(SYSKLOGD_DIR)
-SYSKLOGD_DIR:=$(top_builddir)/sysklogd/
-endif
srcdir=$(top_srcdir)/sysklogd
+objdir=$(top_builddir)/sysklogd
-SYSKLOGD-y:=
SYSKLOGD-$(CONFIG_KLOGD) += klogd.o
SYSKLOGD-$(CONFIG_LOGGER) += logger.o
SYSKLOGD-$(CONFIG_LOGREAD) += logread.o
SYSKLOGD-$(CONFIG_SYSLOGD) += syslogd.o
-ifneq ($(strip $(SYSKLOGD-y)),)
-libraries-y+=$(SYSKLOGD_DIR)$(SYSKLOGD_AR)
-endif
SYSKLOGD_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SYSKLOGD-y))
SYSKLOGD_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(SYSKLOGD_SRC-y)
APPLET_SRC-a+=$(SYSKLOGD_SRC-a)
-$(SYSKLOGD_DIR)$(SYSKLOGD_AR): $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y))
- $(do_ar)
+sysklogd_OBJ:= $(patsubst %,$(objdir)/%,$(SYSKLOGD-y))
-$(SYSKLOGD_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-UTILLINUX_AR:=util-linux.a
-ifndef $(UTILLINUX_DIR)
-UTILLINUX_DIR:=$(top_builddir)/util-linux/
-endif
srcdir=$(top_srcdir)/util-linux
-
-UTILLINUX-y:=
-UTILLINUX-$(CONFIG_DMESG) +=dmesg.o
-UTILLINUX-$(CONFIG_FBSET) +=fbset.o
-UTILLINUX-$(CONFIG_FDFLUSH) +=fdflush.o
-UTILLINUX-$(CONFIG_FDFORMAT) +=fdformat.o
-UTILLINUX-$(CONFIG_FDISK) +=fdisk.o
-UTILLINUX-$(CONFIG_FREERAMDISK) +=freeramdisk.o
-UTILLINUX-$(CONFIG_FSCK_MINIX) +=fsck_minix.o
-UTILLINUX-$(CONFIG_GETOPT) +=getopt.o
-UTILLINUX-$(CONFIG_HEXDUMP) +=hexdump.o
-UTILLINUX-$(CONFIG_HWCLOCK) +=hwclock.o
-UTILLINUX-$(CONFIG_IPCRM) +=ipcrm.o
-UTILLINUX-$(CONFIG_IPCS) +=ipcs.o
-UTILLINUX-$(CONFIG_LOSETUP) +=losetup.o
-UTILLINUX-$(CONFIG_MDEV) +=mdev.o
-UTILLINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o
-UTILLINUX-$(CONFIG_MKSWAP) +=mkswap.o
-UTILLINUX-$(CONFIG_MORE) +=more.o
-UTILLINUX-$(CONFIG_MOUNT) +=mount.o
-UTILLINUX-$(CONFIG_FEATURE_MOUNT_NFS) +=nfsmount.o
-UTILLINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o
-UTILLINUX-$(CONFIG_RDATE) +=rdate.o
-UTILLINUX-$(CONFIG_READPROFILE) +=readprofile.o
-UTILLINUX-$(CONFIG_SETARCH) +=setarch.o
-UTILLINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o
-UTILLINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o
-UTILLINUX-$(CONFIG_UMOUNT) +=umount.o
-
-ifneq ($(strip $(UTILLINUX-y)),)
-libraries-y+=$(UTILLINUX_DIR)$(UTILLINUX_AR)
-endif
-
-UTILLINUX_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(UTILLINUX-y))
+objdir=$(top_builddir)/util-linux
+
+UTIL-LINUX-$(CONFIG_DMESG) +=dmesg.o
+UTIL-LINUX-$(CONFIG_FBSET) +=fbset.o
+UTIL-LINUX-$(CONFIG_FDFLUSH) +=fdflush.o
+UTIL-LINUX-$(CONFIG_FDFORMAT) +=fdformat.o
+UTIL-LINUX-$(CONFIG_FDISK) +=fdisk.o
+UTIL-LINUX-$(CONFIG_FREERAMDISK) +=freeramdisk.o
+UTIL-LINUX-$(CONFIG_FSCK_MINIX) +=fsck_minix.o
+UTIL-LINUX-$(CONFIG_GETOPT) +=getopt.o
+UTIL-LINUX-$(CONFIG_HEXDUMP) +=hexdump.o
+UTIL-LINUX-$(CONFIG_HWCLOCK) +=hwclock.o
+UTIL-LINUX-$(CONFIG_IPCRM) +=ipcrm.o
+UTIL-LINUX-$(CONFIG_IPCS) +=ipcs.o
+UTIL-LINUX-$(CONFIG_LOSETUP) +=losetup.o
+UTIL-LINUX-$(CONFIG_MDEV) +=mdev.o
+UTIL-LINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o
+UTIL-LINUX-$(CONFIG_MKSWAP) +=mkswap.o
+UTIL-LINUX-$(CONFIG_MORE) +=more.o
+UTIL-LINUX-$(CONFIG_MOUNT) +=mount.o
+UTIL-LINUX-$(CONFIG_FEATURE_MOUNT_NFS) +=nfsmount.o
+UTIL-LINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o
+UTIL-LINUX-$(CONFIG_RDATE) +=rdate.o
+UTIL-LINUX-$(CONFIG_READPROFILE) +=readprofile.o
+UTIL-LINUX-$(CONFIG_SETARCH) +=setarch.o
+UTIL-LINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o
+UTIL-LINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o
+UTIL-LINUX-$(CONFIG_UMOUNT) +=umount.o
+
+
+UTILLINUX_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(UTIL-LINUX-y))
UTILLINUX_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(UTILLINUX_SRC-y)
APPLET_SRC-a+=$(UTILLINUX_SRC-a)
-$(UTILLINUX_DIR)$(UTILLINUX_AR): $(patsubst %,$(UTILLINUX_DIR)%, $(UTILLINUX-y))
- $(do_ar)
-
-$(UTILLINUX_DIR)%.o: $(srcdir)/%.c
- $(compile.c)
-
ifneq ($(strip $(CONFIG_LFS)),y)
ifeq ($(strip $(FDISK_SUPPORT_LARGE_DISKS)),y)
-
-$(UTILLINUX_DIR)fdisk.o: $(srcdir)/fdisk.c
- $(CC) $(CFLAGS) \
- -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
- $(EXTRA_CFLAGS) -c -o $@ $<
-
+CFLAGS-util-linux-fdisk.c := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
endif
endif
+
+util-linux_OBJ:= $(patsubst %,$(objdir)/%,$(UTIL-LINUX-y))
+