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