source: menu/Makefile@ fbdd1a8

2.4 ablfs-more legacy trunk
Last change on this file since fbdd1a8 was 2ce3688, checked in by Pierre Labastie <pierre@…>, 9 years ago

Adapt menu to ncurses ABI 6, and clear a warning

  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[a705708]1# Makefile for BusyBox
2#
3# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
4# Modified by George Boudreau georgeb@LinuxFromScratch.org
5
6top_srcdir=.
7top_builddir=.
8srcdir=$(top_srcdir)
9
10# Select the compiler needed to build binaries for your development system
11HOSTCC = gcc
12HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
13
14# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
15LC_ALL:= C
16
17SED ?= sed
18SECHO := @-false
19DISP := pur
20Q := @
21
22show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
23pur_disp_compile.h = echo " "HOSTCC $(show_objs)
24disp_compile.h = $($(DISP)_disp_compile.h)
25cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
26compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
27
28
29all: ncurses conf mconf
30
31ifeq ($(shell uname),SunOS)
32LIBS = -lcurses
33else
34LIBS = -lncurses
35endif
36ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
37 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
38else
39ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
40 HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
41else
42ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
43 HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
44else
45ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
46 HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
47else
48ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
49 HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
50else
51 HOSTNCURSES += -DCURSES_LOC="<curses.h>"
52endif
53endif
54endif
55endif
56endif
57
[6e8fc82]58ifeq (/usr/include/locale.h, $(wildcard /usr/include/locale.h))
59 HOSTNCURSES += -DLOCALE=1
60endif
61
[a705708]62CONF_SRC = conf.c
63MCONF_SRC = mconf.c
64LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
65 lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
66 lxdialog/msgbox.c
67
68SHARED_SRC = zconf.tab.c
69SHARED_DEPS := $(srcdir)/lkc.h $(srcdir)/lkc_proto.h \
70 lkc_defs.h $(srcdir)/expr.h zconf.tab.h
71CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC))
72MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
73SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
74
75conf: $(CONF_OBJS) $(SHARED_OBJS)
76 $(SECHO) " "HOSTCC $@ ; true
77 $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
78
79mconf: $(MCONF_OBJS) $(SHARED_OBJS)
80 $(SECHO) " "HOSTCC $@ ; true
81 $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
82
83$(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
84 $(compile.h) -I.
85
86$(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
87 @[ -d $(@D) ] || mkdir $(@D)
88 $(compile.h) $(HOSTNCURSES) -I.
89
90lkc_defs.h: $(srcdir)/lkc_proto.h
91 @$(SED) < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
92
93###
94# The following requires flex/bison
95# By default we use the _shipped versions, uncomment the
96# following line if you are modifying the flex/bison src.
97#LKC_GENPARSER := 1
98
99ifdef LKC_GENPARSER
100
101%.tab.c %.tab.h: $(srcdir)/%.y
102 bison -t -d -v -b $* -p $(notdir $*) $<
103
104lex.%.c: $(srcdir)/%.l
105 flex -P$(notdir $*) -o$@ $<
106else
107
108lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
109 $(compile.h) -I$(srcdir)
110
111lex.zconf.c: $(srcdir)/lex.zconf.c_shipped
112 $(Q)cp $< $@
113
114zconf.tab.c: $(srcdir)/zconf.tab.c_shipped
115 $(Q)cp $< $@
116
117zconf.tab.h: $(srcdir)/zconf.tab.h_shipped
118 $(Q)cp $< $@
119endif
120
121zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \
122 $(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS)
123 $(compile.h) -I$(srcdir) -I.
124
125.PHONY: ncurses
126
127ncurses:
[2ce3688]128 @echo "int main() {}" > lxtemp.c
[a705708]129 @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
130 rm -f lxtemp.c a.out; \
131 else \
132 rm -f lxtemp.c; \
133 echo -e "\007" ;\
134 echo ">> Unable to find the Ncurses libraries." ;\
135 echo ">>" ;\
136 echo ">> You must have Ncurses installed in order" ;\
137 echo ">> to use 'make menuconfig'" ;\
138 echo ;\
139 exit 1 ;\
140 fi
141
142clean:
143 rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
144 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h
145
Note: See TracBrowser for help on using the repository browser.