Makefile.in 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. ifeq ($(shell uname),SunOS)
  8. HOSTLIBNCURSES = -lcurses
  9. else
  10. HOSTLIBNCURSES = -lncurses
  11. endif
  12. ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
  13. HOSTNCURSES = -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
  14. else
  15. ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
  16. HOSTNCURSES = -I/usr/include/ncurses -DCURSES_LOC="<curses.h>"
  17. else
  18. ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
  19. HOSTNCURSES = -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
  20. else
  21. ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
  22. HOSTNCURSES = -I/usr/local/include/ncurses -DCURSES_LOC="<curses.h>"
  23. else
  24. ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
  25. HOSTNCURSES = -DCURSES_LOC="<ncurses.h>"
  26. else
  27. HOSTNCURSES = -DCURSES_LOC="<curses.h>"
  28. endif
  29. endif
  30. endif
  31. endif
  32. endif
  33. HOSTCFLAGS-config := -I.
  34. HOSTCFLAGS-mconf.o := $(HOSTNCURSES)
  35. HOSTCFLAGS-lxdialog := $(HOSTNCURSES)
  36. BUILD_LDFLAGS-mconf := $(HOSTLIBNCURSES)
  37. config_DIR := $(top_srcdir)extra/config
  38. config_OUT := $(top_builddir)extra/config
  39. config_SHIPPED_SRC := $(patsubst %,$(config_OUT)/%,lex.zconf.c zconf.tab.c zconf.tab.h)
  40. config_CONF_SRC := conf.c
  41. config_MCONF_SRC := mconf.c
  42. config_LXD_SRC := \
  43. lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
  44. lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
  45. lxdialog/msgbox.c
  46. config_SHARED_SRC := $(config_OUT)/zconf.tab.c
  47. config_SHARED_DEP1 := $(patsubst %,$(config_DIR)/%,lkc.h lkc_proto.h expr.h)
  48. config_SHARED_DEP2 := $(patsubst %,$(config_OUT)/%,lkc_defs.h zconf.tab.h)
  49. config_SHARED_DEPS := $(config_SHARED_DEP1) $(config_SHARED_DEP2)
  50. config_CONF_OBJS := $(patsubst %.c,$(config_OUT)/%.o,$(config_CONF_SRC))
  51. config_MCONF_OBJS := $(patsubst %.c,$(config_OUT)/%.o,$(config_MCONF_SRC) $(config_LXD_SRC))
  52. config_SHARED_OBJS := $(patsubst %.c,%.o,$(config_SHARED_SRC))
  53. objs: ncurses $(config_OUT)/conf $(config_OUT)/mconf
  54. conf $(config_OUT)/conf: $(config_CONF_OBJS) $(config_SHARED_OBJS)
  55. $(hcompile.u)
  56. mconf $(config_OUT)/mconf: $(config_MCONF_OBJS) $(config_SHARED_OBJS) | ncurses
  57. $(hcompile.u)
  58. $(config_CONF_OBJS) $(config_MCONF_OBJS): $(config_OUT)/%.o : $(config_DIR)/%.c | $(config_SHARED_DEPS)
  59. $(hcompile.o)
  60. $(config_OUT)/lkc_defs.h: $(config_DIR)/lkc_proto.h
  61. @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  62. ###
  63. # The following requires flex/bison
  64. # By default we use the _shipped versions, uncomment the
  65. # following line if you are modifying the flex/bison src.
  66. #LKC_GENPARSER := 1
  67. ifdef LKC_GENPARSER
  68. %.tab.c %.tab.h: %.y
  69. bison -t -d -v -b $* -p $(notdir $*) $<
  70. lex.%.c: %.l
  71. flex -P$(notdir $*) -o$@ $<
  72. else
  73. $(config_OUT)/lex.zconf.o: $(config_OUT)/lex.zconf.c | $(config_SHARED_DEPS)
  74. $(hcompile.o)
  75. $(config_SHIPPED_SRC): $(config_OUT)/% : $(config_DIR)/%_shipped
  76. cp $< $@
  77. $(config_OUT)/zconf.tab.o: $(config_SHARED_SRC) | $(config_OUT)/lex.zconf.c $(patsubst %,$(config_DIR)/%,confdata.c expr.c symbol.c menu.c) $(config_SHARED_DEPS)
  78. $(hcompile.o)
  79. endif
  80. .PHONY: ncurses
  81. ncurses:
  82. @echo "main() {}" > $(config_OUT)/lxtemp.c
  83. @if $(HOSTCC) $(config_OUT)/lxtemp.c -o $(config_OUT)/a.out $(HOSTLIBNCURSES) ; then \
  84. $(RM) $(config_OUT)/{lxtemp.c,a.out}; \
  85. else \
  86. $(RM) $(config_OUT)/lxtemp.c; \
  87. echo -e "\007" ;\
  88. echo ">> Unable to find the Ncurses libraries." ;\
  89. echo ">>" ;\
  90. echo ">> You must have Ncurses installed in order" ;\
  91. echo ">> to use 'make menuconfig'" ;\
  92. echo ">>" ;\
  93. echo ">> Maybe you want to try 'make config', which" ;\
  94. echo ">> doesn't depend on the Ncurses libraries." ;\
  95. echo ;\
  96. exit 1 ;\
  97. fi
  98. objclean-y += config_clean
  99. # to be removed after including into top Makefile.in
  100. clean: config_clean
  101. config_clean:
  102. $(RM) $(config_OUT)/*.o $(config_SHIPPED_SRC) $(MCONF_OBJS) $(CONF_OBJS) \
  103. conf mconf lkc_defs.h