Makefile 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. # MAKEFILE FOR (STAND_ALONE) CEM PREPROCESSOR
  2. EMHOME=../../..
  3. MODULES=$(EMHOME)/modules
  4. MODULESLIB=$(MODULES)/lib
  5. BIN=$(EMHOME)/lib
  6. MANDIR=$(EMHOME)/man
  7. # Some paths
  8. # Libraries
  9. SYSLIB = $(MODULESLIB)/libsystem.a
  10. STRLIB = $(MODULESLIB)/libstring.a
  11. PRTLIB = $(MODULESLIB)/libprint.a
  12. ALLOCLIB = $(MODULESLIB)/liballoc.a
  13. ASSERTLIB = $(MODULESLIB)/libassert.a
  14. MALLOC = $(MODULESLIB)/malloc.o
  15. LIBS = $(PRTLIB) $(STRLIB) $(ALLOCLIB) $(MALLOC) $(ASSERTLIB) $(SYSLIB)
  16. LIB_INCLUDES = -I$(MODULES)/h -I$(MODULES)/pkg
  17. # Where to install the preprocessor
  18. CEMPP = $(BIN)/cpp.ansi
  19. TABGEN = $(EMHOME)/bin/tabgen
  20. # What C compiler to use and how
  21. CC = cc
  22. COPTIONS = -O
  23. LDFLAGS =
  24. # What parser generator to use and how
  25. GEN = $(EMHOME)/bin/LLgen
  26. GENOPTIONS =
  27. # Special #defines during compilation
  28. CDEFS = $(LIB_INCLUDES)
  29. CFLAGS = $(CDEFS) $(COPTIONS)# # we cannot pass the COPTIONS to lint!
  30. # Grammar files and their objects
  31. LSRC = tokenfile.g expression.g
  32. LCSRC = tokenfile.c expression.c Lpars.c
  33. LOBJ = tokenfile.o expression.o Lpars.o
  34. # Objects of hand-written C files
  35. CSRC = LLlex.c LLmessage.c ch3bin.c ch3mon.c domacro.c \
  36. error.c idf.c init.c input.c main.c options.c \
  37. preprocess.c replace.c skip.c tokenname.c expr.c
  38. COBJ = LLlex.o LLmessage.o ch3bin.o ch3mon.o domacro.o \
  39. error.o idf.o init.o input.o main.o options.o \
  40. preprocess.o replace.o skip.o tokenname.o next.o expr.o
  41. PRFILES = Makefile Parameters \
  42. make.hfiles make.tokcase make.tokfile LLlex.h bits.h file_info.h \
  43. idf.h input.h interface.h macro.str replace.str \
  44. class.h char.tab expression.g $(CSRC)
  45. # Objects of other generated C files
  46. GOBJ = char.o symbol2str.o
  47. # generated source files
  48. GSRC = char.c symbol2str.c next.c
  49. # .h files generated by `make.allod'
  50. STRSRC = macro.str replace.str
  51. GSTRSRC = macro.h replace.h
  52. # .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE!
  53. GHSRC = errout.h idfsize.h ifdepth.h macbuf.h \
  54. nparams.h numsize.h obufsize.h \
  55. parbufsize.h pathlength.h strsize.h textsize.h \
  56. botch_free.h debug.h inputtype.h dobits.h ln_prefix.h
  57. # Other generated files, for 'make clean' only
  58. GENERATED = tokenfile.g Lpars.h LLfiles LL.output lint.out \
  59. Xref hfiles cfiles tags Makefile.old
  60. all: cc
  61. cc: cfiles
  62. make "EMHOME="$(EMHOME) "CC=$(CC)" ncpp
  63. hfiles: Parameters char.c
  64. ./make.hfiles Parameters
  65. @touch hfiles
  66. .SUFFIXES: .str .h
  67. .str.h:
  68. ./make.allocd <$*.str >$*.h
  69. char.c: char.tab
  70. $(TABGEN) -fchar.tab > char.c
  71. next.c: make.next $(STRSRC)
  72. ./make.next $(STRSRC) >next.c
  73. macro.h: make.allocd
  74. replace.h: make.allocd
  75. LLfiles: $(LSRC)
  76. $(GEN) $(GENOPTIONS) $(LSRC)
  77. @touch LLfiles
  78. tokenfile.g: tokenname.c make.tokfile
  79. <tokenname.c ./make.tokfile >tokenfile.g
  80. symbol2str.c: tokenname.c make.tokcase
  81. <tokenname.c ./make.tokcase >symbol2str.c
  82. # Objects needed for 'ncpp'
  83. OBJ = $(COBJ) $(LOBJ) $(GOBJ)
  84. SRC = $(CSRC) $(LCSRC) $(GSRC)
  85. ncpp: $(OBJ) Makefile
  86. $(CC) $(COPTIONS) $(LDFLAGS) $(OBJ) $(LIBS) -o ncpp
  87. -size ncpp
  88. cfiles: hfiles LLfiles $(GSRC) $(GSTRSRC)
  89. @touch cfiles
  90. install: all
  91. rm -f $(CEMPP)
  92. cp ncpp $(CEMPP)
  93. rm -f $(MANDIR)/cpp.ansi.6
  94. cp ncpp.6 $(MANDIR)/cpp.ansi.6
  95. cmp: all
  96. -cmp ncpp $(CEMPP)
  97. -cmp ncpp.6 $(MANDIR)/cpp.ansi.6
  98. pr:
  99. @pr $(PRFILES)
  100. opr:
  101. make pr | opr
  102. tags: cfiles
  103. ctags $(SRC)
  104. depend: cfiles
  105. sed '/^#AUTOAUTO/,$$d' Makefile >Makefile.new
  106. echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >>Makefile.new
  107. $(EMHOME)/bin/mkdep $(SRC) | \
  108. sed 's/\.c:/.o:/' >>Makefile.new
  109. mv Makefile Makefile.old
  110. mv Makefile.new Makefile
  111. xref:
  112. ctags -x `grep "\.[ch]" Files`|sed "s/).*/)/">Xref
  113. lint: cfiles
  114. lint -bx $(CDEFS) $(SRC) >lint.out
  115. clean:
  116. rm -f $(LCSRC) $(OBJ) $(GENERATED) $(GSRC) $(GHSRC) $(GSTRSRC) ncpp Out
  117. #AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
  118. LLlex.o: LLlex.h
  119. LLlex.o: Lpars.h
  120. LLlex.o: arith.h
  121. LLlex.o: bits.h
  122. LLlex.o: class.h
  123. LLlex.o: dobits.h
  124. LLlex.o: file_info.h
  125. LLlex.o: idf.h
  126. LLlex.o: idfsize.h
  127. LLlex.o: input.h
  128. LLlex.o: inputtype.h
  129. LLlex.o: macro.h
  130. LLlex.o: numsize.h
  131. LLlex.o: strsize.h
  132. LLmessage.o: LLlex.h
  133. LLmessage.o: Lpars.h
  134. LLmessage.o: arith.h
  135. LLmessage.o: file_info.h
  136. ch3bin.o: Lpars.h
  137. ch3bin.o: arith.h
  138. ch3mon.o: Lpars.h
  139. ch3mon.o: arith.h
  140. domacro.o: LLlex.h
  141. domacro.o: Lpars.h
  142. domacro.o: arith.h
  143. domacro.o: bits.h
  144. domacro.o: botch_free.h
  145. domacro.o: class.h
  146. domacro.o: dobits.h
  147. domacro.o: file_info.h
  148. domacro.o: idf.h
  149. domacro.o: idfsize.h
  150. domacro.o: ifdepth.h
  151. domacro.o: input.h
  152. domacro.o: inputtype.h
  153. domacro.o: macbuf.h
  154. domacro.o: macro.h
  155. domacro.o: nparams.h
  156. domacro.o: parbufsize.h
  157. domacro.o: replace.h
  158. domacro.o: textsize.h
  159. error.o: LLlex.h
  160. error.o: arith.h
  161. error.o: errout.h
  162. error.o: file_info.h
  163. idf.o: idf.h
  164. init.o: class.h
  165. init.o: idf.h
  166. init.o: macro.h
  167. input.o: file_info.h
  168. input.o: input.h
  169. input.o: inputtype.h
  170. main.o: arith.h
  171. main.o: file_info.h
  172. main.o: idf.h
  173. main.o: idfsize.h
  174. main.o: macro.h
  175. options.o: class.h
  176. options.o: idf.h
  177. options.o: idfsize.h
  178. options.o: macro.h
  179. preprocess.o: LLlex.h
  180. preprocess.o: arith.h
  181. preprocess.o: bits.h
  182. preprocess.o: class.h
  183. preprocess.o: dobits.h
  184. preprocess.o: file_info.h
  185. preprocess.o: idf.h
  186. preprocess.o: idfsize.h
  187. preprocess.o: input.h
  188. preprocess.o: inputtype.h
  189. preprocess.o: ln_prefix.h
  190. preprocess.o: macro.h
  191. preprocess.o: obufsize.h
  192. preprocess.o: textsize.h
  193. replace.o: LLlex.h
  194. replace.o: arith.h
  195. replace.o: class.h
  196. replace.o: file_info.h
  197. replace.o: idf.h
  198. replace.o: idfsize.h
  199. replace.o: input.h
  200. replace.o: inputtype.h
  201. replace.o: macbuf.h
  202. replace.o: macro.h
  203. replace.o: nparams.h
  204. replace.o: numsize.h
  205. replace.o: pathlength.h
  206. replace.o: replace.h
  207. replace.o: strsize.h
  208. skip.o: LLlex.h
  209. skip.o: arith.h
  210. skip.o: class.h
  211. skip.o: file_info.h
  212. skip.o: input.h
  213. skip.o: inputtype.h
  214. tokenname.o: LLlex.h
  215. tokenname.o: Lpars.h
  216. tokenname.o: arith.h
  217. tokenname.o: file_info.h
  218. tokenname.o: idf.h
  219. expr.o: Lpars.h
  220. tokenfile.o: Lpars.h
  221. expression.o: LLlex.h
  222. expression.o: Lpars.h
  223. expression.o: arith.h
  224. expression.o: file_info.h
  225. Lpars.o: Lpars.h
  226. char.o: class.h
  227. symbol2str.o: Lpars.h