Update bridge utils to latest version
[gumsense-br.git] / package / config / Makefile
blobe2ca6fdd87e04de8f87e6df66ed4c764935889ea
1 # Makefile for buildroot2
3 # Copyright (C) 2002-2005 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
8 # later version.
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
13 # details.
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
19 # Select the compiler needed to build binaries for your development system
20 HOSTCC = gcc
21 HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
22 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
23 LC_ALL:= C
25 all: ncurses conf mconf
27 ifeq ($(shell uname),SunOS)
28 LIBS = -lcurses
29 else
30 LIBS = -lncurses
31 endif
32 ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
33 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
34 else
35 ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
36 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
37 else
38 ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
39 HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
40 else
41 ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
42 HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
43 else
44 ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
45 HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
46 else
47 HOSTNCURSES += -DCURSES_LOC="<curses.h>"
48 endif
49 endif
50 endif
51 endif
52 endif
54 CONF_SRC = conf.c
55 MCONF_SRC = mconf.c
56 LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
57 lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
58 lxdialog/msgbox.c
59 SHARED_SRC = zconf.tab.c
60 SHARED_DEPS := lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
61 CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC))
62 MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
63 SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
65 conf: $(CONF_OBJS) $(SHARED_OBJS)
66 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
68 mconf: $(MCONF_OBJS) $(SHARED_OBJS)
69 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
71 $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
72 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
74 $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
75 $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
77 lkc_defs.h: lkc_proto.h
78 @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
80 ###
81 # The following requires flex/bison
82 # By default we use the _shipped versions, uncomment the
83 # following line if you are modifying the flex/bison src.
84 #LKC_GENPARSER := 1
86 ifdef LKC_GENPARSER
88 %.tab.c %.tab.h: %.y
89 bison -t -d -v -b $* -p $(notdir $*) $<
91 lex.%.c: %.l
92 flex -P$(notdir $*) -o$@ $<
93 else
95 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
96 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
98 lex.zconf.c: lex.zconf.c_shipped
99 cp lex.zconf.c_shipped lex.zconf.c
101 zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
102 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
104 zconf.tab.c: zconf.tab.c_shipped
105 cp zconf.tab.c_shipped zconf.tab.c
107 zconf.tab.h: zconf.tab.h_shipped
108 cp zconf.tab.h_shipped zconf.tab.h
109 endif
111 .PHONY: ncurses
113 ncurses:
114 @echo "main() {}" > lxtemp.c
115 @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
116 $(RM) lxtemp.c a.out; \
117 else \
118 $(RM) lxtemp.c; \
119 echo -e "\007" ;\
120 echo ">> Unable to find the Ncurses libraries." ;\
121 echo ">>" ;\
122 echo ">> You must have Ncurses installed in order" ;\
123 echo ">> to use 'make menuconfig'" ;\
124 echo ">>" ;\
125 echo ">> Maybe you want to try 'make config', which" ;\
126 echo ">> doesn't depend on the Ncurses libraries." ;\
127 echo ;\
128 exit 1 ;\
131 clean:
132 $(RM) *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
133 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h