Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. PROG= aicasm
  2. .SUFFIXES= .l .y .c .h
  3. CSRCS= aicasm.c aicasm_symbol.c
  4. YSRCS= aicasm_gram.y aicasm_macro_gram.y
  5. LSRCS= aicasm_scan.l aicasm_macro_scan.l
  6. GENHDRS= aicdb.h $(YSRCS:.y=.h)
  7. GENSRCS= $(YSRCS:.y=.c) $(LSRCS:.l=.c)
  8. SRCS= ${CSRCS} ${GENSRCS}
  9. LIBS= -ldb
  10. clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG)
  11. # Override default kernel CFLAGS. This is a userland app.
  12. AICASM_CFLAGS:= -I/usr/include -I.
  13. LEX= flex
  14. YACC= bison
  15. YFLAGS= -d
  16. NOMAN= noman
  17. ifneq ($(HOSTCC),)
  18. AICASM_CC= $(HOSTCC)
  19. else
  20. AICASM_CC= $(CC)
  21. endif
  22. ifdef DEBUG
  23. CFLAGS+= -DDEBUG -g
  24. YFLAGS+= -t -v
  25. LFLAGS= -d
  26. endif
  27. $(PROG): ${GENHDRS} $(SRCS)
  28. $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(LIBS)
  29. aicdb.h:
  30. @if [ -e "/usr/include/db4/db_185.h" ]; then \
  31. echo "#include <db4/db_185.h>" > aicdb.h; \
  32. elif [ -e "/usr/include/db3/db_185.h" ]; then \
  33. echo "#include <db3/db_185.h>" > aicdb.h; \
  34. elif [ -e "/usr/include/db2/db_185.h" ]; then \
  35. echo "#include <db2/db_185.h>" > aicdb.h; \
  36. elif [ -e "/usr/include/db1/db_185.h" ]; then \
  37. echo "#include <db1/db_185.h>" > aicdb.h; \
  38. elif [ -e "/usr/include/db/db_185.h" ]; then \
  39. echo "#include <db/db_185.h>" > aicdb.h; \
  40. elif [ -e "/usr/include/db_185.h" ]; then \
  41. echo "#include <db_185.h>" > aicdb.h; \
  42. else \
  43. echo "*** Install db development libraries"; \
  44. fi
  45. clean:
  46. rm -f $(clean-files)
  47. # Create a dependency chain in generated files
  48. # to avoid concurrent invocations of the single
  49. # rule that builds them all.
  50. aicasm_gram.c: aicasm_gram.h
  51. aicasm_gram.c aicasm_gram.h: aicasm_gram.y
  52. $(YACC) $(YFLAGS) -b $(<:.y=) $<
  53. mv $(<:.y=).tab.c $(<:.y=.c)
  54. mv $(<:.y=).tab.h $(<:.y=.h)
  55. # Create a dependency chain in generated files
  56. # to avoid concurrent invocations of the single
  57. # rule that builds them all.
  58. aicasm_macro_gram.c: aicasm_macro_gram.h
  59. aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y
  60. $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
  61. mv $(<:.y=).tab.c $(<:.y=.c)
  62. mv $(<:.y=).tab.h $(<:.y=.h)
  63. aicasm_scan.c: aicasm_scan.l
  64. $(LEX) $(LFLAGS) -o$@ $<
  65. aicasm_macro_scan.c: aicasm_macro_scan.l
  66. $(LEX) $(LFLAGS) -Pmm -o$@ $<