Makefile 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101
  1. #
  2. # Makefile generated from Makefile.fpc on 1999-11-08 19:21
  3. #
  4. defaultrule: Makefile all
  5. Makefile: Makefile.fpc
  6. fpcmake
  7. #####################################################################
  8. # Autodetect OS (Linux or Dos or Windows NT)
  9. # define inlinux when running under linux
  10. # define inWinNT when running under WinNT
  11. #####################################################################
  12. # We need only / in the path
  13. override PATH:=$(subst \,/,$(PATH))
  14. # Search for PWD and determine also if we are under linux
  15. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
  16. ifeq ($(PWD),)
  17. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
  18. ifeq ($(PWD),)
  19. nopwd:
  20. @echo You need the GNU utils package to use this Makefile!
  21. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  22. @exit
  23. else
  24. inlinux=1
  25. endif
  26. else
  27. PWD:=$(firstword $(PWD))
  28. endif
  29. # Detect NT - NT sets OS to Windows_NT
  30. ifndef inlinux
  31. ifeq ($(OS),Windows_NT)
  32. inWinNT=1
  33. endif
  34. endif
  35. # Detect OS/2 - OS/2 has OS2_SHELL defined
  36. ifndef inlinux
  37. ifndef inWinNT
  38. ifdef OS2_SHELL
  39. inOS2=1
  40. endif
  41. endif
  42. endif
  43. # The extension of executables
  44. ifdef inlinux
  45. EXEEXT=
  46. else
  47. EXEEXT=.exe
  48. endif
  49. # The path which is search separated by spaces
  50. ifdef inlinux
  51. SEARCHPATH=$(subst :, ,$(PATH))
  52. else
  53. SEARCHPATH=$(subst ;, ,$(PATH))
  54. endif
  55. #####################################################################
  56. # Default target
  57. #####################################################################
  58. override OS_TARGET:=linux
  59. override CPU_TARGET:=i386
  60. #####################################################################
  61. # FPC version/target Detection
  62. #####################################################################
  63. # What compiler to use ?
  64. ifndef FPC
  65. ifdef inOS2
  66. export FPC=ppos2$(EXEEXT)
  67. else
  68. export FPC=ppc386$(EXEEXT)
  69. endif
  70. endif
  71. # Target OS
  72. ifndef OS_TARGET
  73. export OS_TARGET:=$(shell $(FPC) -iTO)
  74. endif
  75. # Source OS
  76. ifndef OS_SOURCE
  77. export OS_SOURCE:=$(shell $(FPC) -iSO)
  78. endif
  79. # Target CPU
  80. ifndef CPU_TARGET
  81. export CPU_TARGET:=$(shell $(FPC) -iTP)
  82. endif
  83. # Source CPU
  84. ifndef CPU_SOURCE
  85. export CPU_SOURCE:=$(shell $(FPC) -iSP)
  86. endif
  87. # FPC version
  88. ifndef FPC_VERSION
  89. export FPC_VERSION:=$(shell $(FPC) -iV)
  90. endif
  91. #####################################################################
  92. # Default Settings
  93. #####################################################################
  94. # Release ? Then force OPT and don't use extra opts via commandline
  95. ifdef RELEASE
  96. override OPT:=-Xs -OG2p3 -n
  97. endif
  98. # Verbose settings (warning,note,info)
  99. ifdef VERBOSE
  100. override OPT+=-vwni
  101. endif
  102. #####################################################################
  103. # User Settings
  104. #####################################################################
  105. # Pre Settings
  106. RTL=..
  107. INC=$(RTL)/inc
  108. PROCINC=$(RTL)/$(CPU_TARGET)
  109. UNITPREFIX=rtl
  110. # Paths
  111. OBJPASDIR=$(RTL)/objpas
  112. GRAPHDIR=$(INC)/graph
  113. # Define Go32v2 Units
  114. SYSTEMUNIT=syslinux
  115. #
  116. # Use LibGGI ?
  117. #
  118. ifndef USELIBGGI
  119. USELIBGGI=NO
  120. endif
  121. # Targets
  122. LOADEROBJECTS=prt0 cprt0 gprt0 cprt21 gprt21
  123. UNITOBJECTS=$(SYSTEMUNIT) objpas strings linux ports dos crt objects printer graph sysutils typinfo math cpu mmx getopts heaptrc errors sockets gpm ipc
  124. # Clean
  125. # Install
  126. # Defaults
  127. DEFAULTUNITS=1
  128. # Directories
  129. ifndef FPCDIR
  130. FPCDIR=.
  131. endif
  132. override NEEDINCDIR=$(INC) $(PROCINC)
  133. ifndef TARGETDIR
  134. TARGETDIR=.
  135. endif
  136. # Libraries
  137. # Info
  138. FPCINFO=fpc_infocfg fpc_infoobjects fpc_infoinstall
  139. # Post Settings
  140. SYSTEMPPU=$(addsuffix $(PPUEXT),$(SYSTEMUNIT))
  141. # Get the system independent include file names.
  142. # This will set the following variables :
  143. # SYSINCNAMES
  144. include $(INC)/makefile.inc
  145. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  146. # Get the processor dependent include file names.
  147. # This will set the following variables :
  148. # CPUINCNAMES
  149. include $(PROCINC)/makefile.cpu
  150. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  151. # Put system unit dependencies together.
  152. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  153. #####################################################################
  154. # Compiler Command Line
  155. #####################################################################
  156. # Load commandline OPTDEF and add FPC_CPU define
  157. override FPCOPTDEF:=-d$(CPU_TARGET)
  158. # Load commandline OPT and add target and unit dir to be sure
  159. ifneq ($(OS_TARGET),$(OS_SOURCE))
  160. override FPCOPT+=-T$(OS_TARGET)
  161. endif
  162. ifdef NEEDOPT
  163. override FPCOPT+=$(NEEDOPT)
  164. endif
  165. # RTL first and then Unit dir (a unit can override RTLunit). Don't add the
  166. # dirs if fpcdir=. which can be used for the rtl makefiles
  167. ifdef FPCDIR
  168. ifneq ($(FPCDIR),.)
  169. override FPCOPT+=-Fu$(FPCDIR)/rtl/$(OS_TARGET) -Fu$(FPCDIR)/units/$(OS_TARGET)
  170. endif
  171. endif
  172. ifdef NEEDINCDIR
  173. override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
  174. endif
  175. # Target dirs
  176. ifdef TARGETDIR
  177. override FPCOPT+=-FE$(TARGETDIR)
  178. endif
  179. # Smartlinking
  180. ifeq ($(SMARTLINK),YES)
  181. override FPCOPT+=-Cx
  182. endif
  183. # Add commandline options
  184. ifdef OPT
  185. override FPCOPT+=$(OPT)
  186. endif
  187. ifdef UNITDIR
  188. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  189. endif
  190. ifdef LIBDIR
  191. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  192. endif
  193. ifdef OBJDIR
  194. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  195. endif
  196. ifdef INCDIR
  197. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  198. endif
  199. # Add defines from FPCOPTDEF to FPCOPT
  200. ifdef FPCOPTDEF
  201. override FPCOPT+=$(FPCOPTDEF)
  202. endif
  203. # Was a config file specified ?
  204. ifdef CFGFILE
  205. override FPCOPT+=@$(CFGFILE)
  206. endif
  207. override COMPILER=$(FPC) $(FPCOPT)
  208. #####################################################################
  209. # Shell tools
  210. #####################################################################
  211. # To copy pograms
  212. ifndef COPY
  213. export COPY:=cp -fp
  214. endif
  215. # To move pograms
  216. ifndef MOVE
  217. export MOVE:=mv -f
  218. endif
  219. # Check delete program
  220. ifndef DEL
  221. export DEL:=rm -f
  222. endif
  223. # Check deltree program
  224. ifndef DELTREE
  225. export DELTREE:=rm -rf
  226. endif
  227. # To install files
  228. ifndef INSTALL
  229. ifdef inlinux
  230. export INSTALL:=install -m 644
  231. else
  232. export INSTALL:=$(COPY)
  233. endif
  234. endif
  235. # To install programs
  236. ifndef INSTALLEXE
  237. ifdef inlinux
  238. export INSTALLEXE:=install -m 755
  239. else
  240. export INSTALLEXE:=$(COPY)
  241. endif
  242. endif
  243. # To make a directory.
  244. ifndef MKDIR
  245. ifdef inlinux
  246. export MKDIR:=install -m 755 -d
  247. else
  248. export MKDIR:=ginstall -m 755 -d
  249. endif
  250. endif
  251. #####################################################################
  252. # Default Tools
  253. #####################################################################
  254. # assembler, redefine it if cross compiling
  255. ifndef AS
  256. AS=as
  257. endif
  258. # linker, but probably not used
  259. ifndef LD
  260. LD=ld
  261. endif
  262. # Where is the ppumove program ?
  263. ifndef PPUMOVE
  264. PPUMOVE=ppumove
  265. endif
  266. # Where is the ppdep program ?
  267. ifndef PPDEP
  268. PPDEP=ppdep
  269. endif
  270. # ppas.bat / ppas.sh
  271. ifdef inlinux
  272. PPAS=ppas.sh
  273. else
  274. ifdef inOS2
  275. PPAS=ppas.cmd
  276. else
  277. PPAS=ppas.bat
  278. endif
  279. endif
  280. # also call ppas if with command option -s
  281. ifeq (,$(findstring -s ,$(COMPILER)))
  282. EXECPPAS=
  283. else
  284. EXECPPAS=@$(PPAS)
  285. endif
  286. # ldconfig to rebuild .so cache
  287. ifdef inlinux
  288. LDCONFIG=ldconfig
  289. else
  290. LDCONFIG=
  291. endif
  292. # echo
  293. ifndef ECHO
  294. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  295. ifeq ($(ECHO),)
  296. export ECHO:=echo
  297. else
  298. export ECHO:=$(firstword $(ECHO))
  299. endif
  300. endif
  301. # Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
  302. # upx uses that one itself (PFV)
  303. ifndef UPXPROG
  304. ifeq ($(OS_TARGET),go32v2)
  305. UPXPROG:=1
  306. endif
  307. ifeq ($(OS_TARGET),win32)
  308. UPXPROG:=1
  309. endif
  310. ifdef UPXPROG
  311. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
  312. ifeq ($(UPX),)
  313. UPXPROG=
  314. else
  315. export UPXPROG:=$(firstword $(UPX))
  316. endif
  317. else
  318. UPXPROG=
  319. endif
  320. endif
  321. # gdate/date
  322. ifndef DATE
  323. DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
  324. ifeq ($(DATE),)
  325. DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
  326. ifeq ($(DATE),)
  327. DATE=
  328. else
  329. export DATE:=$(firstword $(DATE))
  330. endif
  331. else
  332. export DATE:=$(firstword $(DATE))
  333. endif
  334. endif
  335. ifdef DATE
  336. DATESTR:=$(shell $(DATE) +%Y%m%d)
  337. else
  338. DATESTR=
  339. endif
  340. # ZipProg, you can't use Zip as the var name (PFV)
  341. ifndef ZIPPROG
  342. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  343. ifeq ($(ZIPPROG),)
  344. ZIPPROG=
  345. else
  346. export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
  347. endif
  348. endif
  349. ifndef ZIPEXT
  350. ZIPEXT=.zip
  351. endif
  352. #####################################################################
  353. # Default Directories
  354. #####################################################################
  355. # Base dir
  356. ifdef PWD
  357. BASEDIR:=$(shell $(PWD))
  358. else
  359. BASEDIR=.
  360. endif
  361. # set the prefix directory where to install everything
  362. ifndef PREFIXINSTALLDIR
  363. ifdef inlinux
  364. export PREFIXINSTALLDIR=/usr
  365. else
  366. export PREFIXINSTALLDIR=/pp
  367. endif
  368. endif
  369. # set the directory to the rtl base
  370. ifndef RTLDIR
  371. ifdef RTL
  372. RTLDIR:=$(RTL)/$(OS_TARGET)
  373. else
  374. RTLDIR:=$(FPCDIR)/rtl/$(OS_TARGET)
  375. endif
  376. endif
  377. # specify where units are.
  378. ifndef UNITDIR
  379. ifdef UNITS
  380. UNITDIR=$(UNITS)/$(OS_TARGET)
  381. else
  382. UNITDIR=$(FPCDIR)/units/$(OS_TARGET)
  383. endif
  384. endif
  385. ifeq ($(strip $(wildcard $(UNITDIR)/*)),)
  386. UNITDIR=
  387. endif
  388. # On linux, try to find where libgcc.a is.
  389. ifdef inlinux
  390. ifndef GCCLIBDIR
  391. export GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`)
  392. endif
  393. endif
  394. # Where to find other libraries
  395. ifdef inlinux
  396. ifndef OTHERLIBDIR
  397. export OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
  398. endif
  399. endif
  400. #####################################################################
  401. # Install Directories based on BASEINSTALLDIR
  402. #####################################################################
  403. # set the base directory where to install everything
  404. ifndef BASEINSTALLDIR
  405. ifdef inlinux
  406. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  407. else
  408. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  409. endif
  410. endif
  411. # Linux binary really goes to baseinstalldir
  412. ifndef LIBINSTALLDIR
  413. ifdef inlinux
  414. LIBINSTALLDIR=$(BASEINSTALLDIR)
  415. else
  416. LIBINSTALLDIR=$(BASEINSTALLDIR)/lib
  417. endif
  418. endif
  419. # set the directory where to install the binaries
  420. ifndef BININSTALLDIR
  421. ifdef inlinux
  422. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  423. else
  424. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  425. endif
  426. endif
  427. # Where the .msg files will be stored
  428. ifndef MSGINSTALLDIR
  429. MSGINSTALLDIR=$(BASEINSTALLDIR)/msg
  430. endif
  431. # Where the .msg files will be stored
  432. ifndef SOURCEINSTALLDIR
  433. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  434. endif
  435. # Where the doc files will be stored
  436. ifndef DOCINSTALLDIR
  437. ifdef inlinux
  438. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc/$(FPC_VERSION)
  439. else
  440. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  441. endif
  442. endif
  443. ########################
  444. # Unit Directories
  445. ########################
  446. # this can be set to 'rtl' when the RTL units are installed
  447. ifndef UNITPREFIX
  448. UNITPREFIX=units
  449. endif
  450. # set the directory where to install the units.
  451. ifndef UNITINSTALLDIR
  452. UNITINSTALLDIR=$(BASEINSTALLDIR)/$(UNITPREFIX)/$(OS_TARGET)
  453. endif
  454. # set the directory where to install the units.
  455. ifndef STATIC_UNITINSTALLDIR
  456. STATIC_UNITINSTALLDIR=$(UNITINSTALLDIR)/static
  457. endif
  458. # set the directory where to install the units.
  459. ifndef SHARED_UNITINSTALLDIR
  460. SHARED_UNITINSTALLDIR=$(UNITINSTALLDIR)/shared
  461. endif
  462. # set the directory where to install the libs (must exist)
  463. ifndef STATIC_LIBINSTALLDIR
  464. STATIC_LIBINSTALLDIR=$(STATIC_UNITINSTALLDIR)
  465. endif
  466. # set the directory where to install the libs (must exist)
  467. ifndef SHARED_LIBINSTALLDIR
  468. ifdef inlinux
  469. SHARED_LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  470. else
  471. SHARED_LIBINSTALLDIR=$(SHARED_UNITINSTALLDIR)
  472. endif
  473. endif
  474. #####################################################################
  475. # Default extensions
  476. #####################################################################
  477. # Default needed extensions (Go32v2,Linux)
  478. LOADEREXT=.as
  479. PPLEXT=.ppl
  480. PPUEXT=.ppu
  481. OEXT=.o
  482. ASMEXT=.s
  483. SMARTEXT=.sl
  484. STATICLIBEXT=.a
  485. SHAREDLIBEXT=.so
  486. PACKAGESUFFIX=
  487. # Go32v1
  488. ifeq ($(OS_TARGET),go32v1)
  489. PPUEXT=.pp1
  490. OEXT=.o1
  491. ASMEXT=.s1
  492. SMARTEXT=.sl1
  493. STATICLIBEXT=.a1
  494. SHAREDLIBEXT=.so1
  495. PACKAGESUFFIX=v1
  496. endif
  497. # Go32v2
  498. ifeq ($(OS_TARGET),go32v2)
  499. PACKAGESUFFIX=go32
  500. endif
  501. # Linux
  502. ifeq ($(OS_TARGET),linux)
  503. PACKAGESUFFIX=linux
  504. endif
  505. # Win32
  506. ifeq ($(OS_TARGET),win32)
  507. PPUEXT=.ppw
  508. OEXT=.ow
  509. ASMEXT=.sw
  510. SMARTEXT=.slw
  511. STATICLIBEXT=.aw
  512. SHAREDLIBEXT=.dll
  513. PACKAGESUFFIX=win32
  514. endif
  515. # OS/2
  516. ifeq ($(OS_TARGET),os2)
  517. PPUEXT=.ppo
  518. ASMEXT=.so2
  519. OEXT=.oo2
  520. SMARTEXT=.so
  521. STATICLIBEXT=.ao2
  522. SHAREDLIBEXT=.dll
  523. PACKAGESUFFIX=os2
  524. endif
  525. # library prefix
  526. LIBPREFIX=lib
  527. ifeq ($(OS_TARGET),go32v2)
  528. LIBPREFIX=
  529. endif
  530. ifeq ($(OS_TARGET),go32v1)
  531. LIBPREFIX=
  532. endif
  533. # determine which .pas extension is used
  534. ifndef PASEXT
  535. ifdef EXEOBJECTS
  536. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
  537. else
  538. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
  539. endif
  540. ifeq ($(TESTPAS),)
  541. PASEXT=.pp
  542. else
  543. PASEXT=.pas
  544. endif
  545. endif
  546. #####################################################################
  547. # Default rules
  548. #####################################################################
  549. .PHONY: defaultrule all staticlib sharedlib showinstall install \
  550. staticinstall sharedinstall libinstall zipinstall zipinstalladd \
  551. clean cleanall depend info
  552. all: fpc_all
  553. staticlib: fpc_staticlib
  554. sharedlib: fpc_sharedlib
  555. showinstall: fpc_showinstall
  556. install: fpc_install
  557. staticinstall: fpc_staticinstall
  558. sharedinstall: fpc_sharedinstall
  559. libinstall: fpc_libinstall
  560. zipinstall: fpc_zipinstall
  561. zipinstalladd: fpc_zipinstalladd
  562. clean: fpc_clean
  563. clean_all: fpc_clean_all
  564. depend: fpc_depend
  565. info: fpc_info
  566. #####################################################################
  567. # General compile rules
  568. #####################################################################
  569. .PHONY: fpc_all fpc_units fpc_exes fpc_loaders
  570. # Create Filenames
  571. LOADEROFILES=$(addsuffix $(OEXT),$(LOADEROBJECTS))
  572. EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))
  573. EXEOFILES=$(addsuffix $(OEXT),$(EXEOBJECTS))
  574. UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
  575. UNITOFILES=$(addsuffix $(OEXT),$(UNITOBJECTS))
  576. UNITAFILES=$(addsuffix $(STATICLIBEXT),$(UNITOBJECTS))
  577. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
  578. ifdef DEFAULTUNITS
  579. fpc_all: fpc_loaders fpc_units
  580. else
  581. fpc_all: fpc_loaders fpc_units fpc_exes
  582. endif
  583. fpc_loaders: $(LOADEROFILES)
  584. fpc_units: $(UNITPPUFILES)
  585. fpc_exes: $(EXEFILES)
  586. # General compile rules, available for both possible PASEXT
  587. %$(PPUEXT): %.pp
  588. $(COMPILER) $< $(REDIR)
  589. $(EXECPASS)
  590. %$(PPUEXT): %.pas
  591. $(COMPILER) $< $(REDIR)
  592. $(EXECPASS)
  593. %$(EXEEXT): %.pp
  594. $(COMPILER) $< $(REDIR)
  595. $(EXECPASS)
  596. %$(EXEEXT): %.pas
  597. $(COMPILER) $< $(REDIR)
  598. $(EXECPASS)
  599. %$(OEXT): %$(LOADEREXT)
  600. $(AS) -o $*$(OEXT) $<
  601. #####################################################################
  602. # Library
  603. #####################################################################
  604. .PHONY: fpc_staticlib fpc_sharedlib
  605. # Default sharedlib units are all unit objects
  606. ifndef SHAREDLIBUNITOBJECTS
  607. SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
  608. endif
  609. fpc_staticlib:
  610. $(MAKE) libsclean
  611. $(MAKE) all SMARTLINK=YES
  612. fpc_sharedlib: all
  613. ifdef inlinux
  614. ifndef LIBNAME
  615. @$(ECHO) LIBNAME not set
  616. else
  617. $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
  618. endif
  619. else
  620. @$(ECHO) Shared Libraries not supported
  621. endif
  622. #####################################################################
  623. # Install rules
  624. #####################################################################
  625. .PHONY: fpc_showinstallfiles fpc_install
  626. ifdef UNITOBJECTS
  627. override UNITINSTALLFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
  628. endif
  629. ifdef EXTRAINSTALLUNITS
  630. override EXTRAINSTALLFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)))
  631. endif
  632. fpc_showinstallfiles : all
  633. ifndef DEFAULTUNITS
  634. ifdef EXEOBJECTS
  635. @$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(EXEFILES))
  636. endif
  637. endif
  638. ifdef LOADEROBJECTS
  639. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES))
  640. endif
  641. ifdef UNITINSTALLFILES
  642. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(UNITINSTALLFILES))
  643. endif
  644. ifdef EXTRAINSTALLFILES
  645. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(EXTRAINSTALLFILES))
  646. endif
  647. fpc_install:
  648. # Create UnitInstallFiles
  649. ifndef DEFAULTUNITS
  650. ifdef EXEOBJECTS
  651. $(MKDIR) $(BININSTALLDIR)
  652. # Compress the exes if upx is defined
  653. ifdef UPXPROG
  654. -$(UPXPROG) $(EXEFILES)
  655. endif
  656. $(INSTALLEXE) $(EXEFILES) $(BININSTALLDIR)
  657. endif
  658. endif
  659. ifdef LOADEROBJECTS
  660. $(MKDIR) $(UNITINSTALLDIR)
  661. $(INSTALL) $(LOADEROFILES) $(UNITINSTALLDIR)
  662. endif
  663. ifdef UNITINSTALLFILES
  664. $(MKDIR) $(UNITINSTALLDIR)
  665. $(INSTALL) $(UNITINSTALLFILES) $(UNITINSTALLDIR)
  666. endif
  667. ifdef EXTRAINSTALLFILES
  668. $(MKDIR) $(UNITINSTALLDIR)
  669. $(INSTALL) $(EXTRAINSTALLFILES) $(UNITINSTALLDIR)
  670. endif
  671. #####################################################################
  672. # Zip
  673. #####################################################################
  674. .PHONY: fpc_zipinstall fpc_zipinstalladd
  675. # Temporary path to pack a file
  676. ifndef PACKDIR
  677. ifndef inlinux
  678. PACKDIR=pack_tmp
  679. else
  680. PACKDIR=/tmp/fpc-pack
  681. endif
  682. endif
  683. # Test dir if none specified
  684. ifndef PACKAGEDIR
  685. PACKAGEDIR=$(BASEDIR)
  686. endif
  687. # Add .zip/.tar.gz extension
  688. ifdef ZIPNAME
  689. ifndef inlinux
  690. override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
  691. endif
  692. endif
  693. # Default target which is call before zipping
  694. ifndef ZIPTARGET
  695. ZIPTARGET=install
  696. endif
  697. # Note: This will not remove the zipfile first
  698. fpc_zipinstalladd:
  699. ifndef ZIPNAME
  700. @$(ECHO) Please specify ZIPNAME!
  701. @exit
  702. else
  703. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  704. ifdef inlinux
  705. gzip -d $(PACKAGEDIR)/$(ZIPNAME).tar.gz
  706. cd $(PACKDIR) ; tar rv --file $(PACKAGEDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
  707. gzip $(PACKAGEDIR)/$(ZIPNAME).tar
  708. else
  709. cd $(PACKDIR) ; $(ZIPPROG) $(PACKAGEDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  710. endif
  711. $(DELTREE) $(PACKDIR)
  712. endif
  713. # First remove the zip and then install
  714. fpc_zipinstall:
  715. ifndef ZIPNAME
  716. @$(ECHO) Please specify ZIPNAME!
  717. @exit
  718. else
  719. $(DEL) $(PACKAGEDIR)/$(ZIPNAME)
  720. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  721. ifdef inlinux
  722. cd $(PACKDIR) ; tar cvz --file $(PACKAGEDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
  723. else
  724. cd $(PACKDIR) ; $(ZIPPROG) $(PACKAGEDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  725. endif
  726. $(DELTREE) $(PACKDIR)
  727. endif
  728. #####################################################################
  729. # Clean rules
  730. #####################################################################
  731. .PHONY: fpc_clean fpc_libsclean fpc_cleanall
  732. ifdef UNITOBJECTS
  733. override UNITCLEANFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
  734. endif
  735. ifdef EXTRACLEANUNITS
  736. override EXTRACLEANFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)))
  737. endif
  738. fpc_clean:
  739. ifdef EXEOBJECTS
  740. -$(DEL) $(EXEFILES) $(EXEOFILES)
  741. endif
  742. ifdef LOADEROBJECTS
  743. -$(DEL) $(LOADEROFILES)
  744. endif
  745. ifdef UNITCLEANFILES
  746. -$(DEL) $(UNITCLEANFILES)
  747. endif
  748. ifdef EXTRACLEANFILES
  749. -$(DEL) $(EXTRACLEANFILES)
  750. endif
  751. -$(DEL) $(PPAS) link.res log
  752. fpc_libsclean: clean
  753. -$(DEL) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  754. fpc_cleanall:
  755. ifdef EXEOBJECTS
  756. -$(DEL) $(EXEFILES)
  757. endif
  758. -$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  759. -$(DELTREE) *$(SMARTEXT)
  760. #####################################################################
  761. # Depend rules
  762. #####################################################################
  763. .PHONY: fpc_depend
  764. fpc_depend:
  765. $(PPDEP) $(UNITOBJECTS)
  766. #####################################################################
  767. # Info rules
  768. #####################################################################
  769. .PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
  770. fpc_dirinfo
  771. fpc_info: $(FPCINFO)
  772. fpc_infocfg:
  773. @$(ECHO)
  774. @$(ECHO) == Configuration info ==
  775. @$(ECHO)
  776. @$(ECHO) FPC....... $(FPC)
  777. @$(ECHO) Version... $(FPC_VERSION)
  778. @$(ECHO) CPU....... $(CPU_TARGET)
  779. @$(ECHO) Source.... $(OS_SOURCE)
  780. @$(ECHO) Target.... $(OS_TARGET)
  781. @$(ECHO)
  782. fpc_infoinstall:
  783. @$(ECHO)
  784. @$(ECHO) == Install info ==
  785. @$(ECHO)
  786. ifdef DATE
  787. @$(ECHO) DateStr.............. $(DATESTR)
  788. endif
  789. @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX)
  790. @$(ECHO)
  791. @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR)
  792. @$(ECHO) BinInstallDir........ $(BININSTALLDIR)
  793. @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR)
  794. @$(ECHO) StaticUnitInstallDir. $(STATIC_UNITINSTALLDIR)
  795. @$(ECHO) SharedUnitInstallDir. $(SHARED_UNITINSTALLDIR)
  796. @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR)
  797. @$(ECHO) StaticLibInstallDir.. $(STATIC_LIBINSTALLDIR)
  798. @$(ECHO) SharedLibInstallDir.. $(SHARED_LIBINSTALLDIR)
  799. @$(ECHO) MsgInstallDir........ $(MSGINSTALLDIR)
  800. @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR)
  801. @$(ECHO)
  802. #####################################################################
  803. # Users rules
  804. #####################################################################
  805. vpath %$(PASEXT) $(INC) $(PROCINC)
  806. #
  807. # Loaders
  808. #
  809. prt0$(OEXT) : $(CPU_TARGET)/prt0.as
  810. $(AS) -o prt0$(OEXT) $(CPU_TARGET)/prt0.as
  811. gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as
  812. $(AS) -o gprt0$(OEXT) $(CPU_TARGET)/gprt0.as
  813. cprt0$(OEXT) : $(CPU_TARGET)/cprt0.as
  814. $(AS) -o cprt0$(OEXT) $(CPU_TARGET)/cprt0.as
  815. cprt21$(OEXT) : $(CPU_TARGET)/cprt21.as
  816. $(AS) -o cprt21$(OEXT) $(CPU_TARGET)/cprt21.as
  817. # still need to use gprt1, because gprt21 crashes
  818. gprt21$(OEXT) : $(CPU_TARGET)/gprt0.as
  819. $(AS) -o gprt21$(OEXT) $(CPU_TARGET)/gprt0.as
  820. #
  821. # System Units (System, Objpas, Strings)
  822. #
  823. $(SYSTEMPPU) : syslinux.pp sysconst.inc systypes.inc syscalls.inc $(SYSDEPS)
  824. $(COMPILER) -Us -Sg syslinux.pp $(REDIR)
  825. objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMPPU)
  826. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
  827. strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
  828. $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
  829. $(SYSTEMPPU)
  830. #
  831. # System Dependent Units
  832. #
  833. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
  834. syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
  835. ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
  836. #
  837. # TP7 Compatible RTL Units
  838. #
  839. dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
  840. linux$(PPUEXT) $(SYSTEMPPU)
  841. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  842. objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
  843. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  844. #
  845. # Graph
  846. #
  847. ifndef NEWGRAPH
  848. graph$(PPUEXT) : graph.pp linux$(PPUEXT) objects$(PPUEXT)
  849. else
  850. include $(GRAPHDIR)/makefile.inc
  851. GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
  852. ifeq ($(USELIBGGI),YES)
  853. GRAPHINCDEPS+=ggigraph.inc
  854. override COMPILER+=-dUSEGGI -S2
  855. else
  856. GRAPHINCDEPS+=vgagraph.inc
  857. endif
  858. graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) $(GRAPHINCDEPS) graph.inc
  859. $(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
  860. endif
  861. #
  862. # Delphi Compatible Units
  863. #
  864. sysutils$(PPUEXT) : $(OBJPASDIR)/sysutils.pp $(wildcard $(OBJPASDIR)/*.inc) \
  865. filutil.inc disk.inc objpas$(PPUEXT) linux$(PPUEXT)
  866. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/sysutils.pp $(REDIR)
  867. typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
  868. $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
  869. math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
  870. $(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
  871. gettext$(PPUEXT): $(OBJPASDIR)/gettext.pp objpas$(PPUEXT) sysutils$(PPUEXT)
  872. $(COMPILER) $(OBJPASDIR)/gettext.pp $(REDIR)
  873. #
  874. # Other system-independent RTL Units
  875. #
  876. cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMPPU)
  877. mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMPPU)
  878. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)
  879. heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMPPU)
  880. $(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
  881. #
  882. # Other system-dependent RTL Units
  883. #
  884. sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
  885. linux$(PPUEXT) $(SYSTEMPPU)
  886. errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMPPU)
  887. ipc$(PPUEXT) : ipc.pp linux$(PPUEXT) $(SYSTEMPPU)