proto.make 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # $Header$
  2. # make ANSI C pre-processor
  3. #PARAMS do not remove this line!
  4. UTIL_BIN = \
  5. $(UTIL_HOME)/bin
  6. SRC_DIR = \
  7. $(SRC_HOME)/lang/cem/cpp.ansi
  8. TABGEN= $(UTIL_BIN)/tabgen
  9. LLGEN = $(UTIL_BIN)/LLgen
  10. LLGENOPTIONS = \
  11. -v
  12. SRC_G = $(SRC_DIR)/expression.g
  13. GEN_G = tokenfile.g
  14. GFILES= $(GEN_G) $(SRC_G)
  15. SRC_C = \
  16. $(SRC_DIR)/LLlex.c \
  17. $(SRC_DIR)/LLmessage.c \
  18. $(SRC_DIR)/ch3bin.c \
  19. $(SRC_DIR)/ch3mon.c \
  20. $(SRC_DIR)/domacro.c \
  21. $(SRC_DIR)/error.c \
  22. $(SRC_DIR)/idf.c \
  23. $(SRC_DIR)/init.c \
  24. $(SRC_DIR)/input.c \
  25. $(SRC_DIR)/main.c \
  26. $(SRC_DIR)/options.c \
  27. $(SRC_DIR)/preprocess.c \
  28. $(SRC_DIR)/replace.c \
  29. $(SRC_DIR)/skip.c \
  30. $(SRC_DIR)/tokenname.c \
  31. $(SRC_DIR)/expr.c
  32. GEN_C = tokenfile.c expression.c symbol2str.c char.c Lpars.c next.c
  33. CFILES= $(SRC_C) $(GEN_C)
  34. SRC_H = \
  35. $(SRC_DIR)/LLlex.h \
  36. $(SRC_DIR)/bits.h \
  37. $(SRC_DIR)/file_info.h \
  38. $(SRC_DIR)/idf.h \
  39. $(SRC_DIR)/input.h \
  40. $(SRC_DIR)/interface.h \
  41. $(SRC_DIR)/class.h
  42. GEN_H = botch_free.h debug.h errout.h obufsize.h dobits.h \
  43. idfsize.h ifdepth.h inputtype.h macbuf.h ln_prefix.h \
  44. nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
  45. strsize.h textsize.h macro.h replace.h
  46. HFILES= $(GEN_H) $(SRC_H)
  47. NEXTFILES = \
  48. $(SRC_DIR)/macro.str \
  49. $(SRC_DIR)/replace.str
  50. all: make.main
  51. make -f make.main main
  52. install: all
  53. cp main $(TARGET_HOME)/lib.bin/cpp.ansi
  54. if [ $(DO_MACHINE_INDEP) = y ] ; \
  55. then cp $(SRC_DIR)/ncpp.6 cpp.ansi.6 ; \
  56. mk_manpage cpp.ansi.6 $(TARGET_HOME) ; \
  57. rm -f cpp.ansi.6 ; \
  58. fi
  59. cmp: all
  60. -cmp main $(TARGET_HOME)/lib.bin/cpp.ansi
  61. opr:
  62. make pr | opr
  63. pr:
  64. @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
  65. $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
  66. lint: make.main
  67. make -f make.main lint
  68. Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
  69. echo $(CFILES) | tr ' ' '\012' > Cfiles
  70. echo $(HFILES) | tr ' ' '\012' >> Cfiles
  71. resolved: Cfiles
  72. CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
  73. -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
  74. touch resolved
  75. # there is no file called "dependencies"; we want dependencies checked
  76. # every time. This means that make.main is made every time. Oh well ...
  77. # it does not take much time.
  78. dependencies: resolved
  79. do_deps `grep '.c$$' Cfiles`
  80. make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
  81. sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
  82. echo '#DEPENDENCIES' >> make.main
  83. cat *.dep >> make.main
  84. make_macros: Makefile
  85. echo 'SRC_DIR=$(SRC_DIR)' > make_macros
  86. echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
  87. echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
  88. echo 'CC=$(CC)' >> make_macros
  89. echo 'COPTIONS=$(COPTIONS)' >> make_macros
  90. echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
  91. echo 'LINT=$(LINT)' >> make_macros
  92. echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
  93. echo 'SUF=$(SUF)' >> make_macros
  94. echo 'LIBSUF=$(LIBSUF)' >> make_macros
  95. echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
  96. lists: Cfiles
  97. echo "C_SRC = \\" > lists
  98. echo $(CFILES) >> lists
  99. echo "OBJ = \\" >> lists
  100. echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
  101. clean:
  102. -make -f make.main clean
  103. rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
  104. rm -f resolved *.dep lists make.main make_macros
  105. LLfiles: $(GFILES)
  106. $(LLGEN) $(LLGENOPTIONS) $(GFILES)
  107. @touch LLfiles
  108. hfiles: Parameters $(SRC_DIR)/make.hfiles
  109. $(SRC_DIR)/make.hfiles Parameters
  110. touch hfiles
  111. tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
  112. $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
  113. symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
  114. $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
  115. replace.h: $(SRC_DIR)/replace.str $(SRC_DIR)/make.allocd
  116. $(SRC_DIR)/make.allocd < $(SRC_DIR)/replace.str > replace.h
  117. macro.h: $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
  118. $(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
  119. next.c: $(NEXTFILES) $(SRC_DIR)/make.next
  120. $(SRC_DIR)/make.next $(NEXTFILES) > next.c
  121. char.c: $(SRC_DIR)/char.tab
  122. $(TABGEN) -f$(SRC_DIR)/char.tab >char.c