fpcmake.inc 63 KB

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