Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 $(wildcard lxdialog/*.c)
  35. SHARED_SRC=zconf.tab.c
  36. SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.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. %.hash.c: %.gperf
  61. gperf < $< > $@
  62. lex.%.c: %.l
  63. flex -P$(notdir $*) -o$@ $<
  64. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  65. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  66. zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  67. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  68. else
  69. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  70. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  71. lex.zconf.c: lex.zconf.c_shipped
  72. $(CP) lex.zconf.c_shipped lex.zconf.c
  73. zconf.hash.c: zconf.hash.c_shipped
  74. $(CP) zconf.hash.c_shipped zconf.hash.c
  75. zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  76. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  77. zconf.tab.c: zconf.tab.c_shipped
  78. $(CP) zconf.tab.c_shipped zconf.tab.c
  79. zconf.tab.h: zconf.tab.h_shipped
  80. $(CP) zconf.tab.h_shipped zconf.tab.h
  81. endif
  82. .PHONY: ncurses
  83. ncurses:
  84. @echo "int main(void) { return -1; }" > lxtemp.c
  85. @if $(HOSTCC) $(HOSTCFLAGS) lxtemp.c $(LIBS) ; then \
  86. rm -f lxtemp.c a.out; \
  87. else \
  88. rm -f lxtemp.c; \
  89. printf '\007'; \
  90. echo ">> Unable to find the Ncurses libraries." ;\
  91. echo ">>" ;\
  92. echo ">> You must have Ncurses installed in order" ;\
  93. echo ">> to use 'make menuconfig'" ;\
  94. echo ;\
  95. exit 1 ;\
  96. fi
  97. clean:
  98. rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  99. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h