Makefile 3.2 KB

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