proto.make 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # $Id$
  2. # make Modula-2 makefile generator
  3. #PARAMS do not remove this line!
  4. UTIL_BIN = \
  5. $(UTIL_HOME)/bin
  6. SRC_DIR = \
  7. $(SRC_HOME)/lang/m2/m2mm
  8. TABGEN= $(UTIL_BIN)/tabgen
  9. LLGEN = $(UTIL_BIN)/LLgen
  10. LLGENOPTIONS = \
  11. -v
  12. SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
  13. $(SRC_DIR)/expression.g $(SRC_DIR)/statement.g
  14. GEN_G = tokenfile.g
  15. GFILES= $(GEN_G) $(SRC_G)
  16. SRC_C = $(SRC_DIR)/LLlex.c $(SRC_DIR)/LLmessage.c $(SRC_DIR)/error.c \
  17. $(SRC_DIR)/main.c $(SRC_DIR)/lib.c $(SRC_DIR)/tokenname.c \
  18. $(SRC_DIR)/idf.c $(SRC_DIR)/input.c $(SRC_DIR)/misc.c \
  19. $(SRC_DIR)/options.c
  20. GEN_C = tokenfile.c program.c declar.c expression.c statement.c \
  21. symbol2str.c char.c Lpars.c
  22. CFILES= $(SRC_C) $(GEN_C)
  23. SRC_H = $(SRC_DIR)/LLlex.h $(SRC_DIR)/class.h \
  24. $(SRC_DIR)/f_info.h \
  25. $(SRC_DIR)/idf.h $(SRC_DIR)/input.h $(SRC_DIR)/main.h \
  26. $(SRC_DIR)/tokenname.h
  27. GEN_H = Lpars.h
  28. HFILES= $(GEN_H) $(SRC_H)
  29. all: make.main
  30. make -f make.main main
  31. install: all
  32. cp main $(TARGET_HOME)/bin/m2mm
  33. if [ $(DO_MACHINE_INDEP) = y ] ; \
  34. then mk_manpage $(SRC_DIR)/m2mm.1 $(TARGET_HOME) ; \
  35. fi
  36. cmp: all
  37. -cmp main $(TARGET_HOME)/lib.bin/em_m2
  38. opr:
  39. make pr | opr
  40. pr:
  41. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
  42. $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(SRC_C)
  43. lint: make.main
  44. make -f make.main lint
  45. Cfiles: LLfiles $(GEN_C) $(GEN_H) Makefile
  46. echo $(CFILES) | tr ' ' '\012' > Cfiles
  47. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  48. resolved: Cfiles
  49. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  50. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  51. touch resolved
  52. # there is no file called "dependencies"; we want dependencies checked
  53. # every time. This means that make.main is made every time. Oh well ...
  54. # it does not take much time.
  55. dependencies: resolved
  56. do_deps `grep '.c$$' Cfiles`
  57. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  58. rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
  59. cat *.dep >> make.main
  60. make_macros: Makefile
  61. echo 'SRC_DIR=$(SRC_DIR)' > make_macros
  62. echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
  63. echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
  64. echo 'CC=$(CC)' >> make_macros
  65. echo 'COPTIONS=$(COPTIONS)' >> make_macros
  66. echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
  67. echo 'LINT=$(LINT)' >> make_macros
  68. echo 'LINTSUF=$(LINTSUF)' >> make_macros
  69. echo 'LINTPREF=$(LINTPREF)' >> make_macros
  70. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  71. echo 'SUF=$(SUF)' >> make_macros
  72. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  73. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  74. lists: Cfiles
  75. echo "C_SRC = \\" > lists
  76. echo $(CFILES) >> lists
  77. echo "OBJ = \\" >> lists
  78. echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
  79. clean:
  80. -make -f make.main clean
  81. rm -f $(GEN_C) $(GEN_G) $(GEN_H) LLfiles Cfiles LL.output
  82. rm -f resolved *.dep lists make.main make_macros
  83. LLfiles: $(GFILES)
  84. $(LLGEN) $(LLGENOPTIONS) $(GFILES)
  85. @touch LLfiles
  86. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  87. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  88. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  89. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  90. char.c: $(SRC_DIR)/char.tab
  91. $(TABGEN) -f$(SRC_DIR)/char.tab >char.c