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 | |
| 5 | TOPDIR=../../ |
| 6 | include $(TOPDIR)Rules.mak |
| 7 | |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 8 | all: ncurses conf mconf |
| 9 | |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 10 | LIBS = -lncurses |
| 11 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 12 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 13 | else |
| 14 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 15 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 16 | else |
Eric Andersen | 575c782 | 2003-01-11 18:07:38 +0000 | [diff] [blame] | 17 | ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h)) |
| 18 | HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>" |
| 19 | else |
| 20 | ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h)) |
| 21 | HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" |
| 22 | else |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 23 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 24 | HOSTNCURSES += -DCURSES_LOC="<ncurses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 25 | else |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 26 | HOSTNCURSES += -DCURSES_LOC="<curses.h>" |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 27 | endif |
| 28 | endif |
| 29 | endif |
Eric Andersen | 575c782 | 2003-01-11 18:07:38 +0000 | [diff] [blame] | 30 | endif |
| 31 | endif |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 32 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 33 | CONF_SRC =conf.c |
| 34 | MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c |
| 35 | SHARED_SRC=zconf.tab.c |
| 36 | SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 37 | CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC)) |
| 38 | MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC)) |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 39 | SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC)) |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 40 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 41 | conf: $(CONF_OBJS) $(SHARED_OBJS) |
| 42 | $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 43 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 44 | mconf: $(MCONF_OBJS) $(SHARED_OBJS) |
| 45 | $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 46 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 47 | $(CONF_OBJS): %.o : %.c $(SHARED_DEPS) |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 48 | $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ |
| 49 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 50 | $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS) |
| 51 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@ |
| 52 | |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 53 | lkc_defs.h: lkc_proto.h |
| 54 | @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' |
| 55 | |
| 56 | ### |
| 57 | # The following requires flex/bison |
| 58 | # By default we use the _shipped versions, uncomment the |
| 59 | # following line if you are modifying the flex/bison src. |
| 60 | #LKC_GENPARSER := 1 |
| 61 | |
| 62 | ifdef LKC_GENPARSER |
| 63 | |
| 64 | %.tab.c %.tab.h: %.y |
| 65 | bison -t -d -v -b $* -p $(notdir $*) $< |
| 66 | |
| 67 | lex.%.c: %.l |
| 68 | flex -P$(notdir $*) -o$@ $< |
| 69 | else |
| 70 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 71 | lex.zconf.o: lex.zconf.c $(SHARED_DEPS) |
| 72 | $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ |
| 73 | |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 74 | lex.zconf.c: lex.zconf.c_shipped |
| 75 | cp lex.zconf.c_shipped lex.zconf.c |
| 76 | |
Eric Andersen | 068b6b0 | 2002-12-13 22:53:28 +0000 | [diff] [blame] | 77 | zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS) |
| 78 | $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ |
| 79 | |
Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 80 | zconf.tab.c: zconf.tab.c_shipped |
| 81 | cp zconf.tab.c_shipped zconf.tab.c |
| 82 | |
| 83 | zconf.tab.h: zconf.tab.h_shipped |
| 84 | cp zconf.tab.h_shipped zconf.tab.h |
| 85 | endif |
| 86 | |
| 87 | .PHONY: ncurses |
| 88 | |
| 89 | ncurses: |
| 90 | @echo "main() {}" > lxtemp.c |
| 91 | @if $(HOSTCC) lxtemp.c $(LIBS) ; then \ |
| 92 | rm -f lxtemp.c a.out; \ |
| 93 | else \ |
| 94 | rm -f lxtemp.c; \ |
| 95 | echo -e "\007" ;\ |
| 96 | echo ">> Unable to find the Ncurses libraries." ;\ |
| 97 | echo ">>" ;\ |
| 98 | echo ">> You must have Ncurses installed in order" ;\ |
| 99 | echo ">> to use 'make menuconfig'" ;\ |
| 100 | echo ;\ |
| 101 | exit 1 ;\ |
| 102 | fi |
| 103 | |
| 104 | clean: |
| 105 | rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \ |
| 106 | conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h |
| 107 | |