Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. top_builddir=../../
  8. include $(top_builddir)Rules.mak
  9. all: ncurses conf mconf
  10. ifeq ($(shell uname),SunOS)
  11. LIBS = -lcurses
  12. else
  13. LIBS = -lncurses
  14. endif
  15. ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
  16. HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
  17. else
  18. ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
  19. HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  20. else
  21. ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
  22. HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
  23. else
  24. ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
  25. HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  26. else
  27. ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
  28. HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
  29. else
  30. HOSTNCURSES += -DCURSES_LOC="<curses.h>"
  31. endif
  32. endif
  33. endif
  34. endif
  35. endif
  36. CONF_SRC = conf.c
  37. MCONF_SRC = mconf.c
  38. LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
  39. lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
  40. lxdialog/msgbox.c
  41. SHARED_SRC = zconf.tab.c
  42. SHARED_DEPS := lkc.h lkc_proto.h lkc_defs.h 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 : %.c $(SHARED_DEPS)
  51. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  52. $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
  53. $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
  54. lkc_defs.h: 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: %.y
  63. bison -t -d -v -b $* -p $(notdir $*) $<
  64. lex.%.c: %.l
  65. flex -P$(notdir $*) -o$@ $<
  66. else
  67. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  68. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  69. lex.zconf.c: lex.zconf.c_shipped
  70. cp lex.zconf.c_shipped lex.zconf.c
  71. zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  72. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  73. zconf.tab.c: zconf.tab.c_shipped
  74. cp zconf.tab.c_shipped zconf.tab.c
  75. zconf.tab.h: zconf.tab.h_shipped
  76. cp zconf.tab.h_shipped zconf.tab.h
  77. endif
  78. .PHONY: ncurses
  79. ncurses:
  80. @echo "main() {}" > lxtemp.c
  81. @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
  82. $(RM) lxtemp.c a.out; \
  83. else \
  84. $(RM) lxtemp.c; \
  85. echo -e "\007" ;\
  86. echo ">> Unable to find the Ncurses libraries." ;\
  87. echo ">>" ;\
  88. echo ">> You must have Ncurses installed in order" ;\
  89. echo ">> to use 'make menuconfig'" ;\
  90. echo ">>" ;\
  91. echo ">> Maybe you want to try 'make config', which" ;\
  92. echo ">> doesn't depend on the Ncurses libraries." ;\
  93. echo ;\
  94. exit 1 ;\
  95. fi
  96. clean:
  97. $(RM) *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  98. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h