Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Makefile for BusyBox
  2. #
  3. # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
  4. top_srcdir=../..
  5. top_builddir=../..
  6. srcdir=$(top_srcdir)/scripts/config
  7. include $(top_builddir)/Rules.mak
  8. all: ncurses conf mconf
  9. ifeq ($(shell uname),SunOS)
  10. LIBS = -lcurses
  11. else
  12. LIBS = -lncurses
  13. endif
  14. ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
  15. HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
  16. else
  17. ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
  18. HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  19. else
  20. ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
  21. HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
  22. else
  23. ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
  24. HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  25. else
  26. ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
  27. HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
  28. else
  29. HOSTNCURSES += -DCURSES_LOC="<curses.h>"
  30. endif
  31. endif
  32. endif
  33. endif
  34. endif
  35. CONF_SRC = conf.c
  36. MCONF_SRC = mconf.c
  37. LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
  38. lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
  39. lxdialog/msgbox.c
  40. SHARED_SRC = zconf.tab.c
  41. SHARED_DEPS := $(srcdir)/lkc.h $(srcdir)/lkc_proto.h \
  42. lkc_defs.h $(srcdir)/expr.h zconf.tab.h
  43. CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC))
  44. MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
  45. SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
  46. conf: $(CONF_OBJS) $(SHARED_OBJS)
  47. $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
  48. mconf: $(MCONF_OBJS) $(SHARED_OBJS)
  49. $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
  50. $(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
  51. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  52. $(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
  53. $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
  54. lkc_defs.h: $(srcdir)/lkc_proto.h
  55. @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  56. ###
  57. # The following requires flex/bison
  58. # By default we use the _shipped versions, uncomment the
  59. # following line if you are modifying the flex/bison src.
  60. #LKC_GENPARSER := 1
  61. ifdef LKC_GENPARSER
  62. %.tab.c %.tab.h: $(srcdir)/%.y
  63. bison -t -d -v -b $* -p $(notdir $*) $<
  64. lex.%.c: $(srcdir)/%.l
  65. flex -P$(notdir $*) -o$@ $<
  66. else
  67. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  68. $(HOSTCC) $(HOSTCFLAGS) -I$(srcdir) -c $< -o $@
  69. lex.zconf.c: $(srcdir)/lex.zconf.c_shipped
  70. cp $< $@
  71. zconf.tab.c: $(srcdir)/zconf.tab.c_shipped
  72. cp $< $@
  73. zconf.tab.h: $(srcdir)/zconf.tab.h_shipped
  74. cp $< $@
  75. endif
  76. zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \
  77. $(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS)
  78. $(HOSTCC) $(HOSTCFLAGS) -I$(srcdir) -I. -c $< -o $@
  79. .PHONY: ncurses
  80. ncurses:
  81. @echo "main() {}" > lxtemp.c
  82. @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
  83. rm -f lxtemp.c a.out; \
  84. else \
  85. rm -f lxtemp.c; \
  86. echo -e "\007" ;\
  87. echo ">> Unable to find the Ncurses libraries." ;\
  88. echo ">>" ;\
  89. echo ">> You must have Ncurses installed in order" ;\
  90. echo ">> to use 'make menuconfig'" ;\
  91. echo ;\
  92. exit 1 ;\
  93. fi
  94. clean:
  95. rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  96. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h