proto.make 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. # $Id$
  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. $(SRC_DIR)/stab.c
  60. GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
  61. symbol2str.c char.c Lpars.c next.c
  62. CFILES= $(SRC_C) $(GEN_C)
  63. SRC_H = \
  64. $(SRC_DIR)/LLlex.h \
  65. $(SRC_DIR)/align.h \
  66. $(SRC_DIR)/arith.h \
  67. $(SRC_DIR)/assert.h \
  68. $(SRC_DIR)/atw.h \
  69. $(SRC_DIR)/class.h \
  70. $(SRC_DIR)/decspecs.h \
  71. $(SRC_DIR)/file_info.h \
  72. $(SRC_DIR)/input.h \
  73. $(SRC_DIR)/interface.h \
  74. $(SRC_DIR)/l_class.h \
  75. $(SRC_DIR)/l_comment.h \
  76. $(SRC_DIR)/l_em.h \
  77. $(SRC_DIR)/l_lint.h \
  78. $(SRC_DIR)/label.h \
  79. $(SRC_DIR)/level.h \
  80. $(SRC_DIR)/mes.h \
  81. $(SRC_DIR)/sizes.h \
  82. $(SRC_DIR)/specials.h \
  83. $(SRC_DIR)/tokenname.h
  84. GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
  85. idfsize.h ifdepth.h inputtype.h lint.h \
  86. nobitfield.h nopp.h nocross.h \
  87. nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
  88. strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
  89. regcount.h \
  90. code.h declar.h decspecs.h def.h expr.h field.h estack.h util.h \
  91. idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
  92. l_outdef.h stack.h lapbuf.h noRoption.h nofloat.h dbsymtab.h
  93. HFILES= $(GEN_H) $(SRC_H)
  94. NEXTFILES = \
  95. $(SRC_DIR)/code.str \
  96. $(SRC_DIR)/declar.str \
  97. $(SRC_DIR)/decspecs.str \
  98. $(SRC_DIR)/def.str \
  99. $(SRC_DIR)/expr.str \
  100. $(SRC_DIR)/field.str \
  101. $(SRC_DIR)/estack.str \
  102. $(SRC_DIR)/util.str \
  103. $(SRC_DIR)/idf.str \
  104. $(SRC_DIR)/macro.str \
  105. $(SRC_DIR)/stack.str \
  106. $(SRC_DIR)/stmt.str \
  107. $(SRC_DIR)/struct.str \
  108. $(SRC_DIR)/switch.str \
  109. $(SRC_DIR)/type.str \
  110. $(SRC_DIR)/l_brace.str \
  111. $(SRC_DIR)/l_state.str \
  112. $(SRC_DIR)/l_outdef.str
  113. all: make.main
  114. make -f make.main main
  115. install: all
  116. cp main $(TARGET_HOME)/lib.bin/em_cemcom
  117. if [ $(DO_MACHINE_INDEP) = y ] ; \
  118. then cp $(SRC_DIR)/cemcom.1 em_cemcom.6 ; \
  119. mk_manpage em_cemcom.6 $(TARGET_HOME) ; \
  120. rm -f em_cemcom.6 ; \
  121. fi
  122. cmp: all
  123. -cmp main $(TARGET_HOME)/lib.bin/em_cemcom
  124. opr:
  125. make pr | opr
  126. pr:
  127. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
  128. $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
  129. lint: make.main
  130. make -f make.main lint
  131. Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
  132. echo $(CFILES) | tr ' ' '\012' > Cfiles
  133. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  134. resolved: Cfiles
  135. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  136. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  137. touch resolved
  138. # there is no file called "dependencies"; we want dependencies checked
  139. # every time. This means that make.main is made every time. Oh well ...
  140. # it does not take much time.
  141. dependencies: resolved
  142. do_deps `grep '.c$$' Cfiles`
  143. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  144. rm_deps $(SRC_DIR)/proto.main | sed -e '/^.PARAMS/r make_macros' -e '/^.LISTS/r lists' > 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 'LINTSUF=$(LINTSUF)' >> make_macros
  155. echo 'LINTPREF=$(LINTPREF)' >> make_macros
  156. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  157. echo 'SUF=$(SUF)' >> make_macros
  158. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  159. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  160. lists: Cfiles
  161. echo "C_SRC = \\" > lists
  162. echo $(CFILES) >> lists
  163. echo "OBJ = \\" >> lists
  164. echo $(CFILES) | sed -e 's|[^ ]*/||g' -e 's/\.c/.$$(SUF)/g' >> lists
  165. clean:
  166. -make -f make.main clean
  167. rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
  168. rm -f resolved *.dep lists make.main make_macros
  169. LLfiles: $(GFILES)
  170. $(LLGEN) $(LLGENOPTIONS) $(GFILES)
  171. @touch LLfiles
  172. hfiles: Parameters $(SRC_DIR)/make.hfiles
  173. $(SRC_DIR)/make.hfiles Parameters
  174. touch hfiles
  175. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  176. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  177. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  178. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  179. code.h: $(SRC_DIR)/code.str $(SRC_DIR)/make.allocd
  180. $(SRC_DIR)/make.allocd < $(SRC_DIR)/code.str > code.h
  181. declar.h: $(SRC_DIR)/declar.str $(SRC_DIR)/make.allocd
  182. $(SRC_DIR)/make.allocd < $(SRC_DIR)/declar.str > declar.h
  183. def.h: $(SRC_DIR)/def.str $(SRC_DIR)/make.allocd
  184. $(SRC_DIR)/make.allocd < $(SRC_DIR)/def.str > def.h
  185. expr.h: $(SRC_DIR)/expr.str $(SRC_DIR)/make.allocd
  186. $(SRC_DIR)/make.allocd < $(SRC_DIR)/expr.str > expr.h
  187. field.h: $(SRC_DIR)/field.str $(SRC_DIR)/make.allocd
  188. $(SRC_DIR)/make.allocd < $(SRC_DIR)/field.str > field.h
  189. estack.h: $(SRC_DIR)/estack.str $(SRC_DIR)/make.allocd
  190. $(SRC_DIR)/make.allocd < $(SRC_DIR)/estack.str > estack.h
  191. util.h: $(SRC_DIR)/util.str $(SRC_DIR)/make.allocd
  192. $(SRC_DIR)/make.allocd < $(SRC_DIR)/util.str > util.h
  193. decspecs.h: $(SRC_DIR)/decspecs.str $(SRC_DIR)/make.allocd
  194. $(SRC_DIR)/make.allocd < $(SRC_DIR)/decspecs.str > decspecs.h
  195. idf.h: $(SRC_DIR)/idf.str $(SRC_DIR)/make.allocd
  196. $(SRC_DIR)/make.allocd < $(SRC_DIR)/idf.str > idf.h
  197. macro.h: $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
  198. $(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
  199. stack.h: $(SRC_DIR)/stack.str $(SRC_DIR)/make.allocd
  200. $(SRC_DIR)/make.allocd < $(SRC_DIR)/stack.str > stack.h
  201. stmt.h: $(SRC_DIR)/stmt.str $(SRC_DIR)/make.allocd
  202. $(SRC_DIR)/make.allocd < $(SRC_DIR)/stmt.str > stmt.h
  203. struct.h: $(SRC_DIR)/struct.str $(SRC_DIR)/make.allocd
  204. $(SRC_DIR)/make.allocd < $(SRC_DIR)/struct.str > struct.h
  205. switch.h: $(SRC_DIR)/switch.str $(SRC_DIR)/make.allocd
  206. $(SRC_DIR)/make.allocd < $(SRC_DIR)/switch.str > switch.h
  207. type.h: $(SRC_DIR)/type.str $(SRC_DIR)/make.allocd
  208. $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.str > type.h
  209. l_brace.h: $(SRC_DIR)/l_brace.str $(SRC_DIR)/make.allocd
  210. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_brace.str > l_brace.h
  211. l_state.h: $(SRC_DIR)/l_state.str $(SRC_DIR)/make.allocd
  212. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_state.str > l_state.h
  213. l_outdef.h: $(SRC_DIR)/l_outdef.str $(SRC_DIR)/make.allocd
  214. $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_outdef.str > l_outdef.h
  215. next.c: $(NEXTFILES) $(SRC_DIR)/make.next
  216. $(SRC_DIR)/make.next $(NEXTFILES) > next.c
  217. char.c: $(SRC_DIR)/char.tab
  218. $(TABGEN) -f$(SRC_DIR)/char.tab >char.c