Makefile 3.8 KB

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