Fix lzo build
[openwrt.git] / package / config / Makefile
1 # Makefile for buildroot2
2 #
3 # Copyright (C) 2002-2004 Erik Andersen <andersen@codepoet.org>
4
5
6 # Select the compiler needed to build binaries for your development system
7 HOSTCC = gcc
8 HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
9 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
10 LC_ALL:= C
11
12
13 all: ncurses conf mconf
14
15 LIBS = -lncurses
16 ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
17 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
18 else
19 ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
20 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
21 else
22 ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
23 HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
24 else
25 ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
26 HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
27 else
28 ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
29 HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
30 else
31 HOSTNCURSES += -DCURSES_LOC="<curses.h>"
32 endif
33 endif
34 endif
35 endif
36 endif
37
38 CONF_SRC =conf.c
39 MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
40 SHARED_SRC=zconf.tab.c
41 SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
42 CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
43 MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
44 SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
45
46 conf: $(CONF_OBJS) $(SHARED_OBJS)
47 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
48
49 mconf: $(MCONF_OBJS) $(SHARED_OBJS)
50 $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
51
52 $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
53 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
54
55 $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
56 $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
57
58 lkc_defs.h: lkc_proto.h
59 @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
60
61 ###
62 # The following requires flex/bison
63 # By default we use the _shipped versions, uncomment the
64 # following line if you are modifying the flex/bison src.
65 #LKC_GENPARSER := 1
66
67 ifdef LKC_GENPARSER
68
69 %.tab.c %.tab.h: %.y
70 bison -t -d -v -b $* -p $(notdir $*) $<
71
72 lex.%.c: %.l
73 flex -P$(notdir $*) -o$@ $<
74 else
75
76 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
77 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
78
79 lex.zconf.c: lex.zconf.c_shipped
80 cp lex.zconf.c_shipped lex.zconf.c
81
82 zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
83 $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
84
85 zconf.tab.c: zconf.tab.c_shipped
86 cp zconf.tab.c_shipped zconf.tab.c
87
88 zconf.tab.h: zconf.tab.h_shipped
89 cp zconf.tab.h_shipped zconf.tab.h
90 endif
91
92 .PHONY: ncurses
93
94 ncurses:
95 @echo "main() {}" > lxtemp.c
96 @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
97 rm -f lxtemp.c a.out; \
98 else \
99 rm -f lxtemp.c; \
100 echo -e "\007" ;\
101 echo ">> Unable to find the Ncurses libraries." ;\
102 echo ">>" ;\
103 echo ">> You must have Ncurses installed in order" ;\
104 echo ">> to use 'make menuconfig'" ;\
105 echo ;\
106 exit 1 ;\
107 fi
108
109 clean:
110 rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
111 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h
112
This page took 0.046073 seconds and 5 git commands to generate.