Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 1 | # Makefile for BusyBox |
| 2 | # |
| 3 | # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org> |
| 4 | |
Bernhard Reutner-Fischer | 022eb31 | 2006-03-02 17:33:25 +0000 | [diff] [blame] | 5 | ifndef top_srcdir |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 6 | top_srcdir=../.. |
Bernhard Reutner-Fischer | 022eb31 | 2006-03-02 17:33:25 +0000 | [diff] [blame] | 7 | endif |
| 8 | ifndef top_builddir |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 9 | top_builddir=../.. |
Bernhard Reutner-Fischer | 022eb31 | 2006-03-02 17:33:25 +0000 | [diff] [blame] | 10 | endif |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 11 | srcdir=$(top_srcdir)/scripts/config |
Rob Landley | e1d9633 | 2005-08-24 00:41:52 +0000 | [diff] [blame] | 12 | include $(top_srcdir)/Rules.mak |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 13 | |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 14 | all: ncurses conf mconf |
| 15 | |
Peter Kjellerstedt | bae38db | 2005-04-19 09:55:06 +0000 | [diff] [blame] | 16 | ifeq ($(shell uname),SunOS) |
| 17 | LIBS = -lcurses |
| 18 | else |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 19 | LIBS = -lncurses |
Peter Kjellerstedt | bae38db | 2005-04-19 09:55:06 +0000 | [diff] [blame] | 20 | endif |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 21 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 22 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 23 | else |
| 24 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 25 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 26 | else |
Eric Andersen | 575c782 | 2003-01-11 18:07:38 +0000 | [diff] [blame] | 27 | ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h)) |
| 28 | HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>" |
| 29 | else |
| 30 | ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h)) |
| 31 | HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" |
| 32 | else |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 33 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 34 | HOSTNCURSES += -DCURSES_LOC="<ncurses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 35 | else |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 36 | HOSTNCURSES += -DCURSES_LOC="<curses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 37 | endif |
| 38 | endif |
| 39 | endif |
Eric Andersen | 575c782 | 2003-01-11 18:07:38 +0000 | [diff] [blame] | 40 | endif |
| 41 | endif |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 42 | |
Peter Kjellerstedt | bae38db | 2005-04-19 09:55:06 +0000 | [diff] [blame] | 43 | CONF_SRC = conf.c |
| 44 | MCONF_SRC = mconf.c |
| 45 | LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \ |
| 46 | lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \ |
| 47 | lxdialog/msgbox.c |
Rob Landley | e1d9633 | 2005-08-24 00:41:52 +0000 | [diff] [blame] | 48 | |
Peter Kjellerstedt | bae38db | 2005-04-19 09:55:06 +0000 | [diff] [blame] | 49 | SHARED_SRC = zconf.tab.c |
| 50 | SHARED_DEPS := $(srcdir)/lkc.h $(srcdir)/lkc_proto.h \ |
| 51 | lkc_defs.h $(srcdir)/expr.h zconf.tab.h |
| 52 | CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC)) |
| 53 | MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC)) |
| 54 | SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC)) |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 55 | |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 56 | conf: $(CONF_OBJS) $(SHARED_OBJS) |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 57 | $(do_link.h) |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 58 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 59 | mconf: $(MCONF_OBJS) $(SHARED_OBJS) |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 60 | $(do_link.h) $(LIBS) |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 61 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 62 | $(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 63 | $(compile.h) -I. |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 64 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 65 | $(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS) |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 66 | @[ -d $(@D) ] || mkdir $(@D) |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 67 | $(compile.h) $(HOSTNCURSES) -I. |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 68 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 69 | lkc_defs.h: $(srcdir)/lkc_proto.h |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 70 | @$(SED) < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 71 | |
| 72 | ### |
| 73 | # The following requires flex/bison |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 74 | # By default we use the _shipped versions, uncomment the |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 75 | # following line if you are modifying the flex/bison src. |
| 76 | #LKC_GENPARSER := 1 |
| 77 | |
| 78 | ifdef LKC_GENPARSER |
| 79 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 80 | %.tab.c %.tab.h: $(srcdir)/%.y |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 81 | bison -t -d -v -b $* -p $(notdir $*) $< |
| 82 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 83 | lex.%.c: $(srcdir)/%.l |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 84 | flex -P$(notdir $*) -o$@ $< |
| 85 | else |
| 86 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 87 | lex.zconf.o: lex.zconf.c $(SHARED_DEPS) |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 88 | $(compile.h) -I$(srcdir) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 89 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 90 | lex.zconf.c: $(srcdir)/lex.zconf.c_shipped |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 91 | $(Q)cp $< $@ |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 92 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 93 | zconf.tab.c: $(srcdir)/zconf.tab.c_shipped |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 94 | $(Q)cp $< $@ |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 95 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 96 | zconf.tab.h: $(srcdir)/zconf.tab.h_shipped |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 97 | $(Q)cp $< $@ |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 98 | endif |
| 99 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 100 | zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \ |
| 101 | $(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS) |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 102 | $(compile.h) -I$(srcdir) -I. |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 103 | |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 104 | .PHONY: ncurses |
| 105 | |
| 106 | ncurses: |
| 107 | @echo "main() {}" > lxtemp.c |
| 108 | @if $(HOSTCC) lxtemp.c $(LIBS) ; then \ |
| 109 | rm -f lxtemp.c a.out; \ |
| 110 | else \ |
| 111 | rm -f lxtemp.c; \ |
| 112 | echo -e "\007" ;\ |
| 113 | echo ">> Unable to find the Ncurses libraries." ;\ |
| 114 | echo ">>" ;\ |
| 115 | echo ">> You must have Ncurses installed in order" ;\ |
| 116 | echo ">> to use 'make menuconfig'" ;\ |
| 117 | echo ;\ |
| 118 | exit 1 ;\ |
| 119 | fi |
| 120 | |
| 121 | clean: |
| 122 | rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \ |
| 123 | conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h |
| 124 | |