Makefile 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. #
  2. # Makefile generated by fpcmake v0.99.13 [2000/01/06]
  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. #####################################################################
  54. # FPC version/target Detection
  55. #####################################################################
  56. # What compiler to use ?
  57. ifndef FPC
  58. # Compatibility with old makefiles
  59. ifdef PP
  60. FPC=$(PP)
  61. else
  62. ifdef inOS2
  63. FPC=ppos2$(EXEEXT)
  64. else
  65. FPC=ppc386$(EXEEXT)
  66. endif
  67. endif
  68. endif
  69. # Target OS
  70. ifndef OS_TARGET
  71. OS_TARGET:=$(shell $(FPC) -iTO)
  72. endif
  73. # Source OS
  74. ifndef OS_SOURCE
  75. OS_SOURCE:=$(shell $(FPC) -iSO)
  76. endif
  77. # Target CPU
  78. ifndef CPU_TARGET
  79. CPU_TARGET:=$(shell $(FPC) -iTP)
  80. endif
  81. # Source CPU
  82. ifndef CPU_SOURCE
  83. CPU_SOURCE:=$(shell $(FPC) -iSP)
  84. endif
  85. # FPC version
  86. ifndef FPC_VERSION
  87. FPC_VERSION:=$(shell $(FPC) -iV)
  88. endif
  89. export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
  90. # Test FPCDIR to look if the RTL dir exists
  91. ifdef FPCDIR
  92. override FPCDIR:=$(subst \,/,$(FPCDIR))
  93. ifeq ($(wildcard $(FPCDIR)/rtl),)
  94. override FPCDIR=wrong
  95. endif
  96. else
  97. override FPCDIR=wrong
  98. endif
  99. # Detect FPCDIR
  100. ifeq ($(FPCDIR),wrong)
  101. ifdef inlinux
  102. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  103. else
  104. override FPCDIR:=$(subst /$(FPC)$(EXEEXT),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC)$(EXEEXT),$(SEARCHPATH))))))
  105. endif
  106. endif
  107. ifndef PACKAGEDIR
  108. PACKAGEDIR=$(FPCDIR)/packages
  109. endif
  110. ifndef COMPONENTDIR
  111. COMPONENTDIR=$(FPCDIR)/components
  112. endif
  113. # Create units dir
  114. ifneq ($(FPCDIR),.)
  115. UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
  116. endif
  117. # Check if the dirs really exists, else turn it off
  118. ifeq ($(wildcard $(UNITSDIR)),)
  119. UNITSDIR=
  120. endif
  121. ifeq ($(wildcard $(PACKAGEDIR)),)
  122. PACKAGEDIR=
  123. endif
  124. ifeq ($(wildcard $(COMPONENTDIR)),)
  125. COMPONENTDIR=
  126. endif
  127. #####################################################################
  128. # Default Settings
  129. #####################################################################
  130. # Release ? Then force OPT and don't use extra opts via commandline
  131. ifndef REDIRFILE
  132. REDIRFILE=log
  133. endif
  134. ifdef REDIR
  135. ifndef inlinux
  136. override FPC=redir -eo $(FPC)
  137. endif
  138. # set the verbosity to max
  139. override OPT+=-va
  140. override REDIR:= >> $(REDIRFILE)
  141. endif
  142. #####################################################################
  143. # User Settings
  144. #####################################################################
  145. # Targets
  146. override DIROBJECTS+=$(wildcard linux examples build)
  147. # Clean
  148. # Install
  149. ZIPTARGET=install
  150. # Defaults
  151. # Directories
  152. # Packages
  153. override PACKAGES+=rtl
  154. ifneq ($(wildcard $(FPCDIR)/rtl),)
  155. ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
  156. PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
  157. else
  158. PACKAGEDIR_RTL=$(FPCDIR)/rtl
  159. endif
  160. UNITDIR_RTL=$(PACKAGEDIR_RTL)
  161. else
  162. PACKAGEDIR_RTL=
  163. ifneq ($(wildcard $(UNITSDIR)/rtl),)
  164. ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
  165. UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
  166. else
  167. UNITDIR_RTL=$(UNITSDIR)/rtl
  168. endif
  169. else
  170. UNITDIR_RTL=
  171. endif
  172. endif
  173. ifdef UNITDIR_RTL
  174. override NEEDUNITDIR+=$(UNITDIR_RTL)
  175. endif
  176. # Libraries
  177. #####################################################################
  178. # Standard rules
  179. #####################################################################
  180. all: $(addsuffix _all,$(OS_TARGET))
  181. debug: $(addsuffix _debug,$(OS_TARGET))
  182. test: $(addsuffix _test,$(OS_TARGET))
  183. smart: $(addsuffix _smart,$(OS_TARGET))
  184. shared: $(addsuffix _shared,$(OS_TARGET))
  185. showinstall: $(addsuffix _showinstall,$(OS_TARGET))
  186. install: $(addsuffix _install,$(OS_TARGET))
  187. sourceinstall: $(addsuffix _sourceinstall,$(OS_TARGET))
  188. zipinstall: $(addsuffix _zipinstall,$(OS_TARGET))
  189. zipinstalladd: $(addsuffix _zipinstalladd,$(OS_TARGET))
  190. clean: $(addsuffix _clean,$(DIROBJECTS))
  191. cleanall: $(addsuffix _cleanall,$(DIROBJECTS))
  192. require: $(addsuffix _require,$(DIROBJECTS))
  193. .PHONY: all debug test smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall require
  194. ifdef PACKAGERTL
  195. ifneq ($(wildcard $(PACKAGEDIR_RTL)),)
  196. ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
  197. override COMPILEPACKAGES+=rtl
  198. rtl_package:
  199. $(MAKE) -C $(PACKAGEDIR_RTL) all
  200. endif
  201. endif
  202. endif
  203. PACKAGERTL=1
  204. ifdef PACKAGERTL
  205. ifneq ($(wildcard $(PACKAGEDIR_RTL)),)
  206. ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
  207. override COMPILEPACKAGES+=rtl
  208. rtl_package:
  209. $(MAKE) -C $(PACKAGEDIR_RTL) all
  210. endif
  211. endif
  212. endif
  213. .PHONY: rtl_package rtl_package
  214. # Target Dirs
  215. OBJECTDIRLINUX=1
  216. OBJECTDIREXAMPLES=1
  217. OBJECTDIRBUILD=1
  218. # Dir linux
  219. ifdef OBJECTDIRLINUX
  220. .PHONY: linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_zipinstall linux_zipinstalladd linux_clean linux_cleanall linux_require linux_info
  221. linux_all:
  222. $(MAKE) -C linux all
  223. linux_debug:
  224. $(MAKE) -C linux debug
  225. linux_examples:
  226. $(MAKE) -C linux examples
  227. linux_test:
  228. $(MAKE) -C linux test
  229. linux_smart:
  230. $(MAKE) -C linux smart
  231. linux_shared:
  232. $(MAKE) -C linux shared
  233. linux_showinstall:
  234. $(MAKE) -C linux showinstall
  235. linux_install:
  236. $(MAKE) -C linux install
  237. linux_sourceinstall:
  238. $(MAKE) -C linux sourceinstall
  239. linux_zipinstall:
  240. $(MAKE) -C linux zipinstall
  241. linux_zipinstalladd:
  242. $(MAKE) -C linux zipinstalladd
  243. linux_clean:
  244. $(MAKE) -C linux clean
  245. linux_cleanall:
  246. $(MAKE) -C linux cleanall
  247. linux_require:
  248. $(MAKE) -C linux require
  249. linux_info:
  250. $(MAKE) -C linux info
  251. endif
  252. # Dir examples
  253. ifdef OBJECTDIREXAMPLES
  254. .PHONY: examples_all examples_debug examples_examples examples_test examples_smart examples_shared examples_showinstall examples_install examples_sourceinstall examples_zipinstall examples_zipinstalladd examples_clean examples_cleanall examples_require examples_info
  255. examples_all:
  256. $(MAKE) -C examples all
  257. examples_debug:
  258. $(MAKE) -C examples debug
  259. examples_examples:
  260. $(MAKE) -C examples examples
  261. examples_test:
  262. $(MAKE) -C examples test
  263. examples_smart:
  264. $(MAKE) -C examples smart
  265. examples_shared:
  266. $(MAKE) -C examples shared
  267. examples_showinstall:
  268. $(MAKE) -C examples showinstall
  269. examples_install:
  270. $(MAKE) -C examples install
  271. examples_sourceinstall:
  272. $(MAKE) -C examples sourceinstall
  273. examples_zipinstall:
  274. $(MAKE) -C examples zipinstall
  275. examples_zipinstalladd:
  276. $(MAKE) -C examples zipinstalladd
  277. examples_clean:
  278. $(MAKE) -C examples clean
  279. examples_cleanall:
  280. $(MAKE) -C examples cleanall
  281. examples_require:
  282. $(MAKE) -C examples require
  283. examples_info:
  284. $(MAKE) -C examples info
  285. endif
  286. # Dir build
  287. ifdef OBJECTDIRBUILD
  288. .PHONY: build_all build_debug build_examples build_test build_smart build_shared build_showinstall build_install build_sourceinstall build_zipinstall build_zipinstalladd build_clean build_cleanall build_require build_info
  289. build_all:
  290. $(MAKE) -C build all
  291. build_debug:
  292. $(MAKE) -C build debug
  293. build_examples:
  294. $(MAKE) -C build examples
  295. build_test:
  296. $(MAKE) -C build test
  297. build_smart:
  298. $(MAKE) -C build smart
  299. build_shared:
  300. $(MAKE) -C build shared
  301. build_showinstall:
  302. $(MAKE) -C build showinstall
  303. build_install:
  304. $(MAKE) -C build install
  305. build_sourceinstall:
  306. $(MAKE) -C build sourceinstall
  307. build_zipinstall:
  308. $(MAKE) -C build zipinstall
  309. build_zipinstalladd:
  310. $(MAKE) -C build zipinstalladd
  311. build_clean:
  312. $(MAKE) -C build clean
  313. build_cleanall:
  314. $(MAKE) -C build cleanall
  315. build_require:
  316. $(MAKE) -C build require
  317. build_info:
  318. $(MAKE) -C build info
  319. endif
  320. #####################################################################
  321. # Users rules
  322. #####################################################################
  323. .PHONY: examples
  324. examples:
  325. $(MAKE) examples_all