proto.make 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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
  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. cp $(SRC_DIR)/grind.1 $(TARGET_HOME)/man/grind.1
  63. cmp: all
  64. -cmp grind $(TARGET_HOME)/bin/grind
  65. -cmp $(SRC_DIR)/grind.1 $(TARGET_HOME)/man/grind.1
  66. opr:
  67. make pr | opr
  68. pr:
  69. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
  70. $(SRC_DIR)/char.ct operators.ot \
  71. $(SRC_G1) $(SRC_G2) \
  72. $(SRC_H) $(NEXTFILES) \
  73. $(SRC_C)
  74. lint: make.main
  75. make -f make.main lint
  76. Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
  77. echo $(CFILES) | tr ' ' '\012' > Cfiles
  78. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  79. resolved: Cfiles
  80. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  81. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  82. touch resolved
  83. # there is no file called "dependencies"; we want dependencies checked
  84. # every time. This means that make.main is made every time. Oh well ...
  85. # it does not take much time.
  86. dependencies: resolved
  87. do_deps `grep '.c$$' Cfiles`
  88. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  89. sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
  90. echo '#DEPENDENCIES' >> make.main
  91. cat *.dep >> make.main
  92. make_macros: Makefile
  93. echo 'SRC_DIR=$(SRC_DIR)' > make_macros
  94. echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
  95. echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
  96. echo 'CC=$(CC)' >> make_macros
  97. echo 'COPTIONS=$(COPTIONS)' >> make_macros
  98. echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
  99. echo 'LINT=$(LINT)' >> make_macros
  100. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  101. echo 'SUF=$(SUF)' >> make_macros
  102. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  103. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  104. lists: Cfiles
  105. echo "C_SRC = \\" > lists
  106. echo $(CFILES) >> lists
  107. echo "OBJ = \\" >> lists
  108. echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
  109. clean:
  110. -make -f make.main clean
  111. rm -f $(GEN_C) $(GEN_G) $(GEN_H) \
  112. hfiles LL1files LL2files Cfiles LL.output DBS.output
  113. rm -f resolved *.dep lists make.main make_macros
  114. LLfiles: LL1files LL2files
  115. LL1files: $(GFILES1)
  116. $(LLGEN) $(LLGENOPTIONS) $(GFILES1)
  117. @touch LL1files
  118. LL2files: $(GFILES2)
  119. $(LLGEN) $(LLGENOPTIONS) $(GFILES2)
  120. @touch LL2files
  121. hfiles: Parameters $(SRC_DIR)/make.hfiles
  122. $(SRC_DIR)/make.hfiles Parameters
  123. touch hfiles
  124. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  125. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  126. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  127. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  128. file.h: $(SRC_DIR)/file.hh $(SRC_DIR)/make.allocd
  129. $(SRC_DIR)/make.allocd < $(SRC_DIR)/file.hh > file.h
  130. symbol.h: $(SRC_DIR)/symbol.hh $(SRC_DIR)/make.allocd
  131. $(SRC_DIR)/make.allocd < $(SRC_DIR)/symbol.hh > symbol.h
  132. tree.h: $(SRC_DIR)/tree.hh $(SRC_DIR)/make.allocd
  133. $(SRC_DIR)/make.allocd < $(SRC_DIR)/tree.hh > tree.h
  134. type.h: $(SRC_DIR)/type.hh $(SRC_DIR)/make.allocd
  135. $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.hh > type.h
  136. avl.c: $(SRC_DIR)/avl.cc $(SRC_DIR)/make.allocd
  137. $(SRC_DIR)/make.allocd < $(SRC_DIR)/avl.cc > avl.c
  138. itemlist.c: $(SRC_DIR)/itemlist.cc $(SRC_DIR)/make.allocd
  139. $(SRC_DIR)/make.allocd < $(SRC_DIR)/itemlist.cc > itemlist.c
  140. langdep.c: $(SRC_DIR)/langdep.cc $(SRC_DIR)/make.allocd
  141. $(SRC_DIR)/make.allocd < $(SRC_DIR)/langdep.cc > langdep.c
  142. scope.c: $(SRC_DIR)/scope.cc $(SRC_DIR)/make.allocd
  143. $(SRC_DIR)/make.allocd < $(SRC_DIR)/scope.cc > scope.c
  144. next.c: $(NEXTFILES) $(SRC_DIR)/make.next
  145. $(SRC_DIR)/make.next $(NEXTFILES) > next.c
  146. chtab.c: $(SRC_DIR)/char.ct
  147. $(TABGEN) -f$(SRC_DIR)/char.ct >chtab.c
  148. ops.c ops.h: $(SRC_DIR)/operators.ot $(SRC_DIR)/make.ops
  149. $(SRC_DIR)/make.ops $(SRC_DIR)/operators.ot