proto.make 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # $Id$
  2. # make Modula-2 compiler
  3. #PARAMS do not remove this line!
  4. UTIL_BIN = \
  5. $(UTIL_HOME)/bin
  6. SRC_DIR = \
  7. $(SRC_HOME)/lang/m2/comp
  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)/tokenname.c $(SRC_DIR)/idf.c \
  18. $(SRC_DIR)/input.c $(SRC_DIR)/type.c $(SRC_DIR)/def.c \
  19. $(SRC_DIR)/misc.c $(SRC_DIR)/enter.c $(SRC_DIR)/defmodule.c \
  20. $(SRC_DIR)/typequiv.c $(SRC_DIR)/node.c $(SRC_DIR)/cstoper.c \
  21. $(SRC_DIR)/chk_expr.c $(SRC_DIR)/options.c $(SRC_DIR)/walk.c \
  22. $(SRC_DIR)/desig.c $(SRC_DIR)/code.c $(SRC_DIR)/lookup.c \
  23. $(SRC_DIR)/stab.c
  24. GEN_C = tokenfile.c program.c declar.c expression.c statement.c \
  25. symbol2str.c char.c Lpars.c casestat.c tmpvar.c scope.c next.c
  26. CFILES= $(SRC_C) $(GEN_C)
  27. SRC_H = $(SRC_DIR)/LLlex.h $(SRC_DIR)/chk_expr.h $(SRC_DIR)/class.h \
  28. $(SRC_DIR)/debug.h $(SRC_DIR)/desig.h $(SRC_DIR)/f_info.h \
  29. $(SRC_DIR)/idf.h $(SRC_DIR)/input.h $(SRC_DIR)/main.h \
  30. $(SRC_DIR)/misc.h $(SRC_DIR)/scope.h $(SRC_DIR)/standards.h \
  31. $(SRC_DIR)/tokenname.h $(SRC_DIR)/walk.h $(SRC_DIR)/warning.h \
  32. $(SRC_DIR)/SYSTEM.h
  33. GEN_H = errout.h idfsize.h numsize.h strsize.h target_sizes.h bigresult.h \
  34. inputtype.h density.h squeeze.h nocross.h nostrict.h def.h debugcst.h \
  35. type.h Lpars.h node.h strict3rd.h real.h use_insert.h dbsymtab.h \
  36. uns_arith.h def.h type.h node.h real.h
  37. HFILES= $(GEN_H) $(SRC_H)
  38. NEXTFILES = \
  39. $(SRC_DIR)/def.H $(SRC_DIR)/type.H $(SRC_DIR)/node.H $(SRC_DIR)/real.H \
  40. $(SRC_DIR)/scope.C $(SRC_DIR)/tmpvar.C $(SRC_DIR)/casestat.C
  41. all: make.main
  42. make -f make.main main
  43. install: all
  44. cp main $(TARGET_HOME)/lib.bin/em_m2
  45. if [ $(DO_MACHINE_INDEP) = y ] ; \
  46. then mk_manpage $(SRC_DIR)/em_m2.6 $(TARGET_HOME) ; \
  47. mk_manpage $(SRC_DIR)/modula-2.1 $(TARGET_HOME) ; \
  48. fi
  49. cmp: all
  50. -cmp main $(TARGET_HOME)/lib.bin/em_m2
  51. opr:
  52. make pr | opr
  53. pr:
  54. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
  55. $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
  56. lint: make.main
  57. make -f make.main lint
  58. Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
  59. echo $(CFILES) | tr ' ' '\012' > Cfiles
  60. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  61. resolved: Cfiles
  62. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  63. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  64. touch resolved
  65. # there is no file called "dependencies"; we want dependencies checked
  66. # every time. This means that make.main is made every time. Oh well ...
  67. # it does not take much time.
  68. dependencies: resolved
  69. do_deps `grep '.c$$' Cfiles`
  70. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  71. rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > make.main
  72. cat *.dep >> make.main
  73. make_macros: Makefile
  74. echo 'SRC_DIR=$(SRC_DIR)' > make_macros
  75. echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
  76. echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
  77. echo 'CC=$(CC)' >> make_macros
  78. echo 'COPTIONS=$(COPTIONS)' >> make_macros
  79. echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
  80. echo 'LINT=$(LINT)' >> make_macros
  81. echo 'LINTSUF=$(LINTSUF)' >> make_macros
  82. echo 'LINTPREF=$(LINTPREF)' >> make_macros
  83. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  84. echo 'SUF=$(SUF)' >> make_macros
  85. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  86. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  87. lists: Cfiles
  88. echo "C_SRC = \\" > lists
  89. echo $(CFILES) >> lists
  90. echo "OBJ = \\" >> lists
  91. echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
  92. clean:
  93. -make -f make.main clean
  94. rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
  95. rm -f resolved *.dep lists make.main make_macros
  96. LLfiles: $(GFILES)
  97. $(LLGEN) $(LLGENOPTIONS) $(GFILES)
  98. @touch LLfiles
  99. hfiles: Parameters $(SRC_DIR)/make.hfiles
  100. $(SRC_DIR)/make.hfiles Parameters
  101. touch hfiles
  102. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  103. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  104. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  105. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  106. def.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/def.H
  107. $(SRC_DIR)/make.allocd < $(SRC_DIR)/def.H > def.h
  108. type.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/type.H
  109. $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.H > type.h
  110. real.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/real.H
  111. $(SRC_DIR)/make.allocd < $(SRC_DIR)/real.H > real.h
  112. node.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/node.H
  113. $(SRC_DIR)/make.allocd < $(SRC_DIR)/node.H > node.h
  114. scope.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/scope.C
  115. $(SRC_DIR)/make.allocd < $(SRC_DIR)/scope.C > scope.c
  116. tmpvar.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/tmpvar.C
  117. $(SRC_DIR)/make.allocd < $(SRC_DIR)/tmpvar.C > tmpvar.c
  118. casestat.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/casestat.C
  119. $(SRC_DIR)/make.allocd < $(SRC_DIR)/casestat.C > casestat.c
  120. next.c: $(NEXTFILES) $(SRC_DIR)/make.next
  121. $(SRC_DIR)/make.next $(NEXTFILES) > next.c
  122. char.c: $(SRC_DIR)/char.tab
  123. $(TABGEN) -f$(SRC_DIR)/char.tab >char.c