Makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. #
  2. # $Id$
  3. # This file is part of the Free Pascal run time library.
  4. # Copyright (c) 1993-98 by the Free Pascal Development Team
  5. #
  6. # Makefile for the Free Pascal Compiler
  7. #
  8. # See the file COPYING.FPC, included in this distribution,
  9. # for details about the copyright.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. #####################################################################
  16. # Configuration section
  17. #####################################################################
  18. ifndef LANGUAGE
  19. LANGUAGE=e
  20. endif
  21. ifndef CPU
  22. CPU=i386
  23. endif
  24. # Local defines for the compiler only
  25. ifndef LOCALDEF
  26. LOCALDEF=
  27. endif
  28. # Local options for the compiler only
  29. ifndef LOCALOPT
  30. LOCALOPT=
  31. endif
  32. # Options for the RTL only when cycling
  33. ifndef RTLOPTS
  34. RTLOPTS=
  35. endif
  36. # Path to libgcc.a
  37. ifndef GCCLIBPATH
  38. GCCLIBPATH=/usr/lib/gcc-lib/i486-linux/2.7.2.3
  39. endif
  40. export RTLOPTS
  41. #####################################################################
  42. # Defaults
  43. #####################################################################
  44. # Where is the makefile.cfg ?
  45. CFG=../rtl/cfg
  46. # At least set -Sg
  47. override LOCALOPT+=-Sg
  48. # set correct defines (-d$(CPU) is automaticly added in makefile.cfg)
  49. override LOCALDEF+=-dGDB -dFPC
  50. override LOCALOPT+=$(LOCALDEF)
  51. #####################################################################
  52. # Include default makefile
  53. #####################################################################
  54. include $(CFG)/makefile.cfg
  55. # for i386 also insert MMX support
  56. ifneq ($(findstring -di386,$(COMPILER)),)
  57. override LOCALDEF+=-dSUPPORT_MMX
  58. endif
  59. # include OPT also for the RTL (also needed to pass the RELEASE options
  60. # to the RTL !!)
  61. override RTLOPTS+=$(OPT)
  62. #####################################################################
  63. # Setup Targets
  64. #####################################################################
  65. MSGFILE=error$(LANGUAGE).msg
  66. DIFFEXIST:=$(shell $(DIFF) --help)
  67. # Used to avoid unnecessary steps in remake3
  68. ifdef DIFFEXIST
  69. ifdef OLDPP
  70. DIFFRESULT:=$(shell $(DIFF) $(OLDPP) $(PP))
  71. else
  72. DIFFRESULT=Not equal
  73. endif
  74. else
  75. DIFFRESULT=No diff program
  76. endif
  77. #####################################################################
  78. # Setup os-independent filenames
  79. #####################################################################
  80. PPEXENAME=pp$(EXEEXT)
  81. EXENAME=ppc386$(EXEEXT)
  82. M68KEXENAME=ppc68k$(EXEEXT)
  83. TEMPNAME=ppc$(EXEEXT)
  84. TEMPNAME1=ppc1$(EXEEXT)
  85. TEMPNAME2=ppc2$(EXEEXT)
  86. TEMPNAME3=ppc3$(EXEEXT)
  87. MAKEDEP=mkdep$(EXEEXT)
  88. MSG2INC=msg2inc$(EXEEXT)
  89. #####################################################################
  90. # Default makefile
  91. #####################################################################
  92. .SUFFIXES: .pas $(EXEEXT) .ppu .dif .d3p .d3i .d3m .new
  93. .PHONY : all clean info \
  94. cycle remake remake3 \
  95. install next \
  96. diff diff3 patch replacediff3 restorediff3 \
  97. test rtl rtlclean \
  98. # also call ppas if with command option -s
  99. ifeq (,$(findstring -s ,$(COMPILER)))
  100. EXECPPAS=
  101. else
  102. EXECPPAS=@$(PPAS)
  103. endif
  104. .pas$(PPUEXT):
  105. $(COMPILER) $(LOCALOPT) $<
  106. $(EXECPPAS)
  107. .pas$(EXEEXT):
  108. $(COMPILER) $(LOCALOPT) $<
  109. $(EXECPPAS)
  110. all : $(EXENAME)
  111. # @echo Start $(STARTTIME) now $(ENDTIME)
  112. # does not work because $(ENDTIME) is expanded
  113. # before execution !!
  114. make echotime
  115. ifeq ($(MAKELEVEL),0)
  116. ifndef STARTTIME
  117. STARTTIME:=$(shell $(DATE) +%T)
  118. endif
  119. endif
  120. export STARTTIME
  121. ENDTIME=$(shell $(DATE) +%T)
  122. echotime:
  123. @echo Start $(STARTTIME) now $(ENDTIME)
  124. ifndef DIFFRESULT
  125. next :
  126. @echo $(OLDPP) and $(PP) are equal
  127. $(COPY) $(PP) $(EXENAME)
  128. else
  129. next :
  130. make execlean
  131. make -C $(UNITDIR) libsclean
  132. make -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(PP)' 'OPT=$(RTLOPTS)' all
  133. make clean
  134. make all
  135. endif
  136. clean :
  137. -$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) $(EXENAME)
  138. -$(DELTREE) $(SMARTEXT)
  139. execlean :
  140. -$(DEL) $(EXENAME)
  141. distclean: clean
  142. -$(DEL) $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3)
  143. #####################################################################
  144. # Include depencies
  145. #####################################################################
  146. $(MAKEDEP): $(RTLDIR)/utils/mkdep.pp
  147. $(COMPILER) $(RTLDIR)/utils/mkdep.pp
  148. $(COPY) $(RTLDIR)/utils/$(MAKEDEP) $(MAKEDEP)
  149. dependencies : $(MAKEDEP)
  150. $(MAKEDEP) pp.pas $(PPOPTDEF) $(LOCALDEF) '-F$$(COMPILER) $$(LOCALOPT)' > depend
  151. ifdef USEDEPEND
  152. include depend
  153. endif
  154. #####################################################################
  155. # Make targets
  156. #####################################################################
  157. $(MSG2INC): $(RTLDIR)/utils/msg2inc.pp
  158. $(COMPILER) $(RTLDIR)/utils/msg2inc.pp
  159. $(COPY) $(RTLDIR)/utils/$(MSG2INC) $(MSG2INC)
  160. msgtxt.inc: $(MSGFILE) $(MSG2INC)
  161. $(RTLDIR)/utils/$(MSG2INC) $(MSGFILE) msg msg
  162. msg: msgtxt.inc
  163. # Make only the compiler
  164. ifdef inlinux
  165. $(EXENAME) : $(PPEXENAME)
  166. $(MOVE) $(PPEXENAME) $(EXENAME)
  167. else
  168. $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc)
  169. $(COMPILER) $(LOCALOPT) pp.pas
  170. $(EXECPPAS)
  171. $(MOVE) $(PPEXENAME) $(EXENAME)
  172. endif
  173. # This target remakes the units with the currently made version
  174. remake: $(EXENAME)
  175. $(MOVE) $(EXENAME) $(TEMPNAME)
  176. make execlean
  177. make -C $(UNITDIR) libsclean
  178. make clean
  179. make 'PP=./$(TEMPNAME)' all
  180. remake3: $(TEMPNAME3)
  181. make 'PP=./$(TEMPNAME3)' 'OLDPP=./$(TEMPNAME2)' next
  182. $(DIFF) $(TEMPNAME3) $(EXENAME)
  183. $(TEMPNAME1) : $(EXENAME)
  184. -$(DEL) $(TEMPNAME1)
  185. $(MOVE) $(EXENAME) $(TEMPNAME1)
  186. $(TEMPNAME2) : $(TEMPNAME1)
  187. make 'PP=./$(TEMPNAME1)' 'OLDPP=' next
  188. -$(DEL) $(TEMPNAME2)
  189. $(MOVE) $(EXENAME) $(TEMPNAME2)
  190. $(TEMPNAME3) : $(TEMPNAME2)
  191. make 'PP=./$(TEMPNAME2)' 'OLDPP=./$(TEMPNAME1)' next
  192. -$(DEL) $(TEMPNAME3)
  193. $(MOVE) $(EXENAME) $(TEMPNAME3)
  194. cycle:
  195. make clean
  196. make -C $(UNITDIR) libsclean
  197. make -C $(UNITDIR) 'OPT=$(RTLOPTS)' all
  198. make remake3
  199. make echotime
  200. cycledep:
  201. make cycle USEDEPEND=1
  202. cvstest:
  203. make cycle 'LOCALOPT=-n' 'RTLOPTS=-n'
  204. #####################################################################
  205. # Installation
  206. #####################################################################
  207. install:
  208. ifdef inlinux
  209. umask 022
  210. strip ppc386
  211. $(MKDIR) $(LIBINSTALLDIR)
  212. $(INSTALLEXE) ppc386 $(LIBINSTALLDIR)
  213. ln -sf $(LIBINSTALLDIR)/ppc386 $(BININSTALLDIR)/ppc386
  214. chmod 755 makecfg
  215. makecfg $(LIBINSTALLDIR)/samplecfg $(UNITINSTALLDIR) $(MSGINSTALLDIR) $(GCCLIBPATH)
  216. else
  217. $(MKDIR) $(BININSTALLDIR)
  218. $(INSTALLEXE) ppc386$(EXEEXT) $(BININSTALLDIR)
  219. endif
  220. $(MKDIR) $(MSGINSTALLDIR)
  221. $(INSTALL) errore.msg errorn.msg $(MSGINSTALLDIR)
  222. #####################################################################
  223. # Misc
  224. #####################################################################
  225. rtl :
  226. make -C $(UNITDIR) all
  227. rtlclean :
  228. make -C $(UNITDIR) libsclean
  229. ansirtl:
  230. make -C $(UNITDIR) libsclean
  231. make -C $(UNITDIR) PP=$(COMPILERDIR)/ppc386 OPT='-g -dUSeAnsiStrings' all
  232. test:
  233. @echo time is $(STARTTIME) date.exe is $(DATE)
  234. #####################################################################
  235. # local user configurable file
  236. # in makefile.loc you can add any desired target
  237. #####################################################################
  238. localmake:=$(strip $(wildcard makefile.loc))
  239. ifdef localmake
  240. include ./$(localmake)
  241. endif
  242. #####################################################################
  243. # Default targets
  244. #####################################################################
  245. include $(CFG)/makefile.def
  246. # just a quick way to get ppc68k
  247. # needs to be after makefile.def for PASFILES INCFILES
  248. $(M68KEXENAME): $(PASFILES) $(INCFILES)
  249. make clean
  250. $(PP) -uI386 -uSUPPORT_MMX -dm68k -o$(M68KEXENAME) pp
  251. make clean
  252. #
  253. # $Log$
  254. # Revision 1.13 1998-10-22 23:55:24 peter
  255. # * dependencies,mkdep target is not linux only
  256. #
  257. # Revision 1.12 1998/10/22 19:15:46 peter
  258. # + VERBOSE=1 to set -vwni (necessary due the -n)
  259. # * fixed OPT, now also passed to RTLOPTS
  260. #
  261. # Revision 1.11 1998/10/12 12:20:37 pierre
  262. # + added tai_const_symbol_offset
  263. # for r : pointer = @var.field;
  264. # * better message for different arg names on implementation
  265. # of function
  266. #
  267. # Revision 1.10 1998/10/09 12:59:07 pierre
  268. # * MMX_SUPPORT used by default
  269. #
  270. # Revision 1.9 1998/10/09 11:07:44 peter
  271. # + cycledep
  272. #
  273. # Revision 1.8 1998/10/09 08:54:18 pierre
  274. # + added cvstest target
  275. # uses -n option to avoid use of local ppc386.cfg
  276. #
  277. # Revision 1.7 1998/09/29 18:34:45 peter
  278. # + chmod 755 makecfg
  279. #
  280. # Revision 1.6 1998/09/23 15:41:42 pierre
  281. # export for RTLOPTS (useful for make) !!
  282. #
  283. # Revision 1.5 1998/09/22 13:09:24 pierre
  284. # + added possibility to read makefile.loc if it exists
  285. # this allows simple addition of private rules
  286. # * restored EXENAME dependencies
  287. # PASFILES and INCFILES where not defined anymore !!
  288. #
  289. # Revision 1.4 1998/09/16 16:41:38 peter
  290. # * merged fixes
  291. #
  292. # Revision 1.1.2.2 1998/09/16 16:12:43 peter
  293. # * uses makefile.cfg
  294. #
  295. # Revision 1.3 1998/09/11 13:12:45 michael
  296. # + makecfg has support for different kinds of units
  297. #
  298. # Revision 1.2 1998/09/11 12:27:04 pierre
  299. # added execlean target to be able to keep *.s files
  300. #
  301. # Revision 1.1.2.1 1998/09/11 12:07:51 pierre
  302. # + added execlean to be able to keep last *.s files
  303. #
  304. # Revision 1.1 1998/09/10 13:53:54 peter
  305. # * msg2inc compile works
  306. #
  307. # Revision 1.31 1998/09/09 18:26:25 michael
  308. # Spaces to tabs...
  309. #
  310. # Revision 1.30 1998/09/09 18:17:15 florian
  311. # * version number changed to 0.99.8
  312. #
  313. # Revision 1.29 1998/09/02 08:51:30 pierre
  314. # + added -s support must be defined as LOCALOPT
  315. # because it does not work for rtl building
  316. # + added some compilation time info
  317. #
  318. # Revision 1.28 1998/08/29 13:52:30 peter
  319. # + new messagefile
  320. # * merged optione.msg into errore.msg
  321. #
  322. # Revision 1.27 1998/08/21 15:16:56 peter
  323. # * win32 compiles a bit better, no growheap crash
  324. #
  325. # Revision 1.26 1998/08/21 14:08:46 pierre
  326. # + TEST_FUNCRET now default (old code removed)
  327. # works also for m68k (at least compiles)
  328. #
  329. # Revision 1.25 1998/08/18 09:24:41 pierre
  330. # * small warning position bug fixed
  331. # * support_mmx switches splitting was missing
  332. # * rhide error and warning output corrected
  333. #
  334. # Revision 1.24 1998/08/14 09:29:53 michael
  335. # Updated compiler number
  336. #
  337. # Revision 1.23 1998/08/06 10:42:56 pierre
  338. # + faster remake3 :
  339. # stops when two executables are equal
  340. #
  341. # Revision 1.22 1998/07/23 18:17:58 michael
  342. # + Added ansirtl target to make an ansistrings capable rtl
  343. #
  344. # Revision 1.21 1998/07/22 21:33:32 michael
  345. # + COPY and Replace back to mv and cp
  346. #
  347. # Revision 1.20 1998/06/24 14:02:58 peter
  348. # * new depend for the new ra units
  349. #
  350. # Revision 1.19 1998/06/23 14:00:15 peter
  351. # * renamed RA* units
  352. #
  353. # Revision 1.18 1998/06/10 10:42:44 peter
  354. # * ifndef TARGET to allow target on commandline
  355. #
  356. # Revision 1.17 1998/06/08 09:22:02 michael
  357. # fixed dependcies and rules. Make would not run any more after peters changes.
  358. #
  359. # Revision 1.16 1998/06/05 14:37:28 pierre
  360. # * fixes for inline for operators
  361. # * inline procedure more correctly restricted
  362. #
  363. # Revision 1.15 1998/06/03 09:33:39 michael
  364. # added distclean target to remove ppc1-ppc3 too
  365. #
  366. # Revision 1.14 1998/06/03 09:27:51 michael
  367. # Clean cannot remove ppc1-ppc3 : make cycle uses clean
  368. #
  369. # Revision 1.13 1998/06/02 11:29:36 peter
  370. # + make clean removes also ppc1 - ppc3
  371. #
  372. # Revision 1.12 1998/05/31 14:09:45 peter
  373. # * use mv -f instead of move /y whch is not dos6.2 compatible
  374. #
  375. # Revision 1.11 1998/05/06 14:03:27 michael
  376. # + Make install doesn't stop if makecfg not found
  377. #
  378. # Revision 1.10 1998/04/23 13:21:46 michael
  379. # Updated version number
  380. #
  381. # Revision 1.9 1998/04/15 14:16:48 michael
  382. # + Removed CR characters
  383. #
  384. # Revision 1.8 1998/04/06 12:28:23 pierre
  385. # Test of makefile log !
  386. #
  387. # End of log