From 7daa076d3e24e84ce1f4e9b6133783816575c4c8 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 8 Oct 2004 07:46:08 +0000 Subject: egor duda writes: Hi! I've created a patch to busybox' build system to allow building it in separate tree in a manner similar to kbuild from kernel version 2.6. That is, one runs command like 'make O=/build/some/where/for/specific/target/and/options' and everything is built in this exact directory, provided that it exists. I understand that applyingc such invasive changes during 'release candidates' stage of development is at best unwise. So, i'm currently asking for comments about this patch, starting from whether such thing is needed at all to whether it coded properly. 'make check' should work now, and one make creates Makefile in build directory, so one can run 'make' in build directory after that. One possible caveat is that if we build in some directory other than source one, the source directory should be 'distclean'ed first. egor --- scripts/config/Makefile | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'scripts') diff --git a/scripts/config/Makefile b/scripts/config/Makefile index e15ec39..c0b5b9d 100644 --- a/scripts/config/Makefile +++ b/scripts/config/Makefile @@ -2,8 +2,10 @@ # # Copyright (C) 2002 Erik Andersen -TOPDIR=../../ -include $(TOPDIR)Rules.mak +top_srcdir=../.. +top_builddir=../.. +srcdir=$(top_srcdir)/scripts/config +include $(top_builddir)/Rules.mak all: ncurses conf mconf @@ -33,7 +35,8 @@ endif CONF_SRC =conf.c MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c SHARED_SRC=zconf.tab.c -SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h +SHARED_DEPS:=$(srcdir)/lkc.h $(srcdir)/lkc_proto.h \ + lkc_defs.h $(srcdir)/expr.h zconf.tab.h CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC)) MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC)) SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC)) @@ -44,13 +47,13 @@ conf: $(CONF_OBJS) $(SHARED_OBJS) mconf: $(MCONF_OBJS) $(SHARED_OBJS) $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) -$(CONF_OBJS): %.o : %.c $(SHARED_DEPS) +$(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ -$(MCONF_OBJS): %.o : %.c $(SHARED_DEPS) +$(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@ -lkc_defs.h: lkc_proto.h +lkc_defs.h: $(srcdir)/lkc_proto.h @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' ### @@ -61,29 +64,30 @@ lkc_defs.h: lkc_proto.h ifdef LKC_GENPARSER -%.tab.c %.tab.h: %.y +%.tab.c %.tab.h: $(srcdir)/%.y bison -t -d -v -b $* -p $(notdir $*) $< -lex.%.c: %.l +lex.%.c: $(srcdir)/%.l flex -P$(notdir $*) -o$@ $< else lex.zconf.o: lex.zconf.c $(SHARED_DEPS) - $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ - -lex.zconf.c: lex.zconf.c_shipped - cp lex.zconf.c_shipped lex.zconf.c + $(HOSTCC) $(HOSTCFLAGS) -I$(srcdir) -c $< -o $@ -zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS) - $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ +lex.zconf.c: $(srcdir)/lex.zconf.c_shipped + cp $< $@ -zconf.tab.c: zconf.tab.c_shipped - cp zconf.tab.c_shipped zconf.tab.c +zconf.tab.c: $(srcdir)/zconf.tab.c_shipped + cp $< $@ -zconf.tab.h: zconf.tab.h_shipped - cp zconf.tab.h_shipped zconf.tab.h +zconf.tab.h: $(srcdir)/zconf.tab.h_shipped + cp $< $@ endif +zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \ + $(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS) + $(HOSTCC) $(HOSTCFLAGS) -I$(srcdir) -I. -c $< -o $@ + .PHONY: ncurses ncurses: -- cgit v1.1