Makefile 14 KB

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