Makefile 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. #
  2. # Makefile generated by fpcmake v1.00 [2000/12/19]
  3. #
  4. defaultrule: all
  5. #####################################################################
  6. # Autodetect OS (Linux or Dos or Windows NT or OS/2)
  7. # define inUnix when running under Unix (Linux,FreeBSD)
  8. # define inWinNT when running under WinNT
  9. # define inOS2 when running under OS/2
  10. #####################################################################
  11. # We need only / in the path
  12. override PATH:=$(subst \,/,$(PATH))
  13. # Search for PWD and determine also if we are under linux
  14. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
  15. ifeq ($(PWD),)
  16. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
  17. ifeq ($(PWD),)
  18. nopwd:
  19. @echo You need the GNU utils package to use this Makefile!
  20. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  21. @exit
  22. else
  23. inUnix=1
  24. PWD:=$(firstword $(PWD))
  25. endif
  26. else
  27. PWD:=$(firstword $(PWD))
  28. endif
  29. # Detect NT - NT sets OS to Windows_NT
  30. # Detect OS/2 - OS/2 has OS2_SHELL defined
  31. ifndef inUnix
  32. ifeq ($(OS),Windows_NT)
  33. inWinNT=1
  34. else
  35. ifdef OS2_SHELL
  36. inOS2=1
  37. endif
  38. endif
  39. endif
  40. # The extension of executables
  41. ifdef inUnix
  42. SRCEXEEXT=
  43. else
  44. SRCEXEEXT=.exe
  45. endif
  46. # The path which is searched separated by spaces
  47. ifdef inUnix
  48. SEARCHPATH=$(subst :, ,$(PATH))
  49. else
  50. SEARCHPATH=$(subst ;, ,$(PATH))
  51. endif
  52. # Base dir
  53. ifdef PWD
  54. BASEDIR:=$(shell $(PWD))
  55. else
  56. BASEDIR=.
  57. endif
  58. #####################################################################
  59. # FPC version/target Detection
  60. #####################################################################
  61. # What compiler to use ?
  62. ifndef FPC
  63. # Compatibility with old makefiles
  64. ifdef PP
  65. FPC=$(PP)
  66. else
  67. FPC=ppc386
  68. endif
  69. endif
  70. override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
  71. override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
  72. # Target OS
  73. ifndef OS_TARGET
  74. OS_TARGET:=$(shell $(FPC) -iTO)
  75. endif
  76. # Source OS
  77. ifndef OS_SOURCE
  78. OS_SOURCE:=$(shell $(FPC) -iSO)
  79. endif
  80. # Target CPU
  81. ifndef CPU_TARGET
  82. CPU_TARGET:=$(shell $(FPC) -iTP)
  83. endif
  84. # Source CPU
  85. ifndef CPU_SOURCE
  86. CPU_SOURCE:=$(shell $(FPC) -iSP)
  87. endif
  88. # FPC version
  89. ifndef FPC_VERSION
  90. FPC_VERSION:=$(shell $(FPC) -iV)
  91. endif
  92. export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
  93. #####################################################################
  94. # FPCDIR Setting
  95. #####################################################################
  96. # Test FPCDIR to look if the RTL dir exists
  97. ifdef FPCDIR
  98. override FPCDIR:=$(subst \,/,$(FPCDIR))
  99. ifeq ($(wildcard $(FPCDIR)/rtl),)
  100. ifeq ($(wildcard $(FPCDIR)/units),)
  101. override FPCDIR=wrong
  102. endif
  103. endif
  104. else
  105. override FPCDIR=wrong
  106. endif
  107. # Detect FPCDIR
  108. ifeq ($(FPCDIR),wrong)
  109. ifdef inUnix
  110. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  111. ifeq ($(wildcard $(FPCDIR)/units),)
  112. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  113. endif
  114. else
  115. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  116. override FPCDIR:=$(FPCDIR)/..
  117. ifeq ($(wildcard $(FPCDIR)/rtl),)
  118. ifeq ($(wildcard $(FPCDIR)/units),)
  119. override FPCDIR:=$(FPCDIR)/..
  120. ifeq ($(wildcard $(FPCDIR)/rtl),)
  121. ifeq ($(wildcard $(FPCDIR)/units),)
  122. override FPCDIR=c:/pp
  123. endif
  124. endif
  125. endif
  126. endif
  127. endif
  128. endif
  129. #####################################################################
  130. # User Settings
  131. #####################################################################
  132. # Targets
  133. override DIROBJECTS+=$(wildcard fake text)
  134. # Clean
  135. # Install
  136. PACKAGENAME=ide
  137. ZIPTARGET=install
  138. # Defaults
  139. # Directories
  140. # Packages
  141. # Libraries
  142. #####################################################################
  143. # Shell tools
  144. #####################################################################
  145. # echo
  146. ifndef ECHO
  147. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
  148. ifeq ($(ECHO),)
  149. ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
  150. ifeq ($(ECHO),)
  151. ECHO:=echo
  152. ECHOE:=echo
  153. else
  154. ECHO:=$(firstword $(ECHO))
  155. ECHOE=$(ECHO) -E
  156. endif
  157. else
  158. ECHO:=$(firstword $(ECHO))
  159. ECHOE=$(ECHO) -E
  160. endif
  161. endif
  162. # To copy pograms
  163. ifndef COPY
  164. COPY:=cp -fp
  165. endif
  166. # Copy a whole tree
  167. ifndef COPYTREE
  168. COPYTREE:=cp -rfp
  169. endif
  170. # To move pograms
  171. ifndef MOVE
  172. MOVE:=mv -f
  173. endif
  174. # Check delete program
  175. ifndef DEL
  176. DEL:=rm -f
  177. endif
  178. # Check deltree program
  179. ifndef DELTREE
  180. DELTREE:=rm -rf
  181. endif
  182. # To install files
  183. ifndef INSTALL
  184. ifdef inUnix
  185. INSTALL:=install -c -m 644
  186. else
  187. INSTALL:=$(COPY)
  188. endif
  189. endif
  190. # To install programs
  191. ifndef INSTALLEXE
  192. ifdef inUnix
  193. INSTALLEXE:=install -c -m 755
  194. else
  195. INSTALLEXE:=$(COPY)
  196. endif
  197. endif
  198. # To make a directory.
  199. ifndef MKDIR
  200. ifdef inUnix
  201. MKDIR:=install -m 755 -d
  202. else
  203. MKDIR:=ginstall -m 755 -d
  204. endif
  205. endif
  206. export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  207. #####################################################################
  208. # Default Tools
  209. #####################################################################
  210. # assembler, redefine it if cross compiling
  211. ifndef AS
  212. AS=as
  213. endif
  214. # linker, but probably not used
  215. ifndef LD
  216. LD=ld
  217. endif
  218. # ppas.bat / ppas.sh
  219. ifdef inUnix
  220. PPAS=ppas.sh
  221. else
  222. ifdef inOS2
  223. PPAS=ppas.cmd
  224. else
  225. PPAS=ppas.bat
  226. endif
  227. endif
  228. # ldconfig to rebuild .so cache
  229. ifdef inUnix
  230. LDCONFIG=ldconfig
  231. else
  232. LDCONFIG=
  233. endif
  234. # ZipProg, you can't use Zip as the var name (PFV)
  235. ifndef ZIPPROG
  236. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
  237. ifeq ($(ZIPPROG),)
  238. ZIPPROG=
  239. else
  240. ZIPPROG:=$(firstword $(ZIPPROG))
  241. endif
  242. endif
  243. export ZIPPROG
  244. ZIPOPT=-9
  245. ZIPEXT=.zip
  246. # Tar
  247. ifndef TARPROG
  248. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
  249. ifeq ($(TARPROG),)
  250. TARPROG=
  251. else
  252. TARPROG:=$(firstword $(TARPROG))
  253. endif
  254. endif
  255. export TARPROG
  256. ifeq ($(USETAR),bz2)
  257. TAROPT=vI
  258. TAREXT=.tar.bz2
  259. else
  260. TAROPT=vz
  261. TAREXT=.tar.gz
  262. endif
  263. #####################################################################
  264. # Default Directories
  265. #####################################################################
  266. # Linux and freebsd use unix dirs with /usr/bin, /usr/lib
  267. # When zipping use the target as default, when normal install then
  268. # use the source os as default
  269. ifdef ZIPNAME
  270. # Zipinstall
  271. ifeq ($(OS_TARGET),linux)
  272. UNIXINSTALLDIR=1
  273. endif
  274. ifeq ($(OS_TARGET),freebsd)
  275. UNIXINSTALLDIR=1
  276. endif
  277. else
  278. # Normal install
  279. ifeq ($(OS_SOURCE),linux)
  280. UNIXINSTALLDIR=1
  281. endif
  282. ifeq ($(OS_SOURCE),freebsd)
  283. UNIXINSTALLDIR=1
  284. endif
  285. endif
  286. # set the prefix directory where to install everything
  287. ifndef PREFIXINSTALLDIR
  288. ifdef UNIXINSTALLDIR
  289. PREFIXINSTALLDIR=/usr
  290. else
  291. PREFIXINSTALLDIR=/pp
  292. endif
  293. endif
  294. export PREFIXINSTALLDIR
  295. # Where to place the resulting zip files
  296. ifndef DESTZIPDIR
  297. DESTZIPDIR:=$(BASEDIR)
  298. endif
  299. export DESTZIPDIR
  300. #####################################################################
  301. # Install Directories
  302. #####################################################################
  303. # set the base directory where to install everything
  304. ifndef BASEINSTALLDIR
  305. ifdef UNIXINSTALLDIR
  306. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  307. else
  308. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  309. endif
  310. endif
  311. # set the directory where to install the binaries
  312. ifndef BININSTALLDIR
  313. ifdef UNIXINSTALLDIR
  314. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  315. else
  316. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  317. endif
  318. endif
  319. # set the directory where to install the units.
  320. ifndef UNITINSTALLDIR
  321. UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
  322. ifdef UNITSUBDIR
  323. UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
  324. endif
  325. endif
  326. # Where to install shared libraries
  327. ifndef LIBINSTALLDIR
  328. ifdef UNIXINSTALLDIR
  329. LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  330. else
  331. LIBINSTALLDIR=$(UNITINSTALLDIR)
  332. endif
  333. endif
  334. # Where the source files will be stored
  335. ifndef SOURCEINSTALLDIR
  336. ifdef UNIXINSTALLDIR
  337. SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
  338. else
  339. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  340. endif
  341. ifdef SOURCESUBDIR
  342. SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
  343. endif
  344. endif
  345. # Where the doc files will be stored
  346. ifndef DOCINSTALLDIR
  347. ifdef UNIXINSTALLDIR
  348. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
  349. else
  350. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  351. endif
  352. endif
  353. # Where to install the examples, under linux we use the doc dir
  354. # because the copytree command will create a subdir itself
  355. ifndef EXAMPLEINSTALLDIR
  356. ifdef UNIXINSTALLDIR
  357. EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
  358. else
  359. EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
  360. endif
  361. ifdef EXAMPLESUBDIR
  362. EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
  363. endif
  364. endif
  365. # Where the some extra (data)files will be stored
  366. ifndef DATAINSTALLDIR
  367. DATAINSTALLDIR=$(BASEINSTALLDIR)
  368. endif
  369. #####################################################################
  370. # Redirection
  371. #####################################################################
  372. ifndef REDIRFILE
  373. REDIRFILE=log
  374. endif
  375. ifdef REDIR
  376. ifndef inUnix
  377. override FPC=redir -eo $(FPC)
  378. endif
  379. # set the verbosity to max
  380. override FPCOPT+=-va
  381. override REDIR:= >> $(REDIRFILE)
  382. endif
  383. #####################################################################
  384. # Standard rules
  385. #####################################################################
  386. debug: $(addsuffix _debug,$(DIROBJECTS))
  387. smart: $(addsuffix _smart,$(DIROBJECTS))
  388. shared: $(addsuffix _shared,$(DIROBJECTS))
  389. showinstall: $(addsuffix _showinstall,text)
  390. install: $(addsuffix _install,text)
  391. sourceinstall: fpc_sourceinstall
  392. zipinstall: fpc_zipinstall
  393. zipsourceinstall: fpc_zipsourceinstall
  394. clean: $(addsuffix _clean,$(DIROBJECTS))
  395. distclean: $(addsuffix _distclean,$(DIROBJECTS))
  396. cleanall: $(addsuffix _cleanall,$(DIROBJECTS))
  397. require: $(addsuffix _require,$(DIROBJECTS))
  398. .PHONY: debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
  399. #####################################################################
  400. # SourceInstall rules
  401. #####################################################################
  402. .PHONY: fpc_sourceinstall
  403. ifndef SOURCETOPDIR
  404. SOURCETOPDIR=$(BASEDIR)
  405. endif
  406. fpc_sourceinstall: clean
  407. $(MKDIR) $(SOURCEINSTALLDIR)
  408. $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
  409. #####################################################################
  410. # Zip
  411. #####################################################################
  412. .PHONY: fpc_zipinstall
  413. # Create suffix to add
  414. ifndef PACKAGESUFFIX
  415. PACKAGESUFFIX=$(OS_TARGET)
  416. ifeq ($(OS_TARGET),go32v2)
  417. PACKAGESUFFIX=go32
  418. endif
  419. ifeq ($(OS_TARGET),win32)
  420. PACKAGESUFFIX=w32
  421. endif
  422. ifeq ($(OS_TARGET),os2)
  423. PACKAGESUFFIX=emx
  424. endif
  425. endif
  426. # Temporary path to pack a file
  427. ifndef PACKDIR
  428. ifndef inUnix
  429. PACKDIR=$(BASEDIR)/pack_tmp
  430. else
  431. PACKDIR=/tmp/fpc-pack
  432. endif
  433. endif
  434. # Maybe create default zipname from packagename
  435. ifndef ZIPNAME
  436. ifdef PACKAGENAME
  437. ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
  438. endif
  439. endif
  440. # Use tar by default under linux
  441. ifndef USEZIP
  442. ifdef inUnix
  443. USETAR=1
  444. endif
  445. endif
  446. fpc_zipinstall:
  447. ifndef ZIPNAME
  448. @$(ECHO) "Please specify ZIPNAME!"
  449. @exit 1
  450. else
  451. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  452. ifdef USETAR
  453. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
  454. cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
  455. else
  456. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
  457. cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
  458. endif
  459. $(DELTREE) $(PACKDIR)
  460. endif
  461. .PHONY: fpc_zipsourceinstall
  462. fpc_zipsourceinstall:
  463. $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
  464. #####################################################################
  465. # Directories
  466. #####################################################################
  467. OBJECTDIRFAKE=1
  468. OBJECTDIRTEXT=1
  469. # Dir fake
  470. ifdef OBJECTDIRFAKE
  471. .PHONY: fake_all fake_debug fake_examples fake_test fake_smart fake_shared fake_showinstall fake_install fake_sourceinstall fake_exampleinstall fake_zipinstall fake_zipsourceinstall fake_zipexampleinstall fake_clean fake_distclean fake_cleanall fake_require fake_info
  472. fake_all:
  473. $(MAKE) -C fake all
  474. fake_debug:
  475. $(MAKE) -C fake debug
  476. fake_examples:
  477. $(MAKE) -C fake examples
  478. fake_test:
  479. $(MAKE) -C fake test
  480. fake_smart:
  481. $(MAKE) -C fake smart
  482. fake_shared:
  483. $(MAKE) -C fake shared
  484. fake_showinstall:
  485. $(MAKE) -C fake showinstall
  486. fake_install:
  487. $(MAKE) -C fake install
  488. fake_sourceinstall:
  489. $(MAKE) -C fake sourceinstall
  490. fake_exampleinstall:
  491. $(MAKE) -C fake exampleinstall
  492. fake_zipinstall:
  493. $(MAKE) -C fake zipinstall
  494. fake_zipsourceinstall:
  495. $(MAKE) -C fake zipsourceinstall
  496. fake_zipexampleinstall:
  497. $(MAKE) -C fake zipexampleinstall
  498. fake_clean:
  499. $(MAKE) -C fake clean
  500. fake_distclean:
  501. $(MAKE) -C fake distclean
  502. fake_cleanall:
  503. $(MAKE) -C fake cleanall
  504. fake_require:
  505. $(MAKE) -C fake require
  506. fake_info:
  507. $(MAKE) -C fake info
  508. endif
  509. # Dir text
  510. ifdef OBJECTDIRTEXT
  511. .PHONY: text_all text_debug text_examples text_test text_smart text_shared text_showinstall text_install text_sourceinstall text_exampleinstall text_zipinstall text_zipsourceinstall text_zipexampleinstall text_clean text_distclean text_cleanall text_require text_info
  512. text_all:
  513. $(MAKE) -C text all
  514. text_debug:
  515. $(MAKE) -C text debug
  516. text_examples:
  517. $(MAKE) -C text examples
  518. text_test:
  519. $(MAKE) -C text test
  520. text_smart:
  521. $(MAKE) -C text smart
  522. text_shared:
  523. $(MAKE) -C text shared
  524. text_showinstall:
  525. $(MAKE) -C text showinstall
  526. text_install:
  527. $(MAKE) -C text install
  528. text_sourceinstall:
  529. $(MAKE) -C text sourceinstall
  530. text_exampleinstall:
  531. $(MAKE) -C text exampleinstall
  532. text_zipinstall:
  533. $(MAKE) -C text zipinstall
  534. text_zipsourceinstall:
  535. $(MAKE) -C text zipsourceinstall
  536. text_zipexampleinstall:
  537. $(MAKE) -C text zipexampleinstall
  538. text_clean:
  539. $(MAKE) -C text clean
  540. text_distclean:
  541. $(MAKE) -C text distclean
  542. text_cleanall:
  543. $(MAKE) -C text cleanall
  544. text_require:
  545. $(MAKE) -C text require
  546. text_info:
  547. $(MAKE) -C text info
  548. endif
  549. #####################################################################
  550. # Local Makefile
  551. #####################################################################
  552. ifneq ($(wildcard fpcmake.loc),)
  553. include fpcmake.loc
  554. endif
  555. #####################################################################
  556. # Users rules
  557. #####################################################################
  558. .PHONY: gdb full fullgdb clean_compiler
  559. all:
  560. $(MAKE) -C text all
  561. gdb:
  562. $(MAKE) -C text all GDB=1
  563. full:
  564. $(MAKE) -C text all FULL=1 "NEEDOPT+=-Sg -dGDB -dBROWSERCOL"
  565. fullgdb:
  566. $(MAKE) -C text all FULL=1 GDB=1 "NEEDOPT+=-Sg -dGDB -dBROWSERCOL"
  567. #
  568. # Misc
  569. #
  570. clean_compiler:
  571. $(MAKE) -C ../compiler clean