From e1d9633e20d8f3153602249441df916cd31f303f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 24 Aug 2005 00:41:52 +0000 Subject: [PATCH] Bernhard Fischer submitted a couple of Makefile patches: - Fix building out-of-tree - remove duplicate rule in toplevel Makefile - peruse make's builtin notion of `dirname $@' --- Makefile | 14 ++++++-------- e2fsprogs/Makefile.in | 8 +++++--- scripts/config/Makefile | 4 +++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 187f3fcd6..757c41b18 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ endif export srctree=$(top_srcdir) vpath %/Config.in $(srctree) -include $(top_builddir)/Rules.mak +include $(top_srcdir)/Rules.mak DIRS:=applets archival archival/libunarchive coreutils console-tools \ debianutils editors findutils init miscutils modutils networking \ @@ -115,7 +115,7 @@ all: busybox busybox.links doc all_tree: $(ALL_MAKEFILES) $(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile - d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@ + [ -d $(@D) ] || mkdir -p $(@D); cp $< $@ # In this section, we need .config -include $(top_builddir)/.config.cmd @@ -219,7 +219,8 @@ include/bb_config.h: include/config.h echo "#endif" >> $@ include/bbconfigopts.h: .config - scripts/config/mkconfigs >include/bbconfigopts.h + @[ -d $(@D) ] || mkdir -v $(@D) + $(top_srcdir)/scripts/config/mkconfigs >include/bbconfigopts.h finished2: $(SECHO) @@ -233,16 +234,13 @@ all: menuconfig # configuration # --------------------------------------------------------------------------- -$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile - d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@ - -scripts/config/conf: scripts/config/Makefile Rules.mak +scripts/config/conf: scripts/config/Makefile $(top_srcdir)/Rules.mak $(MAKE) -C scripts/config conf -@if [ ! -f .config ] ; then \ cp $(CONFIG_DEFCONFIG) .config; \ fi -scripts/config/mconf: scripts/config/Makefile Rules.mak +scripts/config/mconf: scripts/config/Makefile $(top_srcdir)/Rules.mak $(MAKE) -C scripts/config ncurses conf mconf -@if [ ! -f .config ] ; then \ cp $(CONFIG_DEFCONFIG) .config; \ diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in index dfdf77a65..ed307c1ea 100644 --- a/e2fsprogs/Makefile.in +++ b/e2fsprogs/Makefile.in @@ -18,12 +18,12 @@ # E2FSPROGS_AR:=e2fsprogs.a -ifndef $(E2FSPROGS_DIR) + E2FSPROGS_DIR:=$(top_builddir)/e2fsprogs/ -endif + srcdir=$(top_srcdir)/e2fsprogs -E2FSPROGS_CFLAGS := -I$(E2FSPROGS_DIR) -include $(E2FSPROGS_DIR)e2fsbb.h +E2FSPROGS_CFLAGS := -I$(srcdir) -include $(srcdir)/e2fsbb.h BLKID_SRC := cache.c dev.c devname.c devno.c getsize.c llseek.c probe.c \ read.c resolve.c save.c tag.c resolve.c @@ -63,5 +63,7 @@ libraries-y+=$(E2FSPROGS_DIR)$(E2FSPROGS_AR) $(E2FSPROGS_DIR)$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)%, $(E2FSPROGS-y)) $(AR) $(ARFLAGS) $@ $(patsubst %,$(E2FSPROGS_DIR)%, $(E2FSPROGS-y)) +# for e2p/*: check if the dir exists, dude $(E2FSPROGS_DIR)%.o: $(srcdir)/%.c + @[ -d $(@D) ] || mkdir -v $(@D) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(E2FSPROGS_CFLAGS) -c -o $@ $< diff --git a/scripts/config/Makefile b/scripts/config/Makefile index 3c4669f8c..4d95ce078 100644 --- a/scripts/config/Makefile +++ b/scripts/config/Makefile @@ -5,7 +5,7 @@ top_srcdir=../.. top_builddir=../.. srcdir=$(top_srcdir)/scripts/config -include $(top_builddir)/Rules.mak +include $(top_srcdir)/Rules.mak all: ncurses conf mconf @@ -41,6 +41,7 @@ MCONF_SRC = mconf.c LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \ lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \ lxdialog/msgbox.c + SHARED_SRC = zconf.tab.c SHARED_DEPS := $(srcdir)/lkc.h $(srcdir)/lkc_proto.h \ lkc_defs.h $(srcdir)/expr.h zconf.tab.h @@ -58,6 +59,7 @@ $(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ $(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) + @[ -d $(@D) ] || mkdir -v $(@D) $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@ lkc_defs.h: $(srcdir)/lkc_proto.h