[a705708] | 1 | # Makefile for BusyBox
|
---|
| 2 | #
|
---|
| 3 | # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
|
---|
| 4 | # Modified by George Boudreau georgeb@LinuxFromScratch.org
|
---|
| 5 |
|
---|
| 6 | top_srcdir=.
|
---|
| 7 | top_builddir=.
|
---|
| 8 | srcdir=$(top_srcdir)
|
---|
| 9 |
|
---|
| 10 | # Select the compiler needed to build binaries for your development system
|
---|
| 11 | HOSTCC = gcc
|
---|
| 12 | HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
|
---|
| 13 |
|
---|
| 14 | # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
|
---|
| 15 | LC_ALL:= C
|
---|
| 16 |
|
---|
| 17 | SED ?= sed
|
---|
| 18 | SECHO := @-false
|
---|
| 19 | DISP := pur
|
---|
| 20 | Q := @
|
---|
| 21 |
|
---|
| 22 | show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
|
---|
| 23 | pur_disp_compile.h = echo " "HOSTCC $(show_objs)
|
---|
| 24 | disp_compile.h = $($(DISP)_disp_compile.h)
|
---|
| 25 | cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
|
---|
| 26 | compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | all: ncurses conf mconf
|
---|
| 30 |
|
---|
| 31 | ifeq ($(shell uname),SunOS)
|
---|
| 32 | LIBS = -lcurses
|
---|
| 33 | else
|
---|
| 34 | LIBS = -lncurses
|
---|
| 35 | endif
|
---|
| 36 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
|
---|
| 37 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
|
---|
| 38 | else
|
---|
| 39 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
|
---|
| 40 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
|
---|
| 41 | else
|
---|
| 42 | ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
|
---|
| 43 | HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
|
---|
| 44 | else
|
---|
| 45 | ifeq (/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>"
|
---|
| 47 | else
|
---|
| 48 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
|
---|
| 49 | HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
|
---|
| 50 | else
|
---|
| 51 | HOSTNCURSES += -DCURSES_LOC="<curses.h>"
|
---|
| 52 | endif
|
---|
| 53 | endif
|
---|
| 54 | endif
|
---|
| 55 | endif
|
---|
| 56 | endif
|
---|
| 57 |
|
---|
[6e8fc82] | 58 | ifeq (/usr/include/locale.h, $(wildcard /usr/include/locale.h))
|
---|
| 59 | HOSTNCURSES += -DLOCALE=1
|
---|
| 60 | endif
|
---|
| 61 |
|
---|
[a705708] | 62 | CONF_SRC = conf.c
|
---|
| 63 | MCONF_SRC = mconf.c
|
---|
| 64 | LXD_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 |
|
---|
| 68 | SHARED_SRC = zconf.tab.c
|
---|
| 69 | SHARED_DEPS := $(srcdir)/lkc.h $(srcdir)/lkc_proto.h \
|
---|
| 70 | lkc_defs.h $(srcdir)/expr.h zconf.tab.h
|
---|
| 71 | CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC))
|
---|
| 72 | MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
|
---|
| 73 | SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
|
---|
| 74 |
|
---|
| 75 | conf: $(CONF_OBJS) $(SHARED_OBJS)
|
---|
| 76 | $(SECHO) " "HOSTCC $@ ; true
|
---|
| 77 | $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
|
---|
| 78 |
|
---|
| 79 | mconf: $(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 |
|
---|
| 90 | lkc_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 |
|
---|
| 99 | ifdef LKC_GENPARSER
|
---|
| 100 |
|
---|
| 101 | %.tab.c %.tab.h: $(srcdir)/%.y
|
---|
| 102 | bison -t -d -v -b $* -p $(notdir $*) $<
|
---|
| 103 |
|
---|
| 104 | lex.%.c: $(srcdir)/%.l
|
---|
| 105 | flex -P$(notdir $*) -o$@ $<
|
---|
| 106 | else
|
---|
| 107 |
|
---|
| 108 | lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
|
---|
| 109 | $(compile.h) -I$(srcdir)
|
---|
| 110 |
|
---|
| 111 | lex.zconf.c: $(srcdir)/lex.zconf.c_shipped
|
---|
| 112 | $(Q)cp $< $@
|
---|
| 113 |
|
---|
| 114 | zconf.tab.c: $(srcdir)/zconf.tab.c_shipped
|
---|
| 115 | $(Q)cp $< $@
|
---|
| 116 |
|
---|
| 117 | zconf.tab.h: $(srcdir)/zconf.tab.h_shipped
|
---|
| 118 | $(Q)cp $< $@
|
---|
| 119 | endif
|
---|
| 120 |
|
---|
| 121 | zconf.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 |
|
---|
| 127 | ncurses:
|
---|
[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 |
|
---|
| 142 | clean:
|
---|
| 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 |
|
---|