Makefile 11 KB

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