makefile 10 KB

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