Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
  4. #
  5. # This program is free software; you can redistribute it and/or modify it under
  6. # the terms of the GNU Library General Public License as published by the Free
  7. # Software Foundation; either version 2 of the License, or (at your option) any
  8. # later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Library General Public License
  16. # along with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. TOPDIR=../../
  19. include $(TOPDIR)Rules.mak
  20. all: ncurses conf mconf
  21. ifeq ($(shell uname),SunOS)
  22. LIBS = -lcurses
  23. else
  24. LIBS = -lncurses
  25. endif
  26. ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
  27. HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
  28. else
  29. ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
  30. HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  31. else
  32. ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
  33. HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
  34. else
  35. ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
  36. HOSTCFLAGS += -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  37. else
  38. ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
  39. HOSTNCURSES += -DCURSES_LOC="<ncurses.h>"
  40. else
  41. HOSTNCURSES += -DCURSES_LOC="<curses.h>"
  42. endif
  43. endif
  44. endif
  45. endif
  46. endif
  47. CONF_SRC = conf.c
  48. MCONF_SRC = mconf.c
  49. LXD_SRC = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
  50. lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
  51. lxdialog/msgbox.c
  52. SHARED_SRC = zconf.tab.c
  53. SHARED_DEPS := lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
  54. CONF_OBJS = $(patsubst %.c,%.o, $(CONF_SRC))
  55. MCONF_OBJS = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
  56. SHARED_OBJS = $(patsubst %.c,%.o, $(SHARED_SRC))
  57. conf: $(CONF_OBJS) $(SHARED_OBJS)
  58. $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
  59. mconf: $(MCONF_OBJS) $(SHARED_OBJS)
  60. $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
  61. $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
  62. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  63. $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
  64. $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
  65. lkc_defs.h: lkc_proto.h
  66. @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  67. ###
  68. # The following requires flex/bison
  69. # By default we use the _shipped versions, uncomment the
  70. # following line if you are modifying the flex/bison src.
  71. #LKC_GENPARSER := 1
  72. ifdef LKC_GENPARSER
  73. %.tab.c %.tab.h: %.y
  74. bison -t -d -v -b $* -p $(notdir $*) $<
  75. lex.%.c: %.l
  76. flex -P$(notdir $*) -o$@ $<
  77. else
  78. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  79. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  80. lex.zconf.c: lex.zconf.c_shipped
  81. cp lex.zconf.c_shipped lex.zconf.c
  82. zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  83. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  84. zconf.tab.c: zconf.tab.c_shipped
  85. cp zconf.tab.c_shipped zconf.tab.c
  86. zconf.tab.h: zconf.tab.h_shipped
  87. cp zconf.tab.h_shipped zconf.tab.h
  88. endif
  89. .PHONY: ncurses
  90. ncurses:
  91. @echo "main() {}" > lxtemp.c
  92. @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
  93. $(RM) lxtemp.c a.out; \
  94. else \
  95. $(RM) lxtemp.c; \
  96. echo -e "\007" ;\
  97. echo ">> Unable to find the Ncurses libraries." ;\
  98. echo ">>" ;\
  99. echo ">> You must have Ncurses installed in order" ;\
  100. echo ">> to use 'make menuconfig'" ;\
  101. echo ">>" ;\
  102. echo ">> Maybe you want to try 'make config', which" ;\
  103. echo ">> doesn't depend on the Ncurses libraries." ;\
  104. echo ;\
  105. exit 1 ;\
  106. fi
  107. clean:
  108. $(RM) *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  109. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h