Makefile 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671
  1. #
  2. # Makefile generated by fpcmake v0.99.15 [2000/07/02]
  3. #
  4. defaultrule: help
  5. #####################################################################
  6. # Autodetect OS (Linux or Dos or Windows NT)
  7. # define inlinux when running under linux
  8. # define inWinNT when running under WinNT
  9. #####################################################################
  10. # We need only / in the path
  11. override PATH:=$(subst \,/,$(PATH))
  12. # Search for PWD and determine also if we are under linux
  13. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
  14. ifeq ($(PWD),)
  15. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
  16. ifeq ($(PWD),)
  17. nopwd:
  18. @echo You need the GNU utils package to use this Makefile!
  19. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  20. @exit
  21. else
  22. inlinux=1
  23. endif
  24. else
  25. PWD:=$(firstword $(PWD))
  26. endif
  27. # Detect NT - NT sets OS to Windows_NT
  28. ifndef inlinux
  29. ifeq ($(OS),Windows_NT)
  30. inWinNT=1
  31. endif
  32. endif
  33. # Detect OS/2 - OS/2 has OS2_SHELL defined
  34. ifndef inlinux
  35. ifndef inWinNT
  36. ifdef OS2_SHELL
  37. inOS2=1
  38. endif
  39. endif
  40. endif
  41. # The extension of executables
  42. ifdef inlinux
  43. EXEEXT=
  44. else
  45. EXEEXT=.exe
  46. endif
  47. # The path which is searched separated by spaces
  48. ifdef inlinux
  49. SEARCHPATH=$(subst :, ,$(PATH))
  50. else
  51. SEARCHPATH=$(subst ;, ,$(PATH))
  52. endif
  53. # Base dir
  54. ifdef PWD
  55. BASEDIR:=$(shell $(PWD))
  56. else
  57. BASEDIR=.
  58. endif
  59. #####################################################################
  60. # FPC version/target Detection
  61. #####################################################################
  62. # What compiler to use ?
  63. ifndef FPC
  64. # Compatibility with old makefiles
  65. ifdef PP
  66. FPC=$(PP)
  67. else
  68. ifdef inOS2
  69. FPC=ppos2
  70. else
  71. FPC=ppc386
  72. endif
  73. endif
  74. endif
  75. override FPC:=$(subst $(EXEEXT),,$(FPC))
  76. override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
  77. # Target OS
  78. ifndef OS_TARGET
  79. OS_TARGET:=$(shell $(FPC) -iTO)
  80. endif
  81. # Source OS
  82. ifndef OS_SOURCE
  83. OS_SOURCE:=$(shell $(FPC) -iSO)
  84. endif
  85. # Target CPU
  86. ifndef CPU_TARGET
  87. CPU_TARGET:=$(shell $(FPC) -iTP)
  88. endif
  89. # Source CPU
  90. ifndef CPU_SOURCE
  91. CPU_SOURCE:=$(shell $(FPC) -iSP)
  92. endif
  93. # FPC version
  94. ifndef FPC_VERSION
  95. FPC_VERSION:=$(shell $(FPC) -iV)
  96. endif
  97. export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
  98. #####################################################################
  99. # Pre Settings
  100. #####################################################################
  101. OLDFPCDIR:=$(FPCDIR)
  102. checkfpcdir:
  103. ifdef OLDFPCDIR
  104. ifneq ($(OLDFPCDIR),)
  105. @echo ---------------------------------------------------------
  106. @echo
  107. @echo You must unset FPCDIR to use this the packaging rules.
  108. @echo
  109. @echo ---------------------------------------------------------
  110. @cantcontinuewithfpcdir
  111. endif
  112. endif
  113. # Check if install/ subdir is available
  114. ifneq ($(wildcard install),)
  115. CVSINSTALL=install
  116. else
  117. CVSINSTALL=.
  118. endif
  119. # All target
  120. ifdef SNAPSHOT
  121. ALLTARGET=all
  122. else
  123. ifndef ALLTARGET
  124. ifeq ($(OS_TARGET),win32)
  125. ALLTARGET=smart
  126. else
  127. ifeq ($(OS_TARGET),go32v2)
  128. ALLTARGET=smart
  129. else
  130. ALLTARGET=all
  131. endif
  132. endif
  133. endif
  134. endif
  135. # Stop with an error?
  136. ifdef SNAPSHOT
  137. NOSTOP=-
  138. else
  139. NOSTOP=
  140. endif
  141. # Prefix for units
  142. ifeq ($(OS_TARGET),linux)
  143. PKGPRE=units
  144. else
  145. PKGPRE=u
  146. endif
  147. # Test dir if none specified
  148. ifndef PREFIXINSTALLDIR
  149. ifdef inlinux
  150. PREFIXINSTALLDIR=/tmp/pptest
  151. else
  152. PREFIXINSTALLDIR=/pptest
  153. endif
  154. endif
  155. # Always compile for release
  156. override RELEASE=1
  157. export RELEASE
  158. # We want to have the resulting .zips in the current dir
  159. ifndef DESTZIPDIR
  160. export DESTZIPDIR:=$(BASEDIR)
  161. endif
  162. # Temporary path to pack a file
  163. BASEPACKDIR=$(BASEDIR)/basepack
  164. # Use new ppc386
  165. PPNEW=$(BASEDIR)/compiler/ppc386$(EXEEXT)
  166. # Don't use ppufiles for win32 becuase of commandline length problems
  167. ifneq ($(OS_TARGET),win32)
  168. PPUFILESNEW=$(BASEDIR)/utils/ppufiles$(EXEEXT)
  169. endif
  170. # Build/install options
  171. BUILDOPTS=FPC=$(PPNEW) RELEASE=1
  172. INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR)
  173. ifdef PPUFILESNEW
  174. override INSTALLOPT+=PPUFILES=$(PPUFILESNEW)
  175. endif
  176. # Compile also IDE (check for ide and fv dir)
  177. ifneq ($(wildcard ide),)
  178. ifneq ($(wildcard fv),)
  179. ifeq ($(OS_TARGET),go32v2)
  180. IDE=1
  181. endif
  182. ifeq ($(OS_TARGET),win32)
  183. IDE=1
  184. endif
  185. ifeq ($(OS_TARGET),linux)
  186. IDE=1
  187. endif
  188. endif
  189. endif
  190. #####################################################################
  191. # FPCDIR Setting
  192. #####################################################################
  193. # Test FPCDIR to look if the RTL dir exists
  194. ifdef FPCDIR
  195. override FPCDIR:=$(subst \,/,$(FPCDIR))
  196. ifeq ($(wildcard $(FPCDIR)/rtl),)
  197. ifeq ($(wildcard $(FPCDIR)/units),)
  198. override FPCDIR=wrong
  199. endif
  200. endif
  201. else
  202. override FPCDIR=wrong
  203. endif
  204. # Detect FPCDIR
  205. ifeq ($(FPCDIR),wrong)
  206. ifdef inlinux
  207. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  208. ifeq ($(wildcard $(FPCDIR)/units),)
  209. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  210. endif
  211. else
  212. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  213. override FPCDIR:=$(FPCDIR)/..
  214. ifeq ($(wildcard $(FPCDIR)/rtl),)
  215. ifeq ($(wildcard $(FPCDIR)/units),)
  216. override FPCDIR:=$(FPCDIR)/..
  217. ifeq ($(wildcard $(FPCDIR)/rtl),)
  218. ifeq ($(wildcard $(FPCDIR)/units),)
  219. override FPCDIR=c:/pp
  220. endif
  221. endif
  222. endif
  223. endif
  224. endif
  225. endif
  226. #####################################################################
  227. # User Settings
  228. #####################################################################
  229. # Targets
  230. override DIROBJECTS+=$(wildcard compiler rtl utils fcl api fv packages ide)
  231. # Clean
  232. # Install
  233. ZIPTARGET=install
  234. # Defaults
  235. # Directories
  236. # Packages
  237. # Libraries
  238. #####################################################################
  239. # Shell tools
  240. #####################################################################
  241. # echo
  242. ifndef ECHO
  243. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
  244. ifeq ($(ECHO),)
  245. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  246. ifeq ($(ECHO),)
  247. ECHO:=echo
  248. ECHOE:=echo
  249. else
  250. ECHO:=$(firstword $(ECHO))
  251. ECHOE=$(ECHO) -E
  252. endif
  253. else
  254. ECHO:=$(firstword $(ECHO))
  255. ECHOE=$(ECHO) -E
  256. endif
  257. endif
  258. # To copy pograms
  259. ifndef COPY
  260. COPY:=cp -fp
  261. endif
  262. # Copy a whole tree
  263. ifndef COPYTREE
  264. COPYTREE:=cp -rfp
  265. endif
  266. # To move pograms
  267. ifndef MOVE
  268. MOVE:=mv -f
  269. endif
  270. # Check delete program
  271. ifndef DEL
  272. DEL:=rm -f
  273. endif
  274. # Check deltree program
  275. ifndef DELTREE
  276. DELTREE:=rm -rf
  277. endif
  278. # To install files
  279. ifndef INSTALL
  280. ifdef inlinux
  281. INSTALL:=install -m 644
  282. else
  283. INSTALL:=$(COPY)
  284. endif
  285. endif
  286. # To install programs
  287. ifndef INSTALLEXE
  288. ifdef inlinux
  289. INSTALLEXE:=install -m 755
  290. else
  291. INSTALLEXE:=$(COPY)
  292. endif
  293. endif
  294. # To make a directory.
  295. ifndef MKDIR
  296. ifdef inlinux
  297. MKDIR:=install -m 755 -d
  298. else
  299. MKDIR:=ginstall -m 755 -d
  300. endif
  301. endif
  302. export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  303. #####################################################################
  304. # Default Tools
  305. #####################################################################
  306. # assembler, redefine it if cross compiling
  307. ifndef AS
  308. AS=as
  309. endif
  310. # linker, but probably not used
  311. ifndef LD
  312. LD=ld
  313. endif
  314. # ppas.bat / ppas.sh
  315. ifdef inlinux
  316. PPAS=ppas.sh
  317. else
  318. ifdef inOS2
  319. PPAS=ppas.cmd
  320. else
  321. PPAS=ppas.bat
  322. endif
  323. endif
  324. # ldconfig to rebuild .so cache
  325. ifdef inlinux
  326. LDCONFIG=ldconfig
  327. else
  328. LDCONFIG=
  329. endif
  330. # ppufiles
  331. ifndef PPUFILES
  332. PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
  333. ifeq ($(PPUFILES),)
  334. PPUFILES=
  335. else
  336. PPUFILES:=$(firstword $(PPUFILES))
  337. endif
  338. endif
  339. export PPUFILES
  340. # Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
  341. # upx uses that one itself (PFV)
  342. ifndef UPXPROG
  343. ifeq ($(OS_TARGET),go32v2)
  344. UPXPROG:=1
  345. endif
  346. ifeq ($(OS_TARGET),win32)
  347. UPXPROG:=1
  348. endif
  349. ifdef UPXPROG
  350. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
  351. ifeq ($(UPXPROG),)
  352. UPXPROG=
  353. else
  354. UPXPROG:=$(firstword $(UPXPROG))
  355. endif
  356. else
  357. UPXPROG=
  358. endif
  359. endif
  360. export UPXPROG
  361. # gdate/date
  362. ifndef DATE
  363. DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
  364. ifeq ($(DATE),)
  365. DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
  366. ifeq ($(DATE),)
  367. DATE=
  368. else
  369. DATE:=$(firstword $(DATE))
  370. endif
  371. else
  372. DATE:=$(firstword $(DATE))
  373. endif
  374. endif
  375. export DATE
  376. ifdef DATE
  377. DATESTR:=$(shell $(DATE) +%Y%m%d)
  378. else
  379. DATESTR=
  380. endif
  381. # ZipProg, you can't use Zip as the var name (PFV)
  382. ifndef ZIPPROG
  383. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  384. ifeq ($(ZIPPROG),)
  385. ZIPPROG=
  386. else
  387. ZIPPROG:=$(firstword $(ZIPPROG))
  388. endif
  389. endif
  390. export ZIPPROG
  391. ZIPOPT=-9
  392. ZIPEXT=.zip
  393. # Tar
  394. ifndef TARPROG
  395. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(EXEEXT),$(SEARCHPATH))))
  396. ifeq ($(TARPROG),)
  397. TARPROG=
  398. else
  399. TARPROG:=$(firstword $(TARPROG))
  400. endif
  401. endif
  402. export TARPROG
  403. ifeq ($(USETAR),bz2)
  404. TAROPT=vI
  405. TAREXT=.tar.bz2
  406. else
  407. TAROPT=vz
  408. TAREXT=.tar.gz
  409. endif
  410. #####################################################################
  411. # Default extensions
  412. #####################################################################
  413. # Default needed extensions (Go32v2,Linux)
  414. LOADEREXT=.as
  415. PPLEXT=.ppl
  416. PPUEXT=.ppu
  417. OEXT=.o
  418. ASMEXT=.s
  419. SMARTEXT=.sl
  420. STATICLIBEXT=.a
  421. SHAREDLIBEXT=.so
  422. RSTEXT=.rst
  423. FPCMADE=fpcmade
  424. # Go32v1
  425. ifeq ($(OS_TARGET),go32v1)
  426. PPUEXT=.pp1
  427. OEXT=.o1
  428. ASMEXT=.s1
  429. SMARTEXT=.sl1
  430. STATICLIBEXT=.a1
  431. SHAREDLIBEXT=.so1
  432. FPCMADE=fpcmade.v1
  433. endif
  434. # Go32v2
  435. ifeq ($(OS_TARGET),go32v2)
  436. FPCMADE=fpcmade.dos
  437. endif
  438. # Linux
  439. ifeq ($(OS_TARGET),linux)
  440. FPCMADE=fpcmade.lnx
  441. endif
  442. # Win32
  443. ifeq ($(OS_TARGET),win32)
  444. PPUEXT=.ppw
  445. OEXT=.ow
  446. ASMEXT=.sw
  447. SMARTEXT=.slw
  448. STATICLIBEXT=.aw
  449. SHAREDLIBEXT=.dll
  450. FPCMADE=fpcmade.w32
  451. endif
  452. # OS/2
  453. ifeq ($(OS_TARGET),os2)
  454. PPUEXT=.ppo
  455. ASMEXT=.so2
  456. OEXT=.oo2
  457. SMARTEXT=.so
  458. STATICLIBEXT=.ao2
  459. SHAREDLIBEXT=.dll
  460. FPCMADE=fpcmade.os2
  461. endif
  462. # library prefix
  463. LIBPREFIX=lib
  464. ifeq ($(OS_TARGET),go32v2)
  465. LIBPREFIX=
  466. endif
  467. ifeq ($(OS_TARGET),go32v1)
  468. LIBPREFIX=
  469. endif
  470. # determine which .pas extension is used
  471. ifndef PASEXT
  472. ifdef EXEOBJECTS
  473. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
  474. else
  475. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
  476. endif
  477. ifeq ($(TESTPAS),)
  478. PASEXT=.pp
  479. else
  480. PASEXT=.pas
  481. endif
  482. endif
  483. #####################################################################
  484. # Default Directories
  485. #####################################################################
  486. # set the prefix directory where to install everything
  487. ifndef PREFIXINSTALLDIR
  488. ifdef inlinux
  489. PREFIXINSTALLDIR=/usr
  490. else
  491. PREFIXINSTALLDIR=/pp
  492. endif
  493. endif
  494. export PREFIXINSTALLDIR
  495. # Where to place the resulting zip files
  496. ifndef DESTZIPDIR
  497. DESTZIPDIR:=$(BASEDIR)
  498. endif
  499. export DESTZIPDIR
  500. #####################################################################
  501. # Install Directories
  502. #####################################################################
  503. # set the base directory where to install everything
  504. ifndef BASEINSTALLDIR
  505. ifdef inlinux
  506. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  507. else
  508. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  509. endif
  510. endif
  511. # set the directory where to install the binaries
  512. ifndef BININSTALLDIR
  513. ifdef inlinux
  514. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  515. else
  516. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  517. endif
  518. endif
  519. # set the directory where to install the units.
  520. ifndef UNITINSTALLDIR
  521. UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
  522. ifdef UNITSUBDIR
  523. UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
  524. endif
  525. endif
  526. # Where to install shared libraries
  527. ifndef LIBINSTALLDIR
  528. ifdef inlinux
  529. LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  530. else
  531. LIBINSTALLDIR=$(UNITINSTALLDIR)
  532. endif
  533. endif
  534. # Where the source files will be stored
  535. ifndef SOURCEINSTALLDIR
  536. ifdef inlinux
  537. SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
  538. else
  539. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  540. endif
  541. ifdef SOURCESUBDIR
  542. SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
  543. endif
  544. endif
  545. # Where the doc files will be stored
  546. ifndef DOCINSTALLDIR
  547. ifdef inlinux
  548. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
  549. else
  550. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  551. endif
  552. endif
  553. # Where to install the examples, under linux we use the doc dir
  554. # because the copytree command will create a subdir itself
  555. ifndef EXAMPLEINSTALLDIR
  556. ifdef inlinux
  557. EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
  558. else
  559. EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
  560. endif
  561. ifdef EXAMPLESUBDIR
  562. EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
  563. endif
  564. endif
  565. # Where the some extra (data)files will be stored
  566. ifndef DATAINSTALLDIR
  567. DATAINSTALLDIR=$(BASEINSTALLDIR)
  568. endif
  569. #####################################################################
  570. # Redirection
  571. #####################################################################
  572. ifndef REDIRFILE
  573. REDIRFILE=log
  574. endif
  575. ifdef REDIR
  576. ifndef inlinux
  577. override FPC=redir -eo $(FPC)
  578. endif
  579. # set the verbosity to max
  580. override FPCOPT+=-va
  581. override REDIR:= >> $(REDIRFILE)
  582. endif
  583. #####################################################################
  584. # Standard rules
  585. #####################################################################
  586. debug: $(addsuffix _debug,$(DIROBJECTS))
  587. smart: $(addsuffix _smart,$(DIROBJECTS))
  588. shared: $(addsuffix _shared,$(DIROBJECTS))
  589. showinstall: $(addsuffix _showinstall,$(DIROBJECTS))
  590. cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS))
  591. require: $(addsuffix _require,$(DIROBJECTS))
  592. .PHONY: debug smart shared showinstall cleanall require
  593. #####################################################################
  594. # Zip
  595. #####################################################################
  596. .PHONY: fpc_zipinstall
  597. # Create suffix to add
  598. ifndef PACKAGESUFFIX
  599. PACKAGESUFFIX=$(OS_TARGET)
  600. ifeq ($(OS_TARGET),go32v2)
  601. PACKAGESUFFIX=go32
  602. endif
  603. ifeq ($(OS_TARGET),win32)
  604. PACKAGESUFFIX=w32
  605. endif
  606. endif
  607. # Temporary path to pack a file
  608. ifndef PACKDIR
  609. ifndef inlinux
  610. PACKDIR=$(BASEDIR)/pack_tmp
  611. else
  612. PACKDIR=/tmp/fpc-pack
  613. endif
  614. endif
  615. # Maybe create default zipname from packagename
  616. ifndef ZIPNAME
  617. ifdef PACKAGENAME
  618. ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
  619. endif
  620. endif
  621. # Use tar by default under linux
  622. ifndef USEZIP
  623. ifdef inlinux
  624. USETAR=1
  625. endif
  626. endif
  627. fpc_zipinstall:
  628. ifndef ZIPNAME
  629. @$(ECHO) "Please specify ZIPNAME!"
  630. @exit 1
  631. else
  632. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  633. ifdef USETAR
  634. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
  635. cd $(PACKDIR) ; $(TARPROG) c$(TAROPT) --file $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
  636. else
  637. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
  638. cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
  639. endif
  640. $(DELTREE) $(PACKDIR)
  641. endif
  642. #####################################################################
  643. # Clean rules
  644. #####################################################################
  645. .PHONY: fpc_clean fpc_cleanall fpc_distclean
  646. ifdef EXTRACLEANUNITS
  647. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
  648. endif
  649. ifdef CLEANPPUFILES
  650. ifdef PPUFILES
  651. CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
  652. else
  653. CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
  654. endif
  655. endif
  656. fpc_clean: $(CLEANTARGET)
  657. ifdef CLEANEXEFILES
  658. -$(DEL) $(CLEANEXEFILES)
  659. endif
  660. ifdef CLEANPPUFILES
  661. -$(DEL) $(CLEANPPUFILES)
  662. endif
  663. ifneq ($(CLEANPPULINKFILES),)
  664. -$(DEL) $(CLEANPPULINKFILES)
  665. endif
  666. ifdef CLEANRSTFILES
  667. -$(DEL) $(CLEANRSTFILES)
  668. endif
  669. ifdef EXTRACLEANFILES
  670. -$(DEL) $(EXTRACLEANFILES)
  671. endif
  672. ifdef LIBNAME
  673. -$(DEL) $(LIBNAME) $(LIBFULLNAME)
  674. endif
  675. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  676. fpc_distclean: fpc_clean
  677. fpc_cleanall: $(CLEANTARGET)
  678. ifdef CLEANEXEFILES
  679. -$(DEL) $(CLEANEXEFILES)
  680. endif
  681. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  682. -$(DELTREE) *$(SMARTEXT)
  683. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  684. #####################################################################
  685. # Directories
  686. #####################################################################
  687. OBJECTDIRCOMPILER=1
  688. OBJECTDIRRTL=1
  689. OBJECTDIRUTILS=1
  690. OBJECTDIRFCL=1
  691. OBJECTDIRAPI=1
  692. OBJECTDIRFV=1
  693. OBJECTDIRPACKAGES=1
  694. OBJECTDIRIDE=1
  695. # Dir compiler
  696. ifdef OBJECTDIRCOMPILER
  697. .PHONY: compiler_all compiler_debug compiler_examples compiler_test compiler_smart compiler_shared compiler_showinstall compiler_install compiler_sourceinstall compiler_exampleinstall compiler_zipinstall compiler_zipsourceinstall compiler_zipexampleinstall compiler_clean compiler_distclean compiler_cleanall compiler_require compiler_info
  698. compiler_all:
  699. $(MAKE) -C compiler all
  700. compiler_debug:
  701. $(MAKE) -C compiler debug
  702. compiler_examples:
  703. $(MAKE) -C compiler examples
  704. compiler_test:
  705. $(MAKE) -C compiler test
  706. compiler_smart:
  707. $(MAKE) -C compiler smart
  708. compiler_shared:
  709. $(MAKE) -C compiler shared
  710. compiler_showinstall:
  711. $(MAKE) -C compiler showinstall
  712. compiler_install:
  713. $(MAKE) -C compiler install
  714. compiler_sourceinstall:
  715. $(MAKE) -C compiler sourceinstall
  716. compiler_exampleinstall:
  717. $(MAKE) -C compiler exampleinstall
  718. compiler_zipinstall:
  719. $(MAKE) -C compiler zipinstall
  720. compiler_zipsourceinstall:
  721. $(MAKE) -C compiler zipsourceinstall
  722. compiler_zipexampleinstall:
  723. $(MAKE) -C compiler zipexampleinstall
  724. compiler_clean:
  725. $(MAKE) -C compiler clean
  726. compiler_distclean:
  727. $(MAKE) -C compiler distclean
  728. compiler_cleanall:
  729. $(MAKE) -C compiler cleanall
  730. compiler_require:
  731. $(MAKE) -C compiler require
  732. compiler_info:
  733. $(MAKE) -C compiler info
  734. endif
  735. # Dir rtl
  736. ifdef OBJECTDIRRTL
  737. .PHONY: rtl_all rtl_debug rtl_examples rtl_test rtl_smart rtl_shared rtl_showinstall rtl_install rtl_sourceinstall rtl_exampleinstall rtl_zipinstall rtl_zipsourceinstall rtl_zipexampleinstall rtl_clean rtl_distclean rtl_cleanall rtl_require rtl_info
  738. rtl_all:
  739. $(MAKE) -C rtl all
  740. rtl_debug:
  741. $(MAKE) -C rtl debug
  742. rtl_examples:
  743. $(MAKE) -C rtl examples
  744. rtl_test:
  745. $(MAKE) -C rtl test
  746. rtl_smart:
  747. $(MAKE) -C rtl smart
  748. rtl_shared:
  749. $(MAKE) -C rtl shared
  750. rtl_showinstall:
  751. $(MAKE) -C rtl showinstall
  752. rtl_install:
  753. $(MAKE) -C rtl install
  754. rtl_sourceinstall:
  755. $(MAKE) -C rtl sourceinstall
  756. rtl_exampleinstall:
  757. $(MAKE) -C rtl exampleinstall
  758. rtl_zipinstall:
  759. $(MAKE) -C rtl zipinstall
  760. rtl_zipsourceinstall:
  761. $(MAKE) -C rtl zipsourceinstall
  762. rtl_zipexampleinstall:
  763. $(MAKE) -C rtl zipexampleinstall
  764. rtl_clean:
  765. $(MAKE) -C rtl clean
  766. rtl_distclean:
  767. $(MAKE) -C rtl distclean
  768. rtl_cleanall:
  769. $(MAKE) -C rtl cleanall
  770. rtl_require:
  771. $(MAKE) -C rtl require
  772. rtl_info:
  773. $(MAKE) -C rtl info
  774. endif
  775. # Dir utils
  776. ifdef OBJECTDIRUTILS
  777. .PHONY: utils_all utils_debug utils_examples utils_test utils_smart utils_shared utils_showinstall utils_install utils_sourceinstall utils_exampleinstall utils_zipinstall utils_zipsourceinstall utils_zipexampleinstall utils_clean utils_distclean utils_cleanall utils_require utils_info
  778. utils_all:
  779. $(MAKE) -C utils all
  780. utils_debug:
  781. $(MAKE) -C utils debug
  782. utils_examples:
  783. $(MAKE) -C utils examples
  784. utils_test:
  785. $(MAKE) -C utils test
  786. utils_smart:
  787. $(MAKE) -C utils smart
  788. utils_shared:
  789. $(MAKE) -C utils shared
  790. utils_showinstall:
  791. $(MAKE) -C utils showinstall
  792. utils_install:
  793. $(MAKE) -C utils install
  794. utils_sourceinstall:
  795. $(MAKE) -C utils sourceinstall
  796. utils_exampleinstall:
  797. $(MAKE) -C utils exampleinstall
  798. utils_zipinstall:
  799. $(MAKE) -C utils zipinstall
  800. utils_zipsourceinstall:
  801. $(MAKE) -C utils zipsourceinstall
  802. utils_zipexampleinstall:
  803. $(MAKE) -C utils zipexampleinstall
  804. utils_clean:
  805. $(MAKE) -C utils clean
  806. utils_distclean:
  807. $(MAKE) -C utils distclean
  808. utils_cleanall:
  809. $(MAKE) -C utils cleanall
  810. utils_require:
  811. $(MAKE) -C utils require
  812. utils_info:
  813. $(MAKE) -C utils info
  814. endif
  815. # Dir fcl
  816. ifdef OBJECTDIRFCL
  817. .PHONY: fcl_all fcl_debug fcl_examples fcl_test fcl_smart fcl_shared fcl_showinstall fcl_install fcl_sourceinstall fcl_exampleinstall fcl_zipinstall fcl_zipsourceinstall fcl_zipexampleinstall fcl_clean fcl_distclean fcl_cleanall fcl_require fcl_info
  818. fcl_all:
  819. $(MAKE) -C fcl all
  820. fcl_debug:
  821. $(MAKE) -C fcl debug
  822. fcl_examples:
  823. $(MAKE) -C fcl examples
  824. fcl_test:
  825. $(MAKE) -C fcl test
  826. fcl_smart:
  827. $(MAKE) -C fcl smart
  828. fcl_shared:
  829. $(MAKE) -C fcl shared
  830. fcl_showinstall:
  831. $(MAKE) -C fcl showinstall
  832. fcl_install:
  833. $(MAKE) -C fcl install
  834. fcl_sourceinstall:
  835. $(MAKE) -C fcl sourceinstall
  836. fcl_exampleinstall:
  837. $(MAKE) -C fcl exampleinstall
  838. fcl_zipinstall:
  839. $(MAKE) -C fcl zipinstall
  840. fcl_zipsourceinstall:
  841. $(MAKE) -C fcl zipsourceinstall
  842. fcl_zipexampleinstall:
  843. $(MAKE) -C fcl zipexampleinstall
  844. fcl_clean:
  845. $(MAKE) -C fcl clean
  846. fcl_distclean:
  847. $(MAKE) -C fcl distclean
  848. fcl_cleanall:
  849. $(MAKE) -C fcl cleanall
  850. fcl_require:
  851. $(MAKE) -C fcl require
  852. fcl_info:
  853. $(MAKE) -C fcl info
  854. endif
  855. # Dir api
  856. ifdef OBJECTDIRAPI
  857. .PHONY: api_all api_debug api_examples api_test api_smart api_shared api_showinstall api_install api_sourceinstall api_exampleinstall api_zipinstall api_zipsourceinstall api_zipexampleinstall api_clean api_distclean api_cleanall api_require api_info
  858. api_all:
  859. $(MAKE) -C api all
  860. api_debug:
  861. $(MAKE) -C api debug
  862. api_examples:
  863. $(MAKE) -C api examples
  864. api_test:
  865. $(MAKE) -C api test
  866. api_smart:
  867. $(MAKE) -C api smart
  868. api_shared:
  869. $(MAKE) -C api shared
  870. api_showinstall:
  871. $(MAKE) -C api showinstall
  872. api_install:
  873. $(MAKE) -C api install
  874. api_sourceinstall:
  875. $(MAKE) -C api sourceinstall
  876. api_exampleinstall:
  877. $(MAKE) -C api exampleinstall
  878. api_zipinstall:
  879. $(MAKE) -C api zipinstall
  880. api_zipsourceinstall:
  881. $(MAKE) -C api zipsourceinstall
  882. api_zipexampleinstall:
  883. $(MAKE) -C api zipexampleinstall
  884. api_clean:
  885. $(MAKE) -C api clean
  886. api_distclean:
  887. $(MAKE) -C api distclean
  888. api_cleanall:
  889. $(MAKE) -C api cleanall
  890. api_require:
  891. $(MAKE) -C api require
  892. api_info:
  893. $(MAKE) -C api info
  894. endif
  895. # Dir fv
  896. ifdef OBJECTDIRFV
  897. .PHONY: fv_all fv_debug fv_examples fv_test fv_smart fv_shared fv_showinstall fv_install fv_sourceinstall fv_exampleinstall fv_zipinstall fv_zipsourceinstall fv_zipexampleinstall fv_clean fv_distclean fv_cleanall fv_require fv_info
  898. fv_all:
  899. $(MAKE) -C fv all
  900. fv_debug:
  901. $(MAKE) -C fv debug
  902. fv_examples:
  903. $(MAKE) -C fv examples
  904. fv_test:
  905. $(MAKE) -C fv test
  906. fv_smart:
  907. $(MAKE) -C fv smart
  908. fv_shared:
  909. $(MAKE) -C fv shared
  910. fv_showinstall:
  911. $(MAKE) -C fv showinstall
  912. fv_install:
  913. $(MAKE) -C fv install
  914. fv_sourceinstall:
  915. $(MAKE) -C fv sourceinstall
  916. fv_exampleinstall:
  917. $(MAKE) -C fv exampleinstall
  918. fv_zipinstall:
  919. $(MAKE) -C fv zipinstall
  920. fv_zipsourceinstall:
  921. $(MAKE) -C fv zipsourceinstall
  922. fv_zipexampleinstall:
  923. $(MAKE) -C fv zipexampleinstall
  924. fv_clean:
  925. $(MAKE) -C fv clean
  926. fv_distclean:
  927. $(MAKE) -C fv distclean
  928. fv_cleanall:
  929. $(MAKE) -C fv cleanall
  930. fv_require:
  931. $(MAKE) -C fv require
  932. fv_info:
  933. $(MAKE) -C fv info
  934. endif
  935. # Dir packages
  936. ifdef OBJECTDIRPACKAGES
  937. .PHONY: packages_all packages_debug packages_examples packages_test packages_smart packages_shared packages_showinstall packages_install packages_sourceinstall packages_exampleinstall packages_zipinstall packages_zipsourceinstall packages_zipexampleinstall packages_clean packages_distclean packages_cleanall packages_require packages_info
  938. packages_all:
  939. $(MAKE) -C packages all
  940. packages_debug:
  941. $(MAKE) -C packages debug
  942. packages_examples:
  943. $(MAKE) -C packages examples
  944. packages_test:
  945. $(MAKE) -C packages test
  946. packages_smart:
  947. $(MAKE) -C packages smart
  948. packages_shared:
  949. $(MAKE) -C packages shared
  950. packages_showinstall:
  951. $(MAKE) -C packages showinstall
  952. packages_install:
  953. $(MAKE) -C packages install
  954. packages_sourceinstall:
  955. $(MAKE) -C packages sourceinstall
  956. packages_exampleinstall:
  957. $(MAKE) -C packages exampleinstall
  958. packages_zipinstall:
  959. $(MAKE) -C packages zipinstall
  960. packages_zipsourceinstall:
  961. $(MAKE) -C packages zipsourceinstall
  962. packages_zipexampleinstall:
  963. $(MAKE) -C packages zipexampleinstall
  964. packages_clean:
  965. $(MAKE) -C packages clean
  966. packages_distclean:
  967. $(MAKE) -C packages distclean
  968. packages_cleanall:
  969. $(MAKE) -C packages cleanall
  970. packages_require:
  971. $(MAKE) -C packages require
  972. packages_info:
  973. $(MAKE) -C packages info
  974. endif
  975. # Dir ide
  976. ifdef OBJECTDIRIDE
  977. .PHONY: ide_all ide_debug ide_examples ide_test ide_smart ide_shared ide_showinstall ide_install ide_sourceinstall ide_exampleinstall ide_zipinstall ide_zipsourceinstall ide_zipexampleinstall ide_clean ide_distclean ide_cleanall ide_require ide_info
  978. ide_all:
  979. $(MAKE) -C ide all
  980. ide_debug:
  981. $(MAKE) -C ide debug
  982. ide_examples:
  983. $(MAKE) -C ide examples
  984. ide_test:
  985. $(MAKE) -C ide test
  986. ide_smart:
  987. $(MAKE) -C ide smart
  988. ide_shared:
  989. $(MAKE) -C ide shared
  990. ide_showinstall:
  991. $(MAKE) -C ide showinstall
  992. ide_install:
  993. $(MAKE) -C ide install
  994. ide_sourceinstall:
  995. $(MAKE) -C ide sourceinstall
  996. ide_exampleinstall:
  997. $(MAKE) -C ide exampleinstall
  998. ide_zipinstall:
  999. $(MAKE) -C ide zipinstall
  1000. ide_zipsourceinstall:
  1001. $(MAKE) -C ide zipsourceinstall
  1002. ide_zipexampleinstall:
  1003. $(MAKE) -C ide zipexampleinstall
  1004. ide_clean:
  1005. $(MAKE) -C ide clean
  1006. ide_distclean:
  1007. $(MAKE) -C ide distclean
  1008. ide_cleanall:
  1009. $(MAKE) -C ide cleanall
  1010. ide_require:
  1011. $(MAKE) -C ide require
  1012. ide_info:
  1013. $(MAKE) -C ide info
  1014. endif
  1015. #####################################################################
  1016. # Local Makefile
  1017. #####################################################################
  1018. ifneq ($(wildcard fpcmake.loc),)
  1019. include fpcmake.loc
  1020. endif
  1021. #####################################################################
  1022. # Users rules
  1023. #####################################################################
  1024. # These values can change
  1025. unexport FPC_VERSION OS_SOURCE
  1026. #####################################################################
  1027. # Main targets
  1028. #####################################################################
  1029. .PHONY: help checkfpcdir
  1030. help:
  1031. @echo
  1032. @echo Directory targets:
  1033. @echo
  1034. @echo $(DIROBJECTS)
  1035. @echo
  1036. @echo Packing targets are:
  1037. @echo
  1038. @echo go32v2zip,win32zip,linuxzip,sourcezip
  1039. @echo
  1040. @exit
  1041. #####################################################################
  1042. # Dependencies
  1043. #####################################################################
  1044. #######################################
  1045. # Compiler
  1046. #######################################
  1047. .PHONY: compiler_cycle
  1048. compiler_cycle:
  1049. $(MAKE) -C compiler cycle
  1050. #######################################
  1051. # IDE
  1052. #######################################
  1053. .PHONY: ide_comp ide_full
  1054. ide_comp:
  1055. $(MAKE) -C compiler ppuclean
  1056. $(MAKE) -C ide full
  1057. # Look if libgdb.a is available then use fullgdb
  1058. ifneq ($(wildcard packages/gdbint/libgdb/$(OS_TARGET)/libgdb.a),)
  1059. ide_full:
  1060. $(MAKE) -C compiler ppuclean
  1061. $(MAKE) -C ide fullgdb
  1062. else
  1063. ide_full:
  1064. $(MAKE) -C compiler ppuclean
  1065. $(MAKE) -C ide full
  1066. endif
  1067. #######################################
  1068. # Install targets
  1069. #######################################
  1070. demo_install:
  1071. $(MAKE) -C $(CVSINSTALL)/demo installexamples
  1072. man_install:
  1073. $(MAKE) -C $(CVSINSTALL)/man installman
  1074. doc_install:
  1075. $(MAKE) -C $(CVSINSTALL)/doc installdoc
  1076. #######################################
  1077. # Packaging targets
  1078. #######################################
  1079. idezips: ide_fullzip ide_fullgdbzip optcompinstall optcompzip
  1080. ide_compzip:
  1081. $(MAKE) compiler_clean
  1082. $(MAKE) ide_clean
  1083. $(MAKE) ide_full
  1084. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-comp-$(PACKAGESUFFIX)
  1085. ide_fullgdbzip:
  1086. $(MAKE) ide_clean
  1087. $(MAKE) ide_fullgdb
  1088. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-full-$(PACKAGESUFFIX)
  1089. optcompinstall:
  1090. $(MAKE) compiler_cycle OPT=-dNEWOPTIMIZATIONS
  1091. $(MAKE) compiler_install
  1092. $(MAKE) rtl_install
  1093. optcompzip:
  1094. $(MAKE) fpc_zipinstall PACKAGENAME=optcomp ZIPTARGET=optcompinstall
  1095. ##########################################################################
  1096. # Install
  1097. ##########################################################################
  1098. .PHONY: installer
  1099. INSTALLERBUILDDIR=fpinst
  1100. installer:
  1101. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  1102. $(MAKE) -C $(INSTALLERBUILDDIR) all RELEASE=1
  1103. $(MOVE) $(INSTALLERBUILDDIR)/install.exe .
  1104. ifdef UPXPROG
  1105. -$(UPXPROG) install.exe
  1106. endif
  1107. $(DELTREE) $(INSTALLERBUILDDIR)
  1108. installersrc:
  1109. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  1110. $(MAKE) -C $(INSTALLERBUILDDIR) zipsourceinstall
  1111. $(DELTREE) $(INSTALLERBUILDDIR)
  1112. ##########################################################################
  1113. # Packaging
  1114. ##########################################################################
  1115. .PHONY: all clean distclean build installbase zipinstall zipinstallbase zipinstallfcl \
  1116. zipinstallpackages
  1117. export RELEASE DESTZIPDIR
  1118. all: build
  1119. clean: $(addsuffix _distclean,$(DIROBJECTS))
  1120. $(DEL) build-stamp.*
  1121. distclean: clean
  1122. build: build-stamp.$(OS_TARGET)
  1123. build-stamp.$(OS_TARGET):
  1124. # create new compiler
  1125. ifeq ($(OS_TARGET),win32)
  1126. -$(MAKE) compiler_cycle
  1127. else
  1128. $(MAKE) compiler_cycle
  1129. endif
  1130. # clean
  1131. $(MAKE) rtl_clean
  1132. $(MAKE) api_clean
  1133. $(MAKE) fcl_clean
  1134. $(MAKE) packages_clean
  1135. $(MAKE) utils_clean
  1136. ifdef IDE
  1137. $(MAKE) fv_clean
  1138. $(MAKE) ide_clean
  1139. endif
  1140. # build everything
  1141. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  1142. $(MAKE) api_$(ALLTARGET) $(BUILDOPTS)
  1143. $(MAKE) fcl_$(ALLTARGET) $(BUILDOPTS)
  1144. $(MAKE) packages_$(ALLTARGET) $(BUILDOPTS)
  1145. $(MAKE) utils_all $(BUILDOPTS)
  1146. ifdef IDE
  1147. -$(MAKE) ide_full $(BUILDOPTS)
  1148. endif
  1149. $(ECHO) Build > build-stamp.$(OS_TARGET)
  1150. installbase: build-stamp.$(OS_TARGET)
  1151. # create dirs
  1152. $(MKDIR) $(BASEINSTALLDIR)
  1153. $(MKDIR) $(DOCINSTALLDIR)
  1154. $(MKDIR) $(BININSTALLDIR)
  1155. ifndef SNAPSHOT
  1156. # readme & whatsnew and docs
  1157. $(COPY) $(CVSINSTALL)/doc/*.txt $(CVSINSTALL)/doc/copying* $(CVSINSTALL)/doc/faq.* $(DOCINSTALLDIR)
  1158. # bingo32 (cwsdpmi,wmemu387.dxe)
  1159. ifeq ($(OS_TARGET),go32v2)
  1160. $(COPY) $(CVSINSTALL)/bingo32/* $(BININSTALLDIR)
  1161. endif
  1162. # binw32 (cygwin1.dll)
  1163. ifeq ($(OS_TARGET),win32)
  1164. $(COPY) $(CVSINSTALL)/binw32/* $(BININSTALLDIR)
  1165. endif
  1166. # manpages for linux
  1167. ifeq ($(OS_TARGET),linux)
  1168. $(MAKE) -C $(CVSINSTALL)/man installman
  1169. endif
  1170. endif
  1171. # install generated things
  1172. $(MAKE) compiler_install $(INSTALLOPTS)
  1173. $(MAKE) rtl_install $(INSTALLOPTS)
  1174. install: build-stamp.$(OS_TARGET)
  1175. $(MAKE) installbase $(INSTALLOPTS)
  1176. $(MAKE) utils_install $(INSTALLOPTS)
  1177. $(MAKE) api_install $(INSTALLOPTS)
  1178. $(MAKE) fcl_install $(INSTALLOPTS)
  1179. $(MAKE) packages_install $(INSTALLOPTS)
  1180. ifdef IDE
  1181. $(NOSTOP)$(MAKE) ide_install $(BUILDOPTS)
  1182. endif
  1183. zipinstall: build-stamp.$(OS_TARGET)
  1184. $(MAKE) fpc_zipinstall ZIPTARGET=installbase PACKAGENAME=base $(INSTALLOPTS)
  1185. $(MAKE) utils_zipinstall $(INSTALLOPTS)
  1186. $(MAKE) api_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1187. $(MAKE) fcl_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1188. $(MAKE) packages_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1189. ifdef IDE
  1190. $(NOSTOP)$(MAKE) ide_zipinstall $(INSTALLOPTS)
  1191. endif
  1192. ##########################################################################
  1193. # Docs
  1194. ##########################################################################
  1195. .PHONY: docspdf docs docsrcinstall docsrc
  1196. docspdf:
  1197. $(MAKE) -C docs pdfinstall
  1198. docs:
  1199. $(MAKE) fpc_zipinstall ZIPTARGET=docspdf ZIPNAME=docs
  1200. docsrcinstall:
  1201. $(MAKE) -C docs clean
  1202. $(MKDIR) $(SOURCEINSTALLDIR)
  1203. $(COPYTREE) docs $(SOURCEINSTALLDIR)
  1204. docsrc:
  1205. $(MAKE) fpc_zipinstall ZIPTARGET=docsrcinstall ZIPNAME=docsrc
  1206. ##########################################################################
  1207. # Demos
  1208. ##########################################################################
  1209. .PHONY: demozip
  1210. demozip:
  1211. $(MAKE) -C $(CVSINSTALL)/demo zipsourceinstall ZIPNAME=demo
  1212. ##########################################################################
  1213. # Source targets
  1214. ##########################################################################
  1215. sourcebase:
  1216. # base Makefiles needed for sources
  1217. $(MKDIR) $(SOURCEINSTALLDIR)
  1218. $(MKDIR) $(SOURCEINSTALLDIR)/rtl
  1219. $(MKDIR) $(SOURCEINSTALLDIR)/packages
  1220. $(COPY) Makefile* $(SOURCEINSTALLDIR)
  1221. $(COPY) rtl/Makefile* $(SOURCEINSTALLDIR)/rtl
  1222. $(COPY) packages/Makefile* $(SOURCEINSTALLDIR)/packages
  1223. sourcezip:
  1224. $(MAKE) fpc_zipinstall ZIPTARGET=sourcebase ZIPNAME=basesrc
  1225. $(MAKE) compiler_zipsourceinstall
  1226. $(MAKE) rtl_zipsourceinstall
  1227. $(MAKE) api_zipsourceinstall
  1228. $(MAKE) fcl_zipsourceinstall
  1229. $(MAKE) packages_zipsourceinstall
  1230. $(MAKE) utils_zipsourceinstall
  1231. # $(MAKE) installersrc
  1232. # $(MAKE) docsrc
  1233. ##########################################################################
  1234. # OS targets
  1235. ##########################################################################
  1236. .PHONY: go32v2 win32 linux go32v2zip win32zip linuxzip
  1237. go32v2: checkfpcdir
  1238. $(MAKE) install OS_TARGET=go32v2
  1239. win32: checkfpcdir
  1240. $(MAKE) install OS_TARGET=win32
  1241. linux: checkfpcdir
  1242. $(MAKE) install OS_TARGET=linux
  1243. go32v2zip: checkfpcdir
  1244. $(MAKE) zipinstall OS_TARGET=go32v2
  1245. win32zip: checkfpcdir
  1246. $(MAKE) zipinstall OS_TARGET=win32
  1247. linuxzip: checkfpcdir
  1248. $(MAKE) zipinstall OS_TARGET=linux
  1249. ##########################################################################
  1250. # Debian / RPM
  1251. ##########################################################################
  1252. .PHONY: debcopy deb rpmcopy rpm
  1253. DEBSRCDIR:=/usr/src/fpc-$(FPC_VERSION)
  1254. debcopy: distclean
  1255. rm -rf $(DEBSRCDIR)
  1256. install -d $(DEBSRCDIR)
  1257. $(COPYTREE) compiler $(DEBSRCDIR)
  1258. $(COPYTREE) rtl $(DEBSRCDIR)
  1259. $(COPYTREE) fcl $(DEBSRCDIR)
  1260. $(COPYTREE) api $(DEBSRCDIR)
  1261. $(COPYTREE) packages $(DEBSRCDIR)
  1262. $(COPYTREE) utils $(DEBSRCDIR)
  1263. $(COPYTREE) logs $(DEBSRCDIR)
  1264. $(COPYTREE) docs $(DEBSRCDIR)
  1265. $(COPYTREE) base/Makefile* $(DEBSRCDIR)
  1266. $(COPYTREE) $(CVSINSTALL)/debian $(DEBSRCDIR)
  1267. $(COPYTREE) $(CVSINSTALL)/man $(DEBSRCDIR)
  1268. $(COPYTREE) $(CVSINSTALL)/doc $(DEBSRCDIR)
  1269. $(COPYTREE) $(CVSINSTALL)/demo $(DEBSRCDIR)
  1270. find $(DEBSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  1271. chmod 755 $(DEBSRCDIR)/debian/rules
  1272. deb: checkfpcdir debcopy
  1273. cd $(DEBSRCDIR) ; debian/rules binary
  1274. REDHATDIR=/usr/src/redhat
  1275. RPMSOURCESDIR:=$(REDHATDIR)/SOURCES
  1276. RPMSPECDIR:=$(REDHATDIR)/SPECS
  1277. RPMSRCDIR:=$(RPMSOURCESDIR)/fpc
  1278. DOCSRCDIR:=$(RPMSOURCESDIR)/fpcdoc
  1279. rpmcopy: distclean
  1280. install -d $(REDHATDIR)
  1281. install -d $(RPMSPECDIR)
  1282. install -d $(RPMSOURCESDIR)
  1283. # fpc.rpm
  1284. rm -rf $(RPMSRCDIR)
  1285. cp $(CVSINSTALL)/fpc-$(FPC_VERSION).spec $(RPMSPECDIR)
  1286. install -d $(RPMSRCDIR)
  1287. $(COPYTREE) compiler $(RPMSRCDIR)
  1288. $(COPYTREE) rtl $(RPMSRCDIR)
  1289. $(COPYTREE) fcl $(RPMSRCDIR)
  1290. $(COPYTREE) api $(RPMSRCDIR)
  1291. $(COPYTREE) packages $(RPMSRCDIR)
  1292. $(COPYTREE) utils $(RPMSRCDIR)
  1293. $(COPYTREE) logs $(RPMSRCDIR)
  1294. $(COPYTREE) base/Makefile* $(RPMSRCDIR)
  1295. $(COPYTREE) $(CVSINSTALL)/man $(RPMSRCDIR)
  1296. $(COPYTREE) $(CVSINSTALL)/doc $(RPMSRCDIR)
  1297. $(COPYTREE) $(CVSINSTALL)/demo $(RPMSRCDIR)
  1298. find $(RPMSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  1299. cd $(RPMSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-$(FPC_VERSION)-src.tar.gz
  1300. # fpc-docs.rpm
  1301. rm -rf $(DOCSRCDIR)
  1302. cp $(CVSINSTALL)/fpc-docs-$(FPC_VERSION).spec $(RPMSPECDIR)
  1303. install -d $(DOCSRCDIR)
  1304. $(COPYTREE) docs $(DOCSRCDIR)
  1305. find $(DOCSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  1306. cd $(DOCSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-docs-$(FPC_VERSION)-src.tar.gz
  1307. rpm: checkfpcdir rpmcopy
  1308. cd $(RPMSPECDIR) ; rpm -ba fpc-$(FPC_VERSION).spec
  1309. cd $(RPMSPECDIR) ; rpm -ba fpc-docs-$(FPC_VERSION).spec