blob: ab3df49937efb7e365a2e51fb8de34c5043142f6 [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
Eric Andersenc9f20d92002-12-05 08:41:41 +00008all: ncurses conf mconf
9
Eric Andersenc9f20d92002-12-05 08:41:41 +000010LIBS = -lncurses
11ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
Eric Andersen068b6b02002-12-13 22:53:28 +000012 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
Eric Andersenc9f20d92002-12-05 08:41:41 +000013else
14ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
Eric Andersen068b6b02002-12-13 22:53:28 +000015 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
Eric Andersenc9f20d92002-12-05 08:41:41 +000016else
Eric Andersen575c7822003-01-11 18:07:38 +000017ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
18 HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
19else
20ifeq (/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>"
22else
Eric Andersenc9f20d92002-12-05 08:41:41 +000023ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
Eric Andersen068b6b02002-12-13 22:53:28 +000024 HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
Eric Andersenc9f20d92002-12-05 08:41:41 +000025else
Eric Andersen068b6b02002-12-13 22:53:28 +000026 HOSTNCURSES += -DCURSES_LOC="<curses.h>"
Eric Andersenc9f20d92002-12-05 08:41:41 +000027endif
28endif
29endif
Eric Andersen575c7822003-01-11 18:07:38 +000030endif
31endif
Eric Andersenc9f20d92002-12-05 08:41:41 +000032
Eric Andersen068b6b02002-12-13 22:53:28 +000033CONF_SRC =conf.c
34MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
35SHARED_SRC=zconf.tab.c
36SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
Eric Andersenc9f20d92002-12-05 08:41:41 +000037CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
38MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
Eric Andersen068b6b02002-12-13 22:53:28 +000039SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
Eric Andersenc9f20d92002-12-05 08:41:41 +000040
Eric Andersen068b6b02002-12-13 22:53:28 +000041conf: $(CONF_OBJS) $(SHARED_OBJS)
42 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
Eric Andersenc9f20d92002-12-05 08:41:41 +000043
Eric Andersen068b6b02002-12-13 22:53:28 +000044mconf: $(MCONF_OBJS) $(SHARED_OBJS)
45 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
Eric Andersenc9f20d92002-12-05 08:41:41 +000046
Eric Andersen068b6b02002-12-13 22:53:28 +000047$(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
Eric Andersenc9f20d92002-12-05 08:41:41 +000048 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
49
Eric Andersen068b6b02002-12-13 22:53:28 +000050$(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
51 $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
52
Eric Andersenc9f20d92002-12-05 08:41:41 +000053lkc_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
62ifdef LKC_GENPARSER
63
64%.tab.c %.tab.h: %.y
65 bison -t -d -v -b $* -p $(notdir $*) $<
66
67lex.%.c: %.l
68 flex -P$(notdir $*) -o$@ $<
69else
70
Eric Andersen068b6b02002-12-13 22:53:28 +000071lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
72 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
73
Eric Andersenc9f20d92002-12-05 08:41:41 +000074lex.zconf.c: lex.zconf.c_shipped
75 cp lex.zconf.c_shipped lex.zconf.c
76
Eric Andersen068b6b02002-12-13 22:53:28 +000077zconf.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 Andersenc9f20d92002-12-05 08:41:41 +000080zconf.tab.c: zconf.tab.c_shipped
81 cp zconf.tab.c_shipped zconf.tab.c
82
83zconf.tab.h: zconf.tab.h_shipped
84 cp zconf.tab.h_shipped zconf.tab.h
85endif
86
87.PHONY: ncurses
88
89ncurses:
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
104clean:
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