1
0

Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include ${TOPDIR}/rules.mk
  4. CP=cp -fpR
  5. all: ncurses conf mconf
  6. LIBS= -lncurses
  7. ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
  8. HOSTNCURSES+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
  9. else
  10. ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
  11. HOSTNCURSES+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  12. else
  13. ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
  14. HOSTCFLAGS+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
  15. else
  16. ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
  17. HOSTCFLAGS+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  18. else
  19. ifeq (/usr/pkg/include/ncurses.h, $(wildcard /usr/pkg/include/ncurses.h))
  20. HOSTCFLAGS+= -I/usr/pkg/include -DCURSES_LOC="<ncurses.h>"
  21. LIBS+= -L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib
  22. else
  23. ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
  24. HOSTNCURSES+= -DCURSES_LOC="<ncurses.h>"
  25. else
  26. HOSTNCURSES+= -DCURSES_LOC="<curses.h>"
  27. endif
  28. endif
  29. endif
  30. endif
  31. endif
  32. endif
  33. CONF_SRC =conf.c
  34. MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
  35. SHARED_SRC=zconf.tab.c glob.c
  36. SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h glob.h
  37. CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
  38. MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
  39. SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
  40. conf: $(CONF_OBJS) $(SHARED_OBJS)
  41. $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
  42. mconf: $(MCONF_OBJS) $(SHARED_OBJS)
  43. $(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
  44. $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
  45. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  46. $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
  47. $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
  48. glob.o: glob.c $(SHARED_DEPS)
  49. $(HOSTCC) $(HOSTCFLAGS) -I. -c glob.c -o $@
  50. lkc_defs.h: lkc_proto.h
  51. @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  52. ###
  53. # The following requires flex/bison
  54. # By default we use the _shipped versions, uncomment the
  55. # following line if you are modifying the flex/bison src.
  56. LKC_GENPARSER:= 1
  57. ifdef LKC_GENPARSER
  58. %.tab.c %.tab.h: %.y
  59. bison -t -d -v -b $* -p $(notdir $*) $<
  60. lex.%.c: %.l
  61. flex -P$(notdir $*) -o$@ $<
  62. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  63. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  64. zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  65. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -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 "int main(void) { return -1; }" > lxtemp.c
  81. @if $(HOSTCC) $(HOSTCFLAGS) lxtemp.c $(LIBS) ; then \
  82. rm -f lxtemp.c a.out; \
  83. else \
  84. rm -f lxtemp.c; \
  85. printf '\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. exit 1 ;\
  92. fi
  93. clean:
  94. rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  95. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h