fpcmake.inc 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157
  1. {$ifdef Delphi}
  2. const fpcmakeini : array[0..196] of string[240]=(
  3. {$else Delphi}
  4. const fpcmakeini : array[0..196,1..240] of char=(
  5. {$endif Delphi}
  6. ';'#010+
  7. '; Templates used by fpcmake to create a Makefile from Makefile.fpc'#010+
  8. ';'#010+
  9. #010+
  10. '[defines]'#010+
  11. '#####################################################################'#010+
  12. '# Misc defines to be used by anyone'#010+
  13. '####################################################','################'+
  14. '#'#010+
  15. #010+
  16. '# OS categories'#010+
  17. 'BSDs = freebsd netbsd openbsd darwin'#010+
  18. 'UNIXs = linux $(BSDs) sunos qnx'#010+
  19. #010+
  20. '#Empty target for rules that always should run. Needed if'#010+
  21. '#the target is non-phoney, and there is non-phony prereqisites.'#010+
  22. '#Then add FOR','CE as an prerequisite'#010+
  23. '#See gnu make manual: 4.7 Rules without Commands or Prerequisites'#010+
  24. 'FORCE:'#010+
  25. '.PHONY: FORCE'#010+
  26. #010+
  27. '[osdetect]'#010+
  28. '#####################################################################'#010+
  29. '# Autodetect source OS (Linux or Dos or Windows N','T or OS/2 or other)'+
  30. #010+
  31. '# define inUnix when running under Unix like environment'#010+
  32. '# (Linux,FreeBSD,NetBSD,OpenBSD,Darwin,Cygwin)'#010+
  33. '# define inWinNT when running under WinNT'#010+
  34. '# define inOS2 when running under OS/2'#010+
  35. '# define inCygwin whe','n running under Cygwin32'#010+
  36. '#####################################################################'#010+
  37. #010+
  38. '# We need only / in the path also remove the current dir,'#010+
  39. '# also remove trailing /'#039's'#010+
  40. 'override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))'#010+
  41. #010+
  42. '# Det','ect unix'#010+
  43. '# Darwin is handled specially'#010+
  44. 'ifneq ($(findstring darwin,$(OSTYPE)),)'#010+
  45. 'inUnix=1 #darwin'#010+
  46. 'SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))'#010+
  47. 'else'#010+
  48. '# Determine if we'#039've a unix searchpath by looking for a ;'#010+
  49. '# that normally doesn'#039't exists i','n the unix PATH var.'#010+
  50. 'ifeq ($(findstring ;,$(PATH)),)'#010+
  51. 'inUnix=1'#010+
  52. 'SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))'#010+
  53. 'else'#010+
  54. 'SEARCHPATH:=$(subst ;, ,$(PATH))'#010+
  55. 'endif'#010+
  56. 'endif'#010+
  57. #010+
  58. '# Add path were make is located'#010+
  59. 'SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir ','$(MAKE))))'#010+
  60. #010+
  61. '# Search for PWD'#010+
  62. 'PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))'#010+
  63. 'ifeq ($(PWD),)'#010+
  64. 'PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))'#010+
  65. 'ifeq ($(PWD),)'#010+
  66. '$(error You need the GNU utils package to use this Makefile)'#010,
  67. 'else'#010+
  68. 'PWD:=$(firstword $(PWD))'#010+
  69. 'SRCEXEEXT='#010+
  70. 'endif'#010+
  71. 'else'#010+
  72. 'PWD:=$(firstword $(PWD))'#010+
  73. 'SRCEXEEXT=.exe'#010+
  74. 'endif'#010+
  75. #010+
  76. '# Detect NT - NT sets OS to Windows_NT'#010+
  77. '# Detect OS/2 - OS/2 has OS2_SHELL defined'#010+
  78. 'ifndef inUnix'#010+
  79. 'ifeq ($(OS),Windows_NT)'#010+
  80. 'inWinNT=1'#010+
  81. 'else'#010+
  82. 'ifdef ','OS2_SHELL'#010+
  83. 'inOS2=1'#010+
  84. 'endif'#010+
  85. 'endif'#010+
  86. 'else'#010+
  87. 'ifneq ($(findstring cygdrive,$(PATH)),)'#010+
  88. 'inCygWin=1'#010+
  89. 'endif'#010+
  90. 'endif'#010+
  91. #010+
  92. '# The extension of batch files / scripts'#010+
  93. 'ifdef inUnix'#010+
  94. 'SRCBATCHEXT=.sh'#010+
  95. 'else'#010+
  96. 'ifdef inOS2'#010+
  97. 'SRCBATCHEXT=.cmd'#010+
  98. 'else'#010+
  99. 'SRCBATCHEXT=.bat'#010+
  100. 'endif'#010+
  101. 'endif'#010+
  102. #010+
  103. '# ','Path Separator, the subst trick is necessary for the \ that can'#039+
  104. 't exists'#010+
  105. '# at the end of a line'#010+
  106. 'ifdef inUnix'#010+
  107. 'PATHSEP=/'#010+
  108. 'else'#010+
  109. 'PATHSEP:=$(subst /,\,/)'#010+
  110. '# cygwin bash or sh can not handle backslashs'#010+
  111. 'ifdef inCygWin'#010+
  112. 'PATHSEP=/'#010+
  113. 'endif'#010+
  114. 'endif'#010+
  115. #010+
  116. '# Base d','ir'#010+
  117. 'ifdef PWD'#010+
  118. 'BASEDIR:=$(subst \,/,$(shell $(PWD)))'#010+
  119. '# For Cygwin we need to replace /cygdrive/c/ with c:/'#010+
  120. 'ifdef inCygWin'#010+
  121. 'ifneq ($(findstring /cygdrive/,$(BASEDIR)),)'#010+
  122. 'BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))'#010+
  123. 'BASEDRIVE:=$(firstword $(sub','st /, ,$(BASENODIR)))'#010+
  124. 'BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))'#010+
  125. 'endif'#010+
  126. 'endif'#010+
  127. 'else'#010+
  128. 'BASEDIR=.'#010+
  129. 'endif'#010+
  130. #010+
  131. '# Echo is an internal command under OS/2 (and others), so it'#039's alw'+
  132. 'ays found'#010+
  133. 'ifdef inOS2'#010+
  134. 'ifndef ECHO'#010+
  135. 'ECHO:=$(strip $(','wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH'+
  136. '))))'#010+
  137. 'ifeq ($(ECHO),)'#010+
  138. 'ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))'+
  139. ')'#010+
  140. 'ifeq ($(ECHO),)'#010+
  141. 'ECHO=echo'#010+
  142. 'else'#010+
  143. 'ECHO:=$(firstword $(ECHO))'#010+
  144. 'endif'#010+
  145. 'else'#010+
  146. 'ECHO:=$(firstword $(ECHO))',#010+
  147. 'endif'#010+
  148. 'endif'#010+
  149. 'export ECHO'#010+
  150. 'endif'#010+
  151. #010+
  152. '[fpcdetect]'#010+
  153. '#####################################################################'#010+
  154. '# FPC Binary and Version Detection'#010+
  155. '#####################################################################'#010+
  156. #010+
  157. '# Compatibility with',' old makefiles'#010+
  158. 'ifndef FPC'#010+
  159. 'ifdef PP'#010+
  160. 'FPC=$(PP)'#010+
  161. 'endif'#010+
  162. 'endif'#010+
  163. #010+
  164. '# Try to detect the ppcXXX file to use by using "fpc -PB" option'#010+
  165. '# to query for the default ppcXXX the fpc executable tries. When'#010+
  166. '# fpc is not found use ppc386 by default. Also when ','fpc -PB gives'#010+
  167. '# an error ppc386 will be used.'#010+
  168. 'ifndef FPC'#010+
  169. '# check if fpc exists'#010+
  170. 'FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)'+
  171. ')))'#010+
  172. 'ifneq ($(FPCPROG),)'#010+
  173. 'FPCPROG:=$(firstword $(FPCPROG))'#010+
  174. 'FPC:=$(shell $(FPCPROG) -PB)'#010+
  175. '# Old','er fpc executables didn'#039't support it and return'#010+
  176. '# Error: Illegal processor... When found then fallback to ppc386'#010+
  177. 'ifneq ($(findstring Error,$(FPC)),)'#010+
  178. 'override FPC=ppc386'#010+
  179. 'endif'#010+
  180. 'else'#010+
  181. '# fpc binary not found, fallback to ppc386'#010+
  182. 'override FPC=ppc3','86'#010+
  183. 'endif'#010+
  184. 'endif'#010+
  185. #010+
  186. '# Get a clean executable name'#010+
  187. 'override FPC:=$(subst $(SRCEXEEXT),,$(FPC))'#010+
  188. 'override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)'#010+
  189. #010+
  190. '# FPC version'#010+
  191. 'ifndef FPC_VERSION'#010+
  192. '# For 1.1 and up we can use a single compiler call to retrieve'#010+
  193. '# all n','eeded information'#010+
  194. 'FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)'#010+
  195. 'FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))'#010+
  196. 'endif'#010+
  197. #010+
  198. 'export FPC FPC_VERSION FPC_COMPILERINFO'#010+
  199. '# CHECKDEPEND should not be exported'#010+
  200. '# This should limit multiple checks'#010+
  201. 'unexport CHEC','KDEPEND ALLDEPENDENCIES'#010+
  202. #010+
  203. '#####################################################################'#010+
  204. '# FPC Target Detection'#010+
  205. '#####################################################################'#010+
  206. #010+
  207. '# Fall back to default values if needed'#010+
  208. 'ifndef CPU_','TARGET'#010+
  209. 'ifdef CPU_TARGET_DEFAULT'#010+
  210. 'CPU_TARGET=$(CPU_TARGET_DEFAULT)'#010+
  211. 'endif'#010+
  212. 'endif'#010+
  213. 'ifndef OS_TARGET'#010+
  214. 'ifdef OS_TARGET_DEFAULT'#010+
  215. 'OS_TARGET=$(OS_TARGET_DEFAULT)'#010+
  216. 'endif'#010+
  217. 'endif'#010+
  218. #010+
  219. '# For 1.0.x we need to use extra calls to retrieve all info'#010+
  220. 'ifneq ($(words $(F','PC_COMPILERINFO)),5)'#010+
  221. 'FPC_COMPILERINFO+=$(shell $(FPC) -iSP)'#010+
  222. 'FPC_COMPILERINFO+=$(shell $(FPC) -iTP)'#010+
  223. 'FPC_COMPILERINFO+=$(shell $(FPC) -iSO)'#010+
  224. 'FPC_COMPILERINFO+=$(shell $(FPC) -iTO)'#010+
  225. 'endif'#010+
  226. #010+
  227. '# Retrieve Target/Source CPU and Target/Source OS'#010+
  228. 'ifndef',' CPU_SOURCE'#010+
  229. 'CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))'#010+
  230. 'endif'#010+
  231. 'ifndef CPU_TARGET'#010+
  232. 'CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))'#010+
  233. 'endif'#010+
  234. 'ifndef OS_SOURCE'#010+
  235. 'OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))'#010+
  236. 'endif'#010+
  237. 'ifndef OS_TARGET'#010+
  238. 'OS_TARGET:=$(word 5,$(FPC_COMPILE','RINFO))'#010+
  239. 'endif'#010+
  240. #010+
  241. '# Full name of the target, including CPU and OS'#010+
  242. 'FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)'#010+
  243. 'FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)'#010+
  244. #010+
  245. '# Cross compile flag'#010+
  246. 'ifneq ($(FULL_TARGET),$(FULL_SOURCE))'#010+
  247. 'CROSSCOMPILE=1'#010+
  248. 'endif'#010+
  249. #010+
  250. '# Check if the Ma','kefile supports this target, but not'#010+
  251. '# when the make target is to rebuild the makefile'#010+
  252. 'ifeq ($(findstring makefile,$(MAKECMDGOALS)),)'#010+
  253. 'ifeq ($(findstring $(OS_TARGET),$(MAKEFILETARGETS)),)'#010+
  254. '$(error The Makefile doesn'#039't support target $(OS_TAR','GET), please'+
  255. ' run fpcmake first)'#010+
  256. 'endif'#010+
  257. 'endif'#010+
  258. #010+
  259. #010+
  260. '# Detect BSD, since BSD uses a slightly different directory hierarchy.'+
  261. #010+
  262. 'ifneq ($(findstring $(OS_TARGET),$(BSDs)),)'#010+
  263. 'BSDhier=1'#010+
  264. 'endif'#010+
  265. #010+
  266. '# Detect Linux, will also use its own directory hierarchy.'#010+
  267. 'ife','q ($(OS_TARGET),linux)'#010+
  268. 'linuxHier=1'#010+
  269. 'endif'#010+
  270. #010+
  271. 'export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOUR'+
  272. 'CE CROSSCOMPILE'#010+
  273. #010+
  274. #010+
  275. '[fpcdircheckenv]'#010+
  276. '#####################################################################'#010+
  277. '# FPCDIR Setting'#010+
  278. '######','##############################################################'+
  279. '#'#010+
  280. #010+
  281. '# Test FPCDIR to look if the RTL dir exists'#010+
  282. 'ifdef FPCDIR'#010+
  283. 'override FPCDIR:=$(subst \,/,$(FPCDIR))'#010+
  284. 'ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)'#010+
  285. 'override FPCDIR=wrong'#010+
  286. 'en','dif'#010+
  287. 'else'#010+
  288. 'override FPCDIR=wrong'#010+
  289. 'endif'#010+
  290. #010+
  291. '# Default FPCDIR from Makefile.fpc'#010+
  292. 'ifdef DEFAULT_FPCDIR'#010+
  293. 'ifeq ($(FPCDIR),wrong)'#010+
  294. 'override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))'#010+
  295. 'ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)'#010+
  296. 'override FPCDIR=wrong',#010+
  297. 'endif'#010+
  298. 'endif'#010+
  299. 'endif'#010+
  300. #010+
  301. '[fpcdirdetect]'#010+
  302. '# Detect FPCDIR'#010+
  303. 'ifeq ($(FPCDIR),wrong)'#010+
  304. 'ifdef inUnix'#010+
  305. 'override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)'#010+
  306. 'ifeq ($(wildcard $(FPCDIR)/units),)'#010+
  307. 'override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)'#010+
  308. 'endif'#010+
  309. 'else'#010+
  310. 'override FPC','DIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(a'+
  311. 'ddsuffix /$(FPC),$(SEARCHPATH))))))'#010+
  312. 'override FPCDIR:=$(FPCDIR)/..'#010+
  313. 'ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)'#010+
  314. 'override FPCDIR:=$(FPCDIR)/..'#010+
  315. 'ifeq ($(wildcard $(addprefix $(FPC','DIR)/,rtl units)),)'#010+
  316. 'override FPCDIR:=$(BASEDIR)'#010+
  317. 'ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)'#010+
  318. 'override FPCDIR=c:/pp'#010+
  319. 'endif'#010+
  320. 'endif'#010+
  321. 'endif'#010+
  322. 'endif'#010+
  323. 'endif'#010+
  324. #010+
  325. '# Cross compiler dir'#010+
  326. 'ifndef CROSSDIR'#010+
  327. 'CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET)'#010+
  328. 'endif'#010+
  329. #010,
  330. '# Cross target dir'#010+
  331. 'ifndef CROSSTARGETDIR'#010+
  332. 'CROSSTARGETDIR=$(CROSSDIR)/$(FULL_TARGET)'#010+
  333. 'endif'#010+
  334. #010+
  335. '# Units dir, when cross compiling try first the'#010+
  336. 'ifdef CROSSCOMPILE'#010+
  337. 'UNITSDIR:=$(wildcard $(CROSSTARGETDIR)/units)'#010+
  338. 'ifeq ($(UNITSDIR),)'#010+
  339. 'UNITSDIR:=$(wildc','ard $(FPCDIR)/units/$(OS_TARGET))'#010+
  340. 'endif'#010+
  341. 'else'#010+
  342. 'UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))'#010+
  343. 'endif'#010+
  344. #010+
  345. '# Packages dir'#010+
  346. 'PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/pa'+
  347. 'ckages/extra)'#010+
  348. #010+
  349. #010+
  350. '[shelltools]'#010+
  351. '#######################','#############################################'+
  352. '#'#010+
  353. '# Shell tools'#010+
  354. '#####################################################################'#010+
  355. #010+
  356. '# Echo that can redir (must be able run in the default OS shell)'#010+
  357. 'ifndef ECHOREDIR'#010+
  358. 'ifndef inUnix'#010+
  359. 'ECHOREDIR=ec','ho'#010+
  360. 'else'#010+
  361. 'ECHOREDIR=$(ECHO)'#010+
  362. 'endif'#010+
  363. 'endif'#010+
  364. #010+
  365. '# To copy pograms'#010+
  366. 'ifndef COPY'#010+
  367. 'COPY:=$(CPPROG) -fp'#010+
  368. 'endif'#010+
  369. #010+
  370. '# Copy a whole tree'#010+
  371. 'ifndef COPYTREE'#010+
  372. 'COPYTREE:=$(CPPROG) -rfp'#010+
  373. 'endif'#010+
  374. #010+
  375. '# To move pograms'#010+
  376. 'ifndef MOVE'#010+
  377. 'MOVE:=$(MVPROG) -f'#010+
  378. 'endif'#010+
  379. #010+
  380. '# Check delete progr','am'#010+
  381. 'ifndef DEL'#010+
  382. 'DEL:=$(RMPROG) -f'#010+
  383. 'endif'#010+
  384. #010+
  385. '# Check deltree program'#010+
  386. 'ifndef DELTREE'#010+
  387. 'DELTREE:=$(RMPROG) -rf'#010+
  388. 'endif'#010+
  389. #010+
  390. '# To install files'#010+
  391. 'ifndef INSTALL'#010+
  392. 'ifdef inUnix'#010+
  393. 'INSTALL:=$(GINSTALL) -c -m 644'#010+
  394. 'else'#010+
  395. 'INSTALL:=$(COPY)'#010+
  396. 'endif'#010+
  397. 'endif'#010+
  398. #010+
  399. '# To install progra','ms'#010+
  400. 'ifndef INSTALLEXE'#010+
  401. 'ifdef inUnix'#010+
  402. 'INSTALLEXE:=$(GINSTALL) -c -m 755'#010+
  403. 'else'#010+
  404. 'INSTALLEXE:=$(COPY)'#010+
  405. 'endif'#010+
  406. 'endif'#010+
  407. #010+
  408. '# To make a directory.'#010+
  409. 'ifndef MKDIR'#010+
  410. 'MKDIR:=$(GINSTALL) -m 755 -d'#010+
  411. 'endif'#010+
  412. #010+
  413. 'export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTAL','LEXE M'+
  414. 'KDIR'#010+
  415. #010+
  416. #010+
  417. '[defaultdirs]'#010+
  418. '#####################################################################'#010+
  419. '# Default Directories'#010+
  420. '#####################################################################'#010+
  421. #010+
  422. '# Units dir'#010+
  423. 'ifdef REQUIRE_UNITSDIR'#010+
  424. 'override UNITSD','IR+=$(REQUIRE_UNITSDIR)'#010+
  425. 'endif'#010+
  426. #010+
  427. '# Units dir'#010+
  428. 'ifdef REQUIRE_PACKAGESDIR'#010+
  429. 'override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)'#010+
  430. 'endif'#010+
  431. #010+
  432. #010+
  433. '# Unixes use unix dirs with /usr/bin, /usr/lib'#010+
  434. '# When zipping use the target os default, when normal install then'#010+
  435. '# us','e the source os as default'#010+
  436. 'ifdef ZIPINSTALL'#010+
  437. '# Zipinstall'#010+
  438. 'ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)'#010+
  439. 'UNIXHier=1'#010+
  440. 'endif'#010+
  441. 'else'#010+
  442. '# Normal install'#010+
  443. 'ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)'#010+
  444. 'UNIXHier=1'#010+
  445. 'endif'#010+
  446. 'endif'#010+
  447. #010+
  448. '# When install prefix is not s','et try to use prefix'#010+
  449. 'ifndef INSTALL_PREFIX'#010+
  450. 'ifdef PREFIX'#010+
  451. 'INSTALL_PREFIX=$(PREFIX)'#010+
  452. 'endif'#010+
  453. 'endif'#010+
  454. #010+
  455. '# set the prefix directory where to install everything'#010+
  456. 'ifndef INSTALL_PREFIX'#010+
  457. 'ifdef UNIXHier'#010+
  458. 'INSTALL_PREFIX=/usr/local'#010+
  459. 'else'#010+
  460. 'ifdef INSTALL_FPCPACKAG','E'#010+
  461. 'INSTALL_BASEDIR:=/pp'#010+
  462. 'else'#010+
  463. 'INSTALL_BASEDIR:=/$(PACKAGE_NAME)'#010+
  464. 'endif'#010+
  465. 'endif'#010+
  466. 'endif'#010+
  467. 'export INSTALL_PREFIX'#010+
  468. #010+
  469. '# Export also INSTALL_SOURCESUBDIR set so it will be'#010+
  470. '# used recursively for all subdirs'#010+
  471. 'ifdef INSTALL_FPCSUBDIR'#010+
  472. 'export INSTALL_FPCSUBDIR'#010,
  473. 'endif'#010+
  474. #010+
  475. '# Where to place the resulting zip files'#010+
  476. 'ifndef DIST_DESTDIR'#010+
  477. 'DIST_DESTDIR:=$(BASEDIR)'#010+
  478. 'endif'#010+
  479. 'export DIST_DESTDIR'#010+
  480. #010+
  481. #010+
  482. '#####################################################################'#010+
  483. '# Install Directories'#010+
  484. '###########################','#########################################'+
  485. '#'#010+
  486. #010+
  487. '# set the base directory where to install everything'#010+
  488. 'ifndef INSTALL_BASEDIR'#010+
  489. 'ifdef UNIXHier'#010+
  490. 'ifdef INSTALL_FPCPACKAGE'#010+
  491. 'INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)'#010+
  492. 'else'#010+
  493. 'INSTALL_BASEDIR:=','$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)'#010+
  494. 'endif'#010+
  495. 'else'#010+
  496. 'INSTALL_BASEDIR:=$(INSTALL_PREFIX)'#010+
  497. 'endif'#010+
  498. 'endif'#010+
  499. #010+
  500. '# set the directory where to install the binaries'#010+
  501. 'ifndef INSTALL_BINDIR'#010+
  502. 'ifdef UNIXHier'#010+
  503. 'ifdef CROSSCOMPILE'#010+
  504. 'INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cr','oss/$(FULL_TARGET)/bin'#010+
  505. 'else'#010+
  506. 'INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin'#010+
  507. 'endif'#010+
  508. 'else'#010+
  509. 'ifdef CROSSCOMPILE'#010+
  510. 'INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin'#010+
  511. 'else'#010+
  512. 'INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin'#010+
  513. 'endif'#010+
  514. '# for FPC packages install the bin','aries under their os target subdir'+
  515. #010+
  516. 'ifdef INSTALL_FPCPACKAGE'#010+
  517. 'INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET)'#010+
  518. 'endif'#010+
  519. 'endif'#010+
  520. 'endif'#010+
  521. #010+
  522. '# set the directory where to install the units.'#010+
  523. 'ifndef INSTALL_UNITDIR'#010+
  524. '# If cross compiling install in the cross c','ompile directory'#010+
  525. 'ifdef CROSSCOMPILE'#010+
  526. 'INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/units'#010+
  527. 'else'#010+
  528. 'INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET)'#010+
  529. 'endif'#010+
  530. 'ifdef INSTALL_FPCPACKAGE'#010+
  531. 'ifdef PACKAGE_NAME'#010+
  532. 'INSTALL_UNITDIR:=$(INSTALL_UNIT','DIR)/$(PACKAGE_NAME)'#010+
  533. 'endif'#010+
  534. 'endif'#010+
  535. 'endif'#010+
  536. #010+
  537. '# Where to install shared libraries'#010+
  538. 'ifndef INSTALL_LIBDIR'#010+
  539. 'ifdef UNIXHier'#010+
  540. 'INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib'#010+
  541. 'else'#010+
  542. 'INSTALL_LIBDIR:=$(INSTALL_UNITDIR)'#010+
  543. 'endif'#010+
  544. 'endif'#010+
  545. #010+
  546. '# Where the source files will be sto','red'#010+
  547. 'ifndef INSTALL_SOURCEDIR'#010+
  548. 'ifdef UNIXHier'#010+
  549. 'ifdef BSDhier'#010+
  550. 'SRCPREFIXDIR=share/src'#010+
  551. 'else'#010+
  552. 'ifdef linuxHier'#010+
  553. 'SRCPREFIXDIR=share/src'#010+
  554. 'else'#010+
  555. 'SRCPREFIXDIR=src'#010+
  556. 'endif'#010+
  557. 'endif'#010+
  558. 'ifdef INSTALL_FPCPACKAGE'#010+
  559. 'ifdef INSTALL_FPCSUBDIR'#010+
  560. 'INSTALL_SOURCEDIR:=$(INSTALL_PRE','FIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSI'+
  561. 'ON)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)'#010+
  562. 'else'#010+
  563. 'INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION'+
  564. ')/$(PACKAGE_NAME)'#010+
  565. 'endif'#010+
  566. 'else'#010+
  567. 'INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACK','AGE_NAME)'+
  568. '-$(PACKAGE_VERSION)'#010+
  569. 'endif'#010+
  570. 'else'#010+
  571. 'ifdef INSTALL_FPCPACKAGE'#010+
  572. 'ifdef INSTALL_FPCSUBDIR'#010+
  573. 'INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PA'+
  574. 'CKAGE_NAME)'#010+
  575. 'else'#010+
  576. 'INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)'#010+
  577. 'end','if'#010+
  578. 'else'#010+
  579. 'INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source'#010+
  580. 'endif'#010+
  581. 'endif'#010+
  582. 'endif'#010+
  583. #010+
  584. '# Where the doc files will be stored'#010+
  585. 'ifndef INSTALL_DOCDIR'#010+
  586. 'ifdef UNIXHier'#010+
  587. 'ifdef BSDhier'#010+
  588. 'DOCPREFIXDIR=share/doc'#010+
  589. 'else'#010+
  590. 'ifdef linuxHier'#010+
  591. 'DOCPREFIXDIR=share/doc'#010+
  592. 'else'#010+
  593. 'DOCPREFI','XDIR=doc'#010+
  594. 'endif'#010+
  595. 'endif'#010+
  596. 'ifdef INSTALL_FPCPACKAGE'#010+
  597. 'INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$'+
  598. '(PACKAGE_NAME)'#010+
  599. 'else'#010+
  600. 'INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PA'+
  601. 'CKAGE_VERSION)'#010+
  602. 'endif'#010+
  603. 'else'#010+
  604. 'ifdef IN','STALL_FPCPACKAGE'#010+
  605. 'INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)'#010+
  606. 'else'#010+
  607. 'INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc'#010+
  608. 'endif'#010+
  609. 'endif'#010+
  610. 'endif'#010+
  611. #010+
  612. '# Where to install the examples, under linux we use the doc dir'#010+
  613. '# because the copytree command will creat','e a subdir itself'#010+
  614. 'ifndef INSTALL_EXAMPLEDIR'#010+
  615. 'ifdef UNIXHier'#010+
  616. 'ifdef INSTALL_FPCPACKAGE'#010+
  617. #010+
  618. 'ifdef BSDhier'#010+
  619. 'INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION'+
  620. ')/$(PACKAGE_NAME)'#010+
  621. 'else'#010+
  622. 'ifdef linuxHier'#010+
  623. 'INSTALL_EXAMPLEDIR:=$(INSTALL_DO','CDIR)/examples'#010+
  624. 'else'#010+
  625. 'INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/'+
  626. '$(PACKAGE_NAME)'#010+
  627. 'endif'#010+
  628. 'endif'#010+
  629. #010+
  630. 'else'#010+
  631. #010+
  632. 'ifdef BSDhier'#010+
  633. 'INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$'+
  634. '(PACKAGE_VERSION)'#010+
  635. 'else'#010+
  636. 'ifdef li','nuxHier'#010+
  637. 'INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKA'+
  638. 'GE_VERSION)'#010+
  639. 'else'#010+
  640. 'INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VE'+
  641. 'RSION)'#010+
  642. 'endif'#010+
  643. #010+
  644. 'endif'#010+
  645. 'endif'#010+
  646. 'else'#010+
  647. 'ifdef INSTALL_FPCPACKAGE'#010+
  648. 'INSTALL_EXAMPLEDIR:','=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)'#010+
  649. 'else'#010+
  650. 'INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples'#010+
  651. 'endif'#010+
  652. 'endif'#010+
  653. 'endif'#010+
  654. #010+
  655. '# Where the some extra (data)files will be stored'#010+
  656. 'ifndef INSTALL_DATADIR'#010+
  657. 'INSTALL_DATADIR=$(INSTALL_BASEDIR)'#010+
  658. 'endif'#010+
  659. #010+
  660. '########','############################################################'+
  661. '#'#010+
  662. '# Cross compile dirs'#010+
  663. '#####################################################################'#010+
  664. #010+
  665. 'ifdef CROSSCOMPILE'#010+
  666. '# Directory where the cross compile tools are stored.'#010+
  667. '# First check',' if they are available in FPCDIR. If no targets/ subdir'+
  668. #010+
  669. '# is found use the targets/ subdir in INSTALL_BASEDIR.'#010+
  670. 'ifndef CROSSBINDIR'#010+
  671. 'CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(FULL_SOURCE))'#010+
  672. 'ifeq ($(CROSSBINDIR),)'#010+
  673. 'CROSSBINDIR:=$(wildcard $','(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin/'+
  674. '$(FULL_SOURCE))'#010+
  675. 'endif'#010+
  676. 'endif'#010+
  677. 'else'#010+
  678. 'CROSSBINDIR='#010+
  679. 'endif'#010+
  680. #010+
  681. #010+
  682. '[dirlibc]'#010+
  683. '# On linux, try to find where libgcc.a is.'#010+
  684. 'ifeq ($(OS_SOURCE),linux)'#010+
  685. 'ifndef GCCLIBDIR'#010+
  686. 'ifeq ($(CPU_TARGET),i386)'#010+
  687. 'ifneq ($(findstring x','86_64,$(shell uname -a)),)'#010+
  688. '# try debian biarch'#010+
  689. 'ifeq ($(BINUTILSPREFIX),)'#010+
  690. 'GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`)'#010+
  691. 'else'#010+
  692. 'GCCLIBDIR:=$(shell dirname `$(BINUTILSPREFIX)gcc -print-libgcc-file-na'+
  693. 'me`)'#010+
  694. 'endif'#010+
  695. 'else'#010+
  696. 'GCCLIBDIR:=$(','shell dirname `$(BINUTILSPREFIX)gcc -print-libgcc-file-'+
  697. 'name`)'#010+
  698. 'endif'#010+
  699. 'else'#010+
  700. 'GCCLIBDIR:=$(shell dirname `$(BINUTILSPREFIX)gcc -print-libgcc-file-na'+
  701. 'me`)'#010+
  702. 'endif'#010+
  703. 'endif'#010+
  704. 'ifndef OTHERLIBDIR'#010+
  705. 'OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '#039'{ O','RS='+
  706. '" "; print $1 }'#039')'#010+
  707. 'endif'#010+
  708. 'endif'#010+
  709. #010+
  710. 'ifdef inUnix'#010+
  711. 'ifeq ($(OS_SOURCE),netbsd)'#010+
  712. 'OTHERLIBDIR+=/usr/pkg/lib'#010+
  713. 'endif'#010+
  714. 'export GCCLIBDIR OTHERLIB'#010+
  715. 'endif'#010+
  716. #010+
  717. #010+
  718. '[extensions]'#010+
  719. '#####################################################################'#010+
  720. '# Default extensi','ons'#010+
  721. '#####################################################################'#010+
  722. #010+
  723. '# Default needed extensions (Go32v2,Linux)'#010+
  724. 'BATCHEXT=.bat'#010+
  725. 'LOADEREXT=.as'#010+
  726. 'EXEEXT=.exe'#010+
  727. 'PPLEXT=.ppl'#010+
  728. 'PPUEXT=.ppu'#010+
  729. 'OEXT=.o'#010+
  730. 'ASMEXT=.s'#010+
  731. 'SMARTEXT=.sl'#010+
  732. 'STATICLIBEXT=.a'#010+
  733. 'SHAREDLIBEX','T=.so'#010+
  734. 'STATICLIBPREFIX=libp'#010+
  735. 'RSTEXT=.rst'#010+
  736. 'FPCMADE=fpcmade'#010+
  737. '#DEBUGSYMEXT #for debugger symbol files, define only for targets which'+
  738. ' has this'#010+
  739. #010+
  740. '# 1.0.x has target specific extensions for ppu files and objects'#010+
  741. 'ifeq ($(findstring 1.0.,$(FPC_VERSION))',',)'#010+
  742. '# short version for 1.1 and above - no target specific extensions'#010+
  743. #010+
  744. '# Go32v1'#010+
  745. 'ifeq ($(OS_TARGET),go32v1)'#010+
  746. 'STATICLIBPREFIX='#010+
  747. 'FPCMADE=fpcmade.v1'#010+
  748. 'PACKAGESUFFIX=v1'#010+
  749. 'endif'#010+
  750. #010+
  751. '# Go32v2'#010+
  752. 'ifeq ($(OS_TARGET),go32v2)'#010+
  753. 'STATICLIBPREFIX='#010+
  754. 'FPCMADE=fpcmade.dos'#010+
  755. 'Z','IPSUFFIX=go32'#010+
  756. 'endif'#010+
  757. #010+
  758. '# watcom'#010+
  759. 'ifeq ($(OS_TARGET),watcom)'#010+
  760. 'STATICLIBPREFIX='#010+
  761. 'FPCMADE=fpcmade.wat'#010+
  762. 'ZIPSUFFIX=watc'#010+
  763. 'OEXT=.obj'#010+
  764. 'ASMEXT=.asm'#010+
  765. 'SHAREDLIBEXT=.dll'#010+
  766. 'endif'#010+
  767. #010+
  768. '# Linux'#010+
  769. 'ifeq ($(OS_TARGET),linux)'#010+
  770. 'BATCHEXT=.sh'#010+
  771. 'EXEEXT='#010+
  772. 'HASSHAREDLIB=1'#010+
  773. 'FPCMADE=fpcmad','e.lnx'#010+
  774. 'ZIPSUFFIX=linux'#010+
  775. 'endif'#010+
  776. #010+
  777. '# FreeBSD'#010+
  778. 'ifeq ($(OS_TARGET),freebsd)'#010+
  779. 'BATCHEXT=.sh'#010+
  780. 'EXEEXT='#010+
  781. 'HASSHAREDLIB=1'#010+
  782. 'FPCMADE=fpcmade.freebsd'#010+
  783. 'ZIPSUFFIX=freebsd'#010+
  784. 'endif'#010+
  785. #010+
  786. '# NetBSD'#010+
  787. 'ifeq ($(OS_TARGET),netbsd)'#010+
  788. 'BATCHEXT=.sh'#010+
  789. 'EXEEXT='#010+
  790. 'HASSHAREDLIB=1'#010+
  791. 'FPCMADE=fpcmade.','netbsd'#010+
  792. 'ZIPSUFFIX=netbsd'#010+
  793. 'endif'#010+
  794. #010+
  795. '# OpenBSD'#010+
  796. 'ifeq ($(OS_TARGET),openbsd)'#010+
  797. 'BATCHEXT=.sh'#010+
  798. 'EXEEXT='#010+
  799. 'HASSHAREDLIB=1'#010+
  800. 'FPCMADE=fpcmade.openbsd'#010+
  801. 'ZIPSUFFIX=openbsd'#010+
  802. 'endif'#010+
  803. #010+
  804. '# Win32'#010+
  805. 'ifeq ($(OS_TARGET),win32)'#010+
  806. 'SHAREDLIBEXT=.dll'#010+
  807. 'FPCMADE=fpcmade.w32'#010+
  808. 'ZIPSUFFIX=w32'#010,
  809. 'endif'#010+
  810. #010+
  811. '# OS/2'#010+
  812. 'ifeq ($(OS_TARGET),os2)'#010+
  813. 'BATCHEXT=.cmd'#010+
  814. 'AOUTEXT=.out'#010+
  815. 'STATICLIBPREFIX='#010+
  816. 'SHAREDLIBEXT=.dll'#010+
  817. 'FPCMADE=fpcmade.os2'#010+
  818. 'ZIPSUFFIX=os2'#010+
  819. 'ECHO=echo'#010+
  820. 'endif'#010+
  821. #010+
  822. '# EMX'#010+
  823. 'ifeq ($(OS_TARGET),emx)'#010+
  824. 'BATCHEXT=.cmd'#010+
  825. 'AOUTEXT=.out'#010+
  826. 'STATICLIBPREFIX='#010+
  827. 'SHAREDLIBEXT=.d','ll'#010+
  828. 'FPCMADE=fpcmade.emx'#010+
  829. 'ZIPSUFFIX=emx'#010+
  830. 'ECHO=echo'#010+
  831. 'endif'#010+
  832. #010+
  833. '# Amiga'#010+
  834. 'ifeq ($(OS_TARGET),amiga)'#010+
  835. 'EXEEXT='#010+
  836. 'SHAREDLIBEXT=.library'#010+
  837. 'FPCMADE=fpcmade.amg'#010+
  838. 'endif'#010+
  839. #010+
  840. '# MorphOS'#010+
  841. 'ifeq ($(OS_TARGET),morphos)'#010+
  842. 'EXEEXT='#010+
  843. 'SHAREDLIBEXT=.library'#010+
  844. 'FPCMADE=fpcmade.mos'#010+
  845. 'endif'#010+
  846. #010,
  847. '# Atari'#010+
  848. 'ifeq ($(OS_TARGET),atari)'#010+
  849. 'EXEEXT=.ttp'#010+
  850. 'FPCMADE=fpcmade.ata'#010+
  851. 'endif'#010+
  852. #010+
  853. '# BeOS'#010+
  854. 'ifeq ($(OS_TARGET),beos)'#010+
  855. 'BATCHEXT=.sh'#010+
  856. 'EXEEXT='#010+
  857. 'FPCMADE=fpcmade.be'#010+
  858. 'ZIPSUFFIX=be'#010+
  859. 'endif'#010+
  860. #010+
  861. '# Solaris'#010+
  862. 'ifeq ($(OS_TARGET),sunos)'#010+
  863. 'BATCHEXT=.sh'#010+
  864. 'EXEEXT='#010+
  865. 'FPCMADE=fpcmade.su','n'#010+
  866. 'ZIPSUFFIX=sun'#010+
  867. 'endif'#010+
  868. #010+
  869. '# QNX'#010+
  870. 'ifeq ($(OS_TARGET),qnx)'#010+
  871. 'BATCHEXT=.sh'#010+
  872. 'EXEEXT='#010+
  873. 'FPCMADE=fpcmade.qnx'#010+
  874. 'ZIPSUFFIX=qnx'#010+
  875. 'endif'#010+
  876. #010+
  877. '# Netware clib'#010+
  878. 'ifeq ($(OS_TARGET),netware)'#010+
  879. 'EXEEXT=.nlm'#010+
  880. 'STATICLIBPREFIX='#010+
  881. 'FPCMADE=fpcmade.nw'#010+
  882. 'ZIPSUFFIX=nw'#010+
  883. 'endif'#010+
  884. #010+
  885. '# Netware libc',#010+
  886. 'ifeq ($(OS_TARGET),netwlibc)'#010+
  887. 'EXEEXT=.nlm'#010+
  888. 'STATICLIBPREFIX='#010+
  889. 'FPCMADE=fpcmade.nwl'#010+
  890. 'ZIPSUFFIX=nwl'#010+
  891. 'endif'#010+
  892. #010+
  893. '# MacOS'#010+
  894. 'ifeq ($(OS_TARGET),macos)'#010+
  895. 'BATCHEXT='#010+
  896. 'EXEEXT='#010+
  897. 'FPCMADE=fpcmade.macos'#010+
  898. 'ZIPSUFFIX=macos'#010+
  899. 'DEBUGSYMEXT=.xcoff'#010+
  900. 'endif'#010+
  901. #010+
  902. '# Darwin'#010+
  903. 'ifeq ($(OS_TARG','ET),darwin)'#010+
  904. 'BATCHEXT=.sh'#010+
  905. 'EXEEXT='#010+
  906. 'HASSHAREDLIB=1'#010+
  907. 'FPCMADE=fpcmade.darwin'#010+
  908. 'ZIPSUFFIX=darwin'#010+
  909. 'endif'#010+
  910. #010+
  911. 'else'#010+
  912. '# long version for 1.0.x - target specific extensions'#010+
  913. #010+
  914. '# Go32v1'#010+
  915. 'ifeq ($(OS_TARGET),go32v1)'#010+
  916. 'PPUEXT=.pp1'#010+
  917. 'OEXT=.o1'#010+
  918. 'ASMEXT=.s1'#010+
  919. 'SMARTEXT=.sl1'#010+
  920. 'STA','TICLIBEXT=.a1'#010+
  921. 'SHAREDLIBEXT=.so1'#010+
  922. 'STATICLIBPREFIX='#010+
  923. 'FPCMADE=fpcmade.v1'#010+
  924. 'PACKAGESUFFIX=v1'#010+
  925. 'endif'#010+
  926. #010+
  927. '# Go32v2'#010+
  928. 'ifeq ($(OS_TARGET),go32v2)'#010+
  929. 'STATICLIBPREFIX='#010+
  930. 'FPCMADE=fpcmade.dos'#010+
  931. 'ZIPSUFFIX=go32'#010+
  932. 'endif'#010+
  933. #010+
  934. '# watcom'#010+
  935. 'ifeq ($(OS_TARGET),watcom)'#010+
  936. 'STATICLIBPREFIX='#010,
  937. 'FPCMADE=fpcmade.dos'#010+
  938. 'ZIPSUFFIX=watcom'#010+
  939. 'endif'#010+
  940. #010+
  941. '# Linux'#010+
  942. 'ifeq ($(OS_TARGET),linux)'#010+
  943. 'BATCHEXT=.sh'#010+
  944. 'EXEEXT='#010+
  945. 'HASSHAREDLIB=1'#010+
  946. 'FPCMADE=fpcmade.lnx'#010+
  947. 'ZIPSUFFIX=linux'#010+
  948. 'endif'#010+
  949. #010+
  950. '# FreeBSD'#010+
  951. 'ifeq ($(OS_TARGET),freebsd)'#010+
  952. 'BATCHEXT=.sh'#010+
  953. 'EXEEXT='#010+
  954. 'HASSHAREDLIB=1'#010+
  955. 'FPCMADE=f','pcmade.freebsd'#010+
  956. 'ZIPSUFFIX=freebsd'#010+
  957. 'endif'#010+
  958. #010+
  959. '# NetBSD'#010+
  960. 'ifeq ($(OS_TARGET),netbsd)'#010+
  961. 'BATCHEXT=.sh'#010+
  962. 'EXEEXT='#010+
  963. 'HASSHAREDLIB=1'#010+
  964. 'FPCMADE=fpcmade.netbsd'#010+
  965. 'ZIPSUFFIX=netbsd'#010+
  966. 'endif'#010+
  967. #010+
  968. '# OpenBSD'#010+
  969. 'ifeq ($(OS_TARGET),openbsd)'#010+
  970. 'BATCHEXT=.sh'#010+
  971. 'EXEEXT='#010+
  972. 'HASSHAREDLIB=1'#010+
  973. 'FPCMADE','=fpcmade.openbsd'#010+
  974. 'ZIPSUFFIX=openbsd'#010+
  975. 'endif'#010+
  976. #010+
  977. '# Win32'#010+
  978. 'ifeq ($(OS_TARGET),win32)'#010+
  979. 'PPUEXT=.ppw'#010+
  980. 'OEXT=.ow'#010+
  981. 'ASMEXT=.sw'#010+
  982. 'SMARTEXT=.slw'#010+
  983. 'STATICLIBEXT=.aw'#010+
  984. 'SHAREDLIBEXT=.dll'#010+
  985. 'FPCMADE=fpcmade.w32'#010+
  986. 'ZIPSUFFIX=w32'#010+
  987. 'endif'#010+
  988. #010+
  989. '# OS/2'#010+
  990. 'ifeq ($(OS_TARGET),os2)'#010+
  991. 'BATCHEXT=.c','md'#010+
  992. 'PPUEXT=.ppo'#010+
  993. 'ASMEXT=.so2'#010+
  994. 'OEXT=.oo2'#010+
  995. 'AOUTEXT=.out'#010+
  996. 'SMARTEXT=.sl2'#010+
  997. 'STATICLIBPREFIX='#010+
  998. 'STATICLIBEXT=.ao2'#010+
  999. 'SHAREDLIBEXT=.dll'#010+
  1000. 'FPCMADE=fpcmade.os2'#010+
  1001. 'ZIPSUFFIX=emx'#010+
  1002. 'ECHO=echo'#010+
  1003. 'endif'#010+
  1004. #010+
  1005. '# Amiga'#010+
  1006. 'ifeq ($(OS_TARGET),amiga)'#010+
  1007. 'EXEEXT='#010+
  1008. 'PPUEXT=.ppu'#010+
  1009. 'ASMEXT=.asm'#010+
  1010. 'OEXT=.','o'#010+
  1011. 'SMARTEXT=.sl'#010+
  1012. 'STATICLIBEXT=.a'#010+
  1013. 'SHAREDLIBEXT=.library'#010+
  1014. 'FPCMADE=fpcmade.amg'#010+
  1015. 'endif'#010+
  1016. #010+
  1017. '# Atari'#010+
  1018. 'ifeq ($(OS_TARGET),atari)'#010+
  1019. 'PPUEXT=.ppu'#010+
  1020. 'ASMEXT=.s'#010+
  1021. 'OEXT=.o'#010+
  1022. 'SMARTEXT=.sl'#010+
  1023. 'STATICLIBEXT=.a'#010+
  1024. 'EXEEXT=.ttp'#010+
  1025. 'FPCMADE=fpcmade.ata'#010+
  1026. 'endif'#010+
  1027. #010+
  1028. '# BeOS'#010+
  1029. 'ifeq ($(OS_TARGET),be','os)'#010+
  1030. 'BATCHEXT=.sh'#010+
  1031. 'PPUEXT=.ppu'#010+
  1032. 'ASMEXT=.s'#010+
  1033. 'OEXT=.o'#010+
  1034. 'SMARTEXT=.sl'#010+
  1035. 'STATICLIBEXT=.a'#010+
  1036. 'EXEEXT='#010+
  1037. 'FPCMADE=fpcmade.be'#010+
  1038. 'ZIPSUFFIX=be'#010+
  1039. 'endif'#010+
  1040. #010+
  1041. '# Solaris'#010+
  1042. 'ifeq ($(OS_TARGET),sunos)'#010+
  1043. 'BATCHEXT=.sh'#010+
  1044. 'PPUEXT=.ppu'#010+
  1045. 'ASMEXT=.s'#010+
  1046. 'OEXT=.o'#010+
  1047. 'SMARTEXT=.sl'#010+
  1048. 'STATICLIBEXT=.a'#010+
  1049. 'EXEEXT='#010+
  1050. 'F','PCMADE=fpcmade.sun'#010+
  1051. 'ZIPSUFFIX=sun'#010+
  1052. 'endif'#010+
  1053. #010+
  1054. '# QNX'#010+
  1055. 'ifeq ($(OS_TARGET),qnx)'#010+
  1056. 'BATCHEXT=.sh'#010+
  1057. 'PPUEXT=.ppu'#010+
  1058. 'ASMEXT=.s'#010+
  1059. 'OEXT=.o'#010+
  1060. 'SMARTEXT=.sl'#010+
  1061. 'STATICLIBEXT=.a'#010+
  1062. 'EXEEXT='#010+
  1063. 'FPCMADE=fpcmade.qnx'#010+
  1064. 'ZIPSUFFIX=qnx'#010+
  1065. 'endif'#010+
  1066. #010+
  1067. '# Netware'#010+
  1068. 'ifeq ($(OS_TARGET),netware)'#010+
  1069. 'STATICLIBPR','EFIX='#010+
  1070. 'PPUEXT=.ppu'#010+
  1071. 'OEXT=.o'#010+
  1072. 'ASMEXT=.s'#010+
  1073. 'SMARTEXT=.sl'#010+
  1074. 'STATICLIBEXT=.a'#010+
  1075. 'SHAREDLIBEXT=.nlm'#010+
  1076. 'FPCMADE=fpcmade.nw'#010+
  1077. 'ZIPSUFFIX=nw'#010+
  1078. 'EXEEXT=.nlm'#010+
  1079. 'endif'#010+
  1080. #010+
  1081. '# Netware libc'#010+
  1082. 'ifeq ($(OS_TARGET),netwlibc)'#010+
  1083. 'STATICLIBPREFIX='#010+
  1084. 'PPUEXT=.ppu'#010+
  1085. 'OEXT=.o'#010+
  1086. 'ASMEXT=.s'#010+
  1087. 'SMARTEXT=.sl'#010+
  1088. 'ST','ATICLIBEXT=.a'#010+
  1089. 'SHAREDLIBEXT=.nlm'#010+
  1090. 'FPCMADE=fpcmade.nwl'#010+
  1091. 'ZIPSUFFIX=nwl'#010+
  1092. 'EXEEXT=.nlm'#010+
  1093. 'endif'#010+
  1094. #010+
  1095. '# MacOS'#010+
  1096. 'ifeq ($(OS_TARGET),macos)'#010+
  1097. 'BATCHEXT='#010+
  1098. 'PPUEXT=.ppu'#010+
  1099. 'ASMEXT=.s'#010+
  1100. 'OEXT=.o'#010+
  1101. 'SMARTEXT=.sl'#010+
  1102. 'STATICLIBEXT=.a'#010+
  1103. 'EXEEXT='#010+
  1104. 'DEBUGSYMEXT=.xcoff'#010+
  1105. 'FPCMADE=fpcmade.macos'#010+
  1106. 'end','if'#010+
  1107. #010+
  1108. '#end of target specific settings'#010+
  1109. 'endif'#010+
  1110. #010+
  1111. '[defaulttools]'#010+
  1112. '#####################################################################'#010+
  1113. '# Default Tools'#010+
  1114. '#####################################################################'#010+
  1115. #010+
  1116. '# Names of the binutils ','tools'#010+
  1117. 'ASNAME=$(BINUTILSPREFIX)as'#010+
  1118. 'LDNAME=$(BINUTILSPREFIX)ld'#010+
  1119. 'ARNAME=$(BINUTILSPREFIX)ar'#010+
  1120. 'RCNAME=$(BINUTILSPREFIX)rc'#010+
  1121. 'ifneq ($(findstring 1.0.,$(FPC_VERSION)),)'#010+
  1122. 'ifeq ($(OS_TARGET),win32)'#010+
  1123. 'ifeq ($(CROSSBINDIR),)'#010+
  1124. 'ASNAME=asw'#010+
  1125. 'LDNAME=ldw'#010+
  1126. 'ARNAME=arw'#010+
  1127. 'e','ndif'#010+
  1128. 'endif'#010+
  1129. 'endif'#010+
  1130. #010+
  1131. '# assembler, redefine it if cross compiling'#010+
  1132. 'ifndef ASPROG'#010+
  1133. 'ifdef CROSSBINDIR'#010+
  1134. 'ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)'#010+
  1135. 'else'#010+
  1136. 'ASPROG=$(ASNAME)'#010+
  1137. 'endif'#010+
  1138. 'endif'#010+
  1139. #010+
  1140. '# linker, but probably not used'#010+
  1141. 'ifndef LDPROG'#010+
  1142. 'ifdef CROSSBINDIR'#010+
  1143. 'LDP','ROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)'#010+
  1144. 'else'#010+
  1145. 'LDPROG=$(LDNAME)'#010+
  1146. 'endif'#010+
  1147. 'endif'#010+
  1148. #010+
  1149. '# Resource compiler'#010+
  1150. 'ifndef RCPROG'#010+
  1151. 'ifdef CROSSBINDIR'#010+
  1152. 'RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)'#010+
  1153. 'else'#010+
  1154. 'RCPROG=$(RCNAME)'#010+
  1155. 'endif'#010+
  1156. 'endif'#010+
  1157. #010+
  1158. '# Archiver'#010+
  1159. 'ifndef ARPROG'#010+
  1160. 'ifdef CR','OSSBINDIR'#010+
  1161. 'ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)'#010+
  1162. 'else'#010+
  1163. 'ARPROG=$(ARNAME)'#010+
  1164. 'endif'#010+
  1165. 'endif'#010+
  1166. #010+
  1167. '# Override defaults'#010+
  1168. 'AS=$(ASPROG)'#010+
  1169. 'LD=$(LDPROG)'#010+
  1170. 'RC=$(RCPROG)'#010+
  1171. 'AR=$(ARPROG)'#010+
  1172. #010+
  1173. '# ppas.bat / ppas.sh'#010+
  1174. 'PPAS=ppas$(SRCBATCHEXT)'#010+
  1175. #010+
  1176. '# ldconfig to rebuild .so cache'#010,
  1177. 'ifdef inUnix'#010+
  1178. 'LDCONFIG=ldconfig'#010+
  1179. 'else'#010+
  1180. 'LDCONFIG='#010+
  1181. 'endif'#010+
  1182. #010+
  1183. 'ifdef DATE'#010+
  1184. 'DATESTR:=$(shell $(DATE) +%Y%m%d)'#010+
  1185. 'else'#010+
  1186. 'DATESTR='#010+
  1187. 'endif'#010+
  1188. #010+
  1189. '# Look if UPX is found for go32v2 and win32. We can'#039't use $UPX bec'+
  1190. 'uase'#010+
  1191. '# upx uses that one itself (PFV)'#010+
  1192. 'ifndef UPXPROG'#010+
  1193. 'if','eq ($(OS_TARGET),go32v2)'#010+
  1194. 'UPXPROG:=1'#010+
  1195. 'endif'#010+
  1196. 'ifeq ($(OS_TARGET),win32)'#010+
  1197. 'UPXPROG:=1'#010+
  1198. 'endif'#010+
  1199. 'ifdef UPXPROG'#010+
  1200. 'UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)'+
  1201. ')))'#010+
  1202. 'ifeq ($(UPXPROG),)'#010+
  1203. 'UPXPROG='#010+
  1204. 'else'#010+
  1205. 'UPXPROG:=$(firstword $(UPXPROG))'#010+
  1206. 'e','ndif'#010+
  1207. 'else'#010+
  1208. 'UPXPROG='#010+
  1209. 'endif'#010+
  1210. 'endif'#010+
  1211. 'export UPXPROG'#010+
  1212. #010+
  1213. '# Zip options'#010+
  1214. 'ZIPOPT=-9'#010+
  1215. 'ZIPEXT=.zip'#010+
  1216. #010+
  1217. '# Tar options'#010+
  1218. 'ifeq ($(USETAR),bz2)'#010+
  1219. 'TAROPT=vI'#010+
  1220. 'TAREXT=.tar.bz2'#010+
  1221. 'else'#010+
  1222. 'TAROPT=vz'#010+
  1223. 'TAREXT=.tar.gz'#010+
  1224. 'endif'#010+
  1225. #010+
  1226. #010+
  1227. '[command_begin]'#010+
  1228. '#########################################','###########################'+
  1229. '#'#010+
  1230. '# Compiler Command Line'#010+
  1231. '#####################################################################'#010+
  1232. #010+
  1233. '# Load commandline OPTDEF and add FPC_CPU define, for compiling the'#010+
  1234. '# compiler this needs to be turned off'#010+
  1235. 'ifndef NO','CPUDEF'#010+
  1236. 'override FPCOPTDEF=$(CPU_TARGET)'#010+
  1237. 'endif'#010+
  1238. #010+
  1239. #010+
  1240. '# Load commandline OPT and add target and unit dir to be sure'#010+
  1241. 'ifneq ($(OS_TARGET),$(OS_SOURCE))'#010+
  1242. 'override FPCOPT+=-T$(OS_TARGET)'#010+
  1243. 'endif'#010+
  1244. #010+
  1245. 'ifeq ($(OS_SOURCE),openbsd)'#010+
  1246. 'override FPCOPT+=-FD$(NEW_BIN','UTILS_PATH)'#010+
  1247. 'endif'#010+
  1248. #010+
  1249. 'ifndef CROSSBOOTSTRAP'#010+
  1250. 'ifneq ($(BINUTILSPREFIX),)'#010+
  1251. 'override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc'#010+
  1252. 'endif'#010+
  1253. 'ifneq ($(BINUTILSPREFIX),)'#010+
  1254. 'override FPCOPT+=-Xr$(RLINKPATH)'#010+
  1255. 'endif'#010+
  1256. 'endif'#010+
  1257. #010+
  1258. '# User dirs should be first, so they are looked at ','first'#010+
  1259. 'ifdef UNITDIR'#010+
  1260. 'override FPCOPT+=$(addprefix -Fu,$(UNITDIR))'#010+
  1261. 'endif'#010+
  1262. 'ifdef LIBDIR'#010+
  1263. 'override FPCOPT+=$(addprefix -Fl,$(LIBDIR))'#010+
  1264. 'endif'#010+
  1265. 'ifdef OBJDIR'#010+
  1266. 'override FPCOPT+=$(addprefix -Fo,$(OBJDIR))'#010+
  1267. 'endif'#010+
  1268. 'ifdef INCDIR'#010+
  1269. 'override FPCOPT+=$(addprefix -','Fi,$(INCDIR))'#010+
  1270. 'endif'#010+
  1271. #010+
  1272. '# Smartlinking'#010+
  1273. 'ifdef LINKSMART'#010+
  1274. 'override FPCOPT+=-XX'#010+
  1275. 'endif'#010+
  1276. #010+
  1277. '# Smartlinking creation'#010+
  1278. 'ifdef CREATESMART'#010+
  1279. 'override FPCOPT+=-CX'#010+
  1280. 'endif'#010+
  1281. #010+
  1282. '# Debug'#010+
  1283. 'ifdef DEBUG'#010+
  1284. 'override FPCOPT+=-gl'#010+
  1285. 'override FPCOPTDEF+=DEBUG'#010+
  1286. 'endif'#010+
  1287. #010+
  1288. '# Release mode (','strip, optimize and don'#039't load fpc.cfg)'#010+
  1289. 'ifdef RELEASE'#010+
  1290. 'ifeq ($(CPU_TARGET),i386)'#010+
  1291. 'FPCCPUOPT:=-OG2p3'#010+
  1292. 'else'#010+
  1293. 'ifeq ($(CPU_TARGET),powerpc)'#010+
  1294. 'FPCCPUOPT:=-O1'#010+
  1295. 'else'#010+
  1296. 'FPCCPUOPT:='#010+
  1297. 'endif'#010+
  1298. 'endif'#010+
  1299. 'override FPCOPT+=-Xs $(FPCCPUOPT) -n'#010+
  1300. 'override FPCOPTDEF+=RELEASE',#010+
  1301. 'endif'#010+
  1302. #010+
  1303. '# Strip'#010+
  1304. 'ifdef STRIP'#010+
  1305. 'override FPCOPT+=-Xs'#010+
  1306. 'endif'#010+
  1307. #010+
  1308. '# Optimizer (i386 only for now)'#010+
  1309. 'ifdef OPTIMIZE'#010+
  1310. 'ifeq ($(CPU_TARGET),i386)'#010+
  1311. 'override FPCOPT+=-OG2p3'#010+
  1312. 'endif'#010+
  1313. 'endif'#010+
  1314. #010+
  1315. '# Verbose settings (warning,note,info)'#010+
  1316. 'ifdef VERBOSE'#010+
  1317. 'override FPCOPT+=-vwn','i'#010+
  1318. 'endif'#010+
  1319. #010+
  1320. '# Needed compiler options'#010+
  1321. 'ifdef COMPILER_OPTIONS'#010+
  1322. 'override FPCOPT+=$(COMPILER_OPTIONS)'#010+
  1323. 'endif'#010+
  1324. 'ifdef COMPILER_UNITDIR'#010+
  1325. 'override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))'#010+
  1326. 'endif'#010+
  1327. 'ifdef COMPILER_LIBRARYDIR'#010+
  1328. 'override FPCOPT+=$(addprefix -','Fl,$(COMPILER_LIBRARYDIR))'#010+
  1329. 'endif'#010+
  1330. 'ifdef COMPILER_OBJECTDIR'#010+
  1331. 'override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))'#010+
  1332. 'endif'#010+
  1333. 'ifdef COMPILER_INCLUDEDIR'#010+
  1334. 'override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))'#010+
  1335. 'endif'#010+
  1336. #010+
  1337. '# Cross compiler utils'#010+
  1338. 'ifdef C','ROSSBINDIR'#010+
  1339. 'override FPCOPT+=-FD$(CROSSBINDIR)'#010+
  1340. 'endif'#010+
  1341. #010+
  1342. '# Target dirs and the prefix to use for clean/install'#010+
  1343. 'ifdef COMPILER_TARGETDIR'#010+
  1344. 'override FPCOPT+=-FE$(COMPILER_TARGETDIR)'#010+
  1345. 'ifeq ($(COMPILER_TARGETDIR),.)'#010+
  1346. 'override TARGETDIRPREFIX='#010+
  1347. 'else'#010+
  1348. 'over','ride TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/'#010+
  1349. 'endif'#010+
  1350. 'endif'#010+
  1351. #010+
  1352. '# Unit target dir'#010+
  1353. 'ifdef COMPILER_UNITTARGETDIR'#010+
  1354. 'override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)'#010+
  1355. 'ifeq ($(COMPILER_UNITTARGETDIR),.)'#010+
  1356. 'override UNITTARGETDIRPREFIX='#010+
  1357. 'else'#010+
  1358. 'override UNITTARGETD','IRPREFIX=$(COMPILER_UNITTARGETDIR)/'#010+
  1359. 'endif'#010+
  1360. 'else'#010+
  1361. 'ifdef COMPILER_TARGETDIR'#010+
  1362. 'override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)'#010+
  1363. 'override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)'#010+
  1364. 'endif'#010+
  1365. 'endif'#010+
  1366. #010+
  1367. '# Temporary hack to add HASUNIX define for linux 1.0.','6 compiler'#010+
  1368. 'ifeq ($(OS_TARGET),linux)'#010+
  1369. 'ifeq ($(FPC_VERSION),1.0.6)'#010+
  1370. 'override FPCOPTDEF+=HASUNIX'#010+
  1371. 'endif'#010+
  1372. 'endif'#010+
  1373. #010+
  1374. '[command_libc]'#010+
  1375. '# Add GCC lib path if asked'#010+
  1376. 'ifdef GCCLIBDIR'#010+
  1377. 'override FPCOPT+=-Fl$(GCCLIBDIR)'#010+
  1378. 'endif'#010+
  1379. 'ifdef OTHERLIBDIR'#010+
  1380. 'override FPCOPT+=$','(addprefix -Fl,$(OTHERLIBDIR))'#010+
  1381. 'endif'#010+
  1382. #010+
  1383. #010+
  1384. '[command_end]'#010+
  1385. '# Add commandline options last so they can override'#010+
  1386. 'ifdef OPT'#010+
  1387. 'override FPCOPT+=$(OPT)'#010+
  1388. 'endif'#010+
  1389. #010+
  1390. '# Add defines from FPCOPTDEF to FPCOPT'#010+
  1391. 'ifdef FPCOPTDEF'#010+
  1392. 'override FPCOPT+=$(addprefix -d,$(FPCOP','TDEF))'#010+
  1393. 'endif'#010+
  1394. #010+
  1395. '# Was a config file specified ?'#010+
  1396. 'ifdef CFGFILE'#010+
  1397. 'override FPCOPT+=@$(CFGFILE)'#010+
  1398. 'endif'#010+
  1399. #010+
  1400. '# Use the environment to pass commandline options?'#010+
  1401. 'ifdef USEENV'#010+
  1402. 'override FPCEXTCMD:=$(FPCOPT)'#010+
  1403. 'override FPCOPT:=!FPCEXTCMD'#010+
  1404. 'export FPCEXTCMD'#010+
  1405. 'endif',#010+
  1406. #010+
  1407. '# Compiler commandline'#010+
  1408. 'override COMPILER:=$(FPC) $(FPCOPT)'#010+
  1409. #010+
  1410. '# also call ppas if with command option -s'#010+
  1411. '# but only if the FULL_SOURCE and FULL_TARGET are equal'#010+
  1412. 'ifeq (,$(findstring -s ,$(COMPILER)))'#010+
  1413. 'EXECPPAS='#010+
  1414. 'else'#010+
  1415. 'ifeq ($(FULL_SOURCE),$(FUL','L_TARGET))'#010+
  1416. 'EXECPPAS:=@$(PPAS)'#010+
  1417. 'endif'#010+
  1418. 'endif'#010+
  1419. #010+
  1420. #010+
  1421. '[loaderrules]'#010+
  1422. '#####################################################################'#010+
  1423. '# Loaders'#010+
  1424. '#####################################################################'#010+
  1425. #010+
  1426. '.PHONY: fpc_loaders'#010+
  1427. #010+
  1428. 'ifneq ($(T','ARGET_LOADERS),)'#010+
  1429. 'override ALLTARGET+=fpc_loaders'#010+
  1430. 'override CLEANTARGET+=fpc_loaders_clean'#010+
  1431. 'override INSTALLTARGET+=fpc_loaders_install'#010+
  1432. #010+
  1433. 'override LOADEROFILES:=$(addsuffix $(OEXT),$(TARGET_LOADERS))'#010+
  1434. 'endif'#010+
  1435. #010+
  1436. '%$(OEXT): %$(LOADEREXT)'#010+
  1437. ' $(AS)',' -o $*$(OEXT) $<'#010+
  1438. #010+
  1439. 'fpc_loaders: $(LOADEROFILES)'#010+
  1440. #010+
  1441. 'fpc_loaders_clean:'#010+
  1442. ' -$(DEL) $(LOADEROFILES)'#010+
  1443. #010+
  1444. 'fpc_loaders_install:'#010+
  1445. ' $(MKDIR) $(INSTALL_UNITDIR)'#010+
  1446. ' $(INSTALL) $(LOADEROFILES) $(INSTALL_UNITDIR)'#010+
  1447. #010+
  1448. #010+
  1449. '[unitrules]'#010+
  1450. '###############','#####################################################'+
  1451. '#'#010+
  1452. '# Units'#010+
  1453. '#####################################################################'#010+
  1454. #010+
  1455. '.PHONY: fpc_units'#010+
  1456. #010+
  1457. 'ifneq ($(TARGET_UNITS),)'#010+
  1458. 'override ALLTARGET+=fpc_units'#010+
  1459. #010+
  1460. 'override UNITPPUFILES=$(addsuff','ix $(PPUEXT),$(TARGET_UNITS))'#010+
  1461. 'override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITU'+
  1462. 'NITS))'#010+
  1463. 'override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)'#010+
  1464. 'override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)'#010+
  1465. 'end','if'#010+
  1466. #010+
  1467. 'fpc_units: $(UNITPPUFILES)'#010+
  1468. #010+
  1469. #010+
  1470. '[exerules]'#010+
  1471. '#####################################################################'#010+
  1472. '# Exes'#010+
  1473. '#####################################################################'#010+
  1474. #010+
  1475. '.PHONY: fpc_exes'#010+
  1476. #010+
  1477. 'ifneq ($(TARGET_PROGRAMS),)'#010+
  1478. 'ov','erride EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS))'#010+
  1479. 'override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefi'+
  1480. 'x $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS)))'#010+
  1481. #010+
  1482. 'override ALLTARGET+=fpc_exes'#010+
  1483. 'override INS','TALLEXEFILES+=$(EXEFILES)'#010+
  1484. 'override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)'#010+
  1485. 'ifeq ($(OS_TARGET),os2)'#010+
  1486. 'override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))'#010+
  1487. 'endif'#010+
  1488. 'ifeq ($(OS_TARGET),emx)'#010+
  1489. 'override CLEANEXEFILES+=$(addsuffix $(AOUTEX','T),$(TARGET_PROGRAMS))'#010+
  1490. 'endif'#010+
  1491. 'endif'#010+
  1492. #010+
  1493. 'fpc_exes: $(EXEFILES)'#010+
  1494. #010+
  1495. #010+
  1496. '[rstrules]'#010+
  1497. '#####################################################################'#010+
  1498. '# Resource strings'#010+
  1499. '#####################################################################'#010+
  1500. #010+
  1501. 'ifdef TAR','GET_RSTS'#010+
  1502. 'override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))'#010+
  1503. #010+
  1504. 'override CLEANRSTFILES+=$(RSTFILES)'#010+
  1505. 'endif'#010+
  1506. #010+
  1507. #010+
  1508. '[examplerules]'#010+
  1509. '#####################################################################'#010+
  1510. '# Examples'#010+
  1511. '##################################','##################################'+
  1512. '#'#010+
  1513. #010+
  1514. '.PHONY: fpc_examples'#010+
  1515. #010+
  1516. 'ifneq ($(TARGET_EXAMPLES),)'#010+
  1517. 'HASEXAMPLES=1'#010+
  1518. 'override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMP'+
  1519. 'LES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .lpr,$(TARGET_',
  1520. 'EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES)))'#010+
  1521. 'override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))'#010+
  1522. 'override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addp'+
  1523. 'refix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(T','ARGET_EXAMPL'+
  1524. 'ES)))'#010+
  1525. #010+
  1526. 'override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)'#010+
  1527. 'ifeq ($(OS_TARGET),os2)'#010+
  1528. 'override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))'#010+
  1529. 'endif'#010+
  1530. 'ifeq ($(OS_TARGET),emx)'#010+
  1531. 'override CLEANEXEFILES+=$(addsuffix $(AOUTE','XT),$(TARGET_EXAMPLES))'#010+
  1532. 'endif'#010+
  1533. 'endif'#010+
  1534. 'ifneq ($(TARGET_EXAMPLEDIRS),)'#010+
  1535. 'HASEXAMPLES=1'#010+
  1536. 'endif'#010+
  1537. #010+
  1538. 'fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIR'+
  1539. 'S))'#010+
  1540. #010+
  1541. #010+
  1542. '[compilerules]'#010+
  1543. '#############################################################','#######'+
  1544. '#'#010+
  1545. '# General compile rules'#010+
  1546. '#####################################################################'#010+
  1547. #010+
  1548. '.PHONY: fpc_all fpc_smart fpc_debug fpc_release'#010+
  1549. #010+
  1550. '$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)'#010+
  1551. ' @$(ECHOREDIR) Compiled > $(FPCMADE)',#010+
  1552. #010+
  1553. 'fpc_all: $(FPCMADE)'#010+
  1554. #010+
  1555. 'fpc_smart:'#010+
  1556. ' $(MAKE) all LINKSMART=1 CREATESMART=1'#010+
  1557. #010+
  1558. 'fpc_debug:'#010+
  1559. ' $(MAKE) all DEBUG=1'#010+
  1560. #010+
  1561. 'fpc_release:'#010+
  1562. ' $(MAKE) all RELEASE=1'#010+
  1563. #010+
  1564. '# General compile rules, available for both possible .pp and .pas exte'+
  1565. 'nsion','s'#010+
  1566. #010+
  1567. '.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res'#010+
  1568. #010+
  1569. '%$(PPUEXT): %.pp'#010+
  1570. ' $(COMPILER) $<'#010+
  1571. ' $(EXECPPAS)'#010+
  1572. #010+
  1573. '%$(PPUEXT): %.pas'#010+
  1574. ' $(COMPILER) $<'#010+
  1575. ' $(EXECPPAS)'#010+
  1576. #010+
  1577. '%$(EXEEXT): %.pp'#010+
  1578. ' $(COMPILER) $<'#010+
  1579. ' ',' $(EXECPPAS)'#010+
  1580. #010+
  1581. '%$(EXEEXT): %.pas'#010+
  1582. ' $(COMPILER) $<'#010+
  1583. ' $(EXECPPAS)'#010+
  1584. #010+
  1585. '%$(EXEEXT): %.lpr'#010+
  1586. ' $(COMPILER) $<'#010+
  1587. ' $(EXECPPAS)'#010+
  1588. #010+
  1589. '%$(EXEEXT): %.dpr'#010+
  1590. ' $(COMPILER) $<'#010+
  1591. ' $(EXECPPAS)'#010+
  1592. #010+
  1593. '%.res: %.rc'#010+
  1594. ' windres -i $< -o $@',#010+
  1595. #010+
  1596. '# Search paths for .ppu, .pp, .pas, .lpr, .dpr'#010+
  1597. 'vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)'#010+
  1598. 'vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)'#010+
  1599. 'vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)'#010+
  1600. 'vpath %.dpr $(COMPILE','R_SOURCEDIR) $(COMPILER_INCLUDEDIR)'#010+
  1601. 'vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)'#010+
  1602. #010+
  1603. '[libraryrules]'#010+
  1604. '#####################################################################'#010+
  1605. '# Library'#010+
  1606. '#################################################################','###'+
  1607. '#'#010+
  1608. #010+
  1609. '.PHONY: fpc_shared'#010+
  1610. #010+
  1611. 'ifndef LIB_FULLNAME'#010+
  1612. 'ifdef LIB_VERSION'#010+
  1613. 'LIB_FULLNAME=$(LIB_NAME).$(LIB_VERSION)'#010+
  1614. 'else'#010+
  1615. 'LIB_FULLNAME=$(LIB_NAME)'#010+
  1616. 'endif'#010+
  1617. 'endif'#010+
  1618. #010+
  1619. '# Default sharedlib units are all unit objects'#010+
  1620. 'ifndef LIB_SHAREDUNITS'#010+
  1621. 'LIB_SHAREDUNITS:=$(TARG','ET_UNITS)'#010+
  1622. 'endif'#010+
  1623. #010+
  1624. 'fpc_shared: all'#010+
  1625. 'ifdef HASSHAREDLIB'#010+
  1626. ' $(PPUMOVE) $(LIB_SHAREDUNITS) -o$(LIB_FULLNAME)'#010+
  1627. 'else'#010+
  1628. ' @$(ECHO) Shared Libraries not supported'#010+
  1629. 'endif'#010+
  1630. #010+
  1631. #010+
  1632. '[installrules]'#010+
  1633. '########################################################','############'+
  1634. '#'#010+
  1635. '# Install rules'#010+
  1636. '#####################################################################'#010+
  1637. #010+
  1638. '.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall'#010+
  1639. #010+
  1640. 'ifdef INSTALL_UNITS'#010+
  1641. 'override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNI','TS))'#010+
  1642. 'endif'#010+
  1643. #010+
  1644. 'ifdef INSTALL_BUILDUNIT'#010+
  1645. 'override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$'+
  1646. '(INSTALLPPUFILES))'#010+
  1647. 'endif'#010+
  1648. #010+
  1649. 'ifdef INSTALLPPUFILES'#010+
  1650. 'override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFI'+
  1651. 'LES)) $(addprefi','x $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEX'+
  1652. 'T),$(INSTALLPPUFILES)))'#010+
  1653. 'override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALL'+
  1654. 'PPUFILES))'#010+
  1655. 'override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPR'+
  1656. 'EFIX),$(INSTA','LLPPULINKFILES)))'#010+
  1657. '# Implicitly install Package.fpc'#010+
  1658. 'override INSTALL_CREATEPACKAGEFPC=1'#010+
  1659. 'endif'#010+
  1660. #010+
  1661. 'ifdef INSTALLEXEFILES'#010+
  1662. 'override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEF'+
  1663. 'ILES))'#010+
  1664. 'endif'#010+
  1665. #010+
  1666. 'fpc_install: all $(INSTALLTARGET)'#010+
  1667. 'ifdef ','INSTALLEXEFILES'#010+
  1668. ' $(MKDIR) $(INSTALL_BINDIR)'#010+
  1669. '# Compress the exes if upx is defined'#010+
  1670. 'ifdef UPXPROG'#010+
  1671. ' -$(UPXPROG) $(INSTALLEXEFILES)'#010+
  1672. 'endif'#010+
  1673. ' $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)'#010+
  1674. 'endif'#010+
  1675. 'ifdef INSTALL_CREATEPACKAGE','FPC'#010+
  1676. 'ifdef FPCMAKE'#010+
  1677. '# If the fpcpackage variable is set then create and install Package.fp'+
  1678. 'c,'#010+
  1679. '# a safety check is done if Makefile.fpc is available'#010+
  1680. 'ifdef PACKAGE_VERSION'#010+
  1681. 'ifneq ($(wildcard Makefile.fpc),)'#010+
  1682. ' $(FPCMAKE) -p -T$(OS_TARGET) Ma','kefile.fpc'#010+
  1683. ' $(MKDIR) $(INSTALL_UNITDIR)'#010+
  1684. ' $(INSTALL) Package.fpc $(INSTALL_UNITDIR)'#010+
  1685. 'endif'#010+
  1686. 'endif'#010+
  1687. 'endif'#010+
  1688. 'endif'#010+
  1689. 'ifdef INSTALLPPUFILES'#010+
  1690. ' $(MKDIR) $(INSTALL_UNITDIR)'#010+
  1691. ' $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)'#010+
  1692. 'ifne','q ($(INSTALLPPULINKFILES),)'#010+
  1693. ' $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)'#010+
  1694. 'endif'#010+
  1695. 'ifneq ($(wildcard $(LIB_FULLNAME)),)'#010+
  1696. ' $(MKDIR) $(INSTALL_LIBDIR)'#010+
  1697. ' $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)'#010+
  1698. 'ifdef inUnix'#010+
  1699. ' ',' ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)'#010+
  1700. 'endif'#010+
  1701. 'endif'#010+
  1702. 'endif'#010+
  1703. 'ifdef INSTALL_FILES'#010+
  1704. ' $(MKDIR) $(INSTALL_DATADIR)'#010+
  1705. ' $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)'#010+
  1706. 'endif'#010+
  1707. #010+
  1708. 'fpc_sourceinstall: distclean'#010+
  1709. ' $(MKDIR) $(IN','STALL_SOURCEDIR)'#010+
  1710. ' $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)'#010+
  1711. #010+
  1712. 'fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))'#010+
  1713. 'ifdef HASEXAMPLES'#010+
  1714. ' $(MKDIR) $(INSTALL_EXAMPLEDIR)'#010+
  1715. 'endif'#010+
  1716. 'ifdef EXAMPLESOURCEFILES'#010+
  1717. ' $(COPY',') $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)'#010+
  1718. 'endif'#010+
  1719. 'ifdef TARGET_EXAMPLEDIRS'#010+
  1720. ' $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EX'+
  1721. 'AMPLEDIR)'#010+
  1722. 'endif'#010+
  1723. #010+
  1724. '[distinstallrules]'#010+
  1725. '#########################################################','###########'+
  1726. '#'#010+
  1727. '# Dist Install'#010+
  1728. '#####################################################################'#010+
  1729. #010+
  1730. '.PHONY: fpc_distinstall'#010+
  1731. #010+
  1732. 'fpc_distinstall: install exampleinstall'#010+
  1733. #010+
  1734. #010+
  1735. '[zipinstallrules]'#010+
  1736. '########################################################','############'+
  1737. '#'#010+
  1738. '# Zip'#010+
  1739. '#####################################################################'#010+
  1740. #010+
  1741. '.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall'#010+
  1742. #010+
  1743. '# Temporary path to pack a file, can only use a single deep'#010+
  1744. '# subdir, because the ','deltree can'#039't see the whole tree to remove'+
  1745. #010+
  1746. 'ifndef PACKDIR'#010+
  1747. 'ifndef inUnix'#010+
  1748. 'PACKDIR=$(BASEDIR)/../fpc-pack'#010+
  1749. 'else'#010+
  1750. 'PACKDIR=/tmp/fpc-pack'#010+
  1751. 'endif'#010+
  1752. 'endif'#010+
  1753. #010+
  1754. '# Maybe create default zipname from packagename'#010+
  1755. 'ifndef ZIPNAME'#010+
  1756. 'ifdef DIST_ZIPNAME'#010+
  1757. 'ZIPNAME=$(DIST_','ZIPNAME)'#010+
  1758. 'else'#010+
  1759. 'ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX)'#010+
  1760. 'endif'#010+
  1761. 'endif'#010+
  1762. #010+
  1763. '# ZipTarget'#010+
  1764. 'ifndef ZIPTARGET'#010+
  1765. 'ifdef DIST_ZIPTARGET'#010+
  1766. 'ZIPTARGET=DIST_ZIPTARGET'#010+
  1767. 'else'#010+
  1768. 'ZIPTARGET=install'#010+
  1769. 'endif'#010+
  1770. 'endif'#010+
  1771. #010+
  1772. '# Use tar by default under linux'#010+
  1773. 'ifndef USEZIP'#010+
  1774. 'ifdef i','nUnix'#010+
  1775. 'USETAR=1'#010+
  1776. 'endif'#010+
  1777. 'endif'#010+
  1778. #010+
  1779. '# Use a wrapper script by default for Os/2'#010+
  1780. 'ifndef inUnix'#010+
  1781. 'USEZIPWRAPPER=1'#010+
  1782. 'endif'#010+
  1783. #010+
  1784. '# We need to be able to run in the current OS so fix'#010+
  1785. '# the path separator'#010+
  1786. 'ifdef USEZIPWRAPPER'#010+
  1787. 'ZIPPATHSEP=$(PATHSEP)'#010+
  1788. 'ZIPWRAPPER=$(sub','st /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT)'+
  1789. ')'#010+
  1790. 'else'#010+
  1791. 'ZIPPATHSEP=/'#010+
  1792. 'endif'#010+
  1793. #010+
  1794. '# Create commands to create the zip/tar file'#010+
  1795. 'ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))'#010+
  1796. 'ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))'#010+
  1797. 'ifdef US','ETAR'#010+
  1798. 'ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT)'#010+
  1799. 'ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) *'#010+
  1800. 'else'#010+
  1801. 'ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT)'#010+
  1802. 'ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDES'+
  1803. 'TFILE) *'#010+
  1804. 'e','ndif'#010+
  1805. #010+
  1806. 'fpc_zipinstall:'#010+
  1807. ' $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1'#010+
  1808. ' $(MKDIR) $(DIST_DESTDIR)'#010+
  1809. ' $(DEL) $(ZIPDESTFILE)'#010+
  1810. 'ifdef USEZIPWRAPPER'#010+
  1811. '# Handle gecho separate as we need to espace \ with \\'#010+
  1812. 'ifneq ($(ECH','OREDIR),echo)'#010+
  1813. ' $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPE'+
  1814. 'R)'#010+
  1815. ' $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)'+
  1816. #010+
  1817. ' $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPP'+
  1818. 'ER)'#010+
  1819. 'else'#010+
  1820. ' ',' echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)'#010+
  1821. ' echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)'#010+
  1822. ' echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)'#010+
  1823. 'endif'#010+
  1824. 'ifdef inUnix'#010+
  1825. ' /bin/sh $(ZIPWRAPPER)'#010+
  1826. 'else'#010+
  1827. ' $(ZIPWRAPPER)'#010+
  1828. 'endif'#010+
  1829. ' $(DEL) $(ZIPWRAP','PER)'#010+
  1830. 'else'#010+
  1831. ' $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)'#010+
  1832. 'endif'#010+
  1833. ' $(DELTREE) $(PACKDIR)'#010+
  1834. #010+
  1835. 'fpc_zipsourceinstall:'#010+
  1836. ' $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src'#010+
  1837. #010+
  1838. 'fpc_zipexampleinstall:'#010+
  1839. 'ifdef HASEXAMPLES'#010,
  1840. ' $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm'#010+
  1841. 'endif'#010+
  1842. #010+
  1843. 'fpc_zipdistinstall:'#010+
  1844. ' $(MAKE) fpc_zipinstall ZIPTARGET=distinstall'#010+
  1845. #010+
  1846. #010+
  1847. '[cleanrules]'#010+
  1848. '#####################################################################'#010+
  1849. '# Cle','an rules'#010+
  1850. '#####################################################################'#010+
  1851. #010+
  1852. '.PHONY: fpc_clean fpc_cleanall fpc_distclean'#010+
  1853. #010+
  1854. 'ifdef EXEFILES'#010+
  1855. 'override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES'+
  1856. '))'#010+
  1857. 'endif'#010+
  1858. #010+
  1859. 'ifdef CLEAN_UNITS'#010+
  1860. 'o','verride CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))'#010+
  1861. 'endif'#010+
  1862. #010+
  1863. 'ifdef CLEANPPUFILES'#010+
  1864. 'override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)'+
  1865. ') $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(C'+
  1866. 'LEANPPUFILES',')))'#010+
  1867. 'ifdef DEBUGSYMEXT'#010+
  1868. 'override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPP'+
  1869. 'UFILES)) '#010+
  1870. 'endif'#010+
  1871. 'override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUF'+
  1872. 'ILES))'#010+
  1873. 'override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UN','ITTARGETDIRPR'+
  1874. 'EFIX),$(CLEANPPULINKFILES)))'#010+
  1875. 'endif'#010+
  1876. #010+
  1877. 'fpc_clean: $(CLEANTARGET)'#010+
  1878. 'ifdef CLEANEXEFILES'#010+
  1879. ' -$(DEL) $(CLEANEXEFILES)'#010+
  1880. 'endif'#010+
  1881. 'ifdef CLEANPPUFILES'#010+
  1882. ' -$(DEL) $(CLEANPPUFILES)'#010+
  1883. 'endif'#010+
  1884. 'ifneq ($(CLEANPPULINKFILES),)'#010+
  1885. ' -$(DEL) $','(CLEANPPULINKFILES)'#010+
  1886. 'endif'#010+
  1887. 'ifdef CLEANRSTFILES'#010+
  1888. ' -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))'#010+
  1889. 'endif'#010+
  1890. 'ifdef CLEAN_FILES'#010+
  1891. ' -$(DEL) $(CLEAN_FILES)'#010+
  1892. 'endif'#010+
  1893. 'ifdef LIB_NAME'#010+
  1894. ' -$(DEL) $(LIB_NAME) $(LIB_FULLNAME)'#010+
  1895. 'endif',#010+
  1896. ' -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(F'+
  1897. 'PCEXTFILE) $(REDIRFILE)'#010+
  1898. ' -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)'#010+
  1899. #009#009#010+
  1900. 'fpc_distclean: clean'#010+
  1901. #010+
  1902. '# Also run clean first if targetdir is set. Unittargetdir is always'#010+
  1903. '# set i','f targetdir or unittargetdir is specified'#010+
  1904. 'ifdef COMPILER_UNITTARGETDIR'#010+
  1905. 'TARGETDIRCLEAN=fpc_clean'#010+
  1906. 'endif'#010+
  1907. #010+
  1908. 'fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)'#010+
  1909. 'ifdef CLEANEXEFILES'#010+
  1910. ' -$(DEL) $(CLEANEXEFILES)'#010+
  1911. 'endif'#010+
  1912. ' -$(DEL) *$(OEXT) *$(PPU','EXT) *$(RSTEXT) *$(ASMEXT) *$(STATICL'+
  1913. 'IBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)'#010+
  1914. ' -$(DELTREE) *$(SMARTEXT)'#010+
  1915. ' -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(F'+
  1916. 'PCEXTFILE) $(REDIRFILE)'#010+
  1917. ' -$(DEL) *_ppas$(BATCHEXT)'#010+
  1918. 'ifdef A','OUTEXT'#010+
  1919. ' -$(DEL) *$(AOUTEXT)'#010+
  1920. 'endif'#010+
  1921. 'ifdef DEBUGSYMEXT'#010+
  1922. ' -$(DEL) *$(DEBUGSYMEXT)'#010+
  1923. 'endif'#010+
  1924. #010+
  1925. #010+
  1926. '[baseinforules]'#010+
  1927. '#####################################################################'#010+
  1928. '# Base info rules'#010+
  1929. '#####################################','###############################'+
  1930. '#'#010+
  1931. #010+
  1932. '.PHONY: fpc_baseinfo'#010+
  1933. #010+
  1934. 'override INFORULES+=fpc_baseinfo'#010+
  1935. #010+
  1936. 'fpc_baseinfo:'#010+
  1937. ' @$(ECHO)'#010+
  1938. ' @$(ECHO) == Package info =='#010+
  1939. ' @$(ECHO) Package Name..... $(PACKAGE_NAME)'#010+
  1940. ' @$(ECHO) Package Vers','ion.. $(PACKAGE_VERSION)'#010+
  1941. ' @$(ECHO)'#010+
  1942. ' @$(ECHO) == Configuration info =='#010+
  1943. ' @$(ECHO)'#010+
  1944. ' @$(ECHO) FPC.......... $(FPC)'#010+
  1945. ' @$(ECHO) FPC Version.. $(FPC_VERSION)'#010+
  1946. ' @$(ECHO) Source CPU... $(CPU_SOURCE)'#010+
  1947. ' ',' @$(ECHO) Target CPU... $(CPU_TARGET)'#010+
  1948. ' @$(ECHO) Source OS.... $(OS_SOURCE)'#010+
  1949. ' @$(ECHO) Target OS.... $(OS_TARGET)'#010+
  1950. ' @$(ECHO) Full Source.. $(FULL_SOURCE)'#010+
  1951. ' @$(ECHO) Full Target.. $(FULL_TARGET)'#010+
  1952. ' @$(ECHO)',#010+
  1953. ' @$(ECHO) == Directory info =='#010+
  1954. ' @$(ECHO)'#010+
  1955. ' @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES)'#010+
  1956. ' @$(ECHO)'#010+
  1957. ' @$(ECHO) Basedir......... $(BASEDIR)'#010+
  1958. ' @$(ECHO) FPCDir.......... $(FPCDIR)'#010+
  1959. ' @$(ECHO) Cr','ossBinDir..... $(CROSSBINDIR)'#010+
  1960. ' @$(ECHO) UnitsDir........ $(UNITSDIR)'#010+
  1961. ' @$(ECHO) PackagesDir..... $(PACKAGESDIR)'#010+
  1962. ' @$(ECHO)'#010+
  1963. ' @$(ECHO) GCC library..... $(GCCLIBDIR)'#010+
  1964. ' @$(ECHO) Other library... $(OTHERLIBDIR',')'#010+
  1965. ' @$(ECHO)'#010+
  1966. ' @$(ECHO) == Tools info =='#010+
  1967. ' @$(ECHO)'#010+
  1968. ' @$(ECHO) As........ $(AS)'#010+
  1969. ' @$(ECHO) Ld........ $(LD)'#010+
  1970. ' @$(ECHO) Ar........ $(AR)'#010+
  1971. ' @$(ECHO) Rc........ $(RC)'#010+
  1972. ' @$(ECHO)'#010+
  1973. ' @$(E','CHO) Mv........ $(MVPROG)'#010+
  1974. ' @$(ECHO) Cp........ $(CPPROG)'#010+
  1975. ' @$(ECHO) Rm........ $(RMPROG)'#010+
  1976. ' @$(ECHO) GInstall.. $(GINSTALL)'#010+
  1977. ' @$(ECHO) Echo...... $(ECHO)'#010+
  1978. ' @$(ECHO) Shell..... $(SHELL)'#010+
  1979. ' @$(ECHO) D','ate...... $(DATE)'#010+
  1980. ' @$(ECHO) FPCMake... $(FPCMAKE)'#010+
  1981. ' @$(ECHO) PPUMove... $(PPUMOVE)'#010+
  1982. ' @$(ECHO) Upx....... $(UPXPROG)'#010+
  1983. ' @$(ECHO) Zip....... $(ZIPPROG)'#010+
  1984. ' @$(ECHO)'#010+
  1985. ' @$(ECHO) == Object info =='#010+
  1986. ' @','$(ECHO)'#010+
  1987. ' @$(ECHO) Target Loaders........ $(TARGET_LOADERS)'#010+
  1988. ' @$(ECHO) Target Units.......... $(TARGET_UNITS)'#010+
  1989. ' @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS)'#010+
  1990. ' @$(ECHO) Target Programs....... $(TARGET_P','ROGRAMS)'#010+
  1991. ' @$(ECHO) Target Dirs........... $(TARGET_DIRS)'#010+
  1992. ' @$(ECHO) Target Examples....... $(TARGET_EXAMPLES)'#010+
  1993. ' @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)'#010+
  1994. ' @$(ECHO)'#010+
  1995. ' @$(ECHO) Clean Units......','... $(CLEAN_UNITS)'#010+
  1996. ' @$(ECHO) Clean Files......... $(CLEAN_FILES)'#010+
  1997. ' @$(ECHO)'#010+
  1998. ' @$(ECHO) Install Units....... $(INSTALL_UNITS)'#010+
  1999. ' @$(ECHO) Install Files....... $(INSTALL_FILES)'#010+
  2000. ' @$(ECHO)'#010+
  2001. ' @$(ECHO) == ','Install info =='#010+
  2002. ' @$(ECHO)'#010+
  2003. ' @$(ECHO) DateStr.............. $(DATESTR)'#010+
  2004. ' @$(ECHO) ZipPrefix............ $(ZIPPREFIX)'#010+
  2005. ' @$(ECHO) ZipSuffix............ $(ZIPSUFFIX)'#010+
  2006. ' @$(ECHO) Install FPC Package.. $(INSTALL_','FPCPACKAGE)'#010+
  2007. ' @$(ECHO)'#010+
  2008. ' @$(ECHO) Install base dir..... $(INSTALL_BASEDIR)'#010+
  2009. ' @$(ECHO) Install binary dir... $(INSTALL_BINDIR)'#010+
  2010. ' @$(ECHO) Install library dir.. $(INSTALL_LIBDIR)'#010+
  2011. ' @$(ECHO) Install units dir.','... $(INSTALL_UNITDIR)'#010+
  2012. ' @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR)'#010+
  2013. ' @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR)'#010+
  2014. ' @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR)'#010+
  2015. ' @$(ECHO) Install data dir..','... $(INSTALL_DATADIR)'#010+
  2016. ' @$(ECHO)'#010+
  2017. ' @$(ECHO) Dist destination dir. $(DIST_DESTDIR)'#010+
  2018. ' @$(ECHO) Dist zip name........ $(DIST_ZIPNAME)'#010+
  2019. ' @$(ECHO)'#010+
  2020. #010+
  2021. '[inforules]'#010+
  2022. '##########################################################','##########'+
  2023. '#'#010+
  2024. '# Info rules'#010+
  2025. '#####################################################################'#010+
  2026. #010+
  2027. '.PHONY: fpc_info'#010+
  2028. #010+
  2029. 'fpc_info: $(INFORULES)'#010+
  2030. #010+
  2031. '[makefilerules]'#010+
  2032. '#####################################################################'#010+
  2033. '# Rebuild Makefi','le'#010+
  2034. '#####################################################################'#010+
  2035. #010+
  2036. '.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2'+
  2037. ' \'#010+
  2038. ' fpc_makefile_dirs'#010+
  2039. #010+
  2040. 'fpc_makefile:'#010+
  2041. ' $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc'#010+
  2042. #010+
  2043. 'f','pc_makefile_sub1:'#010+
  2044. 'ifdef TARGET_DIRS'#010+
  2045. ' $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGE'+
  2046. 'T_DIRS))'#010+
  2047. 'endif'#010+
  2048. 'ifdef TARGET_EXAMPLEDIRS'#010+
  2049. ' $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGE'+
  2050. 'T_EXAMPLEDIRS))'#010+
  2051. 'endif'#010+
  2052. #010+
  2053. 'f','pc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGE'+
  2054. 'T_EXAMPLEDIRS))'#010+
  2055. #010+
  2056. 'fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2'#010+
  2057. #010+
  2058. 'fpc_makefiles: fpc_makefile fpc_makefile_dirs'#010+
  2059. #010+
  2060. '[localmakefile]'#010+
  2061. '#####################################','###############################'+
  2062. '#'#010+
  2063. '# Local Makefile'#010+
  2064. '#####################################################################'#010+
  2065. #010+
  2066. 'ifneq ($(wildcard fpcmake.loc),)'#010+
  2067. 'include fpcmake.loc'#010+
  2068. 'endif'#010+
  2069. #010+
  2070. #010+
  2071. '[userrules]'#010+
  2072. '##############################################','######################'+
  2073. '#'#010+
  2074. '# Users rules'#010+
  2075. '#####################################################################'#010+
  2076. #010+
  2077. '[lclrules]'#010+
  2078. '#####################################################################'#010+
  2079. '# LCL Rules'#010+
  2080. '######################################','##############################'+
  2081. '#'#010+
  2082. #010+
  2083. '# LCL Platform'#010+
  2084. 'ifndef LCL_PLATFORM'#010+
  2085. 'ifeq ($(OS_TARGET),win32)'#010+
  2086. 'LCL_PLATFORM=win32'#010+
  2087. 'else'#010+
  2088. 'LCL_PLATFORM=gtk'#010+
  2089. 'endif'#010+
  2090. 'endif'#010+
  2091. 'export LCL_PLATFORM'#010+
  2092. #010+
  2093. '# Check if the specified LCLDIR is correct'#010+
  2094. 'ifdef LCLDIR'#010+
  2095. 'override LCLDIR:','=$(subst \,/,$(LCLDIR))'#010+
  2096. 'ifeq ($(wildcard $(LCLDIR)/units/$(LCL_PLATFORM)),)'#010+
  2097. 'override LCLDIR=wrong'#010+
  2098. 'endif'#010+
  2099. 'else'#010+
  2100. 'override LCLDIR=wrong'#010+
  2101. 'endif'#010+
  2102. #010+
  2103. '# Check if the default LCLDIR is correct'#010+
  2104. 'ifdef DEFAULT_LCLDIR'#010+
  2105. 'override LCLDIR:=$(subst \,/,$(DEFAULT_L','CLDIR))'#010+
  2106. 'ifeq ($(wildcard $(LCLDIR)/units/$(LCL_PLATFORM)),)'#010+
  2107. 'override LCLDIR=wrong'#010+
  2108. 'endif'#010+
  2109. 'endif'#010+
  2110. #010+
  2111. '# Check for development version'#010+
  2112. 'ifeq ($(LCLDIR),wrong)'#010+
  2113. 'override LCLDIR=$(subst /units/$(LCL_PLATFORM),,$(firstword $(wildcard'+
  2114. ' $(addsuffix /units/','$(LCL_PLATFORM),$(BASEDIR)/lcl $(BASEDIR)))))'#010+
  2115. 'ifeq ($(LCLDIR),)'#010+
  2116. 'override LCLDIR=wrong'#010+
  2117. 'endif'#010+
  2118. 'endif'#010+
  2119. #010+
  2120. '# Check for release version'#010+
  2121. 'ifeq ($(LCLDIR),wrong)'#010+
  2122. 'override LCLDIR=$(subst /units/$(LCL_PLATFORM),,$(firstword $(wildcard'+
  2123. ' $(addsuffix /lib/la','zarus/units/$(LCL_PLATFORM),/usr/local /usr))))'#010+
  2124. 'ifeq ($(LCLDIR),)'#010+
  2125. 'override LCLDIR=wrong'#010+
  2126. 'endif'#010+
  2127. 'endif'#010+
  2128. #010+
  2129. '# Generate dirs'#010+
  2130. 'override LCLUNITDIR:=$(wildcard $(LCLDIR)/units/$(LCL_PLATFORM) $(LCLD'+
  2131. 'IR)/units)'#010+
  2132. 'override LCLCOMPONENTDIR:=$(wildcard $(LCL','DIR)/.. $(LCLDIR)/../compo'+
  2133. 'nents $(LCLDIR)/components)'#010+
  2134. 'export LCLDIR LCLUNITDIR LCLCOMPONENTDIR'#010+
  2135. #010+
  2136. '# Add LCL dirs to paths'#010+
  2137. 'override REQUIRE_PACKAGESDIR+=$(LCLCOMPONENTDIR)'#010+
  2138. 'override COMPILER_UNITDIR+=$(LCLUNITDIR)'#010+
  2139. #010+
  2140. '[lclinforules]'#010+
  2141. '##############','######################################################'+
  2142. '#'#010+
  2143. '# LCL Info rules'#010+
  2144. '#####################################################################'#010+
  2145. 'override INFORULES+=lclinfo'#010+
  2146. #010+
  2147. '.PHONY: lclinfo'#010+
  2148. #010+
  2149. 'lclinfo:'#010+
  2150. ' @$(ECHO) == LCL info =='#010+
  2151. ' @','$(ECHO)'#010+
  2152. ' @$(ECHO) Platform............. $(LCL_PLATFORM)'#010+
  2153. ' @$(ECHO) LCLDIR............... $(LCLDIR)'#010+
  2154. ' @$(ECHO) LCL Unit dir......... $(LCLUNITDIR)'#010+
  2155. ' @$(ECHO) LCL Component dir.... $(LCLCOMPONENTDIR)'#010+
  2156. ' @$(EC','HO)'#010
  2157. );