Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. YFLAGS= -d
  14. NOMAN= noman
  15. ifneq ($(HOSTCC),)
  16. AICASM_CC= $(HOSTCC)
  17. else
  18. AICASM_CC= $(CC)
  19. endif
  20. ifdef DEBUG
  21. CFLAGS+= -DDEBUG -g
  22. YFLAGS+= -t -v
  23. LFLAGS= -d
  24. endif
  25. $(PROG): ${GENHDRS} $(SRCS)
  26. $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(LIBS)
  27. aicdb.h:
  28. @if [ -e "/usr/include/db4/db_185.h" ]; then \
  29. echo "#include <db4/db_185.h>" > aicdb.h; \
  30. elif [ -e "/usr/include/db3/db_185.h" ]; then \
  31. echo "#include <db3/db_185.h>" > aicdb.h; \
  32. elif [ -e "/usr/include/db2/db_185.h" ]; then \
  33. echo "#include <db2/db_185.h>" > aicdb.h; \
  34. elif [ -e "/usr/include/db1/db_185.h" ]; then \
  35. echo "#include <db1/db_185.h>" > aicdb.h; \
  36. elif [ -e "/usr/include/db/db_185.h" ]; then \
  37. echo "#include <db/db_185.h>" > aicdb.h; \
  38. elif [ -e "/usr/include/db_185.h" ]; then \
  39. echo "#include <db_185.h>" > aicdb.h; \
  40. else \
  41. echo "*** Install db development libraries"; \
  42. fi
  43. clean:
  44. rm -f $(clean-files)
  45. # Create a dependency chain in generated files
  46. # to avoid concurrent invocations of the single
  47. # rule that builds them all.
  48. aicasm_gram.c: aicasm_gram.h
  49. aicasm_gram.c aicasm_gram.h: aicasm_gram.y
  50. $(YACC) $(YFLAGS) -b $(<:.y=) $<
  51. mv $(<:.y=).tab.c $(<:.y=.c)
  52. mv $(<:.y=).tab.h $(<:.y=.h)
  53. # Create a dependency chain in generated files
  54. # to avoid concurrent invocations of the single
  55. # rule that builds them all.
  56. aicasm_macro_gram.c: aicasm_macro_gram.h
  57. aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y
  58. $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
  59. mv $(<:.y=).tab.c $(<:.y=.c)
  60. mv $(<:.y=).tab.h $(<:.y=.h)
  61. aicasm_scan.c: aicasm_scan.l
  62. $(LEX) $(LFLAGS) -o$@ $<
  63. aicasm_macro_scan.c: aicasm_macro_scan.l
  64. $(LEX) $(LFLAGS) -Pmm -o$@ $<