Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 ${CURSES_CFLAGS}
  9. LIBS= ${CURSES_LIBS}
  10. all: ncurses conf mconf
  11. CONF_SRC =conf.c
  12. MCONF_SRC =mconf.c $(wildcard lxdialog/*.c)
  13. SHARED_SRC=zconf.tab.c
  14. SHARED_DEPS:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
  15. CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC))
  16. MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
  17. SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
  18. conf: $(CONF_OBJS) $(SHARED_OBJS)
  19. @$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ 2>/dev/null
  20. mconf: $(MCONF_OBJS) $(SHARED_OBJS)
  21. @$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ $(LIBS) 2>/dev/null
  22. $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
  23. @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
  24. $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
  25. @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
  26. glob.o: glob.c $(SHARED_DEPS)
  27. @$(HOST_CC) $(HOST_CFLAGS) -I. -c glob.c -o $@ 2>/dev/null
  28. lkc_defs.h: lkc_proto.h
  29. @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
  30. ###
  31. # The following requires flex/bison
  32. # By default we use the _shipped versions, uncomment the
  33. # following line if you are modifying the flex/bison src.
  34. # LKC_GENPARSER:= 1
  35. ifdef LKC_GENPARSER
  36. %.tab.c %.tab.h: %.y
  37. bison -t -d -v -b $* -p $(notdir $*) $<
  38. %.hash.c: %.gperf
  39. gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t zconf.gperf
  40. lex.%.c: %.l
  41. flex -P$(notdir $*) -o$@ $<
  42. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  43. @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
  44. zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  45. @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
  46. else
  47. lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
  48. @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
  49. lex.zconf.c: lex.zconf.c_shipped
  50. @$(CP) lex.zconf.c_shipped lex.zconf.c
  51. zconf.hash.c: zconf.hash.c_shipped
  52. @$(CP) zconf.hash.c_shipped zconf.hash.c
  53. zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
  54. @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
  55. zconf.tab.c: zconf.tab.c_shipped
  56. @$(CP) zconf.tab.c_shipped zconf.tab.c
  57. zconf.tab.h: zconf.tab.h_shipped
  58. @$(CP) zconf.tab.h_shipped zconf.tab.h
  59. endif
  60. .PHONY: ncurses
  61. ncurses:
  62. @echo "int main(void) { return -1; }" > lxtemp.c
  63. @if $(HOST_CC) $(HOST_CFLAGS) lxtemp.c $(LIBS) ; then \
  64. rm -f lxtemp.c a.out; \
  65. else \
  66. rm -f lxtemp.c; \
  67. printf '\007'; \
  68. echo ">> Unable to find the Ncurses libraries." ;\
  69. echo ">>" ;\
  70. echo ">> You must have Ncurses installed in order" ;\
  71. echo ">> to use 'make menuconfig'" ;\
  72. echo ;\
  73. exit 1 ;\
  74. fi
  75. clean:
  76. @rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) zconf.hash.c \
  77. conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h