Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. LIBS = -lncurses
  22. ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
  23. HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
  24. else
  25. ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
  26. HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  27. else
  28. ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
  29. HOSTCFLAGS += -DCURSES_LOC="<ncurses.h>"
  30. else
  31. HOSTCFLAGS += -DCURSES_LOC="<curses.h>"
  32. endif
  33. endif
  34. endif
  35. CONF_SRC =conf.c zconf.tab.c
  36. MCONF_SRC =mconf.c zconf.tab.c
  37. LXDLG_SRC =checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
  38. CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
  39. MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
  40. LXDLG_OBJS=$(patsubst %.c,%.o, $(LXDLG_SRC))
  41. conf: $(CONF_OBJS)
  42. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@
  43. mconf: $(MCONF_OBJS) $(LXDLG_OBJS)
  44. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
  45. lkc_deps:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
  46. conf.o: conf.c $(lkc_deps)
  47. mconf.o: mconf.c $(lkc_deps)
  48. zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps)
  49. lex.zconf.o: lex.zconf.c $(lkc_deps)
  50. %.o : %.c
  51. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  52. lkc_defs.h: lkc_proto.h
  53. @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  54. ###
  55. # The following requires flex/bison
  56. # By default we use the _shipped versions, uncomment the
  57. # following line if you are modifying the flex/bison src.
  58. #LKC_GENPARSER := 1
  59. ifdef LKC_GENPARSER
  60. %.tab.c %.tab.h: %.y
  61. bison -t -d -v -b $* -p $(notdir $*) $<
  62. lex.%.c: %.l
  63. flex -P$(notdir $*) -o$@ $<
  64. else
  65. lex.zconf.c: lex.zconf.c_shipped
  66. cp lex.zconf.c_shipped lex.zconf.c
  67. zconf.tab.c: zconf.tab.c_shipped
  68. cp zconf.tab.c_shipped zconf.tab.c
  69. zconf.tab.h: zconf.tab.h_shipped
  70. cp zconf.tab.h_shipped zconf.tab.h
  71. endif
  72. .PHONY: ncurses
  73. ncurses:
  74. @echo "main() {}" > lxtemp.c
  75. @if $(HOSTCC) lxtemp.c $(LIBS) ; then \
  76. rm -f lxtemp.c a.out; \
  77. else \
  78. rm -f lxtemp.c; \
  79. echo -e "\007" ;\
  80. echo ">> Unable to find the Ncurses libraries." ;\
  81. echo ">>" ;\
  82. echo ">> You must have Ncurses installed in order" ;\
  83. echo ">> to use 'make menuconfig'" ;\
  84. echo ;\
  85. exit 1 ;\
  86. fi
  87. clean:
  88. rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  89. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h