blob: d43c8b14fc43e66bc50c88bc3686da1e7a866a15 [file] [log] [blame]
Eric Andersenc9f20d92002-12-05 08:41:41 +00001# Makefile for BusyBox
2#
3# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
4
5TOPDIR=../../
6include $(TOPDIR)Rules.mak
7
8
9all: ncurses conf mconf
10
11#HOSTCFLAGS=-Wall -g -O0
12LIBS = -lncurses
13ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
14 HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
15else
16ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
17 HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
18else
19ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
20 HOSTCFLAGS += -DCURSES_LOC="<ncurses.h>"
21else
22 HOSTCFLAGS += -DCURSES_LOC="<curses.h>"
23endif
24endif
25endif
26
27
28CONF_SRC =conf.c zconf.tab.c
29MCONF_SRC =mconf.c zconf.tab.c
30LXDLG_SRC =checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
31CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
32MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
33LXDLG_OBJS=$(patsubst %.c,%.o, $(LXDLG_SRC))
34
35conf: $(CONF_OBJS)
36 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@
37
38mconf: $(MCONF_OBJS) $(LXDLG_OBJS)
39 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
40
41lkc_deps:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
42
43conf.o: conf.c $(lkc_deps)
44
45mconf.o: mconf.c $(lkc_deps)
46
47zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps)
48
49lex.zconf.o: lex.zconf.c $(lkc_deps)
50
51%.o : %.c
52 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
53
54lkc_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
63ifdef LKC_GENPARSER
64
65%.tab.c %.tab.h: %.y
66 bison -t -d -v -b $* -p $(notdir $*) $<
67
68lex.%.c: %.l
69 flex -P$(notdir $*) -o$@ $<
70else
71
72lex.zconf.c: lex.zconf.c_shipped
73 cp lex.zconf.c_shipped lex.zconf.c
74
75zconf.tab.c: zconf.tab.c_shipped
76 cp zconf.tab.c_shipped zconf.tab.c
77
78zconf.tab.h: zconf.tab.h_shipped
79 cp zconf.tab.h_shipped zconf.tab.h
80endif
81
82.PHONY: ncurses
83
84ncurses:
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
99clean:
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