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