3 # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Library General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option) any
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 include $(TOPDIR)Rules.mak
22 all: ncurses conf mconf
25 ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
26 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
28 ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
29 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
31 ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
32 HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
34 HOSTNCURSES += -DCURSES_LOC="<curses.h>"
41 MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
42 SHARED_SRC=zconf.tab.c
43 SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
44 CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
45 MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
46 SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
48 conf: $(CONF_OBJS) $(SHARED_OBJS)
49 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
51 mconf: $(MCONF_OBJS) $(SHARED_OBJS)
52 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
54 $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
55 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
57 $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
58 $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
60 lkc_defs.h: lkc_proto.h
61 @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
64 # The following requires flex/bison
65 # By default we use the _shipped versions, uncomment the
66 # following line if you are modifying the flex/bison src.
72 bison -t -d -v -b $* -p $(notdir $*) $<
75 flex -P$(notdir $*) -o$@ $<
78 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
79 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
81 lex.zconf.c: lex.zconf.c_shipped
82 cp lex.zconf.c_shipped lex.zconf.c
84 zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
85 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
87 zconf.tab.c: zconf.tab.c_shipped
88 cp zconf.tab.c_shipped zconf.tab.c
90 zconf.tab.h: zconf.tab.h_shipped
91 cp zconf.tab.h_shipped zconf.tab.h
97 @echo "main() {}" > lxtemp.c
98 @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
99 rm -f lxtemp.c a.out; \
103 echo ">> Unable to find the Ncurses libraries." ;\
105 echo ">> You must have Ncurses installed in order" ;\
106 echo ">> to use 'make menuconfig'" ;\
112 rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
113 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h