- fixes parallel builds (make -j)

- use less resources for the buildsystem itself
This commit is contained in:
Bernhard Reutner-Fischer 2006-03-01 22:54:48 +00:00
parent 12c2429a42
commit 5d26126b9e
28 changed files with 791 additions and 835 deletions

21
INSTALL
View File

@ -72,6 +72,13 @@ also configure a standaone install capability into the busybox base applet,
and then install such links at runtime with one of "busybox --install" (for and then install such links at runtime with one of "busybox --install" (for
hardlinks) or "busybox --install -s" (for symlinks). 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: Building out-of-tree:
===================== =====================
@ -80,8 +87,13 @@ Building from a read-only source tree, or to building multiple
configurations from the same source directory, requires the ability to configurations from the same source directory, requires the ability to
put the temporary files somewhere else. put the temporary files somewhere else.
To build out of tree, use the O=$BUILDPATH option during the configuration To build out of tree, cd to the empty directory and do this instead:
step, as in:
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 make O=/some/empty/directory allyesconfig
cd /some/empty/directory cd /some/empty/directory
@ -90,11 +102,6 @@ step, as in:
(Note, O= requires an absolute path.) (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: More Information:
================= =================

347
Makefile
View File

@ -10,16 +10,15 @@
#-------------------------------------------------------------- #--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \ noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig allbareconfig \ defconfig allyesconfig allnoconfig allbareconfig \
clean distclean \
release tags release tags
# the toplevel sourcedir # the toplevel sourcedir
ifndef top_srcdir ifndef top_srcdir
top_srcdir=$(CURDIR) top_srcdir:=$(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd)
endif endif
# toplevel directory of the object-tree # toplevel directory of the object-tree
ifndef top_builddir ifndef top_builddir
top_builddir=$(CURDIR) top_builddir:=$(CURDIR)
endif endif
export srctree=$(top_srcdir) export srctree=$(top_srcdir)
@ -34,79 +33,102 @@ SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
# That's our default target when none is given on the command line # That's our default target when none is given on the command line
.PHONY: _all .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 ifdef O
ifeq ("$(origin O)", "command line") ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O) PACKAGE_OUTPUTDIR := $(shell cd $(O) && pwd)
top_builddir := $(O) top_builddir := $(PACKAGE_OUTPUTDIR)
endif endif
else else
# If no alternate output-dir was specified, we build in cwd # If no alternate output-dir was specified, we build in cwd
# We are using KBUILD_OUTPUT nevertheless to make sure that we create PACKAGE_OUTPUTDIR := $(top_builddir)
# Rules.mak and the toplevel Makefile, in case they don't exist.
KBUILD_OUTPUT := $(top_builddir)
endif 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 -include $(top_srcdir)/Rules.mak
endif
# All object directories. # Handle building out of tree
OBJ_DIRS := $(DIRS) ifneq ($(top_builddir),$(top_srcdir))
all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include) all_tree := $(patsubst %,$(top_builddir)/%,$(DIRS) scripts scripts/config include include/config)
all_tree: $(all_tree)
$(all_tree): $(all_tree):
@mkdir -p "$@" @mkdir -p "$@"
ifneq ($(KBUILD_OUTPUT),) saved-output := $(PACKAGE_OUTPUTDIR)
# Invoke a second make in the output directory, passing relevant variables
# Check that the output directory actually exists $(if $(wildcard $(PACKAGE_OUTPUTDIR)),, \
saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
$(if $(wildcard $(KBUILD_OUTPUT)),, \
$(error output directory "$(saved-output)" does not exist)) $(error output directory "$(saved-output)" does not exist))
.PHONY: $(MAKECMDGOALS) .PHONY: $(MAKECMDGOALS)
$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree $(PACKAGE_OUTPUTDIR)/Rules.mak:
$(Q)$(MAKE) -C $(KBUILD_OUTPUT) \
top_srcdir=$(top_srcdir) \
top_builddir=$(top_builddir) \
KBUILD_SRC=$(top_srcdir) \
-f $(CURDIR)/Makefile $@
$(KBUILD_OUTPUT)/Rules.mak:
@echo > $@ @echo > $@
@echo top_srcdir=$(top_srcdir) >> $@ @echo top_srcdir=$(top_srcdir) >> $@
@echo top_builddir=$(KBUILD_OUTPUT) >> $@ @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@
@echo include $(top_srcdir)/Rules.mak >> $@ @echo include $$\(top_srcdir\)/Rules.mak >> $@
$(KBUILD_OUTPUT)/Makefile: $(PACKAGE_OUTPUTDIR)/Makefile:
@echo > $@ @echo > $@
@echo top_srcdir=$(top_srcdir) >> $@ @echo top_srcdir=$(top_srcdir) >> $@
@echo top_builddir=$(KBUILD_OUTPUT) >> $@ @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@
@echo KBUILD_SRC='$$(top_srcdir)' >> $@ @echo PACKAGE_SOURCEDIR='$$(top_srcdir)' >> $@
@echo include '$$(KBUILD_SRC)'/Makefile >> $@ @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 # 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. # the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | $(buildtree)
cp $< $@ @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: help:
@echo 'Cleaning:' @echo 'Cleaning:'
@ -137,37 +159,42 @@ help:
@echo ' release - create a distribution tarball' @echo ' release - create a distribution tarball'
@echo ' sizes - show size of all enabled busybox symbols' @echo ' sizes - show size of all enabled busybox symbols'
@echo @echo
@echo 'Make flags:'
@echo ' V=<number> - print verbose make output (default: unset)'
include $(top_srcdir)/Rules.mak @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) ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
# Default target if none was requested explicitly # 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 # warn if no configuration exists and we are asked to build a non-config target
.config: .config:
@echo "" @echo ""
@echo "No $(top_builddir)/$@ found!" @echo "No $(top_builddir)/$@ found!"
@echo "Please refer to 'make help', section Configuration." @echo "Please refer to 'make help', section Configuration."
@echo "" @echo ""
@exit 1 @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 # configuration
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
scripts/config/conf: scripts/config/Makefile scripts/config/conf: scripts/config/Makefile
$(Q)$(MAKE) -C scripts/config conf $(Q)$(MAKE) -C scripts/config conf
-@if [ ! -f .config ] ; then \
touch .config; \
fi
scripts/config/mconf: scripts/config/Makefile scripts/config/mconf: scripts/config/Makefile
$(Q)$(MAKE) -C scripts/config ncurses conf mconf $(Q)$(MAKE) -C scripts/config ncurses conf mconf
-@if [ ! -f .config ] ; then \
touch .config; \
fi
menuconfig: scripts/config/mconf menuconfig: scripts/config/mconf
@./scripts/config/mconf $(CONFIG_CONFIG_IN) @./scripts/config/mconf $(CONFIG_CONFIG_IN)
@ -183,7 +210,7 @@ randconfig: scripts/config/conf
allyesconfig: scripts/config/conf allyesconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) @./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) @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
allnoconfig: scripts/config/conf allnoconfig: scripts/config/conf
@ -195,33 +222,68 @@ allnoconfig: scripts/config/conf
defconfig: scripts/config/conf defconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) @./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) @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
allbareconfig: scripts/config/conf allbareconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) @./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 -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 -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config
@echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN) @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
all: busybox busybox.links doc # Load all Config.in
# In this section, we need .config
-include $(top_builddir)/.config.cmd -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)
-include $(top_builddir)/.config # 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))
# 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 -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) 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? # Which parts of the internal libs are requested?
# Per default we only want what was actually selected. # Per default we only want what was actually selected.
# -a denotes all while -y denotes the selected ones. # -a denotes all while -y denotes the selected ones.
@ -237,19 +299,26 @@ APPLETS_DEFINE:=$(APPLETS_DEFINE-y)
else # CONFIG_BUILD_AT_ONCE else # CONFIG_BUILD_AT_ONCE
# no --combine, build archives out of the individual .o # no --combine, build archives out of the individual .o
# This was the old way the binary was built. # This was the old way the binary was built.
libbusybox-obj:=archival/libunarchive/libunarchive.a \ libbusybox-obj:=$(archival_libunarchive_OBJ$(os)) \
networking/libiproute/libiproute.a \ $(networking_libiproute_OBJ$(os)) \
libpwdgrp/libpwdgrp.a \ $(libpwdgrp_MOBJ$(os)) \
coreutils/libcoreutils/libcoreutils.a \ $(coreutils_libcoreutils_OBJ$(os)) \
libbb/libbb.a $(libbb_OBJ$(os)) $(libbb_MOBJ$(os))
libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj))
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
# linking against libbusybox, so don't build the .a already contained in the .so # linking against libbusybox, so don't build the .o already contained in the .so
libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y)) 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_FEATURE_SHARED_BUSYBOX
endif # CONFIG_BUILD_AT_ONCE 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) ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
LD_LIBBUSYBOX:=libbusybox.so LD_LIBBUSYBOX:=libbusybox.so
@ -258,9 +327,11 @@ DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \
$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION) $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
endif # CONFIG_BUILD_LIBBUSYBOX
ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),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_SRC := $(LIBRARY_SRC)
BUSYBOX_DEFINE:= $(LIBRARY_DEFINE) BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
endif # !CONFIG_FEATURE_SHARED_BUSYBOX endif # !CONFIG_FEATURE_SHARED_BUSYBOX
@ -268,7 +339,7 @@ $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
else # CONFIG_BUILD_AT_ONCE else # CONFIG_BUILD_AT_ONCE
$(LIBBUSYBOX_SONAME): $(libbusybox-obj) $(LIBBUSYBOX_SONAME): $(libbusybox-obj)
endif # CONFIG_BUILD_AT_ONCE endif # CONFIG_BUILD_AT_ONCE
endif # CONFIG_BUILD_LIBBUSYBOX
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
LDBUSYBOX:=-L$(top_builddir) -lbusybox LDBUSYBOX:=-L$(top_builddir) -lbusybox
@ -279,24 +350,27 @@ $(LIBBUSYBOX_SONAME):
ifndef MAJOR_VERSION ifndef MAJOR_VERSION
$(error MAJOR_VERSION needed for $@ is not defined) $(error MAJOR_VERSION needed for $@ is not defined)
endif endif
$(do_link) $(LIB_CFLAGS) $(LIB_LDFLAGS) \ $(do_link) $(LIB_CFLAGS) $(LIB_LDFLAGS) $(CFLAGS_COMBINE) \
-Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
-Wl,-z,combreloc $(LIB_LDFLAGS) \ -Wl,-z,combreloc $(LIB_LDFLAGS) \
-o $(@) \ -o $(@) \
-Wl,--start-group -Wl,--whole-archive \ -Wl,--start-group \
$(LIBRARY_DEFINE) $(^) \ $(LIBRARY_DEFINE) $(^) \
-Wl,--no-whole-archive -Wl,--end-group -Wl,--end-group
$(RM_F) $(DO_INSTALL_LIBS) @rm -f $(DO_INSTALL_LIBS)
for i in $(DO_INSTALL_LIBS); do $(LN_S) -v $(@) $$i ; done @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
$(do_strip) $(do_strip)
endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
busybox: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(libraries-y) busybox: $(top_builddir)/.depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(bin-obj.a)
$(do_link) $(PROG_CFLAGS) \ $(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
-o $@ -Wl,--start-group \ $(foreach f,$(^:.o=.c),$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \
$(CFLAGS-$(@)) \
-o $@ -Wl,--start-group \
$(APPLETS_DEFINE) $(APPLET_SRC) \ $(APPLETS_DEFINE) $(APPLET_SRC) \
$(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \ $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) \
$(bin-obj.a) \
$(LDBUSYBOX) $(LIBRARIES) \ $(LDBUSYBOX) $(LIBRARIES) \
-Wl,--end-group -Wl,--end-group
$(do_strip) $(do_strip)
@ -305,7 +379,7 @@ busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcd
$(Q)-$(SHELL) $^ >$@ $(Q)-$(SHELL) $^ >$@
install: $(top_srcdir)/applets/install.sh busybox busybox.links 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) $(SHELL) $< $(PREFIX) $(INSTALL_OPTS)
ifeq ($(strip $(CONFIG_FEATURE_SUID)),y) ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
@echo @echo
@ -319,44 +393,33 @@ ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
endif endif
uninstall: busybox.links uninstall: busybox.links
$(RM_F) $(PREFIX)/bin/busybox rm -f $(PREFIX)/bin/busybox
for i in `cat busybox.links` ; do $(RM_F) $(PREFIX)$$i; done for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
ifneq ($(strip $(DO_INSTALL_LIBS)),n) ifneq ($(strip $(DO_INSTALL_LIBS)),n)
for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \ for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
$(RM_F) $(PREFIX)$$i; \ rm -f $(PREFIX)$$i; \
done done
endif 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 check test: busybox
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \ bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
$(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
sizes: sizes:
-$(RM_F) busybox -rm -f busybox
$(MAKE) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \ $(MAKE) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
-f $(top_srcdir)/Makefile STRIPCMD=/bin/true -f $(top_srcdir)/Makefile STRIPCMD=/bin/true
$(NM) --size-sort busybox $(NM) --size-sort busybox
# Documentation Targets # 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 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) $(disp_doc)
$(Q)-mkdir -p docs $(Q)-mkdir -p docs
$(Q)-( cat $(top_srcdir)/docs/busybox_header.pod; \ $(Q)-( cat $(top_srcdir)/docs/busybox_header.pod ; \
$(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h; \ $(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h ; \
cat $(top_srcdir)/docs/busybox_footer.pod ) > docs/busybox.pod cat $(top_srcdir)/docs/busybox_footer.pod ; ) > docs/busybox.pod
docs/BusyBox.txt: docs/busybox.pod docs/BusyBox.txt: docs/busybox.pod
$(disp_doc) $(disp_doc)
@ -372,18 +435,18 @@ docs/BusyBox.1: docs/busybox.pod
docs/BusyBox.html: docs/busybox.net/BusyBox.html docs/BusyBox.html: docs/busybox.net/BusyBox.html
$(disp_doc) $(disp_doc)
$(Q)-mkdir -p docs $(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 $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
docs/busybox.net/BusyBox.html: docs/busybox.pod docs/busybox.net/BusyBox.html: docs/busybox.pod
$(Q)-mkdir -p docs/busybox.net $(Q)-mkdir -p docs/busybox.net
$(Q)-pod2html --noindex $< > \ $(Q)-pod2html --noindex $< > \
docs/busybox.net/BusyBox.html 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 scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $< $(do_link.h)
DEP_INCLUDES := include/bb_config.h DEP_INCLUDES := include/bb_config.h
@ -395,63 +458,65 @@ include/bbconfigopts.h: .config
$(Q)$(top_srcdir)/scripts/config/mkconfigs > $@ $(Q)$(top_srcdir)/scripts/config/mkconfigs > $@
endif endif
depend dep: .depend depend dep: $(top_builddir)/.depend ;
.depend: scripts/bb_mkdep $(DEP_INCLUDES) $(top_builddir)/.depend: $(buildtree) scripts/bb_mkdep $(DEP_INCLUDES)
$(disp_gen) $(disp_gen)
$(Q)$(RM_F) .depend $(Q)rm -f .depend
$(Q)mkdir -p include/config $(Q)scripts/bb_mkdep $(MKDEP_ARGS) \
$(Q)scripts/bb_mkdep -I $(top_srcdir)/include $(top_srcdir) > $@.tmp -I $(top_srcdir)/include $(top_srcdir) > $@.tmp
$(Q)mv $@.tmp $@ $(Q)mv $@.tmp $@
include/bb_config.h: .config include/bb_config.h: .config
@if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \ $(disp_gen)
$(MAKE) -C scripts/config conf; \
fi;
@$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN) @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
clean: 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.pod docs/busybox.net/busybox.html \
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \ docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \ docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.net/BusyBox.html busybox.links \ docs/busybox.net/BusyBox.html busybox.links \
$(DO_INSTALL_LIBS) $(LIBBUSYBOX_SONAME) \ $(DO_INSTALL_LIBS) $(LIBBUSYBOX_SONAME) \
.config.old busybox .config.old busybox
- rm -rf _install testsuite/links - rm -r -f _install testsuite/links
- find . -name .\*.flags -exec $(RM_F) {} \; - find . -name .\*.flags -exec rm -f {} \;
- find . -name \*.o -exec $(RM_F) {} \; - find . -name \*.o -exec rm -f {} \;
- find . -name \*.a -exec $(RM_F) {} \; - find . -name \*.om -exec rm -f {} \;
- find . -name \*.so -exec $(RM_F) {} \; - find . -name \*.os -exec rm -f {} \;
- find . -name \*.a -exec rm -f {} \;
distclean: clean distclean: clean
- $(RM_F) scripts/bb_mkdep - $(MAKE) -C scripts/config clean
- rm -rf include/config $(DEP_INCLUDES) - rm -f scripts/bb_mkdep
- find . -name .depend'*' -exec $(RM_F) {} \; - rm -r -f include/config $(DEP_INCLUDES)
$(RM_F) .config .config.old .config.cmd - find . -name .depend'*' -exec rm -f {} \;
rm -f .config .config.old .config.cmd
release: distclean #doc release: distclean #doc
cd ..; \ cd ..; \
rm -rf $(PROG)-$(VERSION); \ rm -r -f $(PROG)-$(VERSION); \
cp -a busybox $(PROG)-$(VERSION); \ cp -a busybox $(PROG)-$(VERSION); \
\ \
find $(PROG)-$(VERSION)/ -type d \ find $(PROG)-$(VERSION)/ -type d \
-name .svn \ -name .svn \
-print \ -print \
-exec rm -rf {} \; ; \ -exec rm -r -f {} \; ; \
\ \
find $(PROG)-$(VERSION)/ -type f \ find $(PROG)-$(VERSION)/ -type f \
-name .\#* \ -name .\#* \
-print \ -print \
-exec $(RM_F) {} \; ; \ -exec rm -f {} \; ; \
\ \
tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/; tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
tags: tags:
ctags -R . ctags -R .
# keep these in sync with noconfig_targets above!
endif # ifeq ($(skip-makefile),) .PHONY: dummy subdirs check test depend dep buildtree \
menuconfig config oldconfig randconfig \
.PHONY: dummy subdirs release distclean clean config oldconfig \ defconfig allyesconfig allnoconfig allbareconfig \
menuconfig tags check test depend dep buildtree clean distclean \
release tags

312
Rules.mak
View File

@ -10,6 +10,12 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(top_builddir)/.config -include $(top_builddir)/.config
endif endif
ifeq ($(MAKELEVEL),0)
ifeq ($(HAVE_DOT_CONFIG),y)
rules-mak-rules:=0
endif
endif
#-------------------------------------------------------- #--------------------------------------------------------
PROG := busybox PROG := busybox
MAJOR_VERSION :=1 MAJOR_VERSION :=1
@ -30,8 +36,9 @@ BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
# If you are running a cross compiler, you will want to set 'CROSS' # If you are running a cross compiler, you will want to set 'CROSS'
# to something more interesting... Target architecture is determined # to something more interesting... Target architecture is determined
# by asking the CC compiler what arch it compiles things for, so unless # 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))) CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
#")
CC = $(CROSS)gcc CC = $(CROSS)gcc
AR = $(CROSS)ar AR = $(CROSS)ar
AS = $(CROSS)as AS = $(CROSS)as
@ -39,17 +46,20 @@ LD = $(CROSS)ld
NM = $(CROSS)nm NM = $(CROSS)nm
STRIP = $(CROSS)strip STRIP = $(CROSS)strip
CPP = $(CC) -E CPP = $(CC) -E
# MAKEFILES = $(top_builddir)/.config SED ?= sed
RM = rm AWK ?= awk
RM_F = $(RM) -f
LN = ln
LN_S = $(LN) -s
MKDIR = mkdir
MKDIR_P = $(MKDIR) -p
MV = mv
CP = cp
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 # What OS are you compiling busybox for? This allows you to include
# OS specific things, syscall overrides, etc. # OS specific things, syscall overrides, etc.
TARGET_OS=linux TARGET_OS=linux
@ -63,8 +73,9 @@ LC_ALL:= C
# If you want to add some simple compiler switches (like -march=i686), # If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly. # 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))) CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
#")
# To compile vs some other alternative libc, you may need to use/adjust # To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs... # the following lines to meet your needs...
@ -81,20 +92,50 @@ CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow 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 ARFLAGS=cru
# Get the CC MAJOR/MINOR version
# gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest # 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_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)) 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 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/i.86/i386/' \
-e 's/sparc.*/sparc/' \ -e 's/sparc.*/sparc/' \
-e 's/arm.*/arm/g' \ -e 's/arm.*/arm/g' \
@ -108,70 +149,60 @@ TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
) )
endif endif
# A nifty macro to make testing gcc features easier $(call check_gcc,CFLAGS,-funsigned-char,)
check_gcc=$(shell \ $(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
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,)
#-------------------------------------------------------- #--------------------------------------------------------
# Arch specific compiler optimization stuff should go here. # Arch specific compiler optimization stuff should go here.
# Unless you want to override the defaults, do not set anything # Unless you want to override the defaults, do not set anything
# for OPTIMIZATION... # for OPTIMIZATIONS...
# use '-Os' optimization if available, else use -O2 # 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" # gcc 2.95 exits with 0 for "unrecognized option"
ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0) $(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
OPTIMIZATION+=$(call check_gcc,--combine,) $(if $(call cc_ge,3,0),\
endif $(call check_gcc,CFLAGS_COMBINE,--combine,)))
OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
endif # CONFIG_BUILD_AT_ONCE
LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,) $(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
#LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,) $(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,))
#LIB_LDFLAGS+=$(call check_ld,--as-needed,)
#LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,)
# 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 # Some nice architecture specific optimizations
ifeq ($(strip $(TARGET_ARCH)),arm) ifeq ($(__TARGET_ARCH),arm)
OPTIMIZATION+=-fstrict-aliasing OPTIMIZATIONS+=-fstrict-aliasing
endif endif # arm
ifeq ($(strip $(TARGET_ARCH)),i386)
OPTIMIZATION+=$(call check_gcc,-march=i386,) $(if $(call is_eq,$(__TARGET_ARCH),i386),\
$(call check_gcc,OPTIMIZATIONS,-march=i386,))
# gcc-4.0 and older seem to suffer from these # gcc-4.0 and older seem to suffer from these
ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0) $(if $(call cc_le,4,0),\
OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,) $(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\
OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\ $(call check_gcc,OPTIMIZATIONS,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\
-malign-functions=0 -malign-jumps=0 -malign-loops=0) -malign-functions=0 -malign-jumps=0 -malign-loops=0))
endif # gcc-4.0 and older
# gcc-4.1 and beyond seem to benefit from these # 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
# turn off flags which hurt -Os $(if $(call cc_ge,4,1),\
OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,) $(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\
OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,) $(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\
OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,) $(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\
\
$(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,))
OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,) $(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
endif # gcc-4.1 and beyond
endif
OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)
# #
#-------------------------------------------------------- #--------------------------------------------------------
@ -182,40 +213,40 @@ OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)
# prone to casual user adjustment. # prone to casual user adjustment.
# #
ifeq ($(strip $(CONFIG_LFS)),y) ifeq ($(CONFIG_LFS),y)
# For large file summit support # For large file summit support
CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
endif endif
ifeq ($(strip $(CONFIG_DMALLOC)),y) ifeq ($(CONFIG_DMALLOC),y)
# For testing mem leaks with dmalloc # For testing mem leaks with dmalloc
CFLAGS+=-DDMALLOC CFLAGS+=-DDMALLOC
LIBRARIES:=-ldmalloc LIBRARIES:=-ldmalloc
else else
ifeq ($(strip $(CONFIG_EFENCE)),y) ifeq ($(CONFIG_EFENCE),y)
LIBRARIES:=-lefence LIBRARIES:=-lefence
endif endif
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 CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
LDFLAGS += $(call check_ld,--warn-common,)
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG 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 STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
endif endif
ifeq ($(strip $(CONFIG_STATIC)),y) $(if $(call is_eq,$(CONFIG_STATIC),y),\
PROG_CFLAGS += $(call check_gcc,-static,) $(call check_gcc,PROG_CFLAGS,-static,))
endif
CFLAGS_SHARED += $(call check_gcc,-shared,) $(call check_gcc,CFLAGS_SHARED,-shared,)
LIB_CFLAGS+=$(CFLAGS_SHARED) LIB_CFLAGS+=$(CFLAGS_SHARED)
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) $(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\
CFLAGS_PIC:= $(call check_gcc,-fPIC,) $(call check_gcc,CFLAGS_PIC,-fPIC,))
endif
ifeq ($(strip $(CONFIG_SELINUX)),y) ifeq ($(CONFIG_SELINUX),y)
LIBRARIES += -lselinux LIBRARIES += -lselinux
endif endif
@ -223,14 +254,6 @@ ifeq ($(strip $(PREFIX)),)
PREFIX:=`pwd`/_install PREFIX:=`pwd`/_install
endif 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) CFLAGS += $(CROSS_CFLAGS)
ifdef BB_INIT_SCRIPT ifdef BB_INIT_SCRIPT
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
@ -252,59 +275,118 @@ ifeq ($(strip $(CONFIG_INSTALL_APPLET_DONT)),y)
INSTALL_OPTS= INSTALL_OPTS=
endif 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 # 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 export MAKE_IS_SILENT=n
ifneq ($(findstring s,$(MAKEFLAGS)),) ifneq ($(findstring s,$(MAKEFLAGS)),)
export MAKE_IS_SILENT=y export MAKE_IS_SILENT=y
SECHO := @-false
DISP := sil DISP := sil
Q := @ Q := @
else else
ifneq ($(V)$(VERBOSE),) ifneq ($(V)$(VERBOSE),)
SECHO := @-false
DISP := ver DISP := ver
Q := Q :=
else else
SECHO := @echo
DISP := pur DISP := pur
Q := @ Q := @
endif endif
endif endif
show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@)) define show_objs
pur_disp_compile.c = echo " "CC $(show_objs) $(subst $(top_builddir)/,,$(subst ../,,$@))
pur_disp_compile.h = echo " "HOSTCC $(show_objs) endef
pur_disp_strip = echo " "STRIP $(show_objs) pur_disp_compile.c = @echo " "CC $(show_objs) ;
pur_disp_link = echo " "LINK $(show_objs) pur_disp_compile.h = @echo " "HOSTCC $(show_objs) ;
pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs) pur_disp_strip = @echo " "STRIP $(show_objs) ;
sil_disp_compile.c = true pur_disp_link = @echo " "LINK $(show_objs) ;
sil_disp_compile.h = true pur_disp_link.h = @echo " "HOSTLINK $(show_objs) ;
sil_disp_strip = true pur_disp_ar = @echo " "AR $(ARFLAGS) $(show_objs) ;
sil_disp_link = true pur_disp_gen = @echo " "GEN $@ ;
sil_disp_ar = true pur_disp_doc = @echo " "DOC $(subst docs/,,$@) ;
ver_disp_compile.c = echo $(cmd_compile.c) pur_disp_bin = @echo " "BIN $(show_objs) ;
ver_disp_compile.h = echo $(cmd_compile.h) sil_disp_compile.c = @
ver_disp_strip = echo $(cmd_strip) sil_disp_compile.h = @
ver_disp_link = echo $(cmd_link) sil_disp_strip = @
ver_disp_ar = echo $(cmd_ar) 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.c = $($(DISP)_disp_compile.c)
disp_compile.h = $($(DISP)_disp_compile.h) disp_compile.h = $($(DISP)_disp_compile.h)
disp_strip = $($(DISP)_disp_strip) disp_strip = $($(DISP)_disp_strip)
disp_link = $($(DISP)_disp_link) disp_link = $($(DISP)_disp_link)
disp_link.h = $($(DISP)_disp_link.h)
disp_ar = $($(DISP)_disp_ar) disp_ar = $($(DISP)_disp_ar)
disp_gen = $(SECHO) " "GEN $@ ; true disp_gen = $($(DISP)_disp_gen)
disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true disp_doc = $($(DISP)_disp_doc)
cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< 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_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
cmd_strip = $(STRIPCMD) $@ 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) $@ $^ cmd_ar = $(AR) $(ARFLAGS) $@ $^
compile.c = @$(disp_compile.c) ; $(cmd_compile.c) compile.c = $(disp_compile.c) $(cmd_compile.c)
compile.h = @$(disp_compile.h) ; $(cmd_compile.h) compile.m = $(disp_compile.c) $(cmd_compile.m)
do_strip = @$(disp_strip) ; $(cmd_strip) compile.h = $(disp_compile.h) $(cmd_compile.h)
do_link = @$(disp_link) ; $(cmd_link) do_strip = $(disp_strip) $(cmd_strip)
do_ar = @$(disp_ar) ; $(cmd_ar) 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 .PHONY: dummy

View File

@ -4,23 +4,13 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/applets
objdir=$(top_builddir)/applets
APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c) APPLETS_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c)
APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
APPLET_SRC-y+=$(APPLET_SRC) APPLET_SRC-y+=$(APPLETS_SRC)
APPLET_SRC-a+=$(APPLET_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)

View File

@ -28,7 +28,8 @@ if [ "$DO_INSTALL_LIBS" != "n" ]; then
for i in $DO_INSTALL_LIBS; do for i in $DO_INSTALL_LIBS; do
rm -f $prefix/$libdir/$i || exit 1 rm -f $prefix/$libdir/$i || exit 1
if [ -f $i ]; then 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 fi
done done
fi fi

View File

@ -4,14 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/archival
objdir=$(top_builddir)/archival
ARCHIVAL-y:=
ARCHIVAL-$(CONFIG_APT_GET) +=
ARCHIVAL-$(CONFIG_AR) += ar.o ARCHIVAL-$(CONFIG_AR) += ar.o
ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o
ARCHIVAL-$(CONFIG_UNLZMA) += unlzma.o ARCHIVAL-$(CONFIG_UNLZMA) += unlzma.o
@ -26,17 +21,10 @@ ARCHIVAL-$(CONFIG_TAR) += tar.o
ARCHIVAL-$(CONFIG_UNCOMPRESS) += uncompress.o ARCHIVAL-$(CONFIG_UNCOMPRESS) += uncompress.o
ARCHIVAL-$(CONFIG_UNZIP) += unzip.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(ARCHIVAL-y))
ARCHIVAL_SRC-a:=$(wildcard $(srcdir)/*.c) ARCHIVAL_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(ARCHIVAL_SRC-y) APPLET_SRC-y+=$(ARCHIVAL_SRC-y)
APPLET_SRC-a+=$(ARCHIVAL_SRC-a) APPLET_SRC-a+=$(ARCHIVAL_SRC-a)
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y)) archival_OBJ:= $(patsubst %,$(objdir)/%,$(ARCHIVAL-y))
$(do_ar)
$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -3,83 +3,71 @@
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
# #
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/archival/libunarchive
objdir=$(top_builddir)/archival/libunarchive
LIBUNARCHIVE-obj:=$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR)
LIBUNARCHIVE-pic:=$(LIBUNARCHIVE_DIR)/$(subst .a,-pic.a,$(LIBUNARCHIVE_AR))
libraries-y+=$(LIBUNARCHIVE-obj)
LIBUNARCHIVE-y:= \ LIBUNARCHIVE-y:= \
\ \
data_skip.o \ data_skip \
data_extract_all.o \ data_extract_all \
data_extract_to_stdout.o \ data_extract_to_stdout \
data_extract_to_buffer.o \ data_extract_to_buffer \
\ \
filter_accept_all.o \ filter_accept_all \
filter_accept_list.o \ filter_accept_list \
filter_accept_reject_list.o \ filter_accept_reject_list \
\ \
header_skip.o \ header_skip \
header_list.o \ header_list \
header_verbose_list.o \ header_verbose_list \
\ \
archive_xread_all.o \ archive_xread_all \
archive_xread_all_eof.o \ archive_xread_all_eof \
\ \
seek_by_char.o \ seek_by_char \
seek_by_jump.o \ seek_by_jump \
\ \
data_align.o \ data_align \
find_list_entry.o \ find_list_entry \
open_transformer.o \ open_transformer \
init_handle.o init_handle
GUNZIP_FILES:= check_header_gzip.o decompress_unzip.o GUNZIP_FILES:= check_header_gzip decompress_unzip
DPKG_FILES:= \ DPKG_FILES:= \
get_header_ar.o \ get_header_ar \
unpack_ar_archive.o \ unpack_ar_archive \
get_header_tar.o \ get_header_tar \
filter_accept_list_reassign.o filter_accept_list_reassign
LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar unpack_ar_archive
LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2
LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma.o LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma
LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio
LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES) LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES)
LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += $(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_GZ) += $(GUNZIP_FILES) get_header_tar_gz
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2 get_header_tar_bz2
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma get_header_tar_lzma
LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress
LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio
LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio
LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2 get_header_tar_bz2
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma get_header_tar_lzma
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress
LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress
LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES) LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y)) 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) LIBUNARCHIVE_SRC-a:=$(wildcard $(srcdir)/*.c)
LIBRARY_SRC-y+=$(LIBUNARCHIVE_SRC-y) LIBRARY_SRC-y+=$(LIBUNARCHIVE_SRC-y)
LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a) LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a)
$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)/%,$(LIBUNARCHIVE-y)) archival_libunarchive_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBUNARCHIVE-y))
$(do_ar)
$(LIBUNARCHIVE_DIR)/%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,34 +4,25 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/console-tools
objdir=$(top_builddir)/console-tools
CONSOLETOOLS-y:=
CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o
CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o
CONSOLETOOLS-$(CONFIG_DEALLOCVT) += deallocvt.o CONSOLETOOLS-$(CONFIG_DEALLOCVT) += deallocvt.o
CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o
CONSOLETOOLS-$(CONFIG_SETCONSOLE) += setconsole.o CONSOLETOOLS-$(CONFIG_SETCONSOLE) += setconsole.o
CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o
CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o
CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o
CONSOLETOOLS-$(CONFIG_RESET) += reset.o CONSOLETOOLS-$(CONFIG_RESET) += reset.o
CONSOLETOOLS-$(CONFIG_SETKEYCODES) += setkeycodes.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(CONSOLETOOLS-y))
CONSOLETOOLS_SRC-a:=$(wildcard $(srcdir)/*.c) CONSOLETOOLS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(CONSOLETOOLS_SRC-y) APPLET_SRC-y+=$(CONSOLETOOLS_SRC-y)
APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a) APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a)
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS-y)) console-tools_OBJ:= $(patsubst %,$(objdir)/%,$(CONSOLETOOLS-y))
$(do_ar)
$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,13 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/coreutils
objdir=$(top_builddir)/coreutils
COREUTILS-y:=
COREUTILS-$(CONFIG_BASENAME) += basename.o COREUTILS-$(CONFIG_BASENAME) += basename.o
COREUTILS-$(CONFIG_CAL) += cal.o COREUTILS-$(CONFIG_CAL) += cal.o
COREUTILS-$(CONFIG_CAT) += cat.o COREUTILS-$(CONFIG_CAT) += cat.o
@ -82,18 +78,12 @@ COREUTILS-$(CONFIG_WHOAMI) += whoami.o
COREUTILS-$(CONFIG_YES) += yes.o COREUTILS-$(CONFIG_YES) += yes.o
COREUTILS-y:=$(sort $(COREUTILS-y)) COREUTILS-y:=$(sort $(COREUTILS-y))
COREUTILS-m:=$(sort $(COREUTILS-m))
ifneq ($(strip $(COREUTILS-y)),)
libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
endif
COREUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(COREUTILS-y)) COREUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(COREUTILS-y))
COREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) COREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(COREUTILS_SRC-y) APPLET_SRC-y+=$(COREUTILS_SRC-y)
APPLET_SRC-a+=$(COREUTILS_SRC-a) APPLET_SRC-a+=$(COREUTILS_SRC-a)
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y)) coreutils_OBJ:= $(patsubst %,$(objdir)/%,$(COREUTILS-y))
$(do_ar)
$(COREUTILS_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -3,49 +3,21 @@
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
# #
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/coreutils/libcoreutils
objdir=$(top_builddir)/coreutils/libcoreutils
LIBCOREUTILS_ALL_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod
LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod
LIBCOREUTILS-y:= LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat
LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat
LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat
LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat.o
LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat.o
LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat.o
LIBCOREUTILS-y:=$(sort $(LIBCOREUTILS-y)) 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) LIBCOREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
LIBRARY_SRC-y+=$(LIBCOREUTILS_SRC-y) LIBRARY_SRC-y+=$(LIBCOREUTILS_SRC-y)
LIBRARY_SRC-a+=$(LIBCOREUTILS_SRC-a) LIBRARY_SRC-a+=$(LIBCOREUTILS_SRC-a)
LIBCOREUTILS-multi-obj:=$(LIBCOREUTILS_DIR)/$(subst .a,-multi.o,$(LIBCOREUTILS_AR)) coreutils_libcoreutils_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBCOREUTILS-y))
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)

View File

@ -4,13 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/debianutils
objdir=$(top_builddir)/debianutils
DEBIANUTILS-y:=
DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o
DEBIANUTILS-$(CONFIG_READLINK) += readlink.o DEBIANUTILS-$(CONFIG_READLINK) += readlink.o
@ -18,16 +14,10 @@ DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o
DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
DEBIANUTILS-$(CONFIG_WHICH) += which.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(DEBIANUTILS-y))
DEBIANUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) DEBIANUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(DEBIANUTILS_SRC-y) APPLET_SRC-y+=$(DEBIANUTILS_SRC-y)
APPLET_SRC-a+=$(DEBIANUTILS_SRC-a) APPLET_SRC-a+=$(DEBIANUTILS_SRC-a)
$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y)) debianutils_OBJ:= $(patsubst %,$(objdir)/%,$(DEBIANUTILS-y))
$(do_ar)
$(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,12 +4,8 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # Licensed under the GPL v2, see the file LICENSE in this tarball.
E2FSPROGS_AR:=e2fsprogs.a srcdir:=$(top_srcdir)/e2fsprogs
objdir:=$(top_builddir)/e2fsprogs
E2FSPROGS_DIR:=$(top_builddir)/e2fsprogs
E2FSPROGS_SRC:=$(top_srcdir)/e2fsprogs
E2FSPROGS_CFLAGS := -include $(E2FSPROGS_SRC)/e2fsbb.h
BLKID_SRC := cache.c dev.c devname.c devno.c blkid_getsize.c \ BLKID_SRC := cache.c dev.c devname.c devno.c blkid_getsize.c \
probe.c read.c resolve.c save.c tag.c probe.c read.c resolve.c save.c tag.c
@ -39,22 +35,23 @@ UUID_SRC := compare.c gen_uuid.c pack.c parse.c unpack.c unparse.c \
UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC)) UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC))
UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS)) UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS))
# for building out-of-tree we need to make sure that the directories to hold # for building out-of-tree we need to make sure that the directories to hold
# the object tree are created # the object tree are created
$(patsubst %,$(E2FSPROGS_DIR)/%, blkid e2fsck e2p ext2fs uuid): $(patsubst %,$(objdir)/%, blkid e2fsck e2p ext2fs uuid):
@mkdir -p "$@" @mkdir -p "$@"
# make sure that the directories are order-only prerequisites. Otherwise we # make sure that the directories are order-only prerequisites. Otherwise we
# may have object files created after the timestamp of the directory was # may have object files created after the timestamp of the directory was
# updated which would lead to spurious rebuilds (as some of the dentries # updated which would lead to spurious rebuilds (as some of the dentries
# may be older than the dir itself). # may be older than the dir itself).
$(patsubst %,$(E2FSPROGS_DIR)/%, $(BLKID_OBJS)):|$(E2FSPROGS_DIR)/blkid $(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/%.c|$(objdir)/blkid
$(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSCK_OBJS)):|$(E2FSPROGS_DIR)/e2fsck $(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/%.c|$(objdir)/e2fsck
$(patsubst %,$(E2FSPROGS_DIR)/%, $(E2P_OBJS)):|$(E2FSPROGS_DIR)/e2p $(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/%.c|$(objdir)/e2p
$(patsubst %,$(E2FSPROGS_DIR)/%, $(EXT2FS_OBJS)):|$(E2FSPROGS_DIR)/ext2fs $(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/%.c|$(objdir)/ext2fs
$(patsubst %,$(E2FSPROGS_DIR)/%, $(UUID_OBJS)):|$(E2FSPROGS_DIR)/uuid $(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/%.c|$(objdir)/uuid
E2FSPROGS-y:=
E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS) E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS)
E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_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_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS)
@ -63,24 +60,26 @@ E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EX
E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
E2FSPROGS-y:=$(sort $(E2FSPROGS-y)) E2FSPROGS-y:=$(sort $(E2FSPROGS-y))
ifneq ($(E2FSPROGS-y),)
ifneq ($(strip $(E2FSPROGS-y)),) CFLAGS-e2fsprogs := -include $(srcdir)/e2fsbb.h
libraries-y+=$(E2FSPROGS_DIR)/$(E2FSPROGS_AR)
endif endif
E2FSPROGS_SRC-y:=$(patsubst %.o,$(E2FSPROGS_SRC)/%.c,$(E2FSPROGS-y)) E2FSPROGS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(E2FSPROGS-y))
E2FSPROGS_SRC-a:=$(wildcard $(E2FSPROGS_SRC)/*.c) $(patsubst %,$(E2FSPROGS_SRC)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS)) E2FSPROGS_SRC-a:=$(wildcard $(srcdir)/*.c) $(patsubst %,$(srcdir)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS))
APPLET_SRC-y+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-y) APPLET_SRC-y+=$(E2FSPROGS_SRC-y)
APPLET_SRC-a+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-a) APPLET_SRC-a+=$(E2FSPROGS_SRC-a)
# XXX: FIXME: change .c to include their stuff relative to $(E2FSPROGS_SRC) $(warning FIXME: change .c to include their stuff relative to $(srcdir))
E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(E2FSPROGS_SRC)/%,blkid e2fsck e2p ext2fs uuid) 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)
APPLETS_DEFINE-y+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE)
APPLETS_DEFINE-a+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE)
$(E2FSPROGS_DIR)/$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y)) APPLETS_DEFINE-y+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
$(do_ar) APPLETS_DEFINE-a+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
e2fsprogs_OBJ:= $(patsubst %,$(objdir)/%,$(E2FSPROGS-y))
$(E2FSPROGS_DIR)/%.o: $(subst $(top_builddir),$(top_srcdir),$(E2FSPROGS_DIR)/%.c)
$(compile.c) $(E2FSPROGS_CFLAGS)

View File

@ -4,36 +4,25 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/editors
objdir=$(top_builddir)/editors
EDITOR-y:= EDITORS-$(CONFIG_AWK) += awk.o
EDITOR-$(CONFIG_AWK) += awk.o EDITORS-$(CONFIG_PATCH) += patch.o
EDITOR-$(CONFIG_PATCH) += patch.o EDITORS-$(CONFIG_SED) += sed.o
EDITOR-$(CONFIG_SED) += sed.o EDITORS-$(CONFIG_VI) += vi.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)
needlibm-y:= needlibm-y:=
needlibm-$(CONFIG_FEATURE_AWK_MATH) := y needlibm-$(CONFIG_FEATURE_AWK_MATH) := y
ifeq ($(needlibm-y),y) ifeq ($(needlibm-y),y)
LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES)) LIBRARIES := $(filter-out -lm,$(LIBRARIES)) -lm
endif endif
$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y)) EDITOR_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(EDITORS-y))
$(do_ar) 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)

View File

@ -4,28 +4,17 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/findutils
objdir=$(top_builddir)/findutils
FINDUTILS-y:=
FINDUTILS-$(CONFIG_FIND) += find.o FINDUTILS-$(CONFIG_FIND) += find.o
FINDUTILS-$(CONFIG_GREP) += grep.o FINDUTILS-$(CONFIG_GREP) += grep.o
FINDUTILS-$(CONFIG_XARGS) += xargs.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(FINDUTILS-y))
FINDUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) FINDUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(FINDUTILS_SRC-y) APPLET_SRC-y+=$(FINDUTILS_SRC-y)
APPLET_SRC-a+=$(FINDUTILS_SRC-a) APPLET_SRC-a+=$(FINDUTILS_SRC-a)
$(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y)) findutils_OBJ:= $(patsubst %,$(objdir)/%,$(FINDUTILS-y))
$(do_ar)
$(FINDUTILS_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,13 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/init
objdir=$(top_builddir)/init
INIT-y:=
INIT-$(CONFIG_HALT) += halt.o INIT-$(CONFIG_HALT) += halt.o
INIT-$(CONFIG_INIT) += init.o INIT-$(CONFIG_INIT) += init.o
INIT-$(CONFIG_MESG) += mesg.o INIT-$(CONFIG_MESG) += mesg.o
@ -27,17 +23,10 @@ endif
INIT-$(CONFIG_INIT_SHARED) += init_shared.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(INIT-y))
INIT_SRC-a:=$(wildcard $(srcdir)/*.c) INIT_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(INIT_SRC-y) APPLET_SRC-y+=$(INIT_SRC-y)
APPLET_SRC-a+=$(INIT_SRC-a) APPLET_SRC-a+=$(INIT_SRC-a)
$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y)) init_OBJ:= $(patsubst %,$(objdir)/%,$(INIT-y))
$(do_ar)
$(INIT_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,10 +4,8 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/libbb
objdir=$(top_builddir)/libbb
LIBBB-n:= LIBBB-n:=
LIBBB-y:= \ LIBBB-y:= \
@ -20,7 +18,7 @@ LIBBB-y:= \
herror_msg.c herror_msg_and_die.c \ herror_msg.c herror_msg_and_die.c \
human_readable.c inet_common.c inode_hash.c isdirectory.c \ human_readable.c inet_common.c inode_hash.c isdirectory.c \
kernel_version.c last_char_is.c login.c loop.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 \ obscure.c parse_mode.c parse_number.c perror_msg.c \
perror_msg_and_die.c print_file.c get_console.c \ perror_msg_and_die.c print_file.c get_console.c \
process_escape_sequence.c procps.c qmodule.c \ process_escape_sequence.c procps.c qmodule.c \
@ -47,81 +45,76 @@ LIBBB-$(CONFIG_SU)+= correct_password.c
LIBBB-$(CONFIG_LOGIN)+= correct_password.c LIBBB-$(CONFIG_LOGIN)+= correct_password.c
LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y)) LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y) $(LIBBB-m))
# 1:N objects # 1:N objects
LIBBB_MSRC0:=$(srcdir)/messages.c LIBBB_MSRC0:=$(srcdir)/messages.c
LIBBB_MOBJ0:=full_version.o \ LIBBB_M0:=full_version \
memory_exhausted.o invalid_date.o io_error.o \ memory_exhausted invalid_date io_error \
read_error.o write_error.o name_longer_than_foo.o unknown.o \ read_error write_error name_longer_than_foo unknown \
can_not_create_raw_socket.o perm_denied_are_you_root.o \ can_not_create_raw_socket perm_denied_are_you_root \
shadow_file.o passwd_file.o group_file.o gshadow_file.o nologin_file.o \ shadow_file passwd_file group_file gshadow_file nologin_file \
securetty_file.o motd_file.o \ securetty_file motd_file \
msg_standard_input.o msg_standard_output.o shell_file.o \ msg_standard_input msg_standard_output shell_file \
bb_dev_null.o bb_common_bufsiz1.o bb_dev_null bb_common_bufsiz1
LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0)) LIBBB_MOBJ0:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M0))
$(LIBBB_MOBJ0):$(LIBBB_MSRC0) $(LIBBB_MOBJ0):$(LIBBB_MSRC0)
$(compile.c) -DL_$(notdir $*)
LIBBB_MSRC1:=$(srcdir)/xfuncs.c LIBBB_MSRC1:=$(srcdir)/xfuncs.c
LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ LIBBB_M1:=xmalloc xrealloc xcalloc xstrdup xstrndup \
xfopen.o xopen.o xread.o xread_all.o xread_char.o \ xfopen xopen xread xread_all xread_char \
xferror.o xferror_stdout.o xfflush_stdout.o strlen.o xferror xferror_stdout xfflush_stdout strlen
LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1)) LIBBB_MOBJ1:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M1))
$(LIBBB_MOBJ1):$(LIBBB_MSRC1) $(LIBBB_MOBJ1):$(LIBBB_MSRC1)
$(compile.c) -DL_$(notdir $*)
LIBBB_MSRC2:=$(srcdir)/printf.c LIBBB_MSRC2:=$(srcdir)/printf.c
LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o LIBBB_M2:=bb_vfprintf bb_vprintf bb_fprintf bb_printf
LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2)) LIBBB_MOBJ2:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M2))
$(LIBBB_MOBJ2):$(LIBBB_MSRC2) $(LIBBB_MOBJ2):$(LIBBB_MSRC2)
$(compile.c) -DL_$(notdir $*)
LIBBB_MSRC3:=$(srcdir)/xgetularg.c LIBBB_MSRC3:=$(srcdir)/xgetularg.c
LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \ LIBBB_M3:=xgetularg_bnd_sfx xgetlarg_bnd_sfx getlarg10_sfx \
xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o xgetularg_bnd xgetularg10_bnd xgetularg10
LIBBB_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3)) LIBBB_MOBJ3:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M3))
$(LIBBB_MOBJ3):$(LIBBB_MSRC3) $(LIBBB_MOBJ3):$(LIBBB_MSRC3)
$(compile.c) -DL_$(notdir $*)
LIBBB_MSRC4:=$(srcdir)/safe_strtol.c LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o LIBBB_M4:=safe_strtoi safe_strtod safe_strtol safe_strtoul
LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4)) LIBBB_MOBJ4:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M4))
$(LIBBB_MOBJ4):$(LIBBB_MSRC4) $(LIBBB_MOBJ4):$(LIBBB_MSRC4)
$(compile.c) -DL_$(notdir $*)
LIBBB_MSRC5:=$(srcdir)/bb_pwd.c LIBBB_MSRC5:=$(srcdir)/bb_pwd.c
LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \ LIBBB_M5:=bb_xgetpwnam bb_xgetgrnam bb_getgrgid bb_getpwuid \
bb_getug.o get_ug_id.o bb_getug get_ug_id
LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5)) LIBBB_MOBJ5:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M5))
$(LIBBB_MOBJ5):$(LIBBB_MSRC5) $(LIBBB_MOBJ5):$(LIBBB_MSRC5)
$(compile.c) -DL_$(notdir $*)
LIBBB_MSRC6:=$(srcdir)/llist.c LIBBB_MSRC6:=$(srcdir)/llist.c
LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o LIBBB_M6:=llist_add_to llist_add_to_end llist_free_one llist_free
LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6)) LIBBB_MOBJ6:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M6))
$(LIBBB_MOBJ6):$(LIBBB_MSRC6) $(LIBBB_MOBJ6):$(LIBBB_MSRC6)
$(compile.c) -DL_$(notdir $*)
# We need the names of the object files built from MSRC for the L_ defines # 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_ALL_MSRC:=$(LIBBB_MSRC0) $(LIBBB_MSRC1) $(LIBBB_MSRC2) $(LIBBB_MSRC3) \
$(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6) $(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6)
LIBBB-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC)) LIBBB-y:=$(sort $(LIBBB-y))
LIBBB_AR:=$(LIBBB_DIR)/libbb.a
libraries-y+=$(LIBBB_AR)
needcrypt-y:= needcrypt-y:=
ifneq ($(findstring $(srcdir)/pw_encrypt.c,$(LIBBB-y)),) ifneq ($(findstring $(srcdir)/pw_encrypt.c,$(LIBBB-y)),)
needcrypt-y:=y needcrypt-y:=y
else endif
ifneq ($(findstring $(srcdir)/correct_password.c,$(LIBBB-y)),) ifneq ($(findstring $(srcdir)/correct_password.c,$(LIBBB-y)),)
needcrypt-y:=y needcrypt-y:=y
endif endif
ifeq ($(CONFIG_FEATURE_FULL_LIBBUSYBOX),y)
needcrypt-y:=y
endif endif
ifeq ($(needcrypt-y),y) ifeq ($(needcrypt-y),y)
@ -129,18 +122,27 @@ ifeq ($(needcrypt-y),y)
endif endif
# all 1:1 objects # all 1:1 objects
LIBBB_OBJS:=$(patsubst $(srcdir)/%.c,$(LIBBB_DIR)/%.o, $(LIBBB-y)) libbb_OBJ$(os):=$(patsubst $(srcdir)/%.c,$(objdir)/%$(os),$(LIBBB-y))
$(LIBBB_DIR)/%.o: $(srcdir)/%.c
$(compile.c)
LIBBB_SRC-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC))
LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c) LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c)
LIBRARY_SRC-y+=$(LIBBB-y) LIBRARY_SRC-y+=$(LIBBB_SRC-y)
LIBRARY_SRC-a+=$(LIBBB_SRC-a) LIBRARY_SRC-a+=$(LIBBB_SRC-a)
# all defines needed for 1:N objects # 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-y+=$(LIBBB_DEFINE-y)
LIBRARY_DEFINE-a+=$(LIBBB_DEFINE-y) LIBRARY_DEFINE-a+=$(LIBBB_DEFINE-y)
$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_ALL_MOBJ) ifeq ($(om),.osm)
$(do_ar) # 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

View File

@ -4,35 +4,28 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/libpwdgrp
objdir=$(top_builddir)/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)
LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c
LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \ LIBPWDGRP_M0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r fgetgrent_r \
fgetpwent.o fgetgrent.o getpwnam_r.o getgrnam_r.o getpwuid_r.o \ fgetpwent fgetgrent getpwnam_r getgrnam_r getpwuid_r \
getgrgid_r.o getpwuid.o getgrgid.o getpwnam.o getgrnam.o getpw.o \ getgrgid_r getpwuid getgrgid getpwnam getgrnam getpw \
getpwent_r.o getgrent_r.o getpwent.o getgrent.o \ getpwent_r getgrent_r getpwent getgrent \
initgroups.o putpwent.o putgrent.o initgroups putpwent putgrent
LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ0-y)) LIBPWDGRP_MOBJ0=$(patsubst %,$(objdir)/%$(om),$(LIBPWDGRP_M0-y))
$(LIBPWDGRP_MOBJ0): $(LIBPWDGRP_MSRC0)
LIBPWDGRP_MSRC1:=$(srcdir)/pwd_grp.c LIBPWDGRP_MSRC1:=$(srcdir)/pwd_grp.c
LIBPWDGRP_MOBJ1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent.o __parsegrent.o \ LIBPWDGRP_M1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent __parsegrent \
__pgsreader.o fgetspent_r.o fgetspent.o sgetspent_r.o getspnam_r.o \ __pgsreader fgetspent_r fgetspent sgetspent_r getspnam_r \
getspnam.o getspent_r.o getspent.o sgetspent.o \ getspnam getspent_r getspent sgetspent \
putspent.o __parsespent.o # getspuid_r.o getspuid.o putspent __parsespent # getspuid_r getspuid
LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ1-y)) LIBPWDGRP_MOBJ1=$(patsubst %,$(objdir)/%$(om),$(LIBPWDGRP_M1-y))
$(LIBPWDGRP_MOBJ1): $(LIBPWDGRP_MSRC1)
LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS0)))) LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(LIBPWDGRP_M0-y))
LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS1)))) LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(LIBPWDGRP_M1-y))
LIBPWDGRP_SRC-y:=$(LIBPWDGRP_MSRC0) LIBPWDGRP_SRC-y:=$(LIBPWDGRP_MSRC0)
@ -42,12 +35,11 @@ LIBRARY_SRC-a+=$(LIBPWDGRP_SRC-y)
LIBRARY_DEFINE-y+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y) LIBRARY_DEFINE-y+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y)
LIBRARY_DEFINE-a+=$(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) ifeq ($(om),.osm)
$(do_ar) # XXX FIXME:
# also create a pattern for the non-shared case
$(LIBPWDGRP_MOBJS0): $(LIBPWDGRP_MSRC0) $(LIBPWDGRP_MOBJ0:.osm=.om): $(LIBPWDGRP_MSRC0)
$(compile.c) -DL_$(notdir $*) $(LIBPWDGRP_MOBJ1:.osm=.om): $(LIBPWDGRP_MSRC1)
endif
$(LIBPWDGRP_MOBJS1): $(LIBPWDGRP_MSRC1)
$(compile.c) -DL_$(notdir $*)

View File

@ -4,13 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/loginutils
objdir=$(top_builddir)/loginutils
LOGINUTILS-y:=
LOGINUTILS-$(CONFIG_ADDGROUP) += addgroup.o LOGINUTILS-$(CONFIG_ADDGROUP) += addgroup.o
LOGINUTILS-$(CONFIG_ADDUSER) += adduser.o LOGINUTILS-$(CONFIG_ADDUSER) += adduser.o
LOGINUTILS-$(CONFIG_GETTY) += getty.o LOGINUTILS-$(CONFIG_GETTY) += getty.o
@ -22,9 +18,6 @@ LOGINUTILS-$(CONFIG_VLOCK) += vlock.o
LOGINUTILS-$(CONFIG_DELUSER) += deluser.o LOGINUTILS-$(CONFIG_DELUSER) += deluser.o
LOGINUTILS-$(CONFIG_DELGROUP) += delgroup.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(LOGINUTILS-y))
LOGINUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) LOGINUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
@ -37,14 +30,12 @@ needcrypt-$(CONFIG_PASSWD) := y
needcrypt-$(CONFIG_SU) := y needcrypt-$(CONFIG_SU) := y
needcrypt-$(CONFIG_SULOGIN) := y needcrypt-$(CONFIG_SULOGIN) := y
needcrypt-$(CONFIG_VLOCK) := y needcrypt-$(CONFIG_VLOCK) := y
ifeq ($(needcrypt-m),y)
needcrypt-y:=y
endif
ifeq ($(needcrypt-y),y) ifeq ($(needcrypt-y),y)
LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
endif endif
$(LOGINUTILS_DIR)$(LOGINUTILS_AR): $(patsubst %,$(LOGINUTILS_DIR)%, $(LOGINUTILS-y)) loginutils_OBJ:= $(patsubst %,$(objdir)/%,$(LOGINUTILS-y))
$(do_ar)
$(LOGINUTILS_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,13 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/miscutils
objdir=$(top_builddir)/miscutils
MISCUTILS-y:=
MISCUTILS-$(CONFIG_ADJTIMEX) += adjtimex.o MISCUTILS-$(CONFIG_ADJTIMEX) += adjtimex.o
MISCUTILS-$(CONFIG_CROND) += crond.o MISCUTILS-$(CONFIG_CROND) += crond.o
MISCUTILS-$(CONFIG_CRONTAB) += crontab.o MISCUTILS-$(CONFIG_CRONTAB) += crontab.o
@ -31,8 +27,13 @@ MISCUTILS-$(CONFIG_STRINGS) += strings.o
MISCUTILS-$(CONFIG_TIME) += time.o MISCUTILS-$(CONFIG_TIME) += time.o
MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o
ifneq ($(strip $(MISCUTILS-y)),) needlibm-y:=
libraries-y+=$(MISCUTILS_DIR)$(MISCUTILS_AR) needlibm-$(CONFIG_DC) := y
ifeq ($(needlibm-m),y)
needlibm-y:=y
endif
ifeq ($(needlibm-y),y)
LIBRARIES := $(filter-out -lm,$(LIBRARIES)) -lm
endif endif
MISCUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MISCUTILS-y)) MISCUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MISCUTILS-y))
@ -40,15 +41,5 @@ MISCUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(MISCUTILS_SRC-y) APPLET_SRC-y+=$(MISCUTILS_SRC-y)
APPLET_SRC-a+=$(MISCUTILS_SRC-a) APPLET_SRC-a+=$(MISCUTILS_SRC-a)
needlibm-y:= miscutils_OBJ:= $(patsubst %,$(objdir)/%,$(MISCUTILS-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_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,29 +4,18 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/modutils
objdir=$(top_builddir)/modutils
MODUTILS-y:=
MODUTILS-$(CONFIG_INSMOD) += insmod.o MODUTILS-$(CONFIG_INSMOD) += insmod.o
MODUTILS-$(CONFIG_LSMOD) += lsmod.o MODUTILS-$(CONFIG_LSMOD) += lsmod.o
MODUTILS-$(CONFIG_MODPROBE) += modprobe.o MODUTILS-$(CONFIG_MODPROBE) += modprobe.o
MODUTILS-$(CONFIG_RMMOD) += rmmod.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(MODUTILS-y))
MODUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) MODUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(MODUTILS_SRC-y) APPLET_SRC-y+=$(MODUTILS_SRC-y)
APPLET_SRC-a+=$(MODUTILS_SRC-a) APPLET_SRC-a+=$(MODUTILS_SRC-a)
$(MODUTILS_DIR)$(MODUTILS_AR): $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y)) modutils_OBJ:= $(patsubst %,$(objdir)/%,$(MODUTILS-y))
$(do_ar)
$(MODUTILS_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,13 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/networking
objdir=$(top_builddir)/networking
NETWORKING-y:=
NETWORKING-$(CONFIG_ARPING) += arping.o NETWORKING-$(CONFIG_ARPING) += arping.o
NETWORKING-$(CONFIG_DNSD) += dnsd.o NETWORKING-$(CONFIG_DNSD) += dnsd.o
NETWORKING-$(CONFIG_ETHER_WAKE) += ether-wake.o NETWORKING-$(CONFIG_ETHER_WAKE) += ether-wake.o
@ -44,8 +40,15 @@ NETWORKING-$(CONFIG_WGET) += wget.o
NETWORKING-$(CONFIG_ZCIP) += zcip.o NETWORKING-$(CONFIG_ZCIP) += zcip.o
NETWORKING-y:=$(sort $(NETWORKING-y)) NETWORKING-y:=$(sort $(NETWORKING-y))
ifneq ($(strip $(NETWORKING-y)),) NETWORKING-m:=$(sort $(NETWORKING-m))
libraries-y+=$(NETWORKING_DIR)$(NETWORKING_AR)
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 endif
NETWORKING_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(NETWORKING-y)) NETWORKING_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(NETWORKING-y))
@ -56,15 +59,5 @@ APPLET_SRC-a+=$(NETWORKING_SRC-a)
LIBRARY_DEFINE-y+= -I$(top_srcdir)/networking LIBRARY_DEFINE-y+= -I$(top_srcdir)/networking
LIBRARY_DEFINE-a+= -I$(top_srcdir)/networking LIBRARY_DEFINE-a+= -I$(top_srcdir)/networking
needcrypt-y:= networking_OBJ:= $(patsubst %,$(objdir)/%,$(NETWORKING-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_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -5,88 +5,66 @@
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/networking/libiproute
objdir=$(top_builddir)/networking/libiproute
LIBIPROUTE-y:=
LIBIPROUTE-$(CONFIG_IP) += \ LIBIPROUTE-$(CONFIG_IP) += \
ip_parse_common_args.o \ ip_parse_common_args \
ipaddress.o \ ipaddress \
iplink.o \ iplink \
iproute.o \ iproute \
iptunnel.o \ iptunnel \
libnetlink.o \ libnetlink \
ll_addr.o \ ll_addr \
ll_map.o \ ll_map \
ll_proto.o \ ll_proto \
ll_types.o \ ll_types \
rt_names.o \ rt_names \
rtm_map.o \ rtm_map \
utils.o utils
LIBIPROUTE-$(CONFIG_IPADDR) += \ LIBIPROUTE-$(CONFIG_IPADDR) += \
ip_parse_common_args.o \ ip_parse_common_args \
ipaddress.o \ ipaddress \
libnetlink.o \ libnetlink \
ll_addr.o \ ll_addr \
ll_map.o \ ll_map \
ll_types.o \ ll_types \
rt_names.o \ rt_names \
utils.o utils
LIBIPROUTE-$(CONFIG_IPLINK) += \ LIBIPROUTE-$(CONFIG_IPLINK) += \
ip_parse_common_args.o \ ip_parse_common_args \
ipaddress.o \ ipaddress \
iplink.o \ iplink \
libnetlink.o \ libnetlink \
ll_addr.o \ ll_addr \
ll_map.o \ ll_map \
ll_types.o \ ll_types \
rt_names.o \ rt_names \
utils.o utils
LIBIPROUTE-$(CONFIG_IPROUTE) += \ LIBIPROUTE-$(CONFIG_IPROUTE) += \
ip_parse_common_args.o \ ip_parse_common_args \
iproute.o \ iproute \
libnetlink.o \ libnetlink \
ll_map.o \ ll_map \
rt_names.o \ rt_names \
rtm_map.o \ rtm_map \
utils.o utils
LIBIPROUTE-$(CONFIG_IPTUNNEL) += \ LIBIPROUTE-$(CONFIG_IPTUNNEL) += \
ip_parse_common_args.o \ ip_parse_common_args \
iptunnel.o \ iptunnel \
rt_names.o \ rt_names \
utils.o utils
LIBIPROUTE-y:=$(sort $(LIBIPROUTE-y)) 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) LIBIPROUTE_SRC-a:=$(wildcard $(srcdir)/*.c)
LIBRARY_SRC-y+=$(LIBIPROUTE_SRC-y) LIBRARY_SRC-y+=$(LIBIPROUTE_SRC-y)
LIBRARY_SRC-a+=$(LIBIPROUTE_SRC-a) 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)

View File

@ -3,13 +3,9 @@
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
# #
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. # 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 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 #ok, so I forgot how to do an or, but this is a quick and dirty hack
ifeq ($(strip $(CONFIG_UDHCPC)),y) ifeq ($(strip $(CONFIG_UDHCPC)),y)
@ -22,32 +18,73 @@ CONFIG_UDHCP_SHARED=n
endif endif
endif endif
UDHCP-y:= UDHCP__SHARED_FILES:=common.c options.c packet.c pidfile.c signalpipe.c socket.c
UDHCP-$(CONFIG_UDHCP_SHARED) += common.c options.c packet.c pidfile.c \ UDHCP__UDHCPC_FILES:=dhcpc.c clientpacket.c clientsocket.c script.c
signalpipe.c socket.c UDHCP__UDHCPD_FILES:=dhcpd.c arpping.c files.c leases.c serverpacket.c \
UDHCP-$(CONFIG_UDHCPC) += dhcpc.c clientpacket.c clientsocket.c \ static_leases.c
script.c UDHCP__DUMPLEASES_FILES:=dumpleases.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)),) UDHCP-$(CONFIG_UDHCP_SHARED) += $(UDHCP__SHARED_FILES)
libraries-y+=$(UDHCP_DIR)$(UDHCP_AR) UDHCP-$(CONFIG_UDHCPC) += $(UDHCP__UDHCPC_FILES)
endif UDHCP-$(CONFIG_UDHCPD) += $(UDHCP__UDHCPD_FILES)
UDHCP-$(CONFIG_DUMPLEASES) += $(UDHCP__DUMPLEASES_FILES)
UDHCP-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y)) UDHCP_SRC-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y))
UDHCP-a:=$(wildcard $(srcdir)/*.c) UDHCP_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(UDHCP-y) APPLET_SRC-y+=$(UDHCP_SRC-y)
APPLET_SRC-a+=$(UDHCP-a) APPLET_SRC-a+=$(UDHCP_SRC-a)
UDHCP_INCLUDES:=$(srcdir) UDHCP_INCLUDES:=$(srcdir)
APPLETS_DEFINE-y+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES) #APPLETS_DEFINE-y+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX
APPLETS_DEFINE-a+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES) #APPLETS_DEFINE-a+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX
$(UDHCP_DIR)$(UDHCP_AR): $(UDHCP_OBJS) CFLAGS-udhcp:= -I$(UDHCP_INCLUDES)
$(do_ar)
# 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
networking_udhcp_OBJ:=$(patsubst %.c,$(objdir)/%.o,$(UDHCP-y))
$(UDHCP_OBJS): $(UDHCP_DIR)%.o : $(srcdir)/%.c
$(compile.c) -DIN_BUSYBOX

View File

@ -4,13 +4,9 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/procps
objdir=$(top_builddir)/procps
PROCPS-y:=
PROCPS-$(CONFIG_FREE) += free.o PROCPS-$(CONFIG_FREE) += free.o
PROCPS-$(CONFIG_KILL) += kill.o PROCPS-$(CONFIG_KILL) += kill.o
PROCPS-$(CONFIG_PIDOF) += pidof.o PROCPS-$(CONFIG_PIDOF) += pidof.o
@ -21,17 +17,11 @@ PROCPS-$(CONFIG_TOP) += top.o
PROCPS-$(CONFIG_UPTIME) += uptime.o PROCPS-$(CONFIG_UPTIME) += uptime.o
PROCPS-$(CONFIG_FUSER) += fuser.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(PROCPS-y))
PROCPS_SRC-a:=$(wildcard $(srcdir)/*.c) PROCPS_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(PROCPS_SRC-y) APPLET_SRC-y+=$(PROCPS_SRC-y)
APPLET_SRC-a+=$(PROCPS_SRC-a) APPLET_SRC-a+=$(PROCPS_SRC-a)
$(PROCPS_DIR)$(PROCPS_AR): $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y)) procps_OBJ:= $(patsubst %,$(objdir)/%,$(PROCPS-y))
$(do_ar)
$(PROCPS_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -50,22 +50,20 @@ MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC)) SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
conf: $(CONF_OBJS) $(SHARED_OBJS) conf: $(CONF_OBJS) $(SHARED_OBJS)
$(SECHO) " "HOSTCC $@ ; true $(do_link.h)
$(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
mconf: $(MCONF_OBJS) $(SHARED_OBJS) mconf: $(MCONF_OBJS) $(SHARED_OBJS)
$(SECHO) " "HOSTCC $@ ; true $(do_link.h) $(LIBS)
$(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
$(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) $(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
$(compile.h) -I. $(compile.h) -I.
$(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) $(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
@[ -d $(@D) ] || mkdir -v $(@D) @[ -d $(@D) ] || mkdir $(@D)
$(compile.h) $(HOSTNCURSES) -I. $(compile.h) $(HOSTNCURSES) -I.
lkc_defs.h: $(srcdir)/lkc_proto.h 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 # The following requires flex/bison

View File

@ -4,30 +4,20 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/shell
objdir=$(top_builddir)/shell
SHELLT-y:= SHELL-$(CONFIG_ASH) += ash.o
SHELLT-$(CONFIG_ASH) += ash.o SHELL-$(CONFIG_HUSH) += hush.o
SHELLT-$(CONFIG_HUSH) += hush.o SHELL-$(CONFIG_LASH) += lash.o
SHELLT-$(CONFIG_LASH) += lash.o SHELL-$(CONFIG_MSH) += msh.o
SHELLT-$(CONFIG_MSH) += msh.o SHELL-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o
SHELLT-$(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) SHELLT_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(SHELLT_SRC-y) APPLET_SRC-y+=$(SHELLT_SRC-y)
APPLET_SRC-a+=$(SHELLT_SRC-a) APPLET_SRC-a+=$(SHELLT_SRC-a)
$(SHELL_DIR)$(SHELL_AR): $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y)) shell_OBJ:= $(patsubst %,$(objdir)/%,$(SHELL-y))
$(do_ar)
$(SHELL_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,29 +4,19 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/sysklogd
objdir=$(top_builddir)/sysklogd
SYSKLOGD-y:=
SYSKLOGD-$(CONFIG_KLOGD) += klogd.o SYSKLOGD-$(CONFIG_KLOGD) += klogd.o
SYSKLOGD-$(CONFIG_LOGGER) += logger.o SYSKLOGD-$(CONFIG_LOGGER) += logger.o
SYSKLOGD-$(CONFIG_LOGREAD) += logread.o SYSKLOGD-$(CONFIG_LOGREAD) += logread.o
SYSKLOGD-$(CONFIG_SYSLOGD) += syslogd.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-y:=$(patsubst %.o,$(srcdir)/%.c,$(SYSKLOGD-y))
SYSKLOGD_SRC-a:=$(wildcard $(srcdir)/*.c) SYSKLOGD_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(SYSKLOGD_SRC-y) APPLET_SRC-y+=$(SYSKLOGD_SRC-y)
APPLET_SRC-a+=$(SYSKLOGD_SRC-a) APPLET_SRC-a+=$(SYSKLOGD_SRC-a)
$(SYSKLOGD_DIR)$(SYSKLOGD_AR): $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y)) sysklogd_OBJ:= $(patsubst %,$(objdir)/%,$(SYSKLOGD-y))
$(do_ar)
$(SYSKLOGD_DIR)%.o: $(srcdir)/%.c
$(compile.c)

View File

@ -4,62 +4,47 @@
# #
# Licensed under the GPL v2, see the file LICENSE in this tarball. # 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 srcdir=$(top_srcdir)/util-linux
objdir=$(top_builddir)/util-linux
UTILLINUX-y:= UTIL-LINUX-$(CONFIG_DMESG) +=dmesg.o
UTILLINUX-$(CONFIG_DMESG) +=dmesg.o UTIL-LINUX-$(CONFIG_FBSET) +=fbset.o
UTILLINUX-$(CONFIG_FBSET) +=fbset.o UTIL-LINUX-$(CONFIG_FDFLUSH) +=fdflush.o
UTILLINUX-$(CONFIG_FDFLUSH) +=fdflush.o UTIL-LINUX-$(CONFIG_FDFORMAT) +=fdformat.o
UTILLINUX-$(CONFIG_FDFORMAT) +=fdformat.o UTIL-LINUX-$(CONFIG_FDISK) +=fdisk.o
UTILLINUX-$(CONFIG_FDISK) +=fdisk.o UTIL-LINUX-$(CONFIG_FREERAMDISK) +=freeramdisk.o
UTILLINUX-$(CONFIG_FREERAMDISK) +=freeramdisk.o UTIL-LINUX-$(CONFIG_FSCK_MINIX) +=fsck_minix.o
UTILLINUX-$(CONFIG_FSCK_MINIX) +=fsck_minix.o UTIL-LINUX-$(CONFIG_GETOPT) +=getopt.o
UTILLINUX-$(CONFIG_GETOPT) +=getopt.o UTIL-LINUX-$(CONFIG_HEXDUMP) +=hexdump.o
UTILLINUX-$(CONFIG_HEXDUMP) +=hexdump.o UTIL-LINUX-$(CONFIG_HWCLOCK) +=hwclock.o
UTILLINUX-$(CONFIG_HWCLOCK) +=hwclock.o UTIL-LINUX-$(CONFIG_IPCRM) +=ipcrm.o
UTILLINUX-$(CONFIG_IPCRM) +=ipcrm.o UTIL-LINUX-$(CONFIG_IPCS) +=ipcs.o
UTILLINUX-$(CONFIG_IPCS) +=ipcs.o UTIL-LINUX-$(CONFIG_LOSETUP) +=losetup.o
UTILLINUX-$(CONFIG_LOSETUP) +=losetup.o UTIL-LINUX-$(CONFIG_MDEV) +=mdev.o
UTILLINUX-$(CONFIG_MDEV) +=mdev.o UTIL-LINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o
UTILLINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o UTIL-LINUX-$(CONFIG_MKSWAP) +=mkswap.o
UTILLINUX-$(CONFIG_MKSWAP) +=mkswap.o UTIL-LINUX-$(CONFIG_MORE) +=more.o
UTILLINUX-$(CONFIG_MORE) +=more.o UTIL-LINUX-$(CONFIG_MOUNT) +=mount.o
UTILLINUX-$(CONFIG_MOUNT) +=mount.o UTIL-LINUX-$(CONFIG_FEATURE_MOUNT_NFS) +=nfsmount.o
UTILLINUX-$(CONFIG_FEATURE_MOUNT_NFS) +=nfsmount.o UTIL-LINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o
UTILLINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o UTIL-LINUX-$(CONFIG_RDATE) +=rdate.o
UTILLINUX-$(CONFIG_RDATE) +=rdate.o UTIL-LINUX-$(CONFIG_READPROFILE) +=readprofile.o
UTILLINUX-$(CONFIG_READPROFILE) +=readprofile.o UTIL-LINUX-$(CONFIG_SETARCH) +=setarch.o
UTILLINUX-$(CONFIG_SETARCH) +=setarch.o UTIL-LINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o
UTILLINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o UTIL-LINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o
UTILLINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o UTIL-LINUX-$(CONFIG_UMOUNT) +=umount.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)) UTILLINUX_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(UTIL-LINUX-y))
UTILLINUX_SRC-a:=$(wildcard $(srcdir)/*.c) UTILLINUX_SRC-a:=$(wildcard $(srcdir)/*.c)
APPLET_SRC-y+=$(UTILLINUX_SRC-y) APPLET_SRC-y+=$(UTILLINUX_SRC-y)
APPLET_SRC-a+=$(UTILLINUX_SRC-a) 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) ifneq ($(strip $(CONFIG_LFS)),y)
ifeq ($(strip $(FDISK_SUPPORT_LARGE_DISKS)),y) ifeq ($(strip $(FDISK_SUPPORT_LARGE_DISKS)),y)
CFLAGS-util-linux-fdisk.c := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
$(UTILLINUX_DIR)fdisk.o: $(srcdir)/fdisk.c
$(CC) $(CFLAGS) \
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
$(EXTRA_CFLAGS) -c -o $@ $<
endif endif
endif endif
util-linux_OBJ:= $(patsubst %,$(objdir)/%,$(UTIL-LINUX-y))