Makefile 4.1 KB

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