proto.make 4.9 KB

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