Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. HOSTCFLAGS+=-DKBUILD_NO_NLS
  6. all: ncurses conf mconf
  7. LIBS= -lncurses
  8. ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
  9. HOSTNCURSES+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
  10. else
  11. ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
  12. HOSTNCURSES+= -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  13. else
  14. ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
  15. HOSTCFLAGS+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
  16. else
  17. ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
  18. HOSTCFLAGS+= -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
  19. else
  20. ifeq (/usr/pkg/include/ncurses.h, $(wildcard /usr/pkg/include/ncurses.h))
  21. HOSTCFLAGS+= -I/usr/pkg/include -DCURSES_LOC="<ncurses.h>"
  22. LIBS+= -L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib
  23. else
  24. ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
  25. HOSTNCURSES+= -DCURSES_LOC="<ncurses.h>"
  26. else
  27. HOSTNCURSES+= -DCURSES_LOC="<curses.h>"
  28. endif
  29. endif
  30. endif
  31. endif
  32. endif
  33. endif
  34. CONF_SRC =conf.c
  35. MCONF_SRC =mconf.c $(wildcard lxdialog/*.c)
  36. SHARED_SRC=zconf.tab.c
  37. SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
  38. CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
  39. MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
  40. SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
  41. conf: $(CONF_OBJS) $(SHARED_OBJS)
  42. $(HOSTCC) -DKBUILD_NO_NLS $(NATIVE_LDFLAGS) $^ -o $@
  43. mconf: $(MCONF_OBJS) $(SHARED_OBJS)
  44. $(HOSTCC) -DKBUILD_NO_NLS $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
  45. $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
  46. $(HOSTCC) -DKBUILD_NO_NLS $(HOSTCFLAGS) -I. -c $< -o $@
  47. $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
  48. $(HOSTCC) -DKBUILD_NO_NLS $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
  49. glob.o: glob.c $(SHARED_DEPS)
  50. $(HOSTCC) $(HOSTCFLAGS) -I. -c glob.c -o $@
  51. lkc_defs.h: lkc_proto.h
  52. @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  53. ###
  54. # The following requires flex/bison
  55. # By default we use the _shipped versions, uncomment the
  56. # following line if you are modifying the flex/bison src.
  57. #LKC_GENPARSER:= 1
  58. ifdef LKC_GENPARSER
  59. %.tab.c %.tab.h: %.y
  60. bison -t -d -v -b $* -p $(notdir $*) $<
  61. %.hash.c: %.gperf
  62. gperf < $< > $@
  63. lex.%.c: %.l
  64. flex -P$(notdir $*) -o$@ $<
  65. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  66. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  67. zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  68. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  69. else
  70. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  71. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  72. lex.zconf.c: lex.zconf.c_shipped
  73. $(CP) lex.zconf.c_shipped lex.zconf.c
  74. zconf.hash.c: zconf.hash.c_shipped
  75. $(CP) zconf.hash.c_shipped zconf.hash.c
  76. zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  77. $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
  78. zconf.tab.c: zconf.tab.c_shipped
  79. $(CP) zconf.tab.c_shipped zconf.tab.c
  80. zconf.tab.h: zconf.tab.h_shipped
  81. $(CP) zconf.tab.h_shipped zconf.tab.h
  82. endif
  83. .PHONY: ncurses
  84. ncurses:
  85. @echo "int main(void) { return -1; }" > lxtemp.c
  86. @if $(HOSTCC) $(HOSTCFLAGS) lxtemp.c $(LIBS) ; then \
  87. rm -f lxtemp.c a.out; \
  88. else \
  89. rm -f lxtemp.c; \
  90. printf '\007'; \
  91. echo ">> Unable to find the Ncurses libraries." ;\
  92. echo ">>" ;\
  93. echo ">> You must have Ncurses installed in order" ;\
  94. echo ">> to use 'make menuconfig'" ;\
  95. echo ;\
  96. exit 1 ;\
  97. fi
  98. clean:
  99. rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
  100. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h