Makefile 12 KB

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