proto.make 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. # $Header$
  2. #PARAMS do not remove this line!
  3. SRC_DIR = $(SRC_HOME)/util/grind
  4. UTIL_BIN = $(UTIL_HOME)/bin
  5. TABGEN= $(UTIL_BIN)/tabgen
  6. LLGEN = $(UTIL_BIN)/LLgen
  7. LLGENOPTIONS = -v
  8. SRC_G1 = $(SRC_DIR)/commands.g
  9. GEN_G1 = tokenfile.g
  10. GFILES1= $(GEN_G1) $(SRC_G1)
  11. SRC_G2 = $(SRC_DIR)/db_symtab.g
  12. GEN_G2 =
  13. GFILES2 = $(GEN_G2) $(SRC_G2)
  14. SRC_C = \
  15. $(SRC_DIR)/main.c \
  16. $(SRC_DIR)/list.c \
  17. $(SRC_DIR)/tree.c \
  18. $(SRC_DIR)/expr.c \
  19. $(SRC_DIR)/position.c \
  20. $(SRC_DIR)/tokenname.c \
  21. $(SRC_DIR)/idf.c \
  22. $(SRC_DIR)/run.c \
  23. $(SRC_DIR)/symbol.c \
  24. $(SRC_DIR)/print.c \
  25. $(SRC_DIR)/type.c \
  26. $(SRC_DIR)/rd.c \
  27. $(SRC_DIR)/do_comm.c \
  28. $(SRC_DIR)/modula-2.c \
  29. $(SRC_DIR)/pascal.c \
  30. $(SRC_DIR)/c.c
  31. GEN_C = db_symtab.c commands.c Lpars.c DBSpars.c avl.c scope.c itemlist.c \
  32. langdep.c ops.c chtab.c symbol2str.c next.c
  33. CFILES= $(SRC_C) $(GEN_C)
  34. SRC_H = \
  35. $(SRC_DIR)/tokenname.h \
  36. $(SRC_DIR)/operator.h \
  37. $(SRC_DIR)/class.h \
  38. $(SRC_DIR)/position.h \
  39. $(SRC_DIR)/idf.h \
  40. $(SRC_DIR)/message.h \
  41. $(SRC_DIR)/avl.h \
  42. $(SRC_DIR)/scope.h \
  43. $(SRC_DIR)/langdep.h \
  44. $(SRC_DIR)/sizes.h \
  45. $(SRC_DIR)/token.h \
  46. $(SRC_DIR)/expr.h \
  47. $(SRC_DIR)/rd.h
  48. GEN_H = file.h type.h symbol.h tree.h Lpars.h DBSpars.h ops.h
  49. HFILES= $(GEN_H) $(SRC_H)
  50. NEXTFILES = $(SRC_DIR)/file.hh \
  51. $(SRC_DIR)/type.hh \
  52. $(SRC_DIR)/symbol.hh \
  53. $(SRC_DIR)/tree.hh \
  54. $(SRC_DIR)/avl.cc \
  55. $(SRC_DIR)/scope.cc \
  56. $(SRC_DIR)/itemlist.cc \
  57. $(SRC_DIR)/langdep.cc
  58. all: make.main
  59. make -f make.main grind
  60. install: all
  61. cp grind $(TARGET_HOME)/bin/grind
  62. if [ $(DO_MACHINE_INDEP) = y ] ; \
  63. then mk_manpage $(SRC_DIR)/grind.1 $(TARGET_HOME) ; \
  64. fi
  65. cmp: all
  66. -cmp grind $(TARGET_HOME)/bin/grind
  67. opr:
  68. make pr | opr
  69. pr:
  70. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
  71. $(SRC_DIR)/char.ct operators.ot \
  72. $(SRC_G1) $(SRC_G2) \
  73. $(SRC_H) $(NEXTFILES) \
  74. $(SRC_C)
  75. lint: make.main
  76. make -f make.main lint
  77. Cfiles: LLfiles $(GEN_C) $(GEN_H) Makefile
  78. echo $(CFILES) | tr ' ' '\012' > Cfiles
  79. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  80. resolved: Cfiles
  81. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  82. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  83. touch resolved
  84. # there is no file called "dependencies"; we want dependencies checked
  85. # every time. This means that make.main is made every time. Oh well ...
  86. # it does not take much time.
  87. dependencies: resolved
  88. do_deps `grep '.c$$' Cfiles`
  89. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  90. sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
  91. echo '#DEPENDENCIES' >> make.main
  92. cat *.dep >> make.main
  93. make_macros: Makefile
  94. echo 'SRC_DIR=$(SRC_DIR)' > make_macros
  95. echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
  96. echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
  97. echo 'CC=$(CC)' >> make_macros
  98. echo 'COPTIONS=$(COPTIONS)' >> make_macros
  99. echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
  100. echo 'LINT=$(LINT)' >> make_macros
  101. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  102. echo 'SUF=$(SUF)' >> make_macros
  103. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  104. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  105. lists: Cfiles
  106. echo "C_SRC = \\" > lists
  107. echo $(CFILES) >> lists
  108. echo "OBJ = \\" >> lists
  109. echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
  110. clean:
  111. -make -f make.main clean
  112. rm -f $(GEN_C) $(GEN_G) $(GEN_H) \
  113. LL1files LL2files Cfiles LL.output DBS.output
  114. rm -f resolved *.dep lists make.main make_macros tokenfile.[cg]
  115. LLfiles: LL1files LL2files
  116. LL1files: $(GFILES1)
  117. $(LLGEN) $(LLGENOPTIONS) $(GFILES1)
  118. @touch LL1files
  119. LL2files: $(GFILES2)
  120. $(LLGEN) $(LLGENOPTIONS) $(GFILES2)
  121. @touch LL2files
  122. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  123. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  124. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  125. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  126. file.h: $(SRC_DIR)/file.hh $(SRC_DIR)/make.allocd
  127. $(SRC_DIR)/make.allocd < $(SRC_DIR)/file.hh > file.h
  128. symbol.h: $(SRC_DIR)/symbol.hh $(SRC_DIR)/make.allocd
  129. $(SRC_DIR)/make.allocd < $(SRC_DIR)/symbol.hh > symbol.h
  130. tree.h: $(SRC_DIR)/tree.hh $(SRC_DIR)/make.allocd
  131. $(SRC_DIR)/make.allocd < $(SRC_DIR)/tree.hh > tree.h
  132. type.h: $(SRC_DIR)/type.hh $(SRC_DIR)/make.allocd
  133. $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.hh > type.h
  134. avl.c: $(SRC_DIR)/avl.cc $(SRC_DIR)/make.allocd
  135. $(SRC_DIR)/make.allocd < $(SRC_DIR)/avl.cc > avl.c
  136. itemlist.c: $(SRC_DIR)/itemlist.cc $(SRC_DIR)/make.allocd
  137. $(SRC_DIR)/make.allocd < $(SRC_DIR)/itemlist.cc > itemlist.c
  138. langdep.c: $(SRC_DIR)/langdep.cc $(SRC_DIR)/make.allocd
  139. $(SRC_DIR)/make.allocd < $(SRC_DIR)/langdep.cc > langdep.c
  140. scope.c: $(SRC_DIR)/scope.cc $(SRC_DIR)/make.allocd
  141. $(SRC_DIR)/make.allocd < $(SRC_DIR)/scope.cc > scope.c
  142. next.c: $(NEXTFILES) $(SRC_DIR)/make.next
  143. $(SRC_DIR)/make.next $(NEXTFILES) > next.c
  144. chtab.c: $(SRC_DIR)/char.ct
  145. $(TABGEN) -f$(SRC_DIR)/char.ct >chtab.c
  146. ops.c ops.h: $(SRC_DIR)/operators.ot $(SRC_DIR)/make.ops
  147. $(SRC_DIR)/make.ops $(SRC_DIR)/operators.ot