frosted: add support for stm32f429-discovery
[openadk.git] / adk / config / Makefile
blob480c3144740360cd86dce462a88b31a9c3fa12aa
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include ${ADK_TOPDIR}/prereq.mk
6 ifneq ($(filter-out clean,${MAKECMDGOALS}),)
7 include ${ADK_TOPDIR}/rules.mk
8 endif
10 CP=cp -fpR
11 HOST_CFLAGS+=-DKBUILD_NO_NLS -w
13 all: ncurses conf mconf
15 LIBS=
16 ifeq (/usr/lib/libtinfo.so, $(wildcard /usr/lib/libtinfo.so))
17 LIBS= -ltinfo
18 endif
20 ifeq (/usr/include/ncursesw/curses.h, $(wildcard /usr/include/ncursesw/curses.h))
21 HOST_CFLAGS+= -I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"
22 LIBS+= -lncursesw
23 else
24 ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
25 HOST_CFLAGS+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
26 LIBS+= -lncurses
27 else
28 ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
29 HOST_CFLAGS+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
30 LIBS+= -lncurses
31 else
32 ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
33 HOST_CFLAGS+= -DCURSES_LOC="<ncurses.h>"
34 LIBS+= -lncurses
35 else
36 ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
37 HOST_CFLAGS+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
38 LIBS+= -lncurses
39 else
40 ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
41 HOST_CFLAGS+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
42 LIBS+= -lncurses
43 else
44 ifeq (/usr/local/opt/ncurses/include/ncursesw/ncurses.h, $(wildcard /usr/local/opt/ncurses/include/ncursesw/ncurses.h))
45 HOST_CFLAGS+= -I/usr/local/opt/ncurses/include -DCURSES_LOC="<ncursesw/ncurses.h>"
46 LIBS+= -L/usr/local/opt/ncurses/lib -Wl,-rpath -Wl,/usr/local/opt/ncurses/lib -lncursesw
47 else
48 ifeq (/usr/pkg/include/ncurses.h, $(wildcard /usr/pkg/include/ncurses.h))
49 HOST_CFLAGS+= -I/usr/pkg/include -DCURSES_LOC="<ncurses.h>"
50 LIBS+= -L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib -lncurses
51 else
52 HOST_CFLAGS+= -DCURSES_LOC="<curses.h>"
53 LIBS= -lcurses
54 endif
55 endif
56 endif
57 endif
58 endif
59 endif
60 endif
61 endif
63 CONF_SRC =conf.c
64 MCONF_SRC =mconf.c $(wildcard lxdialog/*.c)
65 SHARED_SRC=zconf.tab.c
66 SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
67 CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
68 MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
69 SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
71 conf: $(CONF_OBJS) $(SHARED_OBJS)
72 @$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ 2>/dev/null
74 mconf: $(MCONF_OBJS) $(SHARED_OBJS)
75 @$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ $(LIBS) 2>/dev/null
77 $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
78 @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
80 $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
81 @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
83 glob.o: glob.c $(SHARED_DEPS)
84 @$(HOST_CC) $(HOST_CFLAGS) -I. -c glob.c -o $@ 2>/dev/null
86 lkc_defs.h: lkc_proto.h
87 @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
89 ###
90 # The following requires flex/bison
91 # By default we use the _shipped versions, uncomment the
92 # following line if you are modifying the flex/bison src.
93 # LKC_GENPARSER:= 1
95 ifdef LKC_GENPARSER
97 %.tab.c %.tab.h: %.y
98 bison -t -d -v -b $* -p $(notdir $*) $<
100 %.hash.c: %.gperf
101 gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t zconf.gperf
103 lex.%.c: %.l
104 flex -P$(notdir $*) -o$@ $<
106 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
107 @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
109 zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
110 @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
112 else
114 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
115 @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
117 lex.zconf.c: lex.zconf.c_shipped
118 @$(CP) lex.zconf.c_shipped lex.zconf.c
120 zconf.hash.c: zconf.hash.c_shipped
121 @$(CP) zconf.hash.c_shipped zconf.hash.c
123 zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
124 @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
126 zconf.tab.c: zconf.tab.c_shipped
127 @$(CP) zconf.tab.c_shipped zconf.tab.c
129 zconf.tab.h: zconf.tab.h_shipped
130 @$(CP) zconf.tab.h_shipped zconf.tab.h
131 endif
133 .PHONY: ncurses
135 ncurses:
136 @echo "int main(void) { return -1; }" > lxtemp.c
137 @if $(HOST_CC) $(HOST_CFLAGS) lxtemp.c $(LIBS) ; then \
138 rm -f lxtemp.c a.out; \
139 else \
140 rm -f lxtemp.c; \
141 printf '\007'; \
142 echo ">> Unable to find the Ncurses libraries." ;\
143 echo ">>" ;\
144 echo ">> You must have Ncurses installed in order" ;\
145 echo ">> to use 'make menuconfig'" ;\
146 echo ;\
147 exit 1 ;\
150 clean:
151 @rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) zconf.hash.c \
152 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h