| 1 | # Makefile for buildroot2
|
|---|
| 2 | #
|
|---|
| 3 | # Copyright (C) 2002-2004 Erik Andersen <andersen@codepoet.org>
|
|---|
| 4 |
|
|---|
| 5 | CP=cp -fpR
|
|---|
| 6 |
|
|---|
| 7 | # Select the compiler needed to build binaries for your development system
|
|---|
| 8 | HOSTCC ?= gcc
|
|---|
| 9 | HOSTCFLAGS?= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
|
|---|
| 10 | # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
|
|---|
| 11 | LC_ALL:= C
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | all: ncurses conf mconf
|
|---|
| 15 |
|
|---|
| 16 | LIBS = -lncurses
|
|---|
| 17 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
|
|---|
| 18 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
|
|---|
| 19 | else
|
|---|
| 20 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
|
|---|
| 21 | HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
|
|---|
| 22 | else
|
|---|
| 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>"
|
|---|
| 25 | else
|
|---|
| 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>"
|
|---|
| 28 | else
|
|---|
| 29 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
|
|---|
| 30 | HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
|
|---|
| 31 | else
|
|---|
| 32 | HOSTNCURSES += -DCURSES_LOC="<curses.h>"
|
|---|
| 33 | endif
|
|---|
| 34 | endif
|
|---|
| 35 | endif
|
|---|
| 36 | endif
|
|---|
| 37 | endif
|
|---|
| 38 |
|
|---|
| 39 | CONF_SRC =conf.c
|
|---|
| 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 glob.c
|
|---|
| 42 | SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h glob.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))
|
|---|
| 46 |
|
|---|
| 47 | conf: $(CONF_OBJS) $(SHARED_OBJS)
|
|---|
| 48 | $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
|
|---|
| 49 |
|
|---|
| 50 | mconf: $(MCONF_OBJS) $(SHARED_OBJS)
|
|---|
| 51 | $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
|
|---|
| 52 |
|
|---|
| 53 | $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
|
|---|
| 54 | $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
|
|---|
| 55 |
|
|---|
| 56 | $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
|
|---|
| 57 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
|
|---|
| 58 |
|
|---|
| 59 | glob.o: glob.c $(SHARED_DEPS)
|
|---|
| 60 | $(HOSTCC) $(HOSTCFLAGS) -I. -c glob.c -o $@
|
|---|
| 61 |
|
|---|
| 62 | lkc_defs.h: lkc_proto.h
|
|---|
| 63 | @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
|
|---|
| 64 |
|
|---|
| 65 | ###
|
|---|
| 66 | # The following requires flex/bison
|
|---|
| 67 | # By default we use the _shipped versions, uncomment the
|
|---|
| 68 | # following line if you are modifying the flex/bison src.
|
|---|
| 69 | #LKC_GENPARSER := 1
|
|---|
| 70 |
|
|---|
| 71 | ifdef LKC_GENPARSER
|
|---|
| 72 |
|
|---|
| 73 | %.tab.c %.tab.h: %.y
|
|---|
| 74 | bison -t -d -v -b $* -p $(notdir $*) $<
|
|---|
| 75 |
|
|---|
| 76 | lex.%.c: %.l
|
|---|
| 77 | flex -P$(notdir $*) -o$@ $<
|
|---|
| 78 | else
|
|---|
| 79 |
|
|---|
| 80 | lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
|
|---|
| 81 | $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
|
|---|
| 82 |
|
|---|
| 83 | lex.zconf.c: lex.zconf.c_shipped
|
|---|
| 84 | $(CP) lex.zconf.c_shipped lex.zconf.c
|
|---|
| 85 |
|
|---|
| 86 | zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
|
|---|
| 87 | $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
|
|---|
| 88 |
|
|---|
| 89 | zconf.tab.c: zconf.tab.c_shipped
|
|---|
| 90 | $(CP) zconf.tab.c_shipped zconf.tab.c
|
|---|
| 91 |
|
|---|
| 92 | zconf.tab.h: zconf.tab.h_shipped
|
|---|
| 93 | $(CP) zconf.tab.h_shipped zconf.tab.h
|
|---|
| 94 | endif
|
|---|
| 95 |
|
|---|
| 96 | .PHONY: ncurses
|
|---|
| 97 |
|
|---|
| 98 | ncurses:
|
|---|
| 99 | @echo "main() {}" > lxtemp.c
|
|---|
| 100 | @if $(HOSTCC) $(HOSTCFLAGS) lxtemp.c $(LIBS) ; then \
|
|---|
| 101 | rm -f lxtemp.c a.out; \
|
|---|
| 102 | else \
|
|---|
| 103 | rm -f lxtemp.c; \
|
|---|
| 104 | echo -e "\007" ;\
|
|---|
| 105 | echo ">> Unable to find the Ncurses libraries." ;\
|
|---|
| 106 | echo ">>" ;\
|
|---|
| 107 | echo ">> You must have Ncurses installed in order" ;\
|
|---|
| 108 | echo ">> to use 'make menuconfig'" ;\
|
|---|
| 109 | echo ;\
|
|---|
| 110 | exit 1 ;\
|
|---|
| 111 | fi
|
|---|
| 112 |
|
|---|
| 113 | clean:
|
|---|
| 114 | rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
|
|---|
| 115 | conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h
|
|---|