Makefile 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. #
  2. # Makefile generated by fpcmake v0.99.13 [2000/02/09]
  3. #
  4. defaultrule: all
  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. # FPCDIR Setting
  100. #####################################################################
  101. # Test FPCDIR to look if the RTL dir exists
  102. ifdef FPCDIR
  103. override FPCDIR:=$(subst \,/,$(FPCDIR))
  104. ifeq ($(wildcard $(FPCDIR)/rtl),)
  105. ifeq ($(wildcard $(FPCDIR)/units),)
  106. override FPCDIR=wrong
  107. endif
  108. endif
  109. else
  110. override FPCDIR=wrong
  111. endif
  112. # Detect FPCDIR
  113. ifeq ($(FPCDIR),wrong)
  114. ifdef inlinux
  115. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  116. ifeq ($(wildcard $(FPCDIR)/units),)
  117. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  118. endif
  119. else
  120. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  121. override FPCDIR:=$(FPCDIR)/..
  122. ifeq ($(wildcard $(FPCDIR)/rtl),)
  123. ifeq ($(wildcard $(FPCDIR)/units),)
  124. override FPCDIR:=$(FPCDIR)/..
  125. ifeq ($(wildcard $(FPCDIR)/rtl),)
  126. ifeq ($(wildcard $(FPCDIR)/units),)
  127. override FPCDIR=c:/pp
  128. endif
  129. endif
  130. endif
  131. endif
  132. endif
  133. endif
  134. #####################################################################
  135. # User Settings
  136. #####################################################################
  137. # Targets
  138. override DIROBJECTS+=$(wildcard fake text)
  139. # Clean
  140. # Install
  141. PACKAGENAME=ide
  142. ZIPTARGET=install
  143. # Defaults
  144. # Directories
  145. # Packages
  146. # Libraries
  147. #####################################################################
  148. # Shell tools
  149. #####################################################################
  150. # echo
  151. ifndef ECHO
  152. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
  153. ifeq ($(ECHO),)
  154. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  155. ifeq ($(ECHO),)
  156. ECHO:=echo
  157. ECHOE:=echo
  158. else
  159. ECHO:=$(firstword $(ECHO))
  160. ECHOE=$(ECHO) -E
  161. endif
  162. else
  163. ECHO:=$(firstword $(ECHO))
  164. ECHOE=$(ECHO) -E
  165. endif
  166. endif
  167. # To copy pograms
  168. ifndef COPY
  169. COPY:=cp -fp
  170. endif
  171. # Copy a whole tree
  172. ifndef COPYTREE
  173. COPYTREE:=cp -rfp
  174. endif
  175. # To move pograms
  176. ifndef MOVE
  177. MOVE:=mv -f
  178. endif
  179. # Check delete program
  180. ifndef DEL
  181. DEL:=rm -f
  182. endif
  183. # Check deltree program
  184. ifndef DELTREE
  185. DELTREE:=rm -rf
  186. endif
  187. # To install files
  188. ifndef INSTALL
  189. ifdef inlinux
  190. INSTALL:=install -m 644
  191. else
  192. INSTALL:=$(COPY)
  193. endif
  194. endif
  195. # To install programs
  196. ifndef INSTALLEXE
  197. ifdef inlinux
  198. INSTALLEXE:=install -m 755
  199. else
  200. INSTALLEXE:=$(COPY)
  201. endif
  202. endif
  203. # To make a directory.
  204. ifndef MKDIR
  205. ifdef inlinux
  206. MKDIR:=install -m 755 -d
  207. else
  208. MKDIR:=ginstall -m 755 -d
  209. endif
  210. endif
  211. export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  212. #####################################################################
  213. # Default Tools
  214. #####################################################################
  215. # assembler, redefine it if cross compiling
  216. ifndef AS
  217. AS=as
  218. endif
  219. # linker, but probably not used
  220. ifndef LD
  221. LD=ld
  222. endif
  223. # ppas.bat / ppas.sh
  224. ifdef inlinux
  225. PPAS=ppas.sh
  226. else
  227. ifdef inOS2
  228. PPAS=ppas.cmd
  229. else
  230. PPAS=ppas.bat
  231. endif
  232. endif
  233. # ldconfig to rebuild .so cache
  234. ifdef inlinux
  235. LDCONFIG=ldconfig
  236. else
  237. LDCONFIG=
  238. endif
  239. # ZipProg, you can't use Zip as the var name (PFV)
  240. ifndef ZIPPROG
  241. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  242. ifeq ($(ZIPPROG),)
  243. ZIPPROG=
  244. else
  245. ZIPPROG:=$(firstword $(ZIPPROG))
  246. endif
  247. endif
  248. export ZIPPROG
  249. ZIPOPT=-9
  250. ZIPEXT=.zip
  251. # Tar
  252. ifndef TARPROG
  253. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(EXEEXT),$(SEARCHPATH))))
  254. ifeq ($(TARPROG),)
  255. TARPROG=
  256. else
  257. TARPROG:=$(firstword $(TARPROG))
  258. endif
  259. endif
  260. export TARPROG
  261. ifeq ($(USETAR),bz2)
  262. TAROPT=vI
  263. TAREXT=.tar.bz2
  264. else
  265. TAROPT=vz
  266. TAREXT=.tar.gz
  267. endif
  268. #####################################################################
  269. # Default Directories
  270. #####################################################################
  271. # set the prefix directory where to install everything
  272. ifndef PREFIXINSTALLDIR
  273. ifdef inlinux
  274. PREFIXINSTALLDIR=/usr
  275. else
  276. PREFIXINSTALLDIR=/pp
  277. endif
  278. endif
  279. export PREFIXINSTALLDIR
  280. # Where to place the resulting zip files
  281. ifndef DESTZIPDIR
  282. DESTZIPDIR:=$(BASEDIR)
  283. endif
  284. export DESTZIPDIR
  285. #####################################################################
  286. # Install Directories
  287. #####################################################################
  288. # set the base directory where to install everything
  289. ifndef BASEINSTALLDIR
  290. ifdef inlinux
  291. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  292. else
  293. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  294. endif
  295. endif
  296. # set the directory where to install the binaries
  297. ifndef BININSTALLDIR
  298. ifdef inlinux
  299. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  300. else
  301. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  302. endif
  303. endif
  304. # set the directory where to install the units.
  305. ifndef UNITINSTALLDIR
  306. UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
  307. ifdef UNITSUBDIR
  308. UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
  309. endif
  310. endif
  311. # Where to install shared libraries
  312. ifndef LIBINSTALLDIR
  313. ifdef inlinux
  314. LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  315. else
  316. LIBINSTALLDIR=$(UNITINSTALLDIR)
  317. endif
  318. endif
  319. # Where the source files will be stored
  320. ifndef SOURCEINSTALLDIR
  321. ifdef inlinux
  322. SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
  323. else
  324. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  325. endif
  326. ifdef SOURCESUBDIR
  327. SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
  328. endif
  329. endif
  330. # Where the doc files will be stored
  331. ifndef DOCINSTALLDIR
  332. ifdef inlinux
  333. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
  334. else
  335. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  336. endif
  337. endif
  338. # Where the some extra (data)files will be stored
  339. ifndef DATAINSTALLDIR
  340. DATAINSTALLDIR=$(BASEINSTALLDIR)
  341. endif
  342. #####################################################################
  343. # Redirection
  344. #####################################################################
  345. ifndef REDIRFILE
  346. REDIRFILE=log
  347. endif
  348. ifdef REDIR
  349. ifndef inlinux
  350. override FPC=redir -eo $(FPC)
  351. endif
  352. # set the verbosity to max
  353. override FPCOPT+=-va
  354. override REDIR:= >> $(REDIRFILE)
  355. endif
  356. #####################################################################
  357. # Standard rules
  358. #####################################################################
  359. debug: $(addsuffix _debug,$(DIROBJECTS))
  360. examples: $(addsuffix _examples,$(DIROBJECTS))
  361. test: $(addsuffix _test,$(DIROBJECTS))
  362. smart: $(addsuffix _smart,$(DIROBJECTS))
  363. shared: $(addsuffix _shared,$(DIROBJECTS))
  364. showinstall: $(addsuffix _showinstall,text)
  365. install: $(addsuffix _install,text)
  366. sourceinstall: fpc_sourceinstall
  367. zipinstall: fpc_zipinstall
  368. zipsourceinstall: fpc_zipsourceinstall
  369. clean: $(addsuffix _clean,$(DIROBJECTS))
  370. distclean: $(addsuffix _distclean,$(DIROBJECTS))
  371. cleanall: $(addsuffix _cleanall,$(DIROBJECTS))
  372. require: $(addsuffix _require,$(DIROBJECTS))
  373. .PHONY: debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
  374. #####################################################################
  375. # SourceInstall rules
  376. #####################################################################
  377. .PHONY: fpc_sourceinstall
  378. ifndef SOURCETOPDIR
  379. SOURCETOPDIR=$(BASEDIR)
  380. endif
  381. fpc_sourceinstall: clean
  382. $(MKDIR) $(SOURCEINSTALLDIR)
  383. $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
  384. #####################################################################
  385. # Zip
  386. #####################################################################
  387. .PHONY: fpc_zipinstall
  388. # Create suffix to add
  389. ifndef PACKAGESUFFIX
  390. PACKAGESUFFIX=$(OS_TARGET)
  391. ifeq ($(OS_TARGET),go32v2)
  392. PACKAGESUFFIX=go32
  393. endif
  394. ifeq ($(OS_TARGET),win32)
  395. PACKAGESUFFIX=w32
  396. endif
  397. endif
  398. # Temporary path to pack a file
  399. ifndef PACKDIR
  400. ifndef inlinux
  401. PACKDIR=$(BASEDIR)/pack_tmp
  402. else
  403. PACKDIR=/tmp/fpc-pack
  404. endif
  405. endif
  406. # Maybe create default zipname from packagename
  407. ifndef ZIPNAME
  408. ifdef PACKAGENAME
  409. ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
  410. endif
  411. endif
  412. # Use tar by default under linux
  413. ifndef USEZIP
  414. ifdef inlinux
  415. USETAR=1
  416. endif
  417. endif
  418. fpc_zipinstall:
  419. ifndef ZIPNAME
  420. @$(ECHO) "Please specify ZIPNAME!"
  421. @exit 1
  422. else
  423. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  424. ifdef USETAR
  425. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
  426. cd $(PACKDIR) ; $(TARPROG) c$(TAROPT) --file $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
  427. else
  428. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
  429. cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
  430. endif
  431. $(DELTREE) $(PACKDIR)
  432. endif
  433. .PHONY: fpc_zipsourceinstall
  434. fpc_zipsourceinstall:
  435. $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
  436. #####################################################################
  437. # Directories
  438. #####################################################################
  439. OBJECTDIRFAKE=1
  440. OBJECTDIRTEXT=1
  441. # Dir fake
  442. ifdef OBJECTDIRFAKE
  443. .PHONY: fake_all fake_debug fake_examples fake_test fake_smart fake_shared fake_showinstall fake_install fake_sourceinstall fake_zipinstall fake_zipsourceinstall fake_clean fake_distclean fake_cleanall fake_require fake_info
  444. fake_all:
  445. $(MAKE) -C fake all
  446. fake_debug:
  447. $(MAKE) -C fake debug
  448. fake_examples:
  449. $(MAKE) -C fake examples
  450. fake_test:
  451. $(MAKE) -C fake test
  452. fake_smart:
  453. $(MAKE) -C fake smart
  454. fake_shared:
  455. $(MAKE) -C fake shared
  456. fake_showinstall:
  457. $(MAKE) -C fake showinstall
  458. fake_install:
  459. $(MAKE) -C fake install
  460. fake_sourceinstall:
  461. $(MAKE) -C fake sourceinstall
  462. fake_zipinstall:
  463. $(MAKE) -C fake zipinstall
  464. fake_zipsourceinstall:
  465. $(MAKE) -C fake zipsourceinstall
  466. fake_clean:
  467. $(MAKE) -C fake clean
  468. fake_distclean:
  469. $(MAKE) -C fake distclean
  470. fake_cleanall:
  471. $(MAKE) -C fake cleanall
  472. fake_require:
  473. $(MAKE) -C fake require
  474. fake_info:
  475. $(MAKE) -C fake info
  476. endif
  477. # Dir text
  478. ifdef OBJECTDIRTEXT
  479. .PHONY: text_all text_debug text_examples text_test text_smart text_shared text_showinstall text_install text_sourceinstall text_zipinstall text_zipsourceinstall text_clean text_distclean text_cleanall text_require text_info
  480. text_all:
  481. $(MAKE) -C text all
  482. text_debug:
  483. $(MAKE) -C text debug
  484. text_examples:
  485. $(MAKE) -C text examples
  486. text_test:
  487. $(MAKE) -C text test
  488. text_smart:
  489. $(MAKE) -C text smart
  490. text_shared:
  491. $(MAKE) -C text shared
  492. text_showinstall:
  493. $(MAKE) -C text showinstall
  494. text_install:
  495. $(MAKE) -C text install
  496. text_sourceinstall:
  497. $(MAKE) -C text sourceinstall
  498. text_zipinstall:
  499. $(MAKE) -C text zipinstall
  500. text_zipsourceinstall:
  501. $(MAKE) -C text zipsourceinstall
  502. text_clean:
  503. $(MAKE) -C text clean
  504. text_distclean:
  505. $(MAKE) -C text distclean
  506. text_cleanall:
  507. $(MAKE) -C text cleanall
  508. text_require:
  509. $(MAKE) -C text require
  510. text_info:
  511. $(MAKE) -C text info
  512. endif
  513. #####################################################################
  514. # Local Makefile
  515. #####################################################################
  516. ifneq ($(wildcard fpcmake.loc),)
  517. include fpcmake.loc
  518. endif
  519. #####################################################################
  520. # Users rules
  521. #####################################################################
  522. .PHONY: gdb full fullgdb clean_compiler
  523. all:
  524. $(MAKE) -C text all
  525. gdb:
  526. $(MAKE) -C text all GDB=1
  527. full:
  528. $(MAKE) -C text all FULL=1 "NEEDOPT+=-Sg -dGDB -dBROWSERCOL"
  529. fullgdb:
  530. $(MAKE) -C text all FULL=1 GDB=1 "NEEDOPT+=-Sg -dGDB -dBROWSERCOL"
  531. #
  532. # Misc
  533. #
  534. clean_compiler:
  535. $(MAKE) -C ../compiler clean