Makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. # Makefile for GNU C compiler.
  2. # Copyright (C) 1987 Free Software Foundation, Inc.
  3. #This file is part of GNU CC.
  4. #GNU CC is distributed in the hope that it will be useful,
  5. #but WITHOUT ANY WARRANTY. No author or distributor
  6. #accepts responsibility to anyone for the consequences of using it
  7. #or for whether it serves any particular purpose or works at all,
  8. #unless he says so in writing. Refer to the GNU CC General Public
  9. #License for full details.
  10. #Everyone is granted permission to copy, modify and redistribute
  11. #GNU CC, but only under the conditions described in the
  12. #GNU CC General Public License. A copy of this license is
  13. #supposed to have been given to you along with GNU CC so you
  14. #can know your rights and responsibilities. It should be in a
  15. #file named COPYING. Among other things, the copyright notice
  16. #and this notice must be preserved on all copies.
  17. CFLAGS = -g
  18. CC = cc
  19. # OLDCC should not be the GNU C compiler.
  20. OLDCC = cc
  21. BISON = bison
  22. AR = ar
  23. SHELL = /bin/sh
  24. bindir = /usr/local
  25. libdir = /usr/local/lib
  26. # These are what you would need on HPUX:
  27. # CFLAGS = -Wc,-Ns2000 -Wc,-Ne700
  28. # -g is desirable in CFLAGS, but a compiler bug in HPUX version 5
  29. # bites whenever tree.def, rtl.def or machmode.def is included
  30. # (ie., on every source file).
  31. # CCLIBFLAGS = -Wc,-Ns2000 -Wc,-Ne700
  32. # For CCLIBFLAGS you might want to specify the switch that
  33. # forces only 68000 instructions to be used.
  34. # If you are compiling this with CC on HPUX, you need the following line:
  35. # CLIB = alloca.o
  36. # Get alloca.o from GNU Emacs.
  37. # You must also change the line that uses `ranlib'. See below.
  38. # How to link with obstack
  39. OBSTACK=obstack.o
  40. # Dependency on obstack
  41. OBSTACK1=obstack.o
  42. LIBS = $(OBSTACK) $(CLIB)
  43. DIR = ../gcc
  44. OBJS = toplev.o version.o parse.tab.o tree.o print-tree.o \
  45. decl.o typecheck.o stor-layout.o fold-const.o \
  46. rtl.o expr.o stmt.o expmed.o explow.o optabs.o varasm.o \
  47. symout.o dbxout.o emit-rtl.o insn-emit.o \
  48. integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \
  49. regclass.o local-alloc.o global-alloc.o reload.o reload1.o insn-peep.o \
  50. final.o recog.o insn-recog.o insn-extract.o insn-output.o
  51. # Files to be copied away after each stage in building.
  52. STAGE_GCC=gcc
  53. STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
  54. insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
  55. genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
  56. cc1 cpp cccp
  57. # Members of gnulib.
  58. LIBFUNCS = va_end _eprintf \
  59. _umulsi3 _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
  60. _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 \
  61. _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 _cmpdf2 \
  62. _fixunsdfsi _fixunsdfdi _fixdfsi _fixdfdi \
  63. _floatsidf _floatdidf _truncdfsf2 _extendsfdf2 \
  64. _addsf3 _negsf2 _subsf3 _cmpsf2 _mulsf3 _divsf3
  65. # If you want to recompile everything, just do rm *.o.
  66. # CONFIG_H = config.h tm.h
  67. CONFIG_H =
  68. RTL_H = rtl.h rtl.def machmode.def
  69. TREE_H = tree.h tree.def machmode.def
  70. all: gnulib gcc cc1 cpp
  71. compilations: ${OBJS}
  72. gcc: gcc.o $(OBSTACK1)
  73. $(CC) $(CFLAGS) -o gccnew gcc.o $(LIBS)
  74. # Go via `gccnew' to avoid `file busy' if $(CC) is `gcc'.
  75. mv gccnew gcc
  76. gcc.o: gcc.c $(CONFIG_H)
  77. $(CC) $(CFLAGS) -c gcc.c
  78. cc1: $(OBJS) $(OBSTACK1)
  79. $(CC) $(CFLAGS) -o cc1 $(OBJS) $(LIBS)
  80. #Library of arithmetic subroutines
  81. # Don't compile this with gcc!
  82. gnulib: gnulib.c
  83. -mkdir libtemp
  84. cd libtemp; \
  85. rm -f gnulib; \
  86. for name in $(LIBFUNCS); \
  87. do \
  88. echo $${name}; \
  89. rm -f $${name}.c; \
  90. ln ../gnulib.c $${name}.c; \
  91. $(OLDCC) $(CCLIBFLAGS) -O -I.. -c -DL$${name} $${name}.c; \
  92. $(AR) qc gnulib $${name}.o; \
  93. done
  94. mv libtemp/gnulib .
  95. rm -rf libtemp
  96. ranlib gnulib
  97. # On HPUX, if you are working with the GNU assembler and linker,
  98. # the previous line must be replaced with
  99. # No change is needed here if you are using the HPUX assembler and linker.
  100. # mv gnulib gnulib-hp
  101. # hpxt gnulib-hp gnulib
  102. decl.o : decl.c $(CONFIG_H) $(TREE_H) flags.h c-tree.h parse.h
  103. typecheck.o : typecheck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
  104. tree.o : tree.c $(CONFIG_H) $(TREE_H)
  105. print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
  106. stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H)
  107. fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H)
  108. toplev.o : toplev.c $(CONFIG_H) $(TREE_H) flags.h
  109. parse.tab.o : parse.tab.c $(CONFIG_H) $(TREE_H) parse.h c-tree.h flags.h
  110. parse.tab.c : parse.y
  111. $(BISON) -v parse.y
  112. rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
  113. varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h expr.h
  114. stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
  115. insn-flags.h expr.h insn-config.h regs.h
  116. expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
  117. insn-flags.h insn-codes.h expr.h insn-config.h recog.h
  118. expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
  119. insn-flags.h insn-codes.h expr.h insn-config.h recog.h
  120. explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h
  121. optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
  122. insn-flags.h insn-codes.h expr.h insn-config.h recog.h
  123. symout.o : symout.c $(CONFIG_H) $(TREE_H) $(RTL_H) symseg.h gdbfiles.h
  124. dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H)
  125. emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) regs.h insn-config.h
  126. integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-flags.h
  127. jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h regs.h
  128. stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h
  129. cse.o : cse.c $(CONFIG_H) $(RTL_H) insn-config.h regs.h hard-reg-set.h
  130. loop.o : loop.c $(CONFIG_H) $(RTL_H) insn-config.h regs.h recog.h
  131. flow.o : flow.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h
  132. combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \
  133. insn-config.h regs.h basic-block.h recog.h
  134. regclass.o : regclass.c $(CONFIG_H) $(RTL_H) flags.h regs.h insn-config.h recog.h hard-reg-set.h
  135. local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h
  136. global-alloc.o : global-alloc.c $(CONFIG_H) $(RTL_H) flags.h \
  137. basic-block.h regs.h hard-reg-set.h insn-config.h
  138. reload.o : reload.c $(CONFIG_H) $(RTL_H) \
  139. reload.h recog.h hard-reg-set.h insn-config.h regs.h
  140. reload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h \
  141. reload.h regs.h hard-reg-set.h insn-config.h basic-block.h
  142. final.o : final.c $(CONFIG_H) $(RTL_H) regs.h recog.h conditions.h gdbfiles.h
  143. recog.o : recog.c $(CONFIG_H) $(RTL_H) \
  144. regs.h recog.h hard-reg-set.h insn-config.h
  145. # Now the source files that are generated from the machine description.
  146. .PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
  147. insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c
  148. insn-config.h : md genconfig
  149. ./genconfig md > tmp-insn-config.h
  150. ./move-if-change tmp-insn-config.h insn-config.h
  151. insn-flags.h : md genflags
  152. ./genflags md > tmp-insn-flags.h
  153. ./move-if-change tmp-insn-flags.h insn-flags.h
  154. insn-codes.h : md gencodes
  155. ./gencodes md > tmp-insn-codes.h
  156. ./move-if-change tmp-insn-codes.h insn-codes.h
  157. insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h insn-config.h
  158. $(CC) $(CFLAGS) -c insn-emit.c
  159. insn-emit.c : md genemit
  160. ./genemit md > tmp-insn-emit.c
  161. ./move-if-change tmp-insn-emit.c insn-emit.c
  162. insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h
  163. $(CC) $(CFLAGS) -c insn-recog.c
  164. insn-recog.c : md genrecog
  165. ./genrecog md > tmp-insn-recog.c
  166. ./move-if-change tmp-insn-recog.c insn-recog.c
  167. insn-extract.o : insn-extract.c $(RTL_H)
  168. $(CC) $(CFLAGS) -c insn-extract.c
  169. insn-extract.c : md genextract
  170. ./genextract md > tmp-insn-extract.c
  171. ./move-if-change tmp-insn-extract.c insn-extract.c
  172. insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h
  173. $(CC) $(CFLAGS) -c insn-peep.c
  174. insn-peep.c : md genpeep
  175. ./genpeep md > tmp-insn-peep.c
  176. ./move-if-change tmp-insn-peep.c insn-peep.c
  177. insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h insn-config.h insn-flags.h conditions.h output.h aux-output.c
  178. $(CC) $(CFLAGS) -c insn-output.c
  179. insn-output.c : md genoutput
  180. ./genoutput md > tmp-insn-output.c
  181. ./move-if-change tmp-insn-output.c insn-output.c
  182. # Now the programs that generate those files.
  183. genconfig : genconfig.o rtl.o $(OBSTACK1)
  184. $(CC) $(CFLAGS) -o genconfig genconfig.o rtl.o $(LIBS)
  185. genconfig.o : genconfig.c $(RTL_H)
  186. $(CC) $(CFLAGS) -c genconfig.c
  187. genflags : genflags.o rtl.o $(OBSTACK1)
  188. $(CC) $(CFLAGS) -o genflags genflags.o rtl.o $(LIBS)
  189. genflags.o : genflags.c $(RTL_H)
  190. $(CC) $(CFLAGS) -c genflags.c
  191. gencodes : gencodes.o rtl.o $(OBSTACK1)
  192. $(CC) $(CFLAGS) -o gencodes gencodes.o rtl.o $(LIBS)
  193. gencodes.o : gencodes.c $(RTL_H)
  194. $(CC) $(CFLAGS) -c gencodes.c
  195. genemit : genemit.o rtl.o $(OBSTACK1)
  196. $(CC) $(CFLAGS) -o genemit genemit.o rtl.o $(LIBS)
  197. genemit.o : genemit.c $(RTL_H)
  198. $(CC) $(CFLAGS) -c genemit.c
  199. genrecog : genrecog.o rtl.o $(OBSTACK1)
  200. $(CC) $(CFLAGS) -o genrecog genrecog.o rtl.o $(LIBS)
  201. genrecog.o : genrecog.c $(RTL_H)
  202. $(CC) $(CFLAGS) -c genrecog.c
  203. genextract : genextract.o rtl.o $(OBSTACK1)
  204. $(CC) $(CFLAGS) -o genextract genextract.o rtl.o $(LIBS)
  205. genextract.o : genextract.c $(RTL_H)
  206. $(CC) $(CFLAGS) -c genextract.c
  207. genpeep : genpeep.o rtl.o $(OBSTACK1)
  208. $(CC) $(CFLAGS) -o genpeep genpeep.o rtl.o $(LIBS)
  209. genpeep.o : genpeep.c $(RTL_H)
  210. $(CC) $(CFLAGS) -c genpeep.c
  211. genoutput : genoutput.o rtl.o $(OBSTACK1)
  212. $(CC) $(CFLAGS) -o genoutput genoutput.o rtl.o $(LIBS)
  213. genoutput.o : genoutput.c $(RTL_H)
  214. $(CC) $(CFLAGS) -c genoutput.c
  215. # Making the preprocessor
  216. cpp: cccp
  217. -rm -f cpp
  218. ln cccp cpp
  219. cccp: cccp.o cexp.o version.o
  220. $(CC) $(CFLAGS) -o cccp cccp.o cexp.o version.o $(CLIB)
  221. cexp.o: cexp.c
  222. cexp.c: cexp.y
  223. $(BISON) cexp.y
  224. mv cexp.tab.c cexp.c
  225. cccp.o: cccp.c
  226. # gnulib is not deleted because deleting it would be inconvenient
  227. # for most uses of this target.
  228. clean:
  229. -rm -f $(STAGESTUFF) $(STAGE_GCC)
  230. -rm -f *.s *.s[0-9] *.co *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
  231. -rm -f core
  232. # Copy the files into directories where they will be run.
  233. install: all
  234. install cc1 $(libdir)/gcc-cc1
  235. install -c -m 755 gnulib $(libdir)/gcc-gnulib
  236. ranlib $(libdir)/gcc-gnulib
  237. install cpp $(libdir)/gcc-cpp
  238. install gcc $(bindir)
  239. # do make -f ../gcc/Makefile maketest DIR=../gcc
  240. # in the intended test directory to make it a suitable test directory.
  241. maketest:
  242. ln -s $(DIR)/*.[chy] .
  243. ln -s $(DIR)/*.def .
  244. ln -s $(DIR)/*.md .
  245. ln -s $(DIR)/.gdbinit .
  246. -ln -s $(DIR)/bison.simple .
  247. ln -s $(DIR)/gcc .
  248. ln -s $(DIR)/move-if-change .
  249. ln -s $(DIR)/Makefile test-Makefile
  250. -rm tm.h aux-output.c
  251. make -f test-Makefile clean
  252. # You must create the necessary links tm.h, md and aux-output.c
  253. # Copy the object files from a particular stage into a subdirectory.
  254. stage1: force
  255. -mkdir stage1
  256. mv $(STAGESTUFF) $(STAGE_GCC) stage1
  257. ln gnulib stage1
  258. stage2: force
  259. -mkdir stage2
  260. mv $(STAGESTUFF) $(STAGE_GCC) stage2
  261. ln gnulib stage2
  262. stage3: force
  263. -mkdir stage3
  264. mv $(STAGESTUFF) $(STAGE_GCC) stage3
  265. ln gnulib stage3
  266. .PHONY: stage1 stage2 stage3 #In GNU Make, ignore whether `stage*' exists.
  267. force:
  268. TAGS: force
  269. etags *.y *.h *.c
  270. .PHONY: TAGS