proto.make 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. # $Header$
  2. # make C compiler
  3. #PARAMS do not remove this line!
  4. UTIL_BIN = \
  5. $(UTIL_HOME)/bin
  6. SRC_DIR = \
  7. $(SRC_HOME)/lang/cem/cemcom
  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 $(SRC_DIR)/ival.g
  14. GEN_G = tokenfile.g
  15. GFILES= $(GEN_G) $(SRC_G)
  16. SRC_C = \
  17. $(SRC_DIR)/Version.c \
  18. $(SRC_DIR)/LLlex.c \
  19. $(SRC_DIR)/LLmessage.c \
  20. $(SRC_DIR)/arith.c \
  21. $(SRC_DIR)/asm.c \
  22. $(SRC_DIR)/blocks.c \
  23. $(SRC_DIR)/ch7.c \
  24. $(SRC_DIR)/ch7bin.c \
  25. $(SRC_DIR)/ch7mon.c \
  26. $(SRC_DIR)/code.c \
  27. $(SRC_DIR)/conversion.c \
  28. $(SRC_DIR)/cstoper.c \
  29. $(SRC_DIR)/dataflow.c \
  30. $(SRC_DIR)/declarator.c \
  31. $(SRC_DIR)/decspecs.c \
  32. $(SRC_DIR)/domacro.c \
  33. $(SRC_DIR)/dumpidf.c \
  34. $(SRC_DIR)/error.c \
  35. $(SRC_DIR)/eval.c \
  36. $(SRC_DIR)/expr.c \
  37. $(SRC_DIR)/field.c \
  38. $(SRC_DIR)/idf.c \
  39. $(SRC_DIR)/init.c \
  40. $(SRC_DIR)/input.c \
  41. $(SRC_DIR)/l_comment.c \
  42. $(SRC_DIR)/l_ev_ord.c \
  43. $(SRC_DIR)/l_lint.c \
  44. $(SRC_DIR)/l_misc.c \
  45. $(SRC_DIR)/l_outdef.c \
  46. $(SRC_DIR)/l_states.c \
  47. $(SRC_DIR)/label.c \
  48. $(SRC_DIR)/main.c \
  49. $(SRC_DIR)/options.c \
  50. $(SRC_DIR)/replace.c \
  51. $(SRC_DIR)/scan.c \
  52. $(SRC_DIR)/skip.c \
  53. $(SRC_DIR)/stack.c \
  54. $(SRC_DIR)/struct.c \
  55. $(SRC_DIR)/switch.c \
  56. $(SRC_DIR)/tokenname.c \
  57. $(SRC_DIR)/type.c \
  58. $(SRC_DIR)/util.c
  59. GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
  60. symbol2str.c char.c Lpars.c next.c
  61. CFILES= $(SRC_C) $(GEN_C)
  62. SRC_H = \
  63. $(SRC_DIR)/LLlex.h \
  64. $(SRC_DIR)/align.h \
  65. $(SRC_DIR)/arith.h \
  66. $(SRC_DIR)/assert.h \
  67. $(SRC_DIR)/atw.h \
  68. $(SRC_DIR)/class.h \
  69. $(SRC_DIR)/decspecs.h \
  70. $(SRC_DIR)/file_info.h \
  71. $(SRC_DIR)/input.h \
  72. $(SRC_DIR)/interface.h \
  73. $(SRC_DIR)/l_class.h \
  74. $(SRC_DIR)/l_comment.h \
  75. $(SRC_DIR)/l_em.h \
  76. $(SRC_DIR)/l_lint.h \
  77. $(SRC_DIR)/label.h \
  78. $(SRC_DIR)/level.h \
  79. $(SRC_DIR)/mes.h \
  80. $(SRC_DIR)/sizes.h \
  81. $(SRC_DIR)/specials.h \
  82. $(SRC_DIR)/tokenname.h
  83. GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
  84. idfsize.h ifdepth.h inputtype.h lint.h \
  85. nobitfield.h nopp.h nocross.h \
  86. nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
  87. strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
  88. regcount.h \
  89. code.h declar.h decspecs.h def.h expr.h field.h estack.h util.h \
  90. idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
  91. l_outdef.h stack.h lapbuf.h noRoption.h nofloat.h
  92. HFILES= $(GEN_H) $(SRC_H)
  93. NEXTFILES = \
  94. $(SRC_DIR)/code.str \
  95. $(SRC_DIR)/declar.str \
  96. $(SRC_DIR)/decspecs.str \
  97. $(SRC_DIR)/def.str \
  98. $(SRC_DIR)/expr.str \
  99. $(SRC_DIR)/field.str \
  100. $(SRC_DIR)/estack.str \
  101. $(SRC_DIR)/util.str \
  102. $(SRC_DIR)/idf.str \
  103. $(SRC_DIR)/macro.str \
  104. $(SRC_DIR)/stack.str \
  105. $(SRC_DIR)/stmt.str \
  106. $(SRC_DIR)/struct.str \
  107. $(SRC_DIR)/switch.str \
  108. $(SRC_DIR)/type.str \
  109. $(SRC_DIR)/l_brace.str \
  110. $(SRC_DIR)/l_state.str \
  111. $(SRC_DIR)/l_outdef.str
  112. all: make.main
  113. make -f make.main main
  114. install: all
  115. cp main $(TARGET_HOME)/lib.bin/em_cemcom
  116. if [ $(DO_MACHINE_INDEP) = y ] ; \
  117. then cp $(SRC_DIR)/cemcom.1 em_cemcom.6 ; \
  118. mk_manpage em_cemcom.6 $(TARGET_HOME) ; \
  119. rm -f em_cemcom.6 ; \
  120. fi
  121. cmp: all
  122. -cmp main $(TARGET_HOME)/lib.bin/em_cemcom
  123. opr:
  124. make pr | opr
  125. pr:
  126. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
  127. $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
  128. lint: make.main
  129. make -f make.main lint
  130. Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
  131. echo $(CFILES) | tr ' ' '\012' > Cfiles
  132. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  133. resolved: Cfiles
  134. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  135. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  136. touch resolved
  137. # there is no file called "dependencies"; we want dependencies checked
  138. # every time. This means that make.main is made every time. Oh well ...
  139. # it does not take much time.
  140. dependencies: resolved
  141. do_deps `grep '.c$$' Cfiles`
  142. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  143. sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
  144. echo '#DEPENDENCIES' >> make.main
  145. cat *.dep >> make.main
  146. make_macros: Makefile
  147. echo 'SRC_DIR=$(SRC_DIR)' > make_macros
  148. echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
  149. echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
  150. echo 'CC=$(CC)' >> make_macros
  151. echo 'COPTIONS=$(COPTIONS)' >> make_macros
  152. echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
  153. echo 'LINT=$(LINT)' >> make_macros
  154. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  155. echo 'SUF=$(SUF)' >> make_macros
  156. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  157. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  158. lists: Cfiles
  159. echo "C_SRC = \\" > lists
  160. echo $(CFILES) >> lists
  161. echo "OBJ = \\" >> lists
  162. echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
  163. clean:
  164. -make -f make.main clean
  165. rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
  166. rm -f resolved *.dep lists make.main make_macros
  167. LLfiles: $(GFILES)
  168. $(LLGEN) $(LLGENOPTIONS) $(GFILES)
  169. @touch LLfiles
  170. hfiles: Parameters $(SRC_DIR)/make.hfiles
  171. $(SRC_DIR)/make.hfiles Parameters
  172. touch hfiles
  173. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  174. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  175. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  176. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  177. code.h: $(SRC_DIR)/code.str $(SRC_DIR)/make.allocd
  178. $(SRC_DIR)/make.allocd < $(SRC_DIR)/code.str > code.h
  179. declar.h: $(SRC_DIR)/declar.str $(SRC_DIR)/make.allocd
  180. $(SRC_DIR)/make.allocd < $(SRC_DIR)/declar.str > declar.h
  181. def.h: $(SRC_DIR)/def.str $(SRC_DIR)/make.allocd
  182. $(SRC_DIR)/make.allocd < $(SRC_DIR)/def.str > def.h
  183. expr.h: $(SRC_DIR)/expr.str $(SRC_DIR)/make.allocd
  184. $(SRC_DIR)/make.allocd < $(SRC_DIR)/expr.str > expr.h
  185. field.h: $(SRC_DIR)/field.str $(SRC_DIR)/make.allocd
  186. $(SRC_DIR)/make.allocd < $(SRC_DIR)/field.str > field.h
  187. estack.h: $(SRC_DIR)/estack.str $(SRC_DIR)/make.allocd
  188. $(SRC_DIR)/make.allocd < $(SRC_DIR)/estack.str > estack.h
  189. util.h: $(SRC_DIR)/util.str $(SRC_DIR)/make.allocd
  190. $(SRC_DIR)/make.allocd < $(SRC_DIR)/util.str > util.h
  191. decspecs.h: $(SRC_DIR)/decspecs.str $(SRC_DIR)/make.allocd
  192. $(SRC_DIR)/make.allocd < $(SRC_DIR)/decspecs.str > decspecs.h
  193. idf.h: $(SRC_DIR)/idf.str $(SRC_DIR)/make.allocd
  194. $(SRC_DIR)/make.allocd < $(SRC_DIR)/idf.str > idf.h
  195. macro.h: $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
  196. $(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
  197. stack.h: $(SRC_DIR)/stack.str $(SRC_DIR)/make.allocd
  198. $(SRC_DIR)/make.allocd < $(SRC_DIR)/stack.str > stack.h
  199. stmt.h: $(SRC_DIR)/stmt.str $(SRC_DIR)/make.allocd
  200. $(SRC_DIR)/make.allocd < $(SRC_DIR)/stmt.str > stmt.h
  201. struct.h: $(SRC_DIR)/struct.str $(SRC_DIR)/make.allocd
  202. $(SRC_DIR)/make.allocd < $(SRC_DIR)/struct.str > struct.h
  203. switch.h: $(SRC_DIR)/switch.str $(SRC_DIR)/make.allocd
  204. $(SRC_DIR)/make.allocd < $(SRC_DIR)/switch.str > switch.h
  205. type.h: $(SRC_DIR)/type.str $(SRC_DIR)/make.allocd
  206. $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.str > type.h
  207. l_brace.h: $(SRC_DIR)/l_brace.str $(SRC_DIR)/make.allocd
  208. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_brace.str > l_brace.h
  209. l_state.h: $(SRC_DIR)/l_state.str $(SRC_DIR)/make.allocd
  210. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_state.str > l_state.h
  211. l_outdef.h: $(SRC_DIR)/l_outdef.str $(SRC_DIR)/make.allocd
  212. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_outdef.str > l_outdef.h
  213. next.c: $(NEXTFILES) $(SRC_DIR)/make.next
  214. $(SRC_DIR)/make.next $(NEXTFILES) > next.c
  215. char.c: $(SRC_DIR)/char.tab
  216. $(TABGEN) -f$(SRC_DIR)/char.tab >char.c