diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-03-13 22:04:00 +0300 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-03-13 22:04:00 +0300 |
commit | df10094870c28cc0c6c5577c9aa03b8ede9cb8a6 (patch) | |
tree | 49493696039b285aa751a5bc884fc70c9c85e878 | |
parent | c5b1d4d6b14f22b5e2f7ae42eb01bf2746b8001c (diff) |
- revert back to r14406
-rw-r--r-- | Makefile | 231 | ||||
-rw-r--r-- | Rules.mak | 312 | ||||
-rw-r--r-- | applets/Makefile.in | 24 | ||||
-rw-r--r-- | archival/Makefile.in | 22 | ||||
-rw-r--r-- | archival/libunarchive/Makefile.in | 100 | ||||
-rw-r--r-- | console-tools/Makefile.in | 33 | ||||
-rw-r--r-- | coreutils/Makefile.in | 21 | ||||
-rw-r--r-- | coreutils/libcoreutils/Makefile.in | 35 | ||||
-rw-r--r-- | debianutils/Makefile.in | 20 | ||||
-rw-r--r-- | e2fsprogs/Makefile.in | 94 | ||||
-rw-r--r-- | editors/Makefile.in | 39 | ||||
-rw-r--r-- | findutils/Makefile.in | 21 | ||||
-rw-r--r-- | init/Makefile.in | 21 | ||||
-rw-r--r-- | libbb/Makefile.in | 105 | ||||
-rw-r--r-- | libpwdgrp/Makefile.in | 54 | ||||
-rw-r--r-- | loginutils/Makefile.in | 22 | ||||
-rw-r--r-- | miscutils/Makefile.in | 28 | ||||
-rw-r--r-- | modutils/Makefile.in | 21 | ||||
-rw-r--r-- | networking/Makefile.in | 29 | ||||
-rw-r--r-- | networking/libiproute/Makefile.in | 106 | ||||
-rw-r--r-- | networking/udhcp/Makefile.in | 99 | ||||
-rw-r--r-- | procps/Makefile.in | 20 | ||||
-rw-r--r-- | scripts/config/Makefile | 10 | ||||
-rw-r--r-- | shell/Makefile.in | 32 | ||||
-rw-r--r-- | sysklogd/Makefile.in | 20 | ||||
-rw-r--r-- | util-linux/Makefile.in | 91 |
26 files changed, 772 insertions, 838 deletions
@@ -15,18 +15,11 @@ noconfig_targets := menuconfig config oldconfig randconfig \ # the toplevel sourcedir ifndef top_srcdir -# make-3.79.1 didn't support MAKEFILE_LIST -# for building out-of-tree, users of make-3.79.1 still have to pass top_srcdir= -# to make: make -f /srcs/busybox/Makefile top_srcdir=/srcs/busybox -ifdef MAKEFILE_LIST -top_srcdir:=$(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd) -else -top_srcdir:=$(CURDIR) -endif +top_srcdir=$(CURDIR) endif # toplevel directory of the object-tree ifndef top_builddir -top_builddir:=$(CURDIR) +top_builddir=$(CURDIR) endif export srctree=$(top_srcdir) @@ -41,86 +34,79 @@ SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS)) # That's our default target when none is given on the command line .PHONY: _all +_all: -_all: all +CONFIG_CONFIG_IN = $(top_srcdir)/Config.in -# 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 +ifeq ($(KBUILD_SRC),) ifdef O ifeq ("$(origin O)", "command line") - PACKAGE_OUTPUTDIR := $(shell cd $(O) && pwd) - top_builddir := $(PACKAGE_OUTPUTDIR) + KBUILD_OUTPUT := $(O) + top_builddir := $(O) endif else # If no alternate output-dir was specified, we build in cwd - PACKAGE_OUTPUTDIR := $(top_builddir) +# We are using KBUILD_OUTPUT nevertheless to make sure that we create +# Rules.mak and the toplevel Makefile, in case they don't exist. + KBUILD_OUTPUT := $(top_builddir) endif -define check_gcc -$(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 -$(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 - -####################################################################### -# make-3.79.1 doesn't support order-only prerequisites.. -ifeq ($(MAKE_VERSION),3.79.1) -|: $(^) ; +ifneq ($(strip $(HAVE_DOT_CONFIG)),y) +# pull in OS specific commands like cp, mkdir, etc. early +-include $(top_srcdir)/Rules.mak endif -####################################################################### - - -# Handle building out of tree -ifneq ($(top_builddir),$(top_srcdir)) -all_tree := $(patsubst %,$(top_builddir)/%,$(DIRS) scripts scripts/config include include/config) +# All object directories. +OBJ_DIRS := $(DIRS) +all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include) +all_tree: $(all_tree) $(all_tree): @mkdir -p "$@" -saved-output := $(PACKAGE_OUTPUTDIR) - -$(if $(wildcard $(PACKAGE_OUTPUTDIR)),, \ +ifneq ($(KBUILD_OUTPUT),) +# Invoke a second make in the output directory, passing relevant variables +# Check that the output directory actually exists +saved-output := $(KBUILD_OUTPUT) +KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) +$(if $(wildcard $(KBUILD_OUTPUT)),, \ $(error output directory "$(saved-output)" does not exist)) -.PHONY: $(filter $(noconfig_targets),$(MAKECMDGOALS)) +.PHONY: $(MAKECMDGOALS) + +$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree + $(Q)$(MAKE) -C $(KBUILD_OUTPUT) \ + top_srcdir=$(top_srcdir) \ + top_builddir=$(top_builddir) \ + KBUILD_SRC=$(top_srcdir) \ + -f $(CURDIR)/Makefile $@ -$(PACKAGE_OUTPUTDIR)/Rules.mak: +$(KBUILD_OUTPUT)/Rules.mak: @echo > $@ @echo top_srcdir=$(top_srcdir) >> $@ - @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@ - @echo include $$\(top_srcdir\)/Rules.mak >> $@ + @echo top_builddir=$(KBUILD_OUTPUT) >> $@ + @echo include $(top_srcdir)/Rules.mak >> $@ -$(PACKAGE_OUTPUTDIR)/Makefile: +$(KBUILD_OUTPUT)/Makefile: @echo > $@ @echo top_srcdir=$(top_srcdir) >> $@ - @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@ - @echo PACKAGE_SOURCEDIR='$$(top_srcdir)' >> $@ - @echo include '$$(PACKAGE_SOURCEDIR)'/Makefile >> $@ + @echo top_builddir=$(KBUILD_OUTPUT) >> $@ + @echo KBUILD_SRC='$$(top_srcdir)' >> $@ + @echo include '$$(KBUILD_SRC)'/Makefile >> $@ +# Leave processing to above invocation of make +skip-makefile := 1 +endif # ifneq ($(KBUILD_OUTPUT),) +endif # ifeq ($(KBUILD_SRC),) -buildtree := $(all_tree) $(PACKAGE_OUTPUTDIR)/Rules.mak $(PACKAGE_OUTPUTDIR)/Makefile +ifeq ($(skip-makefile),) # We only need a copy of the Makefile for the config targets and reuse # the rest from the source directory, i.e. we do not cp ALL_MAKEFILES. -scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | $(buildtree) - @cp $(top_srcdir)/scripts/config/Makefile $@ +scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile + cp $< $@ -else -all_tree := include/config -$(all_tree): - @mkdir -p "$@" -buildtree := $(all_tree) -endif # ifneq ($(PACKAGE_OUTPUTDIR),$(top_srcdir)) +_all: all help: @echo 'Cleaning:' @@ -151,44 +137,37 @@ help: @echo ' release - create a distribution tarball' @echo ' sizes - show size of all enabled busybox symbols' @echo - @echo 'Make flags:' - @echo ' V=<number> - print verbose make output (default: unset)' - @echo ' 0 print CC invocations' - @echo ' 1' - @echo ' 2 also print when make enters a directory' - @echo ' 3 also verbosely print shell invocations' --include $(top_srcdir)/Rules.mak + +include $(top_srcdir)/Rules.mak ifneq ($(strip $(HAVE_DOT_CONFIG)),y) + # Default target if none was requested explicitly -all: menuconfig ; +all: defconfig menuconfig -ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) # warn if no configuration exists and we are asked to build a non-config target .config: @echo "" @echo "No $(top_builddir)/$@ found!" - @echo "Please refer to 'make help', section Configuration." + @echo "Please refer to 'make help', section Configuration." @echo "" @exit 1 -else -# Avoid implicit rule to kick in by using an empty command -.config: $(buildtree) ; -endif -endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) - # configuration # --------------------------------------------------------------------------- -CONFIG_CONFIG_IN = $(top_srcdir)/Config.in - scripts/config/conf: scripts/config/Makefile $(Q)$(MAKE) -C scripts/config conf + -@if [ ! -f .config ] ; then \ + touch .config; \ + fi scripts/config/mconf: scripts/config/Makefile $(Q)$(MAKE) -C scripts/config ncurses conf mconf + -@if [ ! -f .config ] ; then \ + touch .config; \ + fi menuconfig: scripts/config/mconf @[ -f .config ] || make $(MAKEFLAGS) defconfig @@ -220,6 +199,7 @@ defconfig: scripts/config/conf @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config @./scripts/config/conf -o $(CONFIG_CONFIG_IN) + allbareconfig: scripts/config/conf @./scripts/config/conf -y $(CONFIG_CONFIG_IN) @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config @@ -227,28 +207,19 @@ allbareconfig: scripts/config/conf @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config @./scripts/config/conf -o $(CONFIG_CONFIG_IN) -ifeq ($(strip $(HAVE_DOT_CONFIG)),y) +else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) -# Load all Config.in --include $(top_builddir)/.config.cmd +all: busybox busybox.links doc -endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y) +# In this section, we need .config +-include $(top_builddir)/.config.cmd +include $(patsubst %,%/Makefile.in, $(SRC_DIRS)) -include $(patsubst %,%/Makefile.in,$(SRC_DIRS)) +endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) -ifeq ($(strip $(HAVE_DOT_CONFIG)),y) -# Finally pull in the dependencies (headers and other includes) of the -# individual object files +-include $(top_builddir)/.config -include $(top_builddir)/.depend -$(top_builddir)/applets/applets.o: $(top_builddir)/.config -# Everything is set. - -all: busybox busybox.links doc ; - -# Two modes of operation: legacy and IMA -# Legacy mode builds each object through an individual invocation of CC -# IMA compiles all sources at once (aka IPO aka IPA etc.) ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) libraries-y:= @@ -269,16 +240,18 @@ else # CONFIG_BUILD_AT_ONCE # This was the old way the binary was built. libbusybox-obj:=archival/libunarchive/libunarchive.a \ networking/libiproute/libiproute.a \ - libpwdgrp/libpwdgrp.a coreutils/libcoreutils/libcoreutils.a \ + libpwdgrp/libpwdgrp.a \ + coreutils/libcoreutils/libcoreutils.a \ libbb/libbb.a libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj)) + ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) # linking against libbusybox, so don't build the .a already contained in the .so libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y)) endif # CONFIG_FEATURE_SHARED_BUSYBOX - endif # CONFIG_BUILD_AT_ONCE + ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) LD_LIBBUSYBOX:=libbusybox.so LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION) @@ -286,21 +259,17 @@ DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \ $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION) -endif # CONFIG_BUILD_LIBBUSYBOX - ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) -# --combine but not linking against libbusybox, so compile lib*.c +# --combine but not linking against libbusybox, so compile all BUSYBOX_SRC := $(LIBRARY_SRC) BUSYBOX_DEFINE:= $(LIBRARY_DEFINE) endif # !CONFIG_FEATURE_SHARED_BUSYBOX $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC) else # CONFIG_BUILD_AT_ONCE $(LIBBUSYBOX_SONAME): $(libbusybox-obj) -AR_INTRO:=-Wl,--whole-archive -AR_EXTRO:=-Wl,--no-whole-archive endif # CONFIG_BUILD_AT_ONCE - +endif # CONFIG_BUILD_LIBBUSYBOX ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) LDBUSYBOX:=-L$(top_builddir) -lbusybox @@ -315,23 +284,20 @@ endif -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ -Wl,-z,combreloc $(LIB_LDFLAGS) \ -o $(@) \ - -Wl,--start-group \ - $(LIBRARY_DEFINE) $(AR_INTRO) $(^) $(AR_EXTRO) \ - -Wl,--end-group + -Wl,--start-group -Wl,--whole-archive \ + $(LIBRARY_DEFINE) $(^) \ + -Wl,--no-whole-archive -Wl,--end-group @rm -f $(DO_INSTALL_LIBS) @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done $(do_strip) endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) -busybox_unstripped: $(top_builddir)/.depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y) +busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(libraries-y) $(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \ - $(foreach f,$(^:.o=.c),$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \ - $(CFLAGS-$(@)) \ - -o $@ -Wl,--start-group \ + -o $@ -Wl,--start-group \ $(APPLETS_DEFINE) $(APPLET_SRC) \ - $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) \ - $(libraries-y) \ + $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \ $(LDBUSYBOX) $(LIBRARIES) \ -Wl,--end-group @@ -365,6 +331,17 @@ ifneq ($(strip $(DO_INSTALL_LIBS)),n) done endif +# see if we are in verbose mode +KBUILD_VERBOSE := +ifdef V + ifeq ("$(origin V)", "command line") + KBUILD_VERBOSE := $(V) + endif +endif +ifneq ($(strip $(KBUILD_VERBOSE)),) + CHECK_VERBOSE := -v +# ARFLAGS+=v +endif check test: busybox bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \ $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE) @@ -373,7 +350,7 @@ sizes: busybox_unstripped $(NM) --size-sort $(<) # Documentation Targets -doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html ; +doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl $(disp_doc) @@ -407,7 +384,7 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod # The nifty new dependency stuff scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c - $(do_link.h) + $(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $< DEP_INCLUDES := include/bb_config.h @@ -419,21 +396,22 @@ include/bbconfigopts.h: .config $(Q)$(top_srcdir)/scripts/config/mkconfigs > $@ endif -depend dep: $(top_builddir)/.depend ; -$(top_builddir)/.depend: $(buildtree) scripts/bb_mkdep $(DEP_INCLUDES) +depend dep: .depend +.depend: scripts/bb_mkdep $(DEP_INCLUDES) $(disp_gen) $(Q)rm -f .depend - $(Q)scripts/bb_mkdep $(MKDEP_ARGS) \ - -I $(top_srcdir)/include $(top_srcdir) > $@.tmp + $(Q)mkdir -p include/config + $(Q)scripts/bb_mkdep -I $(top_srcdir)/include $(top_srcdir) > $@.tmp $(Q)mv $@.tmp $@ include/bb_config.h: .config - $(disp_gen) + @if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \ + $(MAKE) -C scripts/config conf; \ + fi; @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN) -endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y) - clean: + - $(MAKE) -C scripts/config $@ - rm -f docs/busybox.dvi docs/busybox.ps \ docs/busybox.pod docs/busybox.net/busybox.html \ docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \ @@ -446,10 +424,9 @@ clean: -o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f distclean: clean - - $(MAKE) -C scripts/config clean - rm -f scripts/bb_mkdep - rm -r -f include/config $(DEP_INCLUDES) - - find . -name .depend'*' | xargs rm -f + - find . -name .depend'*' | xargs rm -f rm -f .config .config.old .config.cmd release: distclean #doc @@ -472,10 +449,8 @@ release: distclean #doc tags: ctags -R . -# keep these in sync with noconfig_targets above! -.PHONY: dummy subdirs check test depend dep buildtree \ - menuconfig config oldconfig randconfig \ - defconfig allyesconfig allnoconfig allbareconfig \ - clean distclean \ - release tags +endif # ifeq ($(skip-makefile),) + +.PHONY: dummy subdirs release distclean clean config oldconfig \ + menuconfig tags check test depend dep buildtree @@ -10,10 +10,6 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) -include $(top_builddir)/.config endif -ifeq ($(HAVE_DOT_CONFIG),y) -rules-mak-rules:=0 -endif - #-------------------------------------------------------- PROG := busybox MAJOR_VERSION :=1 @@ -34,9 +30,8 @@ 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' # to something more interesting... Target architecture is determined # by asking the CC compiler what arch it compiles things for, so unless -# your compiler is broken, you should not need to specify __TARGET_ARCH +# your compiler is broken, you should not need to specify TARGET_ARCH CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) -#") CC = $(CROSS)gcc AR = $(CROSS)ar AS = $(CROSS)as @@ -45,18 +40,7 @@ NM = $(CROSS)nm STRIP = $(CROSS)strip CPP = $(CC) -E SED ?= sed -AWK ?= awk - -ifdef PACKAGE_BE_VERBOSE -PACKAGE_BE_VERBOSE := $(shell echo $(PACKAGE_BE_VERBOSE) | $(SED) "s/[[:alpha:]]*//g") -endif - -# for make V=3 and above make $(shell) invocations verbose -ifeq ($(if $(strip $(PACKAGE_BE_VERBOSE)),$(shell test $(PACKAGE_BE_VERBOSE) -gt 2 ; echo $$?),1),0) - SHELL+=-x - MKDEP_ARGS:=-w -endif # What OS are you compiling busybox for? This allows you to include # OS specific things, syscall overrides, etc. @@ -69,21 +53,10 @@ HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. LC_ALL:= C -# initialize flags here -CFLAGS:= -CFLAGS_COMBINE:= -CFLAGS_PIC:= -LD_FLAGS:= -LIB_LDFLAGS:= -PROG_LDFLAGS:= -PROG_CFLAGS:= -OPTIMIZATIONS:= - # If you want to add some simple compiler switches (like -march=i686), # especially from the command line, use this instead of CFLAGS directly. -# For optimization overrides, it's better still to set OPTIMIZATIONS. +# For optimization overrides, it's better still to set OPTIMIZATION. CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS))) -#") # To compile vs some other alternative libc, you may need to use/adjust # the following lines to meet your needs... @@ -100,50 +73,20 @@ CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS))) #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") WARNINGS=-Wall -Wstrict-prototypes -Wshadow -CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include +CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) ARFLAGS=cru - -# Get the CC MAJOR/MINOR version # gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest +# get the CC MAJOR/MINOR version CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1)) CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1)) -# Note: spaces are significant here! -# Check if CC version is equal to given MAJOR,MINOR. Returns empty if false. -define cc_eq -$(shell [ $(CC_MAJOR) -eq $(1) -a $(CC_MINOR) -eq $(2) ] && echo y) -endef -# Check if CC version is greater or equal than given MAJOR,MINOR -define cc_ge -$(shell [ $(CC_MAJOR) -ge $(1) -a $(CC_MINOR) -ge $(2) ] && echo y) -endef -# Check if CC version is less or equal than given MAJOR,MINOR -define cc_le -$(shell [ $(CC_MAJOR) -le $(1) -a $(CC_MINOR) -le $(2) ] && echo y) -endef - -# Workaround bugs in make-3.80 for eval in conditionals -define is_eq -$(shell [ $(1) = $(2) ] 2> /dev/null && echo y) -endef -define is_neq -$(shell [ $(1) != $(2) ] 2> /dev/null && echo y) -endef - #-------------------------------------------------------- export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP - -# 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'/-.*//' \ +ifeq ($(strip $(TARGET_ARCH)),) +TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ -e 's/i.86/i386/' \ -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' \ @@ -157,60 +100,70 @@ __TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ ) endif -CFLAGS+=$(call check_gcc,CFLAGS,-funsigned-char,) -CFLAGS+=$(call check_gcc,CFLAGS,-mmax-stack-frame=256,) +# A nifty macro to make testing gcc features easier +check_gcc=$(shell \ + if [ "$(1)" != "" ]; then \ + if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ + then echo "$(1)"; else echo "$(2)"; fi \ + fi) + +# A not very robust macro to check for available ld flags +check_ld=$(shell \ + if [ "x$(1)" != "x" ]; then \ + $(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \ + fi) + +CFLAGS+=$(call check_gcc,-funsigned-char,) + +CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,) #-------------------------------------------------------- # Arch specific compiler optimization stuff should go here. # Unless you want to override the defaults, do not set anything -# for OPTIMIZATIONS... +# for OPTIMIZATION... # use '-Os' optimization if available, else use -O2 -OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-Os,-O2) +OPTIMIZATION:=$(call check_gcc,-Os,-O2) +ifeq ($(CONFIG_BUILD_AT_ONCE),y) # gcc 2.95 exits with 0 for "unrecognized option" -CFLAGS_COMBINE+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ - $(if $(call cc_ge,3,0),\ - $(call check_gcc,CFLAGS_COMBINE,--combine,))) - -OPTIMIZATIONS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ - $(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,)) - -# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795 -#PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ -# $(call check_gcc,PROG_CFLAGS,-fwhole-program,)) +ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0) + CFLAGS_COMBINE:=$(call check_gcc,--combine,) +endif +OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,) +PROG_CFLAGS+=$(call check_gcc,-fwhole-program,) +endif # CONFIG_BUILD_AT_ONCE -LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,) -#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,) -#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--as-needed,) -#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,) +LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,) +#LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,) +#LIB_LDFLAGS+=$(call check_ld,--as-needed,) +#LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,) -PROG_LDFLAGS+=$(call check_ld,PROG_LDFLAGS,--gc-sections,) # Some nice architecture specific optimizations -ifeq ($(__TARGET_ARCH),arm) - OPTIMIZATIONS+=-fstrict-aliasing -endif # arm - -OPTIMIZATIONS+=$(if $(call is_eq,$(__TARGET_ARCH),i386),\ - $(call check_gcc,OPTIMIZATIONS,-march=i386,)) - +ifeq ($(strip $(TARGET_ARCH)),arm) + OPTIMIZATION+=-fstrict-aliasing +endif +ifeq ($(strip $(TARGET_ARCH)),i386) + OPTIMIZATION+=$(call check_gcc,-march=i386,) # gcc-4.0 and older seem to benefit from these -OPTIMIZATIONS+=$(if $(call cc_le,4,0),\ - $(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\ - $(call check_gcc,OPTIMIZATIONS,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\ - -malign-functions=0 -malign-jumps=0 -malign-loops=0)) +#ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0) + OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,) + OPTIMIZATION+=$(call check_gcc,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\ + -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 -# turn off flags which hurt -Os -OPTIMIZATIONS+=$(if $(call cc_ge,4,1),\ - $(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\ - $(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\ - $(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\ -\ - $(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,)) - -OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,) +ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0) + # turn off flags which hurt -Os + OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,) + OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,) + OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,) + + OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,) +endif # gcc-4.1 and beyond +endif +OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,) # #-------------------------------------------------------- @@ -221,42 +174,45 @@ OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,) # prone to casual user adjustment. # -ifeq ($(CONFIG_LFS),y) +ifeq ($(strip $(CONFIG_LFS)),y) # For large file summit support CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 endif -ifeq ($(CONFIG_DMALLOC),y) +ifeq ($(strip $(CONFIG_DMALLOC)),y) # For testing mem leaks with dmalloc CFLAGS+=-DDMALLOC LIBRARIES:=-ldmalloc else - ifeq ($(CONFIG_EFENCE),y) + ifeq ($(strip $(CONFIG_EFENCE)),y) LIBRARIES:=-lefence endif endif - -LDFLAGS+=$(if $(call is_eq,$(CONFIG_DEBUG),y),$(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,)) -ifeq ($(CONFIG_DEBUG),y) +ifeq ($(strip $(CONFIG_DEBUG)),y) CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE + LDFLAGS += $(call check_ld,--warn-common,) else CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG + LDFLAGS += $(call check_ld,--warn-common,) + LDFLAGS += $(call check_ld,--sort-common,) endif ifeq ($(CONFIG_STRIP_BINARIES),y) STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment else STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging endif -PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_STATIC),y),\ - $(call check_gcc,PROG_CFLAGS,-static,)) - -CFLAGS_SHARED+=$(call check_gcc,CFLAGS_SHARED,-shared,) +ifeq ($(strip $(CONFIG_STATIC)),y) + PROG_CFLAGS += $(call check_gcc,-static,) +endif +CFLAGS_SHARED += $(call check_gcc,-shared,) LIB_CFLAGS+=$(CFLAGS_SHARED) -CFLAGS_PIC+=$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\ - $(call check_gcc,CFLAGS_PIC,-fPIC,)) -LIB_CFLAGS+=$(CFLAGS_PIC) +ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) + CFLAGS_PIC:= $(call check_gcc,-fPIC,) + LIB_CFLAGS+=$(CFLAGS_PIC) +endif + -ifeq ($(CONFIG_SELINUX),y) +ifeq ($(strip $(CONFIG_SELINUX)),y) LIBRARIES += -lselinux endif @@ -264,6 +220,14 @@ ifeq ($(strip $(PREFIX)),) PREFIX:=`pwd`/_install endif +# Additional complications due to support for pristine source dir. +# Include files in the build directory should take precedence over +# the copy in top_srcdir, both during the compilation phase and the +# shell script that finds the list of object files. +# Work in progress by <ldoolitt@recycle.lbl.gov>. + + +OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o CFLAGS += $(CROSS_CFLAGS) ifdef BB_INIT_SCRIPT CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' @@ -285,117 +249,59 @@ ifeq ($(strip $(CONFIG_INSTALL_APPLET_DONT)),y) INSTALL_OPTS= endif - -#------------------------------------------------------------ -# object extensions - -# object potentially used in shared object -ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) -# single-object extension -os:=.os -# multi-object extension -om:=.osm -else -os:=.o -om:=.om -endif - #------------------------------------------------------------ # Make the output nice and tight - -# 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 +MAKEFLAGS += --no-print-directory export MAKE_IS_SILENT=n ifneq ($(findstring s,$(MAKEFLAGS)),) export MAKE_IS_SILENT=y +SECHO := @-false DISP := sil Q := @ else ifneq ($(V)$(VERBOSE),) +SECHO := @-false DISP := ver Q := else +SECHO := @echo DISP := pur Q := @ endif endif -define show_objs - $(subst $(top_builddir)/,,$(subst ../,,$@)) -endef -pur_disp_compile.c = @echo " "CC $(show_objs) ; -pur_disp_compile.h = @echo " "HOSTCC $(show_objs) ; -pur_disp_strip = @echo " "STRIP $(show_objs) ; -pur_disp_link = @echo " "LINK $(show_objs) ; -pur_disp_link.h = @echo " "HOSTLINK $(show_objs) ; -pur_disp_ar = @echo " "AR $(ARFLAGS) $(show_objs) ; -pur_disp_gen = @echo " "GEN $@ ; -pur_disp_doc = @echo " "DOC $(subst docs/,,$@) ; -pur_disp_bin = @echo " "BIN $(show_objs) ; -sil_disp_compile.c = @ -sil_disp_compile.h = @ -sil_disp_strip = @ -sil_disp_link = @ -sil_disp_link.h = @ -sil_disp_ar = @ -sil_disp_gen = @ -sil_disp_doc = @ -sil_disp_bin = @ -ver_disp_compile.c = -ver_disp_compile.h = -ver_disp_strip = -ver_disp_link = -ver_disp_link.h = -ver_disp_ar = -ver_disp_gen = -ver_disp_doc = -ver_disp_bin = +show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@)) +pur_disp_compile.c = echo " "CC $(show_objs) +pur_disp_compile.h = echo " "HOSTCC $(show_objs) +pur_disp_strip = echo " "STRIP $(show_objs) +pur_disp_link = echo " "LINK $(show_objs) +pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs) +sil_disp_compile.c = true +sil_disp_compile.h = true +sil_disp_strip = true +sil_disp_link = true +sil_disp_ar = true +ver_disp_compile.c = echo $(cmd_compile.c) +ver_disp_compile.h = echo $(cmd_compile.h) +ver_disp_strip = echo $(cmd_strip) +ver_disp_link = echo $(cmd_link) +ver_disp_ar = echo $(cmd_ar) disp_compile.c = $($(DISP)_disp_compile.c) disp_compile.h = $($(DISP)_disp_compile.h) disp_strip = $($(DISP)_disp_strip) disp_link = $($(DISP)_disp_link) -disp_link.h = $($(DISP)_disp_link.h) disp_ar = $($(DISP)_disp_ar) -disp_gen = $($(DISP)_disp_gen) -disp_doc = $($(DISP)_disp_doc) -disp_bin = $($(DISP)_disp_bin) -# CFLAGS-dir == $(CFLAGS-$(notdir $(@D))) -# CFLAGS-dir-file.o == $(CFLAGS-$(notdir $(@D))-$(notdir $(@F))) -# CFLAGS-dir-file.c == $(CFLAGS-$(notdir $(<D))-$(notdir $(<F))) -# all prerequesites == $(foreach fil,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(fil))))-$(notdir $(fil)))) -cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) -c -o $@ $< \ - $(foreach f,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \ - $(CFLAGS-$(notdir $(@D))-$(notdir $(@F))) \ - $(CFLAGS-$(notdir $(@D))) -cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@)) +disp_gen = $(SECHO) " "GEN $@ ; true +disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true +cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< cmd_strip = $(STRIPCMD) $@ -cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) $(LDFLAGS) -cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(HOST_LDFLAGS) $^ -o $@ +cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) cmd_ar = $(AR) $(ARFLAGS) $@ $^ -compile.c = $(disp_compile.c) $(cmd_compile.c) -compile.m = $(disp_compile.c) $(cmd_compile.m) -compile.h = $(disp_compile.h) $(cmd_compile.h) -do_strip = $(disp_strip) $(cmd_strip) -do_link = $(disp_link) $(cmd_link) -do_link.h = $(disp_link.h) $(cmd_link.h) -do_ar = $(disp_ar) $(cmd_ar) - -ifdef rules-mak-rules -.SUFFIXES: .c .S .o .os .om .osm .oS .so .a .s .i .E - -# generic rules -%.o: ; $(compile.c) -%.os: ; $(compile.c) $(CFLAGS_PIC) -%.om: ; $(compile.m) -%.osm: ; $(compile.m) $(CFLAGS_PIC) -%.a: ; $(do_ar) - -endif # rules-mak-rules +compile.c = @$(disp_compile.c) ; $(cmd_compile.c) +compile.h = @$(disp_compile.h) ; $(cmd_compile.h) +do_strip = @$(disp_strip) ; $(cmd_strip) +do_link = @$(disp_link) ; $(cmd_link) +do_ar = @$(disp_ar) ; $(cmd_ar) .PHONY: dummy - diff --git a/applets/Makefile.in b/applets/Makefile.in index 391b4658c..02bcda93b 100644 --- a/applets/Makefile.in +++ b/applets/Makefile.in @@ -4,17 +4,23 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/applets -objdir:=$(top_builddir)/applets +APPLETS_AR:=applets.a +ifndef $(APPLETS_DIR) +APPLETS_DIR:=$(top_builddir)/applets/ +endif +srcdir=$(top_srcdir)/applets -APPLETS_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c) +APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c) +APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC)) -APPLET_SRC-y+=$(APPLETS_SRC) -APPLET_SRC-a+=$(APPLETS_SRC) +APPLET_SRC-y+=$(APPLET_SRC) +APPLET_SRC-a+=$(APPLET_SRC) -applets_OBJ:=$(patsubst $(srcdir)/%.c,$(objdir)/%.o,$(APPLETS_SRC)) +libraries-y+=$(APPLETS_DIR)$(APPLETS_AR) -$(applets_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/applets.a: $(applets_OBJ) -libraries-y:=$(libraries-y) $(objdir)/applets.a +$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ) + $(do_ar) +$(APPLET_OBJ): $(top_builddir)/.config +$(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/archival/Makefile.in b/archival/Makefile.in index 8a7b3bd4a..ee284ad7a 100644 --- a/archival/Makefile.in +++ b/archival/Makefile.in @@ -4,9 +4,14 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/archival -objdir:=$(top_builddir)/archival +ARCHIVAL_AR:=archival.a +ifndef $(ARCHIVAL_DIR) +ARCHIVAL_DIR:=$(top_builddir)/archival/ +endif +srcdir=$(top_srcdir)/archival +ARCHIVAL-y:= +ARCHIVAL-$(CONFIG_APT_GET) += ARCHIVAL-$(CONFIG_AR) += ar.o ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o ARCHIVAL-$(CONFIG_UNLZMA) += unlzma.o @@ -21,14 +26,17 @@ ARCHIVAL-$(CONFIG_TAR) += tar.o ARCHIVAL-$(CONFIG_UNCOMPRESS) += uncompress.o ARCHIVAL-$(CONFIG_UNZIP) += unzip.o +ifneq ($(strip $(ARCHIVAL-y)),) +libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR) +endif + ARCHIVAL_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(ARCHIVAL-y)) ARCHIVAL_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(ARCHIVAL_SRC-y) APPLET_SRC-a+=$(ARCHIVAL_SRC-a) -archival_OBJ:= $(patsubst %,$(objdir)/%,$(ARCHIVAL-y)) - -$(archival_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/archival.a: $(archival_OBJ) -libraries-y:=$(libraries-y) $(objdir)/archival.a +$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y)) + $(do_ar) +$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in index d77aff736..9bb91563d 100644 --- a/archival/libunarchive/Makefile.in +++ b/archival/libunarchive/Makefile.in @@ -4,74 +4,80 @@ # # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/archival/libunarchive -objdir:=$(top_builddir)/archival/libunarchive +LIBUNARCHIVE_AR:=libunarchive.a +ifndef $(LIBUNARCHIVE_DIR) +LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive +endif +srcdir=$(top_srcdir)/archival/libunarchive + +LIBUNARCHIVE-obj:=$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR) + +libraries-y+=$(LIBUNARCHIVE-obj) LIBUNARCHIVE-y:= \ \ - data_skip \ - data_extract_all \ - data_extract_to_stdout \ - data_extract_to_buffer \ + data_skip.o \ + data_extract_all.o \ + data_extract_to_stdout.o \ + data_extract_to_buffer.o \ \ - filter_accept_all \ - filter_accept_list \ - filter_accept_reject_list \ + filter_accept_all.o \ + filter_accept_list.o \ + filter_accept_reject_list.o \ \ - header_skip \ - header_list \ - header_verbose_list \ + header_skip.o \ + header_list.o \ + header_verbose_list.o \ \ - archive_xread_all \ - archive_xread_all_eof \ + archive_xread_all.o \ + archive_xread_all_eof.o \ \ - seek_by_char \ - seek_by_jump \ + seek_by_char.o \ + seek_by_jump.o \ \ - data_align \ - find_list_entry \ - open_transformer \ - init_handle + data_align.o \ + find_list_entry.o \ + open_transformer.o \ + init_handle.o -GUNZIP_FILES:= check_header_gzip decompress_unzip +GUNZIP_FILES:= check_header_gzip.o decompress_unzip.o DPKG_FILES:= \ - get_header_ar \ - unpack_ar_archive \ - get_header_tar \ - filter_accept_list_reassign + get_header_ar.o \ + unpack_ar_archive.o \ + get_header_tar.o \ + filter_accept_list_reassign.o -LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar unpack_ar_archive -LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2 -LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma -LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio +LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o +LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o +LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma.o +LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES) LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += $(DPKG_FILES) -LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz -LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2 get_header_tar_bz2 -LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma get_header_tar_lzma +LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o +LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o +LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) -LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress -LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio -LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio -LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar -LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2 get_header_tar_bz2 -LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma get_header_tar_lzma -LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz -LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress -LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress +LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o +LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o +LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o +LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o +LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o +LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o +LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o +LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o +LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES) LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y)) -LIBUNARCHIVE_SRC-y:=$(patsubst %,$(srcdir)/%.c,$(LIBUNARCHIVE-y)) +LIBUNARCHIVE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBUNARCHIVE-y))) LIBUNARCHIVE_SRC-a:=$(wildcard $(srcdir)/*.c) LIBRARY_SRC-y+=$(LIBUNARCHIVE_SRC-y) LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a) -archival_libunarchive_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBUNARCHIVE-y)) - -$(archival_libunarchive_OBJ$(os)): $(objdir)/%$(os): $(srcdir)/%.c -$(objdir)/libunarchive.a: $(archival_libunarchive_OBJ$(os)) -libraries-y:=$(libraries-y) $(objdir)/libunarchive.a +$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)/%,$(LIBUNARCHIVE-y)) + $(do_ar) +$(LIBUNARCHIVE_DIR)/%.o: $(srcdir)/%.c + $(compile.c) diff --git a/console-tools/Makefile.in b/console-tools/Makefile.in index 7994e0f08..f14e338e1 100644 --- a/console-tools/Makefile.in +++ b/console-tools/Makefile.in @@ -4,29 +4,34 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/console-tools -objdir:=$(top_builddir)/console-tools +CONSOLETOOLS_AR:=console-tools.a +ifndef $(CONSOLETOOLS_DIR) +CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/ +endif +srcdir=$(top_srcdir)/console-tools +CONSOLETOOLS-y:= CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o -CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o +CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o CONSOLETOOLS-$(CONFIG_DEALLOCVT) += deallocvt.o -CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o +CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o CONSOLETOOLS-$(CONFIG_SETCONSOLE) += setconsole.o -CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o -CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o -CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o -CONSOLETOOLS-$(CONFIG_RESET) += reset.o +CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o +CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o +CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o +CONSOLETOOLS-$(CONFIG_RESET) += reset.o CONSOLETOOLS-$(CONFIG_SETKEYCODES) += setkeycodes.o - +ifneq ($(strip $(CONSOLETOOLS-y)),) +libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR) +endif CONSOLETOOLS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(CONSOLETOOLS-y)) CONSOLETOOLS_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(CONSOLETOOLS_SRC-y) APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a) -console-tools_OBJ:= $(patsubst %,$(objdir)/%,$(CONSOLETOOLS-y)) - -$(console-tools_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/console-tools.a: $(console-tools_OBJ) -libraries-y:=$(libraries-y) $(objdir)/console-tools.a +$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS-y)) + $(do_ar) +$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/coreutils/Makefile.in b/coreutils/Makefile.in index 73581f2aa..2ab256c15 100644 --- a/coreutils/Makefile.in +++ b/coreutils/Makefile.in @@ -4,9 +4,13 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/coreutils -objdir:=$(top_builddir)/coreutils +COREUTILS_AR:=coreutils.a +ifndef $(COREUTILS_DIR) +COREUTILS_DIR:=$(top_builddir)/coreutils/ +endif +srcdir=$(top_srcdir)/coreutils +COREUTILS-y:= COREUTILS-$(CONFIG_BASENAME) += basename.o COREUTILS-$(CONFIG_CAL) += cal.o COREUTILS-$(CONFIG_CAT) += cat.o @@ -79,14 +83,17 @@ COREUTILS-$(CONFIG_YES) += yes.o COREUTILS-y:=$(sort $(COREUTILS-y)) +ifneq ($(strip $(COREUTILS-y)),) +libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR) +endif + COREUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(COREUTILS-y)) COREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(COREUTILS_SRC-y) APPLET_SRC-a+=$(COREUTILS_SRC-a) -coreutils_OBJ:= $(patsubst %,$(objdir)/%,$(COREUTILS-y)) - -$(coreutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/coreutils.a: $(coreutils_OBJ) -libraries-y:=$(libraries-y) $(objdir)/coreutils.a +$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y)) + $(do_ar) +$(COREUTILS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/coreutils/libcoreutils/Makefile.in b/coreutils/libcoreutils/Makefile.in index d89e9d049..30a38c9d9 100644 --- a/coreutils/libcoreutils/Makefile.in +++ b/coreutils/libcoreutils/Makefile.in @@ -4,25 +4,36 @@ # # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/coreutils/libcoreutils -objdir:=$(top_builddir)/coreutils/libcoreutils +LIBCOREUTILS_AR:=libcoreutils.a +ifndef $(LIBCOREUTILS_DIR) +LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils +endif +srcdir=$(top_srcdir)/coreutils/libcoreutils -LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod -LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod -LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat -LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat -LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat +LIBCOREUTILS_ALL_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c + +LIBCOREUTILS-y:= +LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o +LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o +LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat.o +LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat.o +LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat.o LIBCOREUTILS-y:=$(sort $(LIBCOREUTILS-y)) -LIBCOREUTILS_SRC-y:=$(patsubst %,$(srcdir)/%.c,$(LIBCOREUTILS-y)) +LIBCOREUTILS_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBCOREUTILS-y))) LIBCOREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) LIBRARY_SRC-y+=$(LIBCOREUTILS_SRC-y) LIBRARY_SRC-a+=$(LIBCOREUTILS_SRC-a) -coreutils_libcoreutils_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBCOREUTILS-y)) +ifneq ($(strip $(LIBCOREUTILS-y)),) +libraries-y+=$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR) +endif + +LIBCOREUTILS_OBJS=$(patsubst %,$(LIBCOREUTILS_DIR)/%, $(LIBCOREUTILS-y)) -$(coreutils_libcoreutils_OBJ$(os)): $(objdir)/%$(os): $(srcdir)/%.c -$(objdir)/libcoreutils.a: $(coreutils_libcoreutils_OBJ$(os)) -libraries-y:=$(libraries-y) $(objdir)/libcoreutils.a +$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR): $(patsubst %,$(LIBCOREUTILS_DIR)/%,$(LIBCOREUTILS-y)) + $(do_ar) +$(LIBCOREUTILS_DIR)/%.o: $(srcdir)/%.c + $(compile.c) diff --git a/debianutils/Makefile.in b/debianutils/Makefile.in index 4f72c233c..2983565b8 100644 --- a/debianutils/Makefile.in +++ b/debianutils/Makefile.in @@ -4,9 +4,13 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/debianutils -objdir:=$(top_builddir)/debianutils +DEBIANUTILS_AR:=debianutils.a +ifndef $(DEBIANUTILS_DIR) +DEBIANUTILS_DIR:=$(top_builddir)/debianutils/ +endif +srcdir=$(top_srcdir)/debianutils +DEBIANUTILS-y:= DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o DEBIANUTILS-$(CONFIG_READLINK) += readlink.o @@ -14,14 +18,16 @@ DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o DEBIANUTILS-$(CONFIG_WHICH) += which.o +ifneq ($(strip $(DEBIANUTILS-y)),) +libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR) +endif DEBIANUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(DEBIANUTILS-y)) DEBIANUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(DEBIANUTILS_SRC-y) APPLET_SRC-a+=$(DEBIANUTILS_SRC-a) -debianutils_OBJ:= $(patsubst %,$(objdir)/%,$(DEBIANUTILS-y)) - -$(debianutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/debianutils.a: $(debianutils_OBJ) -libraries-y:=$(libraries-y) $(objdir)/debianutils.a +$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y)) + $(do_ar) +$(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in index 0ca1c976d..e4cfdf545 100644 --- a/e2fsprogs/Makefile.in +++ b/e2fsprogs/Makefile.in @@ -4,8 +4,12 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/e2fsprogs -objdir:=$(top_builddir)/e2fsprogs +E2FSPROGS_AR:=e2fsprogs.a + +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 \ probe.c read.c resolve.c save.c tag.c @@ -35,58 +39,22 @@ UUID_SRC := compare.c gen_uuid.c pack.c parse.c unpack.c unparse.c \ UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC)) UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS)) - # for building out-of-tree we need to make sure that the directories to hold # the object tree are created -$(patsubst %,$(objdir)/%, blkid e2fsck e2p ext2fs uuid): +$(patsubst %,$(E2FSPROGS_DIR)/%, blkid e2fsck e2p ext2fs uuid): @mkdir -p "$@" # make sure that the directories are order-only prerequisites. Otherwise we # may have object files created after the timestamp of the directory was # updated which would lead to spurious rebuilds (as some of the dentries # may be older than the dir itself). -ifeq ($(MAKE_VERSION),3.81beta4) -# alleged bug in 3.81beta4. Stripping dir from dir/files.c -# /top/obj/dir/*.o: /top/obj/dir/file.o: /top/src/file.c -$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/%.c |$(objdir)/blkid -$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/%.c|$(objdir)/e2fsck -$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/%.c |$(objdir)/e2p -$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/%.c|$(objdir)/ext2fs -$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/%.c |$(objdir)/uuid - -e2fsprogs-rules-seen:=1 -endif - -ifeq ($(MAKE_VERSION),3.79.1) -# no order-only prerequesites -$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c #|$(objdir)/blkid -$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c#|$(objdir)/e2fsck -$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c #|$(objdir)/e2p -$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c#|$(objdir)/ext2fs -$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c #|$(objdir)/uuid -$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid -$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck -$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p -$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs -$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid -$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid -$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck -$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p -$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs -$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid - -e2fsprogs-rules-seen:=1 -endif - -ifndef e2fsprogs-rules-seen -$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c |$(objdir)/blkid -$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c|$(objdir)/e2fsck -$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c |$(objdir)/e2p -$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c|$(objdir)/ext2fs -$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c |$(objdir)/uuid -endif - +$(patsubst %,$(E2FSPROGS_DIR)/%, $(BLKID_OBJS)):|$(E2FSPROGS_DIR)/blkid +$(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSCK_OBJS)):|$(E2FSPROGS_DIR)/e2fsck +$(patsubst %,$(E2FSPROGS_DIR)/%, $(E2P_OBJS)):|$(E2FSPROGS_DIR)/e2p +$(patsubst %,$(E2FSPROGS_DIR)/%, $(EXT2FS_OBJS)):|$(E2FSPROGS_DIR)/ext2fs +$(patsubst %,$(E2FSPROGS_DIR)/%, $(UUID_OBJS)):|$(E2FSPROGS_DIR)/uuid +E2FSPROGS-y:= E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS) E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS) @@ -95,30 +63,24 @@ 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-y:=$(sort $(E2FSPROGS-y)) -ifneq ($(E2FSPROGS-y),) -CFLAGS-e2fsprogs := -include $(srcdir)/e2fsbb.h -endif - -E2FSPROGS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(E2FSPROGS-y)) -E2FSPROGS_SRC-a:=$(wildcard $(srcdir)/*.c) $(patsubst %,$(srcdir)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS)) -APPLET_SRC-y+=$(E2FSPROGS_SRC-y) -APPLET_SRC-a+=$(E2FSPROGS_SRC-a) -$(warning FIXME: change .c to include their stuff relative to $(srcdir)) -E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(srcdir)/%,blkid e2fsck e2p ext2fs uuid) -CFLAGS-blkid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) -CFLAGS-e2fsck=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) -CFLAGS-e2p=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) -CFLAGS-ext2fs=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) -CFLAGS-uuid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) +ifneq ($(strip $(E2FSPROGS-y)),) +libraries-y+=$(E2FSPROGS_DIR)/$(E2FSPROGS_AR) +endif +E2FSPROGS_SRC-y:=$(patsubst %.o,$(E2FSPROGS_SRC)/%.c,$(E2FSPROGS-y)) +E2FSPROGS_SRC-a:=$(wildcard $(E2FSPROGS_SRC)/*.c) $(patsubst %,$(E2FSPROGS_SRC)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS)) +APPLET_SRC-y+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-y) +APPLET_SRC-a+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-a) -APPLETS_DEFINE-y+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE) -APPLETS_DEFINE-a+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE) +# XXX: FIXME: change .c to include their stuff relative to $(E2FSPROGS_SRC) +E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(E2FSPROGS_SRC)/%,blkid e2fsck e2p ext2fs uuid) -e2fsprogs_OBJ:= $(patsubst %,$(objdir)/%,$(E2FSPROGS-y)) +APPLETS_DEFINE-y+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE) +APPLETS_DEFINE-a+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE) -$(e2fsprogs_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/e2fsprogs.a: $(e2fsprogs_OBJ) -libraries-y:=$(libraries-y) $(objdir)/e2fsprogs.a +$(E2FSPROGS_DIR)/$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y)) + $(do_ar) +$(E2FSPROGS_DIR)/%.o: $(subst $(top_builddir),$(top_srcdir),$(E2FSPROGS_DIR)/%.c) + $(compile.c) $(E2FSPROGS_CFLAGS) diff --git a/editors/Makefile.in b/editors/Makefile.in index dd09e7a21..805017dcc 100644 --- a/editors/Makefile.in +++ b/editors/Makefile.in @@ -4,29 +4,36 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/editors -objdir:=$(top_builddir)/editors +EDITOR_AR:=editors.a +ifndef $(EDITOR_DIR) +EDITOR_DIR:=$(top_builddir)/editors/ +endif +srcdir=$(top_srcdir)/editors -EDITORS-$(CONFIG_AWK) += awk.o -EDITORS-$(CONFIG_PATCH) += patch.o -EDITORS-$(CONFIG_SED) += sed.o -EDITORS-$(CONFIG_VI) += vi.o +EDITOR-y:= +EDITOR-$(CONFIG_AWK) += awk.o +EDITOR-$(CONFIG_PATCH) += patch.o +EDITOR-$(CONFIG_SED) += sed.o +EDITOR-$(CONFIG_VI) += vi.o -needlibm-y:= -needlibm-$(CONFIG_FEATURE_AWK_MATH) := y - -ifeq ($(needlibm-y),y) - LIBRARIES := $(filter-out -lm,$(LIBRARIES)) -lm +ifneq ($(strip $(EDITOR-y)),) +libraries-y+=$(EDITOR_DIR)$(EDITOR_AR) endif -EDITOR_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(EDITORS-y)) +EDITOR_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(EDITOR-y)) EDITOR_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(EDITOR_SRC-y) APPLET_SRC-a+=$(EDITOR_SRC-a) -editors_OBJ:= $(patsubst %,$(objdir)/%,$(EDITORS-y)) +needlibm-y:= +needlibm-$(CONFIG_FEATURE_AWK_MATH) := y + +ifeq ($(needlibm-y),y) + LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES)) +endif -$(editors_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/editors.a: $(editors_OBJ) -libraries-y:=$(libraries-y) $(objdir)/editors.a +$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y)) + $(do_ar) +$(EDITOR_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/findutils/Makefile.in b/findutils/Makefile.in index 7fbf8d4b9..25a2d38d3 100644 --- a/findutils/Makefile.in +++ b/findutils/Makefile.in @@ -4,21 +4,28 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/findutils -objdir:=$(top_builddir)/findutils +FINDUTILS_AR:=findutils.a +ifndef $(FINDUTILS_DIR) +FINDUTILS_DIR:=$(top_builddir)/findutils/ +endif +srcdir=$(top_srcdir)/findutils +FINDUTILS-y:= FINDUTILS-$(CONFIG_FIND) += find.o FINDUTILS-$(CONFIG_GREP) += grep.o FINDUTILS-$(CONFIG_XARGS) += xargs.o +ifneq ($(strip $(FINDUTILS-y)),) +libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR) +endif + FINDUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(FINDUTILS-y)) FINDUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(FINDUTILS_SRC-y) APPLET_SRC-a+=$(FINDUTILS_SRC-a) -findutils_OBJ:= $(patsubst %,$(objdir)/%,$(FINDUTILS-y)) - -$(findutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/findutils.a: $(findutils_OBJ) -libraries-y:=$(libraries-y) $(objdir)/findutils.a +$(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y)) + $(do_ar) +$(FINDUTILS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/init/Makefile.in b/init/Makefile.in index ef5eb1c58..a48ead446 100644 --- a/init/Makefile.in +++ b/init/Makefile.in @@ -4,9 +4,13 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/init -objdir:=$(top_builddir)/init +INIT_AR:=init.a +ifndef $(INIT_DIR) +INIT_DIR:=$(top_builddir)/init/ +endif +srcdir=$(top_srcdir)/init +INIT-y:= INIT-$(CONFIG_HALT) += halt.o INIT-$(CONFIG_INIT) += init.o INIT-$(CONFIG_MESG) += mesg.o @@ -23,14 +27,17 @@ endif INIT-$(CONFIG_INIT_SHARED) += init_shared.o +ifneq ($(strip $(INIT-y)),) +libraries-y+=$(INIT_DIR)$(INIT_AR) +endif + INIT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(INIT-y)) INIT_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(INIT_SRC-y) APPLET_SRC-a+=$(INIT_SRC-a) -init_OBJ:= $(patsubst %,$(objdir)/%,$(INIT-y)) - -$(init_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/init.a: $(init_OBJ) -libraries-y:=$(libraries-y) $(objdir)/init.a +$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y)) + $(do_ar) +$(INIT_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/libbb/Makefile.in b/libbb/Makefile.in index 159957aa4..7b501531a 100644 --- a/libbb/Makefile.in +++ b/libbb/Makefile.in @@ -4,8 +4,10 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/libbb -objdir:=$(top_builddir)/libbb +ifndef $(LIBBB_DIR) +LIBBB_DIR:=$(top_builddir)/libbb +endif +srcdir=$(top_srcdir)/libbb LIBBB-n:= LIBBB-y:= \ @@ -49,72 +51,77 @@ LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y)) # 1:N objects LIBBB_MSRC0:=$(srcdir)/messages.c -LIBBB_M0:=full_version \ - memory_exhausted invalid_date io_error \ - read_error write_error name_longer_than_foo unknown \ - can_not_create_raw_socket perm_denied_are_you_root \ - shadow_file passwd_file group_file gshadow_file nologin_file \ - securetty_file motd_file \ - msg_standard_input msg_standard_output shell_file \ - bb_dev_null bb_common_bufsiz1 -LIBBB_MOBJ0:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M0)) +LIBBB_MOBJ0:=full_version.o \ + memory_exhausted.o invalid_date.o io_error.o \ + read_error.o write_error.o name_longer_than_foo.o unknown.o \ + can_not_create_raw_socket.o perm_denied_are_you_root.o \ + shadow_file.o passwd_file.o group_file.o gshadow_file.o nologin_file.o \ + securetty_file.o motd_file.o \ + msg_standard_input.o msg_standard_output.o shell_file.o \ + bb_dev_null.o bb_common_bufsiz1.o +LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0)) $(LIBBB_MOBJ0):$(LIBBB_MSRC0) + $(compile.c) -DL_$(notdir $*) LIBBB_MSRC1:=$(srcdir)/xfuncs.c -LIBBB_M1:=xmalloc xrealloc xcalloc xstrdup xstrndup \ - xfopen xopen xread xread_all xread_char \ - xferror xferror_stdout xfflush_stdout strlen -LIBBB_MOBJ1:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M1)) +LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ + xfopen.o xopen.o xread.o xread_all.o xread_char.o \ + xferror.o xferror_stdout.o xfflush_stdout.o strlen.o +LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1)) $(LIBBB_MOBJ1):$(LIBBB_MSRC1) + $(compile.c) -DL_$(notdir $*) LIBBB_MSRC2:=$(srcdir)/printf.c -LIBBB_M2:=bb_vfprintf bb_vprintf bb_fprintf bb_printf -LIBBB_MOBJ2:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M2)) +LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o +LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2)) $(LIBBB_MOBJ2):$(LIBBB_MSRC2) + $(compile.c) -DL_$(notdir $*) LIBBB_MSRC3:=$(srcdir)/xgetularg.c -LIBBB_M3:=xgetularg_bnd_sfx xgetlarg_bnd_sfx getlarg10_sfx \ - xgetularg_bnd xgetularg10_bnd xgetularg10 -LIBBB_MOBJ3:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M3)) +LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \ + xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o +LIBBB_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3)) $(LIBBB_MOBJ3):$(LIBBB_MSRC3) + $(compile.c) -DL_$(notdir $*) LIBBB_MSRC4:=$(srcdir)/safe_strtol.c -LIBBB_M4:=safe_strtoi safe_strtod safe_strtol safe_strtoul -LIBBB_MOBJ4:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M4)) +LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o +LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4)) $(LIBBB_MOBJ4):$(LIBBB_MSRC4) + $(compile.c) -DL_$(notdir $*) LIBBB_MSRC5:=$(srcdir)/bb_pwd.c -LIBBB_M5:=bb_xgetpwnam bb_xgetgrnam bb_getgrgid bb_getpwuid \ - bb_getug get_ug_id -LIBBB_MOBJ5:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M5)) +LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \ + bb_getug.o get_ug_id.o +LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5)) $(LIBBB_MOBJ5):$(LIBBB_MSRC5) + $(compile.c) -DL_$(notdir $*) LIBBB_MSRC6:=$(srcdir)/llist.c -LIBBB_M6:=llist_add_to llist_add_to_end llist_free_one llist_free -LIBBB_MOBJ6:=$(patsubst %,$(objdir)/%$(om),$(LIBBB_M6)) +LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o +LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6)) $(LIBBB_MOBJ6):$(LIBBB_MSRC6) + $(compile.c) -DL_$(notdir $*) # We need the names of the object files built from MSRC for the L_ defines -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_MOBJ:=$(LIBBB_MOBJ0) $(LIBBB_MOBJ1) $(LIBBB_MOBJ2) $(LIBBB_MOBJ3) $(LIBBB_MOBJ4) $(LIBBB_MOBJ5) $(LIBBB_MOBJ6) LIBBB_ALL_MSRC:=$(LIBBB_MSRC0) $(LIBBB_MSRC1) $(LIBBB_MSRC2) $(LIBBB_MSRC3) \ $(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6) -LIBBB-y:=$(sort $(LIBBB-y)) +LIBBB-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC)) + +LIBBB_AR:=$(LIBBB_DIR)/libbb.a +libraries-y+=$(LIBBB_AR) needcrypt-y:= ifneq ($(findstring $(srcdir)/pw_encrypt.c,$(LIBBB-y)),) needcrypt-y:=y -endif +else ifneq ($(findstring $(srcdir)/correct_password.c,$(LIBBB-y)),) needcrypt-y:=y endif -ifeq ($(CONFIG_FEATURE_FULL_LIBBUSYBOX),y) -needcrypt-y:=y endif ifeq ($(needcrypt-y),y) @@ -122,32 +129,18 @@ ifeq ($(needcrypt-y),y) endif # all 1:1 objects -libbb_OBJ$(os):=$(patsubst $(srcdir)/%.c,$(objdir)/%$(os),$(LIBBB-y)) +LIBBB_OBJS:=$(patsubst $(srcdir)/%.c,$(LIBBB_DIR)/%.o, $(LIBBB-y)) +$(LIBBB_DIR)/%.o: $(srcdir)/%.c + $(compile.c) -LIBBB_SRC-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC)) LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c) -LIBRARY_SRC-y+=$(LIBBB_SRC-y) +LIBRARY_SRC-y+=$(LIBBB-y) LIBRARY_SRC-a+=$(LIBBB_SRC-a) # all defines needed for 1:N objects -LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(LIBBB_ALL_MDEFS)) +LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBBB_ALL_MOBJ)))) LIBRARY_DEFINE-y+=$(LIBBB_DEFINE-y) LIBRARY_DEFINE-a+=$(LIBBB_DEFINE-y) -ifeq ($(om),.osm) -# XXX FIXME: -# also create a pattern for the non-shared case -$(LIBBB_MOBJ0:.osm=.om): $(LIBBB_MSRC0) -$(LIBBB_MOBJ1:.osm=.om): $(LIBBB_MSRC1) -$(LIBBB_MOBJ2:.osm=.om): $(LIBBB_MSRC2) -$(LIBBB_MOBJ3:.osm=.om): $(LIBBB_MSRC3) -$(LIBBB_MOBJ4:.osm=.om): $(LIBBB_MSRC4) -$(LIBBB_MOBJ5:.osm=.om): $(LIBBB_MSRC5) -$(LIBBB_MOBJ6:.osm=.om): $(LIBBB_MSRC6) -endif - -$(libbb_OBJ.os): $(objdir)/%.os: $(srcdir)/%.c -$(libbb_OBJ.o): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/libbb.a: $(libbb_OBJ$(os)) $(libbb_MOBJ$(os)) -libraries-y:=$(libraries-y) $(objdir)/libbb.a - +$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_ALL_MOBJ) + $(do_ar) diff --git a/libpwdgrp/Makefile.in b/libpwdgrp/Makefile.in index a99d3d86f..2511d34ef 100644 --- a/libpwdgrp/Makefile.in +++ b/libpwdgrp/Makefile.in @@ -4,28 +4,33 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/libpwdgrp -objdir:=$(top_builddir)/libpwdgrp +LIBPWDGRP_AR:=libpwdgrp.a +ifndef $(LIBPWDGRP_DIR) +LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp +endif +srcdir=$(top_srcdir)/libpwdgrp + +LIBPWDGRP-obj:=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR) + +libraries-y+=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR) LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c -LIBPWDGRP_M0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r fgetgrent_r \ - fgetpwent fgetgrent getpwnam_r getgrnam_r getpwuid_r \ - getgrgid_r getpwuid getgrgid getpwnam getgrnam getpw \ - getpwent_r getgrent_r getpwent getgrent \ - initgroups putpwent putgrent -LIBPWDGRP_MOBJ0=$(patsubst %,$(objdir)/%$(om),$(LIBPWDGRP_M0-y)) -$(LIBPWDGRP_MOBJ0): $(LIBPWDGRP_MSRC0) +LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \ + fgetpwent.o fgetgrent.o getpwnam_r.o getgrnam_r.o getpwuid_r.o \ + getgrgid_r.o getpwuid.o getgrgid.o getpwnam.o getgrnam.o getpw.o \ + getpwent_r.o getgrent_r.o getpwent.o getgrent.o \ + initgroups.o putpwent.o putgrent.o +LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ0-y)) LIBPWDGRP_MSRC1:=$(srcdir)/pwd_grp.c -LIBPWDGRP_M1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent __parsegrent \ - __pgsreader fgetspent_r fgetspent sgetspent_r getspnam_r \ - getspnam getspent_r getspent sgetspent \ - putspent __parsespent # getspuid_r getspuid -LIBPWDGRP_MOBJ1=$(patsubst %,$(objdir)/%$(om),$(LIBPWDGRP_M1-y)) -$(LIBPWDGRP_MOBJ1): $(LIBPWDGRP_MSRC1) +LIBPWDGRP_MOBJ1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent.o __parsegrent.o \ + __pgsreader.o fgetspent_r.o fgetspent.o sgetspent_r.o getspnam_r.o \ + getspnam.o getspent_r.o getspent.o sgetspent.o \ + putspent.o __parsespent.o # getspuid_r.o getspuid.o +LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ1-y)) -LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(LIBPWDGRP_M0-y)) -LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(LIBPWDGRP_M1-y)) +LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS0)))) +LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS1)))) LIBPWDGRP_SRC-y:=$(LIBPWDGRP_MSRC0) @@ -35,15 +40,12 @@ LIBRARY_SRC-a+=$(LIBPWDGRP_SRC-y) LIBRARY_DEFINE-y+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y) LIBRARY_DEFINE-a+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y) -libpwdgrp_MOBJ$(os):=$(LIBPWDGRP_MOBJ0) $(LIBPWDGRP_MOBJ1) -ifeq ($(om),.osm) -# XXX FIXME: -# also create a pattern for the non-shared case -$(LIBPWDGRP_MOBJ0:.osm=.om): $(LIBPWDGRP_MSRC0) -$(LIBPWDGRP_MOBJ1:.osm=.om): $(LIBPWDGRP_MSRC1) -endif +$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR): $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1) + $(do_ar) -$(objdir)/libpwdgrp.a: $(libpwdgrp_MOBJ$(os)) -libraries-y:=$(libraries-y) $(objdir)/libpwdgrp.a +$(LIBPWDGRP_MOBJS0): $(LIBPWDGRP_MSRC0) + $(compile.c) -DL_$(notdir $*) +$(LIBPWDGRP_MOBJS1): $(LIBPWDGRP_MSRC1) + $(compile.c) -DL_$(notdir $*) diff --git a/loginutils/Makefile.in b/loginutils/Makefile.in index 959cb4f57..c11bbfc03 100644 --- a/loginutils/Makefile.in +++ b/loginutils/Makefile.in @@ -4,9 +4,13 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/loginutils -objdir:=$(top_builddir)/loginutils +LOGINUTILS_AR:=loginutils.a +ifndef LOGINUTILS_DIR +LOGINUTILS_DIR:=$(top_builddir)/loginutils/ +endif +srcdir=$(top_srcdir)/loginutils +LOGINUTILS-y:= LOGINUTILS-$(CONFIG_ADDGROUP) += addgroup.o LOGINUTILS-$(CONFIG_ADDUSER) += adduser.o LOGINUTILS-$(CONFIG_GETTY) += getty.o @@ -18,6 +22,9 @@ LOGINUTILS-$(CONFIG_VLOCK) += vlock.o LOGINUTILS-$(CONFIG_DELUSER) += deluser.o LOGINUTILS-$(CONFIG_DELGROUP) += delgroup.o +ifneq ($(strip $(LOGINUTILS-y)),) +libraries-y+=$(LOGINUTILS_DIR)$(LOGINUTILS_AR) +endif LOGINUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(LOGINUTILS-y)) LOGINUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) @@ -30,13 +37,14 @@ needcrypt-$(CONFIG_PASSWD) := y needcrypt-$(CONFIG_SU) := y needcrypt-$(CONFIG_SULOGIN) := y needcrypt-$(CONFIG_VLOCK) := y + + ifeq ($(needcrypt-y),y) LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) endif -loginutils_OBJ:= $(patsubst %,$(objdir)/%,$(LOGINUTILS-y)) - -$(loginutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/loginutils.a: $(loginutils_OBJ) -libraries-y:=$(libraries-y) $(objdir)/loginutils.a +$(LOGINUTILS_DIR)$(LOGINUTILS_AR): $(patsubst %,$(LOGINUTILS_DIR)%, $(LOGINUTILS-y)) + $(do_ar) +$(LOGINUTILS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/miscutils/Makefile.in b/miscutils/Makefile.in index 4f9de7c93..a0b6b7233 100644 --- a/miscutils/Makefile.in +++ b/miscutils/Makefile.in @@ -4,9 +4,13 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/miscutils -objdir:=$(top_builddir)/miscutils +MISCUTILS_AR:=miscutils.a +ifndef $(MISCUTILS_DIR) +MISCUTILS_DIR:=$(top_builddir)/miscutils/ +endif +srcdir=$(top_srcdir)/miscutils +MISCUTILS-y:= MISCUTILS-$(CONFIG_ADJTIMEX) += adjtimex.o MISCUTILS-$(CONFIG_CROND) += crond.o MISCUTILS-$(CONFIG_CRONTAB) += crontab.o @@ -27,10 +31,8 @@ MISCUTILS-$(CONFIG_STRINGS) += strings.o MISCUTILS-$(CONFIG_TIME) += time.o MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o -needlibm-y:= -needlibm-$(CONFIG_DC) := y -ifeq ($(needlibm-y),y) - LIBRARIES := $(filter-out -lm,$(LIBRARIES)) -lm +ifneq ($(strip $(MISCUTILS-y)),) +libraries-y+=$(MISCUTILS_DIR)$(MISCUTILS_AR) endif MISCUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MISCUTILS-y)) @@ -38,9 +40,15 @@ MISCUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(MISCUTILS_SRC-y) APPLET_SRC-a+=$(MISCUTILS_SRC-a) -miscutils_OBJ:= $(patsubst %,$(objdir)/%,$(MISCUTILS-y)) +needlibm-y:= +needlibm-$(CONFIG_DC) := y + +ifeq ($(needlibm-y),y) + LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES)) +endif -$(miscutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/miscutils.a: $(miscutils_OBJ) -libraries-y:=$(libraries-y) $(objdir)/miscutils.a +$(MISCUTILS_DIR)$(MISCUTILS_AR): $(patsubst %,$(MISCUTILS_DIR)%, $(MISCUTILS-y)) + $(do_ar) +$(MISCUTILS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/modutils/Makefile.in b/modutils/Makefile.in index a59b29d76..5c7c9238e 100644 --- a/modutils/Makefile.in +++ b/modutils/Makefile.in @@ -4,22 +4,29 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/modutils -objdir:=$(top_builddir)/modutils +MODUTILS_AR:=modutils.a +ifndef $(MODUTILS_DIR) +MODUTILS_DIR:=$(top_builddir)/modutils/ +endif +srcdir=$(top_srcdir)/modutils +MODUTILS-y:= MODUTILS-$(CONFIG_INSMOD) += insmod.o MODUTILS-$(CONFIG_LSMOD) += lsmod.o MODUTILS-$(CONFIG_MODPROBE) += modprobe.o MODUTILS-$(CONFIG_RMMOD) += rmmod.o +ifneq ($(strip $(MODUTILS-y)),) +libraries-y+=$(MODUTILS_DIR)$(MODUTILS_AR) +endif + MODUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MODUTILS-y)) MODUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(MODUTILS_SRC-y) APPLET_SRC-a+=$(MODUTILS_SRC-a) -modutils_OBJ:= $(patsubst %,$(objdir)/%,$(MODUTILS-y)) - -$(modutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/modutils.a: $(modutils_OBJ) -libraries-y:=$(libraries-y) $(objdir)/modutils.a +$(MODUTILS_DIR)$(MODUTILS_AR): $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y)) + $(do_ar) +$(MODUTILS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/networking/Makefile.in b/networking/Makefile.in index 80cfd1733..650fc1a4a 100644 --- a/networking/Makefile.in +++ b/networking/Makefile.in @@ -4,9 +4,13 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/networking -objdir:=$(top_builddir)/networking +NETWORKING_AR:=networking.a +ifndef $(NETWORKING_DIR) +NETWORKING_DIR:=$(top_builddir)/networking/ +endif +srcdir=$(top_srcdir)/networking +NETWORKING-y:= NETWORKING-$(CONFIG_ARPING) += arping.o NETWORKING-$(CONFIG_DNSD) += dnsd.o NETWORKING-$(CONFIG_ETHER_WAKE) += ether-wake.o @@ -40,11 +44,8 @@ NETWORKING-$(CONFIG_WGET) += wget.o NETWORKING-$(CONFIG_ZCIP) += zcip.o NETWORKING-y:=$(sort $(NETWORKING-y)) - -needcrypt-y:= -needcrypt-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) := y -ifeq ($(needcrypt-y),y) - LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) +ifneq ($(strip $(NETWORKING-y)),) +libraries-y+=$(NETWORKING_DIR)$(NETWORKING_AR) endif NETWORKING_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(NETWORKING-y)) @@ -55,9 +56,15 @@ APPLET_SRC-a+=$(NETWORKING_SRC-a) LIBRARY_DEFINE-y+= -I$(top_srcdir)/networking LIBRARY_DEFINE-a+= -I$(top_srcdir)/networking -networking_OBJ:= $(patsubst %,$(objdir)/%,$(NETWORKING-y)) +needcrypt-y:= +needcrypt-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) := y + +ifeq ($(needcrypt-y),y) + LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) +endif -$(networking_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/networking.a: $(networking_OBJ) -libraries-y:=$(libraries-y) $(objdir)/networking.a +$(NETWORKING_DIR)$(NETWORKING_AR): $(patsubst %,$(NETWORKING_DIR)%, $(NETWORKING-y)) + $(do_ar) +$(NETWORKING_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/networking/libiproute/Makefile.in b/networking/libiproute/Makefile.in index 3ad77ecfc..f713502b3 100644 --- a/networking/libiproute/Makefile.in +++ b/networking/libiproute/Makefile.in @@ -3,71 +3,81 @@ # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> # # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. +# -srcdir:=$(top_srcdir)/networking/libiproute -objdir:=$(top_builddir)/networking/libiproute +LIBIPROUTE_AR:=libiproute.a +ifndef $(LIBIPROUTE_DIR) +LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute +endif +srcdir=$(top_srcdir)/networking/libiproute +LIBIPROUTE-y:= LIBIPROUTE-$(CONFIG_IP) += \ - ip_parse_common_args \ - ipaddress \ - iplink \ - iproute \ - iptunnel \ - libnetlink \ - ll_addr \ - ll_map \ - ll_proto \ - ll_types \ - rt_names \ - rtm_map \ - utils + ip_parse_common_args.o \ + ipaddress.o \ + iplink.o \ + iproute.o \ + iptunnel.o \ + libnetlink.o \ + ll_addr.o \ + ll_map.o \ + ll_proto.o \ + ll_types.o \ + rt_names.o \ + rtm_map.o \ + utils.o LIBIPROUTE-$(CONFIG_IPADDR) += \ - ip_parse_common_args \ - ipaddress \ - libnetlink \ - ll_addr \ - ll_map \ - ll_types \ - rt_names \ - utils + ip_parse_common_args.o \ + ipaddress.o \ + libnetlink.o \ + ll_addr.o \ + ll_map.o \ + ll_types.o \ + rt_names.o \ + utils.o LIBIPROUTE-$(CONFIG_IPLINK) += \ - ip_parse_common_args \ - ipaddress \ - iplink \ - libnetlink \ - ll_addr \ - ll_map \ - ll_types \ - rt_names \ - utils + ip_parse_common_args.o \ + ipaddress.o \ + iplink.o \ + libnetlink.o \ + ll_addr.o \ + ll_map.o \ + ll_types.o \ + rt_names.o \ + utils.o LIBIPROUTE-$(CONFIG_IPROUTE) += \ - ip_parse_common_args \ - iproute \ - libnetlink \ - ll_map \ - rt_names \ - rtm_map \ - utils + ip_parse_common_args.o \ + iproute.o \ + libnetlink.o \ + ll_map.o \ + rt_names.o \ + rtm_map.o \ + utils.o LIBIPROUTE-$(CONFIG_IPTUNNEL) += \ - ip_parse_common_args \ - iptunnel \ - rt_names \ - utils + ip_parse_common_args.o \ + iptunnel.o \ + rt_names.o \ + utils.o LIBIPROUTE-y:=$(sort $(LIBIPROUTE-y)) -LIBIPROUTE_SRC-y:=$(patsubst %,$(srcdir)/%.c,$(LIBIPROUTE-y)) +LIBIPROUTE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBIPROUTE-y))) LIBIPROUTE_SRC-a:=$(wildcard $(srcdir)/*.c) LIBRARY_SRC-y+=$(LIBIPROUTE_SRC-y) LIBRARY_SRC-a+=$(LIBIPROUTE_SRC-a) -networking_libiproute_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBIPROUTE-y)) +LIBIPROUTE-obj:=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR) + +ifneq ($(strip $(LIBIPROUTE-y)),) +libraries-y+=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR) +endif -$(networking_libiproute_OBJ$(os)): $(objdir)/%$(os): $(srcdir)/%.c -$(objdir)/libiproute.a: $(networking_libiproute_OBJ$(os)) -libraries-y:=$(libraries-y) $(objdir)/libiproute.a +$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)/%,$(LIBIPROUTE-y)) + $(do_ar) +$(LIBIPROUTE_DIR)/%.o: $(srcdir)/%.c + $(compile.c) diff --git a/networking/udhcp/Makefile.in b/networking/udhcp/Makefile.in index 210939fd6..df32247c6 100644 --- a/networking/udhcp/Makefile.in +++ b/networking/udhcp/Makefile.in @@ -3,9 +3,13 @@ # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> # # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. +# -srcdir:=$(top_srcdir)/networking/udhcp -objdir:=$(top_builddir)/networking/udhcp +UDHCP_AR:=udhcp.a +ifndef $(UDHCP_DIR) +UDHCP_DIR:=$(top_builddir)/networking/udhcp/ +endif +srcdir=$(top_srcdir)/networking/udhcp #ok, so I forgot how to do an or, but this is a quick and dirty hack ifeq ($(strip $(CONFIG_UDHCPC)),y) @@ -18,77 +22,32 @@ CONFIG_UDHCP_SHARED=n endif endif -UDHCP__SHARED_FILES:=common.c options.c packet.c pidfile.c signalpipe.c socket.c -UDHCP__UDHCPC_FILES:=dhcpc.c clientpacket.c clientsocket.c script.c -UDHCP__UDHCPD_FILES:=dhcpd.c arpping.c files.c leases.c serverpacket.c \ - static_leases.c -UDHCP__DUMPLEASES_FILES:=dumpleases.c - -UDHCP-$(CONFIG_UDHCP_SHARED) += $(UDHCP__SHARED_FILES) -UDHCP-$(CONFIG_UDHCPC) += $(UDHCP__UDHCPC_FILES) -UDHCP-$(CONFIG_UDHCPD) += $(UDHCP__UDHCPD_FILES) -UDHCP-$(CONFIG_DUMPLEASES) += $(UDHCP__DUMPLEASES_FILES) +UDHCP-y:= +UDHCP-$(CONFIG_UDHCP_SHARED) += common.c options.c packet.c pidfile.c \ + signalpipe.c socket.c +UDHCP-$(CONFIG_UDHCPC) += dhcpc.c clientpacket.c clientsocket.c \ + script.c +UDHCP-$(CONFIG_UDHCPD) += dhcpd.c arpping.c files.c leases.c \ + serverpacket.c static_leases.c +UDHCP-$(CONFIG_DUMPLEASES) += dumpleases.c +UDHCP_OBJS:=$(patsubst %.c,$(UDHCP_DIR)%.o, $(UDHCP-y)) + +ifneq ($(strip $(UDHCP-y)),) +libraries-y+=$(UDHCP_DIR)$(UDHCP_AR) +endif -UDHCP_SRC-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y)) -UDHCP_SRC-a:=$(wildcard $(srcdir)/*.c) -APPLET_SRC-y+=$(UDHCP_SRC-y) -APPLET_SRC-a+=$(UDHCP_SRC-a) +UDHCP-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y)) +UDHCP-a:=$(wildcard $(srcdir)/*.c) +APPLET_SRC-y+=$(UDHCP-y) +APPLET_SRC-a+=$(UDHCP-a) UDHCP_INCLUDES:=$(srcdir) -#APPLETS_DEFINE-y+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX -#APPLETS_DEFINE-a+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX - -CFLAGS-udhcp:= -I$(UDHCP_INCLUDES) - -# bug in make-3.80 prevents this: -#define udhcp__flags -#CFLAGS-udhcp-$(1):=-DIN_BUSYBOX -#endef -# -#ifeq ($(CONFIG_UDHCP_SHARED),y) -#$(foreach f,$(UDHCP__SHARED_FILES),$(eval $(call udhcp__flags,$(f)))) -#endif -#ifeq ($(CONFIG_UDHCPC),y) -#$(foreach f,$(UDHCP__UDHCPC_FILES),$(eval $(call udhcp__flags,$(f)))) -#endif -#ifeq ($(CONFIG_UDHCPD),y) -#$(foreach f,$(UDHCP__UDHCPD_FILES),$(eval $(call udhcp__flags,$(f)))) -#endif -#ifeq ($(CONFIG_DUMPLEASES),y) -#$(foreach f,$(UDHCP__DUMPLEASES_FILES),$(eval $(call udhcp__flags,$(f)))) -#endif - -ifeq ($(CONFIG_UDHCP_SHARED),y) -CFLAGS-udhcp-common.c:=-DIN_BUSYBOX -CFLAGS-udhcp-options.c:=-DIN_BUSYBOX -CFLAGS-udhcp-packet.c:=-DIN_BUSYBOX -CFLAGS-udhcp-pidfile.c:=-DIN_BUSYBOX -CFLAGS-udhcp-signalpipe.c:=-DIN_BUSYBOX -CFLAGS-udhcp-socket.c:=-DIN_BUSYBOX -endif -ifeq ($(CONFIG_UDHCPC),y) -CFLAGS-udhcp-dhcpc.c:=-DIN_BUSYBOX -CFLAGS-udhcp-clientpacket.c:=-DIN_BUSYBOX -CFLAGS-udhcp-clientsocket.c:=-DIN_BUSYBOX -CFLAGS-udhcp-script.c:=-DIN_BUSYBOX -endif -ifeq ($(CONFIG_UDHCPD),y) -CFLAGS-udhcp-dhcpd.c:=-DIN_BUSYBOX -CFLAGS-udhcp-arpping.c:=-DIN_BUSYBOX -CFLAGS-udhcp-files.c:=-DIN_BUSYBOX -CFLAGS-udhcp-leases.c:=-DIN_BUSYBOX -CFLAGS-udhcp-serverpacket.c:=-DIN_BUSYBOX -CFLAGS-udhcp-static_leases.c:=-DIN_BUSYBOX -endif -ifeq ($(CONFIG_DUMPLEASES),y) -CFLAGS-udhcp-dumpleases.c:=-DIN_BUSYBOX -endif - - -networking_udhcp_OBJ:=$(patsubst %.c,$(objdir)/%.o,$(UDHCP-y)) +APPLETS_DEFINE-y+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES) +APPLETS_DEFINE-a+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES) -$(networking_udhcp_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/udhcp.a: $(networking_udhcp_OBJ) -libraries-y:=$(libraries-y) $(objdir)/udhcp.a +$(UDHCP_DIR)$(UDHCP_AR): $(UDHCP_OBJS) + $(do_ar) +$(UDHCP_OBJS): $(UDHCP_DIR)%.o : $(srcdir)/%.c + $(compile.c) -DIN_BUSYBOX diff --git a/procps/Makefile.in b/procps/Makefile.in index 69455eb26..261c49b02 100644 --- a/procps/Makefile.in +++ b/procps/Makefile.in @@ -4,9 +4,13 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/procps -objdir:=$(top_builddir)/procps +PROCPS_AR:=procps.a +ifndef $(PROCPS_DIR) +PROCPS_DIR:=$(top_builddir)/procps/ +endif +srcdir=$(top_srcdir)/procps +PROCPS-y:= PROCPS-$(CONFIG_FREE) += free.o PROCPS-$(CONFIG_KILL) += kill.o PROCPS-$(CONFIG_PIDOF) += pidof.o @@ -17,15 +21,17 @@ PROCPS-$(CONFIG_TOP) += top.o PROCPS-$(CONFIG_UPTIME) += uptime.o PROCPS-$(CONFIG_FUSER) += fuser.o +ifneq ($(strip $(PROCPS-y)),) +libraries-y+=$(PROCPS_DIR)$(PROCPS_AR) +endif PROCPS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(PROCPS-y)) PROCPS_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(PROCPS_SRC-y) APPLET_SRC-a+=$(PROCPS_SRC-a) -procps_OBJ:= $(patsubst %,$(objdir)/%,$(PROCPS-y)) - -$(procps_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/procps.a: $(procps_OBJ) -libraries-y:=$(libraries-y) $(objdir)/procps.a +$(PROCPS_DIR)$(PROCPS_AR): $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y)) + $(do_ar) +$(PROCPS_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/scripts/config/Makefile b/scripts/config/Makefile index 716e130da..4c966f7a6 100644 --- a/scripts/config/Makefile +++ b/scripts/config/Makefile @@ -2,12 +2,8 @@ # # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org> -ifndef top_srcdir top_srcdir=../.. -endif -ifndef top_builddir top_builddir=../.. -endif srcdir=$(top_srcdir)/scripts/config include $(top_srcdir)/Rules.mak @@ -54,10 +50,12 @@ MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC)) SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC)) conf: $(CONF_OBJS) $(SHARED_OBJS) - $(do_link.h) + $(SECHO) " "HOSTCC $@ ; true + $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ mconf: $(MCONF_OBJS) $(SHARED_OBJS) - $(do_link.h) $(LIBS) + $(SECHO) " "HOSTCC $@ ; true + $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) $(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) $(compile.h) -I. diff --git a/shell/Makefile.in b/shell/Makefile.in index 94cf729a7..fcd93f345 100644 --- a/shell/Makefile.in +++ b/shell/Makefile.in @@ -4,24 +4,30 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/shell -objdir:=$(top_builddir)/shell +SHELL_AR:=shell.a +ifndef $(SHELL_DIR) +SHELL_DIR:=$(top_builddir)/shell/ +endif +srcdir=$(top_srcdir)/shell -SHELL-$(CONFIG_ASH) += ash.o -SHELL-$(CONFIG_HUSH) += hush.o -SHELL-$(CONFIG_LASH) += lash.o -SHELL-$(CONFIG_MSH) += msh.o -SHELL-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o +SHELLT-y:= +SHELLT-$(CONFIG_ASH) += ash.o +SHELLT-$(CONFIG_HUSH) += hush.o +SHELLT-$(CONFIG_LASH) += lash.o +SHELLT-$(CONFIG_MSH) += msh.o +SHELLT-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o +ifneq ($(strip $(SHELLT-y)),) +libraries-y+=$(SHELL_DIR)$(SHELL_AR) +endif -SHELLT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SHELL-y)) +SHELLT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SHELLT-y)) SHELLT_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(SHELLT_SRC-y) APPLET_SRC-a+=$(SHELLT_SRC-a) -shell_OBJ:= $(patsubst %,$(objdir)/%,$(SHELL-y)) - -$(shell_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/shell.a: $(shell_OBJ) -libraries-y:=$(libraries-y) $(objdir)/shell.a +$(SHELL_DIR)$(SHELL_AR): $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y)) + $(do_ar) +$(SHELL_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/sysklogd/Makefile.in b/sysklogd/Makefile.in index 412cf5bab..83f77be90 100644 --- a/sysklogd/Makefile.in +++ b/sysklogd/Makefile.in @@ -4,23 +4,29 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/sysklogd -objdir:=$(top_builddir)/sysklogd +SYSKLOGD_AR:=sysklogd.a +ifndef $(SYSKLOGD_DIR) +SYSKLOGD_DIR:=$(top_builddir)/sysklogd/ +endif +srcdir=$(top_srcdir)/sysklogd +SYSKLOGD-y:= SYSKLOGD-$(CONFIG_KLOGD) += klogd.o SYSKLOGD-$(CONFIG_LOGGER) += logger.o SYSKLOGD-$(CONFIG_LOGREAD) += logread.o SYSKLOGD-$(CONFIG_SYSLOGD) += syslogd.o +ifneq ($(strip $(SYSKLOGD-y)),) +libraries-y+=$(SYSKLOGD_DIR)$(SYSKLOGD_AR) +endif SYSKLOGD_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SYSKLOGD-y)) SYSKLOGD_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(SYSKLOGD_SRC-y) APPLET_SRC-a+=$(SYSKLOGD_SRC-a) -sysklogd_OBJ:= $(patsubst %,$(objdir)/%,$(SYSKLOGD-y)) - -$(sysklogd_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/sysklogd.a: $(sysklogd_OBJ) -libraries-y:=$(libraries-y) $(objdir)/sysklogd.a +$(SYSKLOGD_DIR)$(SYSKLOGD_AR): $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y)) + $(do_ar) +$(SYSKLOGD_DIR)%.o: $(srcdir)/%.c + $(compile.c) diff --git a/util-linux/Makefile.in b/util-linux/Makefile.in index b56a7766e..f6a50b7f7 100644 --- a/util-linux/Makefile.in +++ b/util-linux/Makefile.in @@ -4,51 +4,62 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -srcdir:=$(top_srcdir)/util-linux -objdir:=$(top_builddir)/util-linux - -UTIL-LINUX-$(CONFIG_DMESG) +=dmesg.o -UTIL-LINUX-$(CONFIG_FBSET) +=fbset.o -UTIL-LINUX-$(CONFIG_FDFLUSH) +=fdflush.o -UTIL-LINUX-$(CONFIG_FDFORMAT) +=fdformat.o -UTIL-LINUX-$(CONFIG_FDISK) +=fdisk.o -UTIL-LINUX-$(CONFIG_FREERAMDISK) +=freeramdisk.o -UTIL-LINUX-$(CONFIG_FSCK_MINIX) +=fsck_minix.o -UTIL-LINUX-$(CONFIG_GETOPT) +=getopt.o -UTIL-LINUX-$(CONFIG_HEXDUMP) +=hexdump.o -UTIL-LINUX-$(CONFIG_HWCLOCK) +=hwclock.o -UTIL-LINUX-$(CONFIG_IPCRM) +=ipcrm.o -UTIL-LINUX-$(CONFIG_IPCS) +=ipcs.o -UTIL-LINUX-$(CONFIG_LOSETUP) +=losetup.o -UTIL-LINUX-$(CONFIG_MDEV) +=mdev.o -UTIL-LINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o -UTIL-LINUX-$(CONFIG_MKSWAP) +=mkswap.o -UTIL-LINUX-$(CONFIG_MORE) +=more.o -UTIL-LINUX-$(CONFIG_MOUNT) +=mount.o -UTIL-LINUX-$(CONFIG_FEATURE_MOUNT_NFS) +=nfsmount.o -UTIL-LINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o -UTIL-LINUX-$(CONFIG_RDATE) +=rdate.o -UTIL-LINUX-$(CONFIG_READPROFILE) +=readprofile.o -UTIL-LINUX-$(CONFIG_SETARCH) +=setarch.o -UTIL-LINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o -UTIL-LINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o -UTIL-LINUX-$(CONFIG_UMOUNT) +=umount.o - - -UTILLINUX_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(UTIL-LINUX-y)) +UTILLINUX_AR:=util-linux.a +ifndef $(UTILLINUX_DIR) +UTILLINUX_DIR:=$(top_builddir)/util-linux/ +endif +srcdir=$(top_srcdir)/util-linux + +UTILLINUX-y:= +UTILLINUX-$(CONFIG_DMESG) +=dmesg.o +UTILLINUX-$(CONFIG_FBSET) +=fbset.o +UTILLINUX-$(CONFIG_FDFLUSH) +=fdflush.o +UTILLINUX-$(CONFIG_FDFORMAT) +=fdformat.o +UTILLINUX-$(CONFIG_FDISK) +=fdisk.o +UTILLINUX-$(CONFIG_FREERAMDISK) +=freeramdisk.o +UTILLINUX-$(CONFIG_FSCK_MINIX) +=fsck_minix.o +UTILLINUX-$(CONFIG_GETOPT) +=getopt.o +UTILLINUX-$(CONFIG_HEXDUMP) +=hexdump.o +UTILLINUX-$(CONFIG_HWCLOCK) +=hwclock.o +UTILLINUX-$(CONFIG_IPCRM) +=ipcrm.o +UTILLINUX-$(CONFIG_IPCS) +=ipcs.o +UTILLINUX-$(CONFIG_LOSETUP) +=losetup.o +UTILLINUX-$(CONFIG_MDEV) +=mdev.o +UTILLINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o +UTILLINUX-$(CONFIG_MKSWAP) +=mkswap.o +UTILLINUX-$(CONFIG_MORE) +=more.o +UTILLINUX-$(CONFIG_MOUNT) +=mount.o +UTILLINUX-$(CONFIG_FEATURE_MOUNT_NFS) +=nfsmount.o +UTILLINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o +UTILLINUX-$(CONFIG_RDATE) +=rdate.o +UTILLINUX-$(CONFIG_READPROFILE) +=readprofile.o +UTILLINUX-$(CONFIG_SETARCH) +=setarch.o +UTILLINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o +UTILLINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o +UTILLINUX-$(CONFIG_UMOUNT) +=umount.o + +ifneq ($(strip $(UTILLINUX-y)),) +libraries-y+=$(UTILLINUX_DIR)$(UTILLINUX_AR) +endif + +UTILLINUX_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(UTILLINUX-y)) UTILLINUX_SRC-a:=$(wildcard $(srcdir)/*.c) APPLET_SRC-y+=$(UTILLINUX_SRC-y) APPLET_SRC-a+=$(UTILLINUX_SRC-a) +$(UTILLINUX_DIR)$(UTILLINUX_AR): $(patsubst %,$(UTILLINUX_DIR)%, $(UTILLINUX-y)) + $(do_ar) + +$(UTILLINUX_DIR)%.o: $(srcdir)/%.c + $(compile.c) + ifneq ($(strip $(CONFIG_LFS)),y) ifeq ($(strip $(FDISK_SUPPORT_LARGE_DISKS)),y) -CFLAGS-util-linux-fdisk.c := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -endif -endif -util-linux_OBJ:= $(patsubst %,$(objdir)/%,$(UTIL-LINUX-y)) - -$(util-linux_OBJ): $(objdir)/%.o: $(srcdir)/%.c -$(objdir)/util-linux.a: $(util-linux_OBJ) -libraries-y:=$(libraries-y) $(objdir)/util-linux.a +$(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 |