Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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_srcdir)/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. $(SECHO) " "HOSTCC $@ ; true
  48. $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
  49. mconf: $(MCONF_OBJS) $(SHARED_OBJS)
  50. $(SECHO) " "HOSTCC $@ ; true
  51. $(Q)$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
  52. $(CONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
  53. $(compile.h) -I.
  54. $(MCONF_OBJS): %.o : $(srcdir)/%.c $(SHARED_DEPS)
  55. @[ -d $(@D) ] || mkdir $(@D)
  56. $(compile.h) $(HOSTNCURSES) -I.
  57. lkc_defs.h: $(srcdir)/lkc_proto.h
  58. @$(SED) < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  59. ###
  60. # The following requires flex/bison
  61. # By default we use the _shipped versions, uncomment the
  62. # following line if you are modifying the flex/bison src.
  63. #LKC_GENPARSER := 1
  64. ifdef LKC_GENPARSER
  65. %.tab.c %.tab.h: $(srcdir)/%.y
  66. bison -t -d -v -b $* -p $(notdir $*) $<
  67. lex.%.c: $(srcdir)/%.l
  68. flex -P$(notdir $*) -o$@ $<
  69. else
  70. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  71. $(compile.h) -I$(srcdir)
  72. lex.zconf.c: $(srcdir)/lex.zconf.c_shipped
  73. $(Q)cp $< $@
  74. zconf.tab.c: $(srcdir)/zconf.tab.c_shipped
  75. $(Q)cp $< $@
  76. zconf.tab.h: $(srcdir)/zconf.tab.h_shipped
  77. $(Q)cp $< $@
  78. endif
  79. zconf.tab.o: zconf.tab.c lex.zconf.c $(srcdir)/confdata.c $(srcdir)/expr.c \
  80. $(srcdir)/symbol.c $(srcdir)/menu.c $(SHARED_DEPS)
  81. $(compile.h) -I$(srcdir) -I.
  82. .PHONY: ncurses
  83. ncurses:
  84. @echo "main() {}" > lxtemp.c
  85. @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
  86. rm -f lxtemp.c a.out; \
  87. else \
  88. rm -f lxtemp.c; \
  89. echo -e "\007" ;\
  90. echo ">> Unable to find the Ncurses libraries." ;\
  91. echo ">>" ;\
  92. echo ">> You must have Ncurses installed in order" ;\
  93. echo ">> to use 'make menuconfig'" ;\
  94. echo ;\
  95. exit 1 ;\
  96. fi
  97. clean:
  98. rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  99. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h