1 # Makefile for buildroot2
3 # Copyright (C) 2002-2004 Erik Andersen <andersen@codepoet.org>
7 # Select the compiler needed to build binaries for your development system
9 HOSTCFLAGS
= -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
10 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
14 all: ncurses conf mconf
17 ifeq (/usr
/include/ncurses
/ncurses.h
, $(wildcard /usr
/include/ncurses
/ncurses.h
))
18 HOSTNCURSES
+= -I
/usr
/include/ncurses
-DCURSES_LOC
="<ncurses.h>"
20 ifeq (/usr
/include/ncurses
/curses.h
, $(wildcard /usr
/include/ncurses
/curses.h
))
21 HOSTNCURSES
+= -I
/usr
/include/ncurses
-DCURSES_LOC
="<ncurses/curses.h>"
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>"
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>"
29 ifeq (/usr
/include/ncurses.h
, $(wildcard /usr
/include/ncurses.h
))
30 HOSTNCURSES
+= -DCURSES_LOC
="<ncurses.h>"
32 HOSTNCURSES
+= -DCURSES_LOC
="<curses.h>"
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
))
47 conf
: $(CONF_OBJS
) $(SHARED_OBJS
)
48 $(HOSTCC
) $(NATIVE_LDFLAGS
) $^
-o
$@
50 mconf
: $(MCONF_OBJS
) $(SHARED_OBJS
)
51 $(HOSTCC
) $(NATIVE_LDFLAGS
) $^
-o
$@
$(LIBS
)
53 $(CONF_OBJS
): %.o
: %.c
$(SHARED_DEPS
)
54 $(HOSTCC
) $(HOSTCFLAGS
) -I.
-c
$< -o
$@
56 $(MCONF_OBJS
): %.o
: %.c
$(SHARED_DEPS
)
57 $(HOSTCC
) $(HOSTCFLAGS
) $(HOSTNCURSES
) -I.
-c
$< -o
$@
59 lkc_defs.h
: lkc_proto.h
60 @sed
< $< > $@
's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
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.
71 bison
-t
-d
-v
-b
$* -p
$(notdir $*) $<
74 flex
-P
$(notdir $*) -o
$@
$<
77 lex.zconf.o
: lex.zconf.c
$(SHARED_DEPS
)
78 $(HOSTCC
) $(HOSTCFLAGS
) -I.
-c
$< -o
$@
80 lex.zconf.c
: lex.zconf.c_shipped
81 $(CP
) lex.zconf.c_shipped
lex.zconf.c
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
$@
86 zconf.tab.c
: zconf.tab.c_shipped
87 $(CP
) zconf.tab.c_shipped zconf.tab.c
89 zconf.tab.h
: zconf.tab.h_shipped
90 $(CP
) zconf.tab.h_shipped zconf.tab.h
96 @echo
"main() {}" > lxtemp.c
97 @if
$(HOSTCC
) lxtemp.c
$(LIBS
) ; then \
98 rm -f lxtemp.c a.out
; \
102 echo
">> Unable to find the Ncurses libraries." ;\
104 echo
">> You must have Ncurses installed in order" ;\
105 echo
">> to use 'make menuconfig'" ;\
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