findutils: fix compile with debugging options
[openadk.git] / config / Makefile
blobafe153c8a84f7185f85e7a805525b7c483385931
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 ifneq ($(filter-out clean,${MAKECMDGOALS}),)
5 include ${TOPDIR}/rules.mk
6 endif
8 CP=cp -fpR
9 CFLAGS_FOR_BUILD+=-DKBUILD_NO_NLS
11 all: ncurses conf mconf
13 LIBS= -lncurses
14 ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
15 CFLAGS_FOR_BUILD+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
16 else
17 ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
18 CFLAGS_FOR_BUILD+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
19 else
20 ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
21 CFLAGS_FOR_BUILD+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
22 else
23 ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
24 CFLAGS_FOR_BUILD+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
25 else
26 ifeq (/usr/pkg/include/ncurses.h, $(wildcard /usr/pkg/include/ncurses.h))
27 CFLAGS_FOR_BUILD+= -I/usr/pkg/include -DCURSES_LOC="<ncurses.h>"
28 LIBS+= -L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib
29 else
30 ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
31 CFLAGS_FOR_BUILD+= -DCURSES_LOC="<ncurses.h>"
32 else
33 CFLAGS_FOR_BUILD+= -DCURSES_LOC="<curses.h>"
34 LIBS= -lcurses
35 endif
36 endif
37 endif
38 endif
39 endif
40 endif
42 GTKLIBS = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
43 GTKCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0`
45 CONF_SRC =conf.c
46 MCONF_SRC =mconf.c $(wildcard lxdialog/*.c)
47 GCONF_SRC =gconf.c
48 SHARED_SRC=zconf.tab.c
49 SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
50 CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
51 MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
52 GCONF_OBJS=$(patsubst %.c,%.o, $(GCONF_SRC))
53 SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
55 conf: $(CONF_OBJS) $(SHARED_OBJS)
56 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NATIVE_LDFLAGS) $^ -o $@
58 mconf: $(MCONF_OBJS) $(SHARED_OBJS)
59 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
61 gconf: $(GCONF_OBJS) $(SHARED_OBJS)
62 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NATIVE_LDFLAGS) $^ -o $@ $(GTKLIBS)
64 $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
65 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
67 $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
68 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(HOSTNCURSES) -I. -c $< -o $@
70 $(GCONF_OBJS): %.o : %.c $(SHARED_DEPS)
71 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(GTKCFLAGS) -DLKC_DIRECT_LINK -I. -c $< -o $@
73 glob.o: glob.c $(SHARED_DEPS)
74 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c glob.c -o $@
76 lkc_defs.h: lkc_proto.h
77 @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
79 ###
80 # The following requires flex/bison
81 # By default we use the _shipped versions, uncomment the
82 # following line if you are modifying the flex/bison src.
83 #LKC_GENPARSER:= 1
85 ifdef LKC_GENPARSER
87 %.tab.c %.tab.h: %.y
88 bison -t -d -v -b $* -p $(notdir $*) $<
90 %.hash.c: %.gperf
91 gperf < $< > $@
93 lex.%.c: %.l
94 flex -P$(notdir $*) -o$@ $<
96 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
97 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
99 zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
100 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
102 else
104 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
105 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
107 lex.zconf.c: lex.zconf.c_shipped
108 @$(CP) lex.zconf.c_shipped lex.zconf.c
110 zconf.hash.c: zconf.hash.c_shipped
111 @$(CP) zconf.hash.c_shipped zconf.hash.c
113 zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
114 @$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
116 zconf.tab.c: zconf.tab.c_shipped
117 @$(CP) zconf.tab.c_shipped zconf.tab.c
119 zconf.tab.h: zconf.tab.h_shipped
120 @$(CP) zconf.tab.h_shipped zconf.tab.h
121 endif
123 .PHONY: ncurses
125 ncurses:
126 @echo "int main(void) { return -1; }" > lxtemp.c
127 @if $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) lxtemp.c $(LIBS) ; then \
128 rm -f lxtemp.c a.out; \
129 else \
130 rm -f lxtemp.c; \
131 printf '\007'; \
132 echo ">> Unable to find the Ncurses libraries." ;\
133 echo ">>" ;\
134 echo ">> You must have Ncurses installed in order" ;\
135 echo ">> to use 'make menuconfig'" ;\
136 echo ;\
137 exit 1 ;\
140 clean:
141 @rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) zconf.hash.c \
142 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h