makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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. # Try to determine Operating System
  17. #####################################################################
  18. BASEDIR=$(shell pwd)
  19. # in linux no : in pathes
  20. ifeq ($(findstring :,$(BASEDIR)),)
  21. inlinux=1
  22. endif
  23. # in case pwd is not present on the DOS-OS
  24. ifeq ($(strip $(BASEDIR)),'')
  25. inlinux=
  26. BASEDIR:=.
  27. endif
  28. # What compiler to use
  29. ifndef PP
  30. PP=ppc386
  31. endif
  32. #####################################################################
  33. # Setup Targets
  34. #####################################################################
  35. # what target do we use
  36. # currently dos go32v2 os2 and linux are available
  37. ifndef TARGET
  38. ifdef inlinux
  39. TARGET=linux
  40. else
  41. TARGET=go32v2
  42. endif
  43. endif
  44. # What processor do you want to compile for : i386 m68k (case sensitive !!)
  45. ifndef CPU
  46. CPU= i386
  47. # CPU= m68k
  48. endif
  49. #####################################################################
  50. # Setup Files Directories
  51. #####################################################################
  52. # Set os-dependent files and extensions
  53. ifdef inlinux
  54. EXEEXT=
  55. REPLACE=mv -f
  56. CP=cp -f
  57. else
  58. EXEEXT=.exe
  59. # mv -f gives problem under dos
  60. # claiming source and destinaztion are the same files !
  61. REPLACE=copy /y
  62. CP=cp -f
  63. endif
  64. COMPILERDIR=$(BASEDIR)
  65. RTLDIR:=$(BASEDIR)/../rtl
  66. # specify where units are.
  67. # This needs to be set correctly for the 'remake' target to work !
  68. ifndef UNITDIR
  69. UNITDIR=$(RTLDIR)/$(TARGET)
  70. ifeq ($(TARGET),go32v1)
  71. UNITDIR=$(RTLDIR)/dos/go32v1
  72. endif
  73. ifeq ($(TARGET),go32v2)
  74. UNITDIR=$(RTLDIR)/dos/go32v2
  75. endif
  76. endif
  77. # not def UNITDIR
  78. # Where to install the executable program/link
  79. ifndef PROGINSTALLDIR
  80. ifdef inlinux
  81. PROGINSTALLDIR = /usr/bin
  82. else
  83. PROGINSTALLDIR = c:\pp\bin
  84. endif
  85. endif
  86. # !!! Linux only
  87. # Where to install the _real_executable and support files
  88. ifndef LIBINSTALLDIR
  89. ifdef inlinux
  90. LIBINSTALLDIR=/usr/lib/fpc/0.99.6
  91. # for a.out
  92. # LIBINSTALLDIR=/usr/lib/ppc/aout/0.99.6
  93. else
  94. LIBINSTALLDIR=$(PROGINSTALLDIR)
  95. endif
  96. endif
  97. # Where the .msg files will be stored
  98. ifndef MSGINSTALLDIR
  99. MSGINSTALLDIR=$(LIBINSTALLDIR)/msg
  100. endif
  101. ifndef UNITINSTALLDIR
  102. ifdef inlinux
  103. UNITINSTALLDIR=$(LIBINSTALLDIR)/linuxunits
  104. else
  105. UNITINSTALLDIR=$(UNITDIR)
  106. endif
  107. endif
  108. # !!! Linux only
  109. # GCCLIBPATH is wat is it on my PC... it MUST be set in the main Makefile
  110. ifndef GCCLIBPATH
  111. GCCLIBPATH=/usr/lib/gcc-lib/i486-linux/2.6.3
  112. endif
  113. #####################################################################
  114. # When making diffs of the sources
  115. #####################################################################
  116. # Diff program
  117. DIFF = diff
  118. # Diff3 program
  119. DIFF3 = diff3
  120. # Options to diff.
  121. DIFFOPTS = -b -c
  122. # Directory where files are to make diffs with..
  123. ifdef inlinux
  124. DIFDIR = /usr/local/fpk/work/new/compiler
  125. else
  126. DIFDIR = h:/cvs/compiler
  127. endif
  128. # Directory where reference files are for diff3
  129. ifdef inlinux
  130. REFDIR = /usr/local/fpk/dist/source/compiler
  131. else
  132. REFDIR = h:/myref/compiler
  133. endif
  134. #####################################################################
  135. # End of configurable section. Do not edit after this line.
  136. #####################################################################
  137. # set correct defines (also needed by mkdep)
  138. PPDEFS:=-d$(CPU) -dGDB -dFPC
  139. # Set the needed compiler options
  140. PPOPTS:=$(OPT) $(PPDEFS) -Sg -T$(TARGET)
  141. # Unitdir specified ?
  142. ifneq ("$(UNITDIR)", "")
  143. PPOPTS:=$(PPOPTS) -Up$(UNITDIR)
  144. endif
  145. # Do we need the GCC library ?
  146. ifeq ($(LINK_TO_C),YES)
  147. PPOPTS:=$(PPOPTS) -Fg$(GCCLIBPATH)
  148. endif
  149. # Create the whole compiler commandline
  150. COMPILER=$(PP) $(PPOPTS)
  151. #####################################################################
  152. # Setup os-independent filenames
  153. #####################################################################
  154. PPEXENAME=pp$(EXEEXT)
  155. EXENAME=ppc386$(EXEEXT)
  156. TEMPNAME=ppc$(EXEEXT)
  157. TEMPNAME1=ppc1$(EXEEXT)
  158. TEMPNAME2=ppc2$(EXEEXT)
  159. TEMPNAME3=ppc3$(EXEEXT)
  160. MAKEDEP=mkdep$(EXEEXT)
  161. PASFILES:=$(wildcard *.pas)
  162. INCFILES:=$(wildcard *.inc)
  163. MSGFILES:=$(wildcard *.msg)
  164. #####################################################################
  165. # Default makefile
  166. #####################################################################
  167. .SUFFIXES: .pas $(EXEEXT) .ppu .dif .d3p .d3i .d3m .new
  168. .PHONY : all clean info \
  169. cycle remake remake3 \
  170. install \
  171. diff diff3 patch rtl toflor replacediff3 restorediff3 \
  172. test rtlzip \
  173. .pas.ppu:
  174. $(COMPILER) $<
  175. .pas$(EXEEXT):
  176. $(COMPILER) $<
  177. all : $(EXENAME)
  178. clean :
  179. -rm -f *.o *.ppu *.s $(EXENAME)
  180. distclean: clean
  181. -rm -f $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3)
  182. #####################################################################
  183. # Info
  184. #####################################################################
  185. info :
  186. @echo - Target is $(TARGET)
  187. @echo - Basedir is $(BASEDIR)
  188. @echo - Unitdir is $(UNITDIR)
  189. @echo - Pascal files are $(PASFILES)
  190. @echo - Inc files are $(INCFILES)
  191. @echo - Msg files are $(MSGFILES)
  192. #####################################################################
  193. # Include depencies (linux only)
  194. #####################################################################
  195. ifdef inlinux
  196. $(MAKEDEP) : $(RTLDIR)/utils/mkdep.pp
  197. $(PP) $(RTLDIR)/utils/mkdep.pp
  198. $(CP) $(RTLDIR)/utils/$(MAKEDEP) $(MAKEDEP)
  199. dependencies : $(MAKEDEP)
  200. $(MAKEDEP) pp.pas $(PPDEFS) '-F$$(COMPILER)' > depend
  201. include depend
  202. endif
  203. #####################################################################
  204. # Make targets
  205. #####################################################################
  206. msgtxt.inc: errore.msg
  207. msg2inc errore.msg msgtxt.inc msgtxt
  208. optmsg.inc: optione.msg
  209. msg2inc optione.msg optmsg.inc optiontxt
  210. msg: msgtxt.inc optmsg.inc
  211. # Make only the compiler
  212. ifdef inlinux
  213. $(EXENAME) : $(PPEXENAME)
  214. $(REPLACE) $(PPEXENAME) $(EXENAME)
  215. else
  216. $(EXENAME) : $(PASFILES) $(INCFILES) $(MSGFILES)
  217. $(COMPILER) pp.pas
  218. $(REPLACE) $(PPEXENAME) $(EXENAME)
  219. endif
  220. # This target remakes the units with the currently made version
  221. remake: $(EXENAME)
  222. $(REPLACE) $(EXENAME) $(TEMPNAME)
  223. $(MAKE) clean
  224. $(MAKE) -C $(UNITDIR) clean
  225. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME)' all
  226. $(MAKE) 'PP=./$(TEMPNAME)' all
  227. remake3: $(TEMPNAME3)
  228. $(MAKE) clean
  229. $(MAKE) -C $(UNITDIR) clean
  230. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME3)' all
  231. $(MAKE) 'PP=./$(TEMPNAME3)' all
  232. diff $(TEMPNAME3) $(EXENAME)
  233. $(TEMPNAME1) : $(EXENAME)
  234. $(REPLACE) $(EXENAME) $(TEMPNAME1)
  235. $(TEMPNAME2) : $(TEMPNAME1)
  236. $(MAKE) clean
  237. $(MAKE) -C $(UNITDIR) clean
  238. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME1)' all
  239. $(MAKE) 'PP=./$(TEMPNAME1)' all
  240. $(REPLACE) $(EXENAME) $(TEMPNAME2)
  241. $(TEMPNAME3) : $(TEMPNAME2)
  242. $(MAKE) clean
  243. $(MAKE) -C $(UNITDIR) clean
  244. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME2)' all
  245. $(MAKE) 'PP=./$(TEMPNAME2)' all
  246. $(REPLACE) $(EXENAME) $(TEMPNAME3)
  247. cycle:
  248. $(MAKE) clean
  249. $(MAKE) -C $(UNITDIR) clean
  250. $(MAKE) -C $(UNITDIR)
  251. $(MAKE) remake3
  252. #####################################################################
  253. # Installation
  254. #####################################################################
  255. install:
  256. umask 022
  257. strip ppc386
  258. install -m 755 -d $(LIBINSTALLDIR)
  259. install -m 755 ppc386 $(LIBINSTALLDIR)
  260. ln -sf $(LIBINSTALLDIR)/ppc386 $(PROGINSTALLDIR)/ppc386
  261. -makecfg $(LIBINSTALLDIR)/samplecfg $(UNITINSTALLDIR) $(MSGINSTALLDIR) $(GCCLIBPATH)
  262. install -m 755 -d $(MSGINSTALLDIR)
  263. install -m 666 errore.msg $(MSGINSTALLDIR)
  264. install -m 666 errorn.msg $(MSGINSTALLDIR)
  265. #####################################################################
  266. # Diffs
  267. #####################################################################
  268. SOURCEFILES = $(PASFILES) $(INCFILES) $(MSGFILES) Makefile
  269. DIFFFILES = $(patsubst %.pas,%.dif,$(PASFILES)) \
  270. $(patsubst %.inc,%.dif,$(INCFILES)) \
  271. $(patsubst %.msg,%.dif,$(MSGFILES)) \
  272. Makefile.dif
  273. DIFF3FILES = $(patsubst %.pas,%.d3p,$(PASFILES)) \
  274. $(patsubst %.inc,%.d3i,$(INCFILES)) \
  275. $(patsubst %.msg,%.d3m,$(MSGFILES)) \
  276. Makefile.di3
  277. PATCHFILES = $(patsubst %.pas,%.new,$(PASFILES)) \
  278. $(patsubst %.inc,%.new,$(INCFILES)) \
  279. $(patsubst %.msg,%.new,$(MSGFILES)) \
  280. Makefile.new
  281. %.dif : %.pas
  282. -$(DIFF) $(DIFFOPTS) $*.pas $(DIFDIR)/$*.pas > $*.dif
  283. %.dif : %.msg
  284. -$(DIFF) $(DIFFOPTS) $*.msg $(DIFDIR)/$*.msg > $*.dif
  285. %.dif : %.inc
  286. -$(DIFF) $(DIFFOPTS) $*.inc $(DIFDIR)/$*.inc > $*.dif
  287. Makefile.dif : Makefile
  288. -$(DIFF) $(DIFFOPTS) Makefile $(DIFDIR)/Makefile > Makefile.dif
  289. %.new : %.pas %.dif
  290. -copy /y $*.pas $*.new
  291. -patch $*.new $*.dif
  292. %.new : %.msg %.dif
  293. -copy /y $*.msg $*.new
  294. -patch $*.new $*.dif
  295. %.new : %.inc %.dif
  296. -copy /y $*.inc $*.new
  297. -patch $*.new $*.dif
  298. Makefile.new : Makefile Makefile.dif
  299. -copy /y Makefile Makefile.new
  300. -patch Makefile.new Makefile.dif
  301. %.d3p : %.pas
  302. -$(DIFF3) -m -E $*.pas $(REFDIR)/$*.pas $(DIFDIR)/$*.pas > $*.d3p
  303. %.d3m : %.msg
  304. -$(DIFF3) -m -E $*.msg $(REFDIR)/$*.msg $(DIFDIR)/$*.msg > $*.d3m
  305. %.d3i : %.inc
  306. -diff3 -m -E $*.inc $(REFDIR)/$*.inc $(DIFDIR)/$*.inc > $*.d3i
  307. Makefile.di3: Makefile
  308. -diff3 -m -E Makefile $(REFDIR)/Makefile $(DIFDIR)/Makefile > Makefile.di3
  309. diff : $(DIFFFILES)
  310. diff3 : $(DIFF3FILES)
  311. replacediff3 : diff3
  312. copy /y *.pas *.bkp
  313. copy /y *.inc *.bki
  314. copy /y *.msg *.bkm
  315. copy /y Makefile Makefile.old
  316. copy /y *.d3p *.pas
  317. copy /y *.d3i *.inc
  318. copy /y *.d3m *.msg
  319. copy /y Makefile.di3 Makefile
  320. restorediff3 :
  321. copy /y *.bkp *.pas
  322. copy /y *.bki *.inc
  323. copy /y *.bkm *.msg
  324. copy /y Makefile.old Makefile
  325. patch : $(PATCHFILES)
  326. diffclean :
  327. -del *.dif
  328. -del *.d3*
  329. -del *.new
  330. rtl :
  331. make -C $(UNITDIR) all
  332. rtlclean :
  333. make -C $(UNITDIR) clean
  334. # Test of log at the end
  335. # does CVS add # at start of each line ??
  336. # $Log$
  337. # Revision 1.20 1998-06-24 14:02:58 peter
  338. # * new depend for the new ra units
  339. #
  340. # Revision 1.19 1998/06/23 14:00:15 peter
  341. # * renamed RA* units
  342. #
  343. # Revision 1.18 1998/06/10 10:42:44 peter
  344. # * ifndef TARGET to allow target on commandline
  345. #
  346. # Revision 1.17 1998/06/08 09:22:02 michael
  347. # fixed dependcies and rules. Make would not run any more after peters changes.
  348. #
  349. # Revision 1.16 1998/06/05 14:37:28 pierre
  350. # * fixes for inline for operators
  351. # * inline procedure more correctly restricted
  352. #
  353. # Revision 1.15 1998/06/03 09:33:39 michael
  354. # added distclean target to remove ppc1-ppc3 too
  355. #
  356. # Revision 1.14 1998/06/03 09:27:51 michael
  357. # Clean cannot remove ppc1-ppc3 : make cycle uses clean
  358. #
  359. # Revision 1.13 1998/06/02 11:29:36 peter
  360. # + make clean removes also ppc1 - ppc3
  361. #
  362. # Revision 1.12 1998/05/31 14:09:45 peter
  363. # * use mv -f instead of move /y whch is not dos6.2 compatible
  364. #
  365. # Revision 1.11 1998/05/06 14:03:27 michael
  366. # + Make install doesn't stop if makecfg not found
  367. #
  368. # Revision 1.10 1998/04/23 13:21:46 michael
  369. # Updated version number
  370. #
  371. # Revision 1.9 1998/04/15 14:16:48 michael
  372. # + Removed CR characters
  373. #
  374. # Revision 1.8 1998/04/06 12:28:23 pierre
  375. # Test of makefile log !
  376. #
  377. # End of log