Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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
  19. # What C compiler to use and how
  20. CC = cc
  21. COPTIONS =
  22. LDFLAGS = -i
  23. # What parser generator to use and how
  24. GEN = $(EMHOME)/bin/LLgen
  25. GENOPTIONS =
  26. # Special #defines during compilation
  27. CDEFS = $(LIB_INCLUDES)
  28. CFLAGS = $(CDEFS) $(COPTIONS) -O# # we cannot pass the COPTIONS to lint!
  29. # Grammar files and their objects
  30. LSRC = tokenfile.g expression.g
  31. LCSRC = tokenfile.c expression.c Lpars.c
  32. LOBJ = tokenfile.o expression.o Lpars.o
  33. # Objects of hand-written C files
  34. CSRC = LLlex.c LLmessage.c ch7bin.c ch7mon.c domacro.c \
  35. error.c idf.c init.c input.c main.c options.c \
  36. preprocess.c replace.c scan.c skip.c tokenname.c next.c expr.c
  37. COBJ = LLlex.o LLmessage.o ch7bin.o ch7mon.o domacro.o \
  38. error.o idf.o init.o input.o main.o options.o \
  39. preprocess.o replace.o scan.o skip.o tokenname.o next.o expr.o
  40. PRFILES = Makefile Parameters \
  41. make.hfiles make.tokcase make.tokfile LLlex.h bits.h file_info.h \
  42. idf.h input.h interface.h macro.h \
  43. class.h chtab.c char.tab expression.g $(CSRC)
  44. # Objects of other generated C files
  45. GOBJ = char.o symbol2str.o
  46. # generated source files
  47. GSRC = char.c symbol2str.c
  48. # .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE!
  49. GHSRC = errout.h idfsize.h ifdepth.h lapbuf.h \
  50. maxincl.h nparams.h numsize.h obufsize.h \
  51. parbufsize.h pathlength.h strsize.h textsize.h \
  52. botch_free.h debug.h inputtype.h dobits.h line_prefix.h
  53. # Other generated files, for 'make clean' only
  54. GENERATED = tokenfile.g Lpars.h LLfiles LL.output lint.out \
  55. Xref hfiles cfiles charoffset.h
  56. all: cc
  57. cc: hfiles LLfiles
  58. make "EMHOME="$(EMHOME) cpp
  59. hfiles: Parameters char.c charoffset.h
  60. ./make.hfiles Parameters
  61. @touch hfiles
  62. charoffset.h char.c: chtab char.tab
  63. chtab -fchar.tab > char.c
  64. LLfiles: $(LSRC)
  65. $(GEN) $(GENOPTIONS) $(LSRC)
  66. @touch LLfiles
  67. tokenfile.g: tokenname.c make.tokfile
  68. <tokenname.c ./make.tokfile >tokenfile.g
  69. symbol2str.c: tokenname.c make.tokcase
  70. <tokenname.c ./make.tokcase >symbol2str.c
  71. chtab: chtab.o
  72. $(CC) -o chtab chtab.o
  73. # Objects needed for 'cpp'
  74. OBJ = $(COBJ) $(LOBJ) $(GOBJ)
  75. SRC = $(CSRC) $(LCSRC) $(GSRC)
  76. cpp: $(OBJ) Makefile
  77. $(CC) $(COPTIONS) $(LDFLAGS) $(OBJ) $(LIBS) -o cpp
  78. size cpp
  79. cfiles: hfiles LLfiles $(GSRC)
  80. @touch cfiles
  81. install: all
  82. rm -f $(CEMPP)
  83. cp cpp $(CEMPP)
  84. rm -f $(MANDIR)/cpp.6
  85. cp cpp.6 $(MANDIR)/cpp.6
  86. cmp: all
  87. -cmp cpp $(CEMPP)
  88. -cmp cpp.6 $(MANDIR)/cpp.6
  89. pr:
  90. @pr $(PRFILES)
  91. opr:
  92. make pr | opr
  93. tags: cfiles
  94. ctags $(SRC)
  95. depend: cfiles
  96. sed '/^#AUTOAUTO/,$$d' Makefile >Makefile.new
  97. echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >>Makefile.new
  98. $(EMHOME)/bin/mkdep $(SRC) | \
  99. sed 's/\.c:/.o:/' >>Makefile.new
  100. mv Makefile Makefile.old
  101. mv Makefile.new Makefile
  102. xref:
  103. ctags -x `grep "\.[ch]" Files`|sed "s/).*/)/">Xref
  104. lint: cfiles
  105. lint -bx $(CDEFS) $(SRC) >lint.out
  106. clean:
  107. rm -f $(LCSRC) $(OBJ) $(GENERATED) $(GSRC) $(GHSRC) chtab.o chtab cpp Out
  108. #AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
  109. LLlex.o: LLlex.h Lpars.h bits.h charoffset.h class.h dobits.h file_info.h idf.h idfsize.h input.h inputtype.h numsize.h strsize.h
  110. LLmessage.o: LLlex.h Lpars.h file_info.h
  111. ch7bin.o: Lpars.h
  112. ch7mon.o: Lpars.h
  113. domacro.o: LLlex.h Lpars.h bits.h botch_free.h charoffset.h class.h debug.h dobits.h file_info.h idf.h idfsize.h ifdepth.h input.h inputtype.h interface.h macro.h nparams.h parbufsize.h textsize.h
  114. error.o: LLlex.h errout.h file_info.h
  115. idf.o: idf.h
  116. init.o: charoffset.h class.h idf.h interface.h macro.h
  117. input.o: file_info.h input.h inputtype.h
  118. main.o: file_info.h idfsize.h
  119. options.o: charoffset.h class.h idf.h idfsize.h macro.h maxincl.h
  120. preprocess.o: LLlex.h bits.h charoffset.h class.h dobits.h file_info.h idf.h idfsize.h input.h inputtype.h line_prefix.h maxincl.h obufsize.h
  121. replace.o: LLlex.h charoffset.h class.h debug.h file_info.h idf.h input.h inputtype.h interface.h macro.h pathlength.h textsize.h
  122. scan.o: charoffset.h class.h idf.h input.h inputtype.h interface.h lapbuf.h macro.h nparams.h
  123. skip.o: LLlex.h charoffset.h class.h file_info.h input.h inputtype.h
  124. tokenname.o: LLlex.h Lpars.h file_info.h idf.h
  125. next.o: debug.h
  126. expr.o: Lpars.h
  127. tokenfile.o: Lpars.h
  128. expression.o: LLlex.h Lpars.h file_info.h
  129. Lpars.o: Lpars.h
  130. char.o: charoffset.h class.h
  131. symbol2str.o: Lpars.h