Makefile 12 KB

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