source: menu/Makefile@ 6a9d41e

experimental
Last change on this file since 6a9d41e was 613d46b, checked in by George Boudreau <georgeb@…>, 18 years ago

Added new configuration tool.. <make> menuconfig. Needs work, especially inline help text

  • Property mode set to 100644
File size: 3.9 KB
Line 
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
58CONF_SRC = conf.c
59MCONF_SRC = mconf.c
60LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
61 lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
62 lxdialog/msgbox.c
63
64SHARED_SRC = zconf.tab.c
65SHARED_DEPS := $(srcdir)/lkc.h $(srcdir)/lkc_proto.h \
66 lkc_defs.h $(srcdir)/expr.h zconf.tab.h
67CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC))
68MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
69SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
70
71conf: $(CONF_OBJS) $(SHARED_OBJS)
72 $(SECHO) " "HOSTCC $@ ; true
73 $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
74
75mconf: $(MCONF_OBJS) $(SHARED_OBJS)
76 $(SECHO) " "HOSTCC $@ ; true
77 $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
78
79$(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
80 $(compile.h) -I.
81
82$(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
83 @[ -d $(@D) ] || mkdir $(@D)
84 $(compile.h) $(HOSTNCURSES) -I.
85
86lkc_defs.h: $(srcdir)/lkc_proto.h
87 @$(SED) < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
88
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
94
95ifdef LKC_GENPARSER
96
97%.tab.c %.tab.h: $(srcdir)/%.y
98 bison -t -d -v -b $* -p $(notdir $*) $<
99
100lex.%.c: $(srcdir)/%.l
101 flex -P$(notdir $*) -o$@ $<
102else
103
104lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
105 $(compile.h) -I$(srcdir)
106
107lex.zconf.c: $(srcdir)/lex.zconf.c_shipped
108 $(Q)cp $< $@
109
110zconf.tab.c: $(srcdir)/zconf.tab.c_shipped
111 $(Q)cp $< $@
112
113zconf.tab.h: $(srcdir)/zconf.tab.h_shipped
114 $(Q)cp $< $@
115endif
116
117zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \
118 $(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS)
119 $(compile.h) -I$(srcdir) -I.
120
121.PHONY: ncurses
122
123ncurses:
124 @echo "main() {}" > lxtemp.c
125 @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
126 rm -f lxtemp.c a.out; \
127 else \
128 rm -f lxtemp.c; \
129 echo -e "\007" ;\
130 echo ">> Unable to find the Ncurses libraries." ;\
131 echo ">>" ;\
132 echo ">> You must have Ncurses installed in order" ;\
133 echo ">> to use 'make menuconfig'" ;\
134 echo ;\
135 exit 1 ;\
136 fi
137
138clean:
139 rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
140 conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h
141
Note: See TracBrowser for help on using the repository browser.