makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. # $Id: makefile 145 2001-10-17 21:53:10Z timo $
  2. HOSTFILE=etc/linux.c
  3. TEMPDIR=/tmp
  4. A=.a
  5. O=.o
  6. E=
  7. CC=cc
  8. CFLAGS=-g
  9. LDFLAGS=
  10. LD=cc
  11. AR=ar ruv
  12. RANLIB=ranlib
  13. DIFF=diff
  14. RM=rm -f
  15. RMDIR=rmdir
  16. TSTDIR=$(BUILDDIR)/$(TARGET)/tst
  17. CUSTOM=custom.mk
  18. include $(CUSTOM)
  19. B=$(BUILDDIR)/
  20. T=$(TSTDIR)/
  21. # $Id: makefile 145 2001-10-17 21:53:10Z timo $
  22. what:
  23. -@echo make all rcc lburg cpp lcc bprint liblcc triple clean clobber
  24. all:: rcc lburg cpp lcc bprint liblcc
  25. rcc: $Brcc$E
  26. lburg: $Blburg$E
  27. cpp: $Bcpp$E
  28. lcc: $Blcc$E
  29. bprint: $Bbprint$E
  30. liblcc: $Bliblcc$A
  31. RCCOBJS=$Balloc$O \
  32. $Bbind$O \
  33. $Bdag$O \
  34. $Bdagcheck$O \
  35. $Bdecl$O \
  36. $Benode$O \
  37. $Berror$O \
  38. $Bexpr$O \
  39. $Bevent$O \
  40. $Binit$O \
  41. $Binits$O \
  42. $Binput$O \
  43. $Blex$O \
  44. $Blist$O \
  45. $Bmain$O \
  46. $Boutput$O \
  47. $Bprof$O \
  48. $Bprofio$O \
  49. $Bsimp$O \
  50. $Bstmt$O \
  51. $Bstring$O \
  52. $Bsym$O \
  53. $Btrace$O \
  54. $Btree$O \
  55. $Btypes$O \
  56. $Bnull$O \
  57. $Bsymbolic$O \
  58. $Bgen$O \
  59. $Bbytecode$O \
  60. $Balpha$O \
  61. $Bmips$O \
  62. $Bsparc$O \
  63. $Bstab$O \
  64. $Bx86$O \
  65. $Bx86linux$O
  66. $Brcc$E:: $Bmain$O $Blibrcc$A $(EXTRAOBJS)
  67. $(LD) $(LDFLAGS) -o $@ $Bmain$O $(EXTRAOBJS) $Blibrcc$A $(EXTRALIBS)
  68. $Blibrcc$A: $(RCCOBJS)
  69. $(AR) $@ $(RCCOBJS); $(RANLIB) $@ || true
  70. $(RCCOBJS): src/c.h src/token.h src/config.h
  71. $Balloc$O: src/alloc.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/alloc.c
  72. $Bbind$O: src/bind.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/bind.c
  73. $Bdag$O: src/dag.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/dag.c
  74. $Bdecl$O: src/decl.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/decl.c
  75. $Benode$O: src/enode.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/enode.c
  76. $Berror$O: src/error.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/error.c
  77. $Bevent$O: src/event.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/event.c
  78. $Bexpr$O: src/expr.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/expr.c
  79. $Bgen$O: src/gen.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/gen.c
  80. $Binit$O: src/init.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/init.c
  81. $Binits$O: src/inits.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/inits.c
  82. $Binput$O: src/input.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/input.c
  83. $Blex$O: src/lex.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/lex.c
  84. $Blist$O: src/list.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/list.c
  85. $Bmain$O: src/main.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/main.c
  86. $Bnull$O: src/null.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/null.c
  87. $Boutput$O: src/output.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/output.c
  88. $Bprof$O: src/prof.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/prof.c
  89. $Bprofio$O: src/profio.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/profio.c
  90. $Bsimp$O: src/simp.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/simp.c
  91. $Bstmt$O: src/stmt.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/stmt.c
  92. $Bstring$O: src/string.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/string.c
  93. $Bsym$O: src/sym.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/sym.c
  94. $Bsymbolic$O: src/symbolic.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/symbolic.c
  95. $Bbytecode$O: src/bytecode.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/bytecode.c
  96. $Btrace$O: src/trace.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/trace.c
  97. $Btree$O: src/tree.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/tree.c
  98. $Btypes$O: src/types.c; $(CC) $(CFLAGS) -c -Isrc -o $@ src/types.c
  99. $Bstab$O: src/stab.c src/stab.h; $(CC) $(CFLAGS) -c -Isrc -o $@ src/stab.c
  100. $Bdagcheck$O: $Bdagcheck.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bdagcheck.c
  101. $Balpha$O: $Balpha.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Balpha.c
  102. $Bmips$O: $Bmips.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bmips.c
  103. $Bsparc$O: $Bsparc.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bsparc.c
  104. $Bx86$O: $Bx86.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bx86.c
  105. $Bx86linux$O: $Bx86linux.c; $(CC) $(CFLAGS) -c -Isrc -o $@ $Bx86linux.c
  106. $Bdagcheck.c: $Blburg$E src/dagcheck.md; $Blburg src/dagcheck.md $@
  107. $Balpha.c: $Blburg$E src/alpha.md; $Blburg src/alpha.md $@
  108. $Bmips.c: $Blburg$E src/mips.md; $Blburg src/mips.md $@
  109. $Bsparc.c: $Blburg$E src/sparc.md; $Blburg src/sparc.md $@
  110. $Bx86.c: $Blburg$E src/x86.md; $Blburg src/x86.md $@
  111. $Bx86linux.c: $Blburg$E src/x86linux.md; $Blburg src/x86linux.md $@
  112. $Brcc.h: src/rcc.asdl; $(ASDL_HOME)/bin/asdlGen --c -d $B src/rcc.asdl
  113. $Brcc$O: $Brcc.h; $(CC) $(CFLAGS) -c -Isrc -I$B -I$(ASDL_HOME)/include/asdlGen -o $@ $Brcc.c
  114. $Basdl$O: src/asdl.c $Brcc.h src/c.h; $(CC) $(CFLAGS) -c -Isrc -I$B -I$(ASDL_HOME)/include/asdlGen -o $@ src/asdl.c
  115. $Bpass2$O: src/pass2.c $Brcc.h src/c.h; $(CC) $(CFLAGS) -c -Isrc -I$B -I$(ASDL_HOME)/include/asdlGen -o $@ src/pass2.c
  116. $B2html$O: src/2html.c $Brcc.h src/c.h; $(CC) $(CFLAGS) -c -Isrc -I$B -I$(ASDL_HOME)/include/asdlGen -o $@ src/2html.c
  117. $Bpass2$E: $Bpass2$O $(EXTRAOBJS) $Blibrcc$A; $(LD) $(LDFLAGS) -o $@ $Bpass2$O $(EXTRAOBJS) $Blibrcc$A $(EXTRALIBS)
  118. $B2html$E: $B2html$O $Brcc$O; $(LD) $(LDFLAGS) -o $@ $B2html$O $Brcc$O $(EXTRALIBS)
  119. $Bbprint$E: $Bbprint$O; $(LD) $(LDFLAGS) -o $@ $Bbprint$O
  120. $Bbprint$O: etc/bprint.c; $(CC) $(CFLAGS) -c -Isrc -o $@ etc/bprint.c
  121. $Blcc$E: $Blcc$O $Bhost$O; $(LD) $(LDFLAGS) -o $@ $Blcc$O $Bhost$O
  122. SYSTEM=$(shell cc -print-search-dirs | head -n 1 | cut -b 10-)
  123. $Blcc$O: etc/lcc.c; $(CC) $(CFLAGS) -c -DTEMPDIR=\"$(TEMPDIR)\" -o $@ etc/lcc.c
  124. $Bhost$O: $(HOSTFILE); $(CC) $(CFLAGS) -c -DSYSTEM=\"$(SYSTEM)\" -o $@ $(HOSTFILE)
  125. LIBOBJS=$Bassert$O $Bbbexit$O $Byynull$O
  126. $Bliblcc$A: $(LIBOBJS); $(AR) $@ $Bassert$O $Bbbexit$O $Byynull$O; $(RANLIB) $@ || true
  127. $Bassert$O: lib/assert.c; $(CC) $(CFLAGS) -c -o $@ lib/assert.c
  128. $Byynull$O: lib/yynull.c; $(CC) $(CFLAGS) -c -o $@ lib/yynull.c
  129. $Bbbexit$O: lib/bbexit.c; $(CC) $(CFLAGS) -c -o $@ lib/bbexit.c
  130. $Blburg$E: $Blburg$O $Bgram$O; $(LD) $(LDFLAGS) -o $@ $Blburg$O $Bgram$O
  131. $Blburg$O $Bgram$O: lburg/lburg.h
  132. $Blburg$O: lburg/lburg.c; $(CC) $(CFLAGS) -c -Ilburg -o $@ lburg/lburg.c
  133. $Bgram$O: lburg/gram.c; $(CC) $(CFLAGS) -c -Ilburg -o $@ lburg/gram.c
  134. CPPOBJS=$Bcpp$O $Blexer$O $Bnlist$O $Btokens$O $Bmacro$O $Beval$O \
  135. $Binclude$O $Bhideset$O $Bgetopt$O $Bunix$O
  136. $Bcpp$E: $(CPPOBJS)
  137. $(LD) $(LDFLAGS) -o $@ $(CPPOBJS)
  138. $(CPPOBJS): cpp/cpp.h
  139. $Bcpp$O: cpp/cpp.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/cpp.c
  140. $Blexer$O: cpp/lex.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/lex.c
  141. $Bnlist$O: cpp/nlist.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/nlist.c
  142. $Btokens$O: cpp/tokens.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/tokens.c
  143. $Bmacro$O: cpp/macro.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/macro.c
  144. $Beval$O: cpp/eval.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/eval.c
  145. $Binclude$O: cpp/include.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/include.c
  146. $Bhideset$O: cpp/hideset.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/hideset.c
  147. $Bgetopt$O: cpp/getopt.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/getopt.c
  148. $Bunix$O: cpp/unix.c; $(CC) $(CFLAGS) -c -Icpp -o $@ cpp/unix.c
  149. test: $T8q.s \
  150. $Tarray.s \
  151. $Tcf.s \
  152. $Tcq.s \
  153. $Tcvt.s \
  154. $Tfields.s \
  155. $Tfront.s \
  156. $Tincr.s \
  157. $Tinit.s \
  158. $Tlimits.s \
  159. $Tparanoia.s \
  160. $Tsort.s \
  161. $Tspill.s \
  162. $Tstdarg.s \
  163. $Tstruct.s \
  164. $Tswitch.s \
  165. $Twf1.s \
  166. $Tyacc.s
  167. $T8q.s: tst/8q.c tst/8q.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  168. $Tarray.s: tst/array.c tst/array.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  169. $Tcf.s: tst/cf.c tst/cf.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  170. $Tcq.s: tst/cq.c tst/cq.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  171. $Tcvt.s: tst/cvt.c tst/cvt.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  172. $Tfields.s: tst/fields.c tst/fields.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  173. $Tfront.s: tst/front.c tst/front.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  174. $Tincr.s: tst/incr.c tst/incr.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  175. $Tinit.s: tst/init.c tst/init.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  176. $Tlimits.s: tst/limits.c tst/limits.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  177. $Tparanoia.s: tst/paranoia.c tst/paranoia.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  178. $Tsort.s: tst/sort.c tst/sort.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  179. $Tspill.s: tst/spill.c tst/spill.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  180. $Tstdarg.s: tst/stdarg.c tst/stdarg.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  181. $Tstruct.s: tst/struct.c tst/struct.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  182. $Tswitch.s: tst/switch.c tst/switch.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  183. $Twf1.s: tst/wf1.c tst/wf1.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  184. $Tyacc.s: tst/yacc.c tst/yacc.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) src/run.sh $@
  185. testclean:
  186. $(RM) $T8q$E $T8q.s $T8q.2 $T8q.1
  187. $(RM) $Tarray$E $Tarray.s $Tarray.2 $Tarray.1
  188. $(RM) $Tcf$E $Tcf.s $Tcf.2 $Tcf.1
  189. $(RM) $Tcq$E $Tcq.s $Tcq.2 $Tcq.1
  190. $(RM) $Tcvt$E $Tcvt.s $Tcvt.2 $Tcvt.1
  191. $(RM) $Tfields$E $Tfields.s $Tfields.2 $Tfields.1
  192. $(RM) $Tfront$E $Tfront.s $Tfront.2 $Tfront.1
  193. $(RM) $Tincr$E $Tincr.s $Tincr.2 $Tincr.1
  194. $(RM) $Tinit$E $Tinit.s $Tinit.2 $Tinit.1
  195. $(RM) $Tlimits$E $Tlimits.s $Tlimits.2 $Tlimits.1
  196. $(RM) $Tparanoia$E $Tparanoia.s $Tparanoia.2 $Tparanoia.1
  197. $(RM) $Tsort$E $Tsort.s $Tsort.2 $Tsort.1
  198. $(RM) $Tspill$E $Tspill.s $Tspill.2 $Tspill.1
  199. $(RM) $Tstdarg$E $Tstdarg.s $Tstdarg.2 $Tstdarg.1
  200. $(RM) $Tstruct$E $Tstruct.s $Tstruct.2 $Tstruct.1
  201. $(RM) $Tswitch$E $Tswitch.s $Tswitch.2 $Tswitch.1
  202. $(RM) $Twf1$E $Twf1.s $Twf1.2 $Twf1.1
  203. $(RM) $Tyacc$E $Tyacc.s $Tyacc.2 $Tyacc.1
  204. install:: all
  205. install -d /usr/local/lib/lcc
  206. install -d /usr/local/lib/lcc/gcc
  207. install $Blcc$E /usr/local/bin
  208. install $Bcpp$E /usr/local/lib/lcc/gcc
  209. install $Brcc$E /usr/local/lib/lcc
  210. install $Bliblcc$A /usr/local/lib/lcc
  211. install $Blibrcc$A /usr/local/lib/lcc
  212. uninstall::
  213. $(RM) /usr/local/lib/lcc/librcc$A
  214. $(RM) /usr/local/lib/lcc/liblcc$A
  215. $(RM) /usr/local/lib/lcc/rcc$E
  216. $(RM) /usr/local/lib/lcc/gcc/cpp$E
  217. $(RM) /usr/local/bin/lcc$E
  218. $(RMDIR) /usr/local/lib/lcc/gcc
  219. $(RMDIR) /usr/local/lib/lcc
  220. clean:: testclean
  221. $(RM) $B*$O
  222. $(RM) $Bdagcheck.c $Balpha.c $Bmips.c $Bx86.c $Bsparc.c $Bx86linux.c $Bgram.c
  223. $(RM) $Brcc.c $Brcc.h
  224. $(RM) $Brcc1$E $Brcc1$E $B1rcc$E $B2rcc$E
  225. $(RM) $B*.ilk
  226. clobber:: clean
  227. $(RM) $Brcc$E $B2html$E $Bpass2$E $Blburg$E $Bcpp$E $Blcc$E $Bbprint$E $B*$A
  228. $(RM) $B*.pdb $B*.pch
  229. RCCSRCS=src/alloc.c \
  230. src/bind.c \
  231. src/dag.c \
  232. src/decl.c \
  233. src/enode.c \
  234. src/error.c \
  235. src/expr.c \
  236. src/event.c \
  237. src/init.c \
  238. src/inits.c \
  239. src/input.c \
  240. src/lex.c \
  241. src/list.c \
  242. src/main.c \
  243. src/output.c \
  244. src/prof.c \
  245. src/profio.c \
  246. src/simp.c \
  247. src/stmt.c \
  248. src/string.c \
  249. src/sym.c \
  250. src/trace.c \
  251. src/tree.c \
  252. src/types.c \
  253. src/null.c \
  254. src/symbolic.c \
  255. src/bytecode.c \
  256. src/gen.c \
  257. src/stab.c \
  258. $Bdagcheck.c \
  259. $Balpha.c \
  260. $Bmips.c \
  261. $Bsparc.c \
  262. $Bx86linux.c \
  263. $Bx86.c
  264. C=$Blcc -A -d0.6 -Wo-lccdir=$(BUILDDIR) -Isrc -I$(BUILDDIR)
  265. triple: $Brcc$E $Blcc$E $Bcpp$E
  266. $C -o $B1rcc$E -B$B $(RCCSRCS)
  267. $C -o $B2rcc$E -B$B1 $(RCCSRCS)
  268. strip $B1rcc$E $B2rcc$E
  269. dd if=$B1rcc$E of=$Brcc1$E bs=512 skip=1
  270. dd if=$B2rcc$E of=$Brcc2$E bs=512 skip=1
  271. if cmp $Brcc1$E $Brcc2$E; then \
  272. mv $B2rcc$E $Brcc$E; \
  273. $(RM) $B1rcc$E $Brcc[12]$E; fi