Template.models.pp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. //
  2. // Template.models.pp
  3. //
  4. // This file defines the Makefiles that will be built to generate
  5. // models (egg, bam models computed from flt, soft, alias,
  6. // etc. sources). Unlike the other Template files, this is not based
  7. // directly on the BUILD_TYPE, but is specifically included when a
  8. // directory specifies a DIR_TYPE of "models". It uses some
  9. // Unix-specific conventions (like forward slashes as a directory
  10. // separator), so it requires either a Unix platform or a Cygwin
  11. // environment.
  12. //
  13. #if $[< $[PPREMAKE_VERSION],0.57]
  14. #error You need at least ppremake version 0.58 to build models.
  15. #endif
  16. // Search for the texattrib dir definition. This will be in the
  17. // models_topdir directory.
  18. #define texattrib_dir $[dir_type $[TEXATTRIB_DIR],models_toplevel]
  19. // Prefix $[TOPDIR]. If it wasn't defined, make a default.
  20. #if $[texattrib_dir]
  21. #define texattrib_dir $[TOPDIR]/$[texattrib_dir]
  22. #else
  23. #define texattrib_dir $[TOPDIR]/src/maps
  24. #endif
  25. #define texattrib_file $[texattrib_dir]/textures.txa
  26. //////////////////////////////////////////////////////////////////////
  27. #if $[eq $[DIR_TYPE], models]
  28. //////////////////////////////////////////////////////////////////////
  29. #define pal_egg_dir pal_egg
  30. #define bam_dir bams
  31. #define soft_maps_dir soft_maps
  32. #defer phase_prefix $[if $[PHASE],phase_$[PHASE]/]
  33. #defer install_model_dir $[install_dir]/$[phase_prefix]$[INSTALL_TO]
  34. #define filter_dirs $[TARGET_DIR(filter_egg filter_char_egg optchar_egg)]
  35. #defer source_prefix $[SOURCE_DIR:%=%/]
  36. #define build_models \
  37. $[SOURCES(flt_egg):%.flt=%.egg] \
  38. $[patsubst %.lwo %.LWO,%.egg,$[SOURCES(lwo_egg)]] \
  39. $[patsubst %.ma %.mb,%.egg,$[SOURCES(maya_egg)]] \
  40. $[forscopes soft_char_egg,$[POLY_MODEL:%=$[EGG_PREFIX]%.egg] $[NURBS_MODEL:%=$[EGG_PREFIX]%.egg]] \
  41. $[forscopes maya_char_egg,$[POLY_MODEL:%=$[EGG_PREFIX]%.egg] $[NURBS_MODEL:%=$[EGG_PREFIX]%.egg]]
  42. #define build_anims \
  43. $[forscopes soft_char_egg,$[ANIMS:%=$[EGG_PREFIX]%$[CHAN_SUFFIX].egg]] \
  44. $[forscopes maya_char_egg,$[ANIMS:%=$[EGG_PREFIX]%$[CHAN_SUFFIX].egg]]
  45. #define build_eggs $[sort $[build_models] $[build_anims]]
  46. // Get the list of egg files that are to be installed
  47. #define install_pal_eggs
  48. #define install_unpal_eggs
  49. #forscopes install_egg
  50. #define egglist $[notdir $[SOURCES]]
  51. #set install_pal_eggs $[install_pal_eggs] $[filter-out $[language_egg_filters],$[egglist]]
  52. #if $[LANGUAGES]
  53. // Now look for the eggs of the current language.
  54. #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]]
  55. #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg]
  56. #if $[filter $[wantegg],$[egglist]]
  57. // The current language file exists.
  58. #set install_pal_eggs $[install_pal_eggs] $[wantegg]
  59. #else
  60. #set install_pal_eggs $[install_pal_eggs] $[egg]
  61. #endif
  62. #end egg
  63. #endif
  64. #define egglist $[notdir $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]
  65. #set install_unpal_eggs $[install_unpal_eggs] $[filter-out $[language_egg_filters],$[egglist]]
  66. #if $[LANGUAGES]
  67. // Now look for the eggs of the current language.
  68. #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]]
  69. #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg]
  70. #if $[filter $[wantegg],$[egglist]]
  71. // The current language file exists.
  72. #set install_unpal_eggs $[install_unpal_eggs] $[wantegg]
  73. #else
  74. #set install_unpal_eggs $[install_unpal_eggs] $[egg]
  75. #endif
  76. #end egg
  77. #endif
  78. #end install_egg
  79. #define install_eggs $[install_pal_eggs] $[install_unpal_eggs]
  80. // Get the list of bam files in the install directories
  81. #define install_egg_dirs $[sort $[forscopes install_egg,$[install_model_dir]]]
  82. #define installed_generic_bams $[sort $[forscopes install_egg,$[patsubst %.egg,$[install_model_dir]/%.bam,$[filter-out $[language_egg_filters],$[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]]]]]
  83. #if $[LANGUAGES]
  84. #define installed_language_bams $[sort $[forscopes install_egg,$[patsubst %.egg,$[install_model_dir]/%.bam,$[patsubst %_$[DEFAULT_LANGUAGE].egg,%.egg,%,,$[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]]]]]
  85. #endif
  86. // And the list of dna files in the install directories.
  87. #define install_dna_dirs $[sort $[forscopes install_dna,$[install_model_dir]]]
  88. #define installed_generic_dna $[sort $[forscopes install_dna,$[patsubst %,$[install_model_dir]/%,$[filter-out $[language_dna_filters],$[notdir $[SOURCES]]]]]]
  89. #if $[LANGUAGES]
  90. #define installed_language_dna $[sort $[forscopes install_dna,$[patsubst %,$[install_model_dir]/%,$[patsubst %_$[DEFAULT_LANGUAGE].dna,%.dna,%,,$[notdir $[SOURCES]]]]]]
  91. #endif
  92. #define install_other_dirs $[sort $[forscopes install_audio install_icons install_misc,$[install_model_dir]]]
  93. #define installed_other $[sort $[forscopes install_audio install_icons install_misc,$[SOURCES:%=$[install_model_dir]/%]]]
  94. #define pal_egg_targets $[sort $[patsubst %,$[pal_egg_dir]/%,$[notdir $[install_pal_eggs]]]]
  95. #define bam_targets $[install_eggs:%.egg=$[bam_dir]/%.bam]
  96. #output Makefile
  97. #format makefile
  98. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  99. ################################# DO NOT EDIT ###########################
  100. #define all_targets \
  101. Makefile \
  102. $[texattrib_dir] \
  103. $[filter_dirs] \
  104. $[optchar_dirs] \
  105. egg bam
  106. all : $[all_targets]
  107. #define egg_targets \
  108. $[if $[POLY_MODEL(soft_char_egg)] $[NURBS_MODEL(soft_char_egg)],$[soft_maps_dir]] \
  109. $[build_eggs]
  110. egg : $[egg_targets]
  111. pal : $[if $[pal_egg_targets],$[pal_egg_dir]] $[pal_egg_targets]
  112. bam : pal $[if $[bam_targets],$[bam_dir]] $[bam_targets]
  113. #map soft_scenes soft_scene_files(soft_char_egg)
  114. unpack-soft : $[soft_scenes]
  115. #define install_bam_targets \
  116. $[install_egg_dirs] \
  117. $[installed_generic_bams] $[installed_language_bams]
  118. install-bam : $[install_bam_targets]
  119. #define install_other_targets \
  120. $[install_dna_dirs] \
  121. $[installed_generic_dna] $[installed_language_dna] \
  122. $[install_other_dirs] \
  123. $[installed_other]
  124. install-other : $[install_other_targets]
  125. install : all install-other install-bam
  126. uninstall : uninstall-other uninstall-bam
  127. clean-bam :
  128. #if $[bam_targets]
  129. $[TAB]rm -rf $[bam_dir]
  130. #endif
  131. clean-pal : clean-bam
  132. #if $[pal_egg_targets]
  133. $[TAB]rm -rf $[pal_egg_dir]
  134. #endif
  135. clean : clean-pal
  136. #if $[build_eggs]
  137. $[TAB]rm -f $[build_eggs] *.pt
  138. #endif
  139. #if $[POLY_MODEL(soft_char_egg)] $[NURBS_MODEL(soft_char_egg)]
  140. $[TAB]rm -rf $[soft_maps_dir]
  141. #endif
  142. #if $[filter_dirs]
  143. $[TAB]rm -rf $[filter_dirs]
  144. #endif
  145. // We need a rule for each directory we might need to make. This
  146. // loops through the full set of directories and creates a rule to
  147. // make each one, as needed.
  148. #foreach directory $[sort \
  149. $[filter_dirs] \
  150. $[if $[pal_egg_targets],$[pal_egg_dir]] \
  151. $[if $[bam_targets],$[bam_dir]] \
  152. $[if $[POLY_MODEL(soft_char_egg)] $[NURBS_MODEL(soft_char_egg)],$[soft_maps_dir]] \
  153. $[TARGET_DIR(filter_char_egg)] \
  154. $[texattrib_dir] \
  155. $[install_egg_dirs] \
  156. $[install_dna_dirs] \
  157. $[install_other_dirs] \
  158. ]
  159. $[directory] :
  160. $[TAB]@test -d $[directory] || echo mkdir -p $[directory]
  161. $[TAB]@test -d $[directory] || mkdir -p $[directory]
  162. // Sometimes we need a target to depend on the directory existing, without
  163. // being fooled by the directory's modification times. We use this
  164. // phony timestamp file to achieve that.
  165. $[directory]/stamp :
  166. $[TAB]@test -d $[directory] || echo mkdir -p $[directory]
  167. $[TAB]@test -d $[directory] || mkdir -p $[directory]
  168. $[TAB]@touch $[directory]/stamp
  169. #end directory
  170. // Decompressing compressed files.
  171. #forscopes gz
  172. #foreach gz $[SOURCES]
  173. #define target $[gz:%.gz=%]
  174. #define source $[gz]
  175. $[target] : $[source]
  176. $[TAB]rm -f $[target]
  177. $[TAB]gunzip $[GUNZIP_OPTS] < $[source] > $[target]
  178. #end gz
  179. #end gz
  180. // Egg file generation from Flt files.
  181. #forscopes flt_egg
  182. #foreach flt $[SOURCES]
  183. #define target $[flt:%.flt=%.egg]
  184. #define source $[flt]
  185. $[target] : $[source]
  186. $[TAB]flt2egg $[FLT2EGG_OPTS] -o $[target] $[source]
  187. #end flt
  188. #end flt_egg
  189. // Egg file generation from Lightwave files.
  190. #forscopes lwo_egg
  191. #foreach lwo $[SOURCES]
  192. #define target $[patsubst %.lwo %.LWO,%.egg,$[lwo]]
  193. #define source $[lwo]
  194. $[target] : $[source]
  195. $[TAB]lwo2egg $[LWO2EGG_OPTS] -o $[target] $[source]
  196. #end lwo
  197. #end lwo_egg
  198. // Egg file generation from Maya files (for unanimated models).
  199. #forscopes maya_egg
  200. #foreach maya $[SOURCES]
  201. #define target $[patsubst %.ma %.mb,%.egg,$[maya]]
  202. #define source $[maya]
  203. $[target] : $[source]
  204. $[TAB]maya2egg $[MAYA2EGG_OPTS] -o $[target] $[source]
  205. #end maya
  206. #end maya_egg
  207. // Egg character model generation from Maya files.
  208. #forscopes maya_char_egg
  209. #if $[POLY_MODEL]
  210. #define target $[EGG_PREFIX]$[POLY_MODEL].egg
  211. #define source $[MAYA_PREFIX]$[or $[MODEL],$[POLY_MODEL]].mb
  212. $[target] : $[source]
  213. $[TAB]maya2egg $[MAYA2EGG_OPTS] -p -a model -cn "$[CHAR_NAME]" -o $[target] $[source]
  214. #endif
  215. #end maya_char_egg
  216. // Egg animation generation from Maya files.
  217. #forscopes maya_char_egg
  218. #foreach anim $[ANIMS]
  219. #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg
  220. #define source $[MAYA_PREFIX]$[anim].mb
  221. #define begin 0
  222. #define end
  223. #if $[$[anim]_frames]
  224. #set begin $[word 1,$[$[anim]_frames]]
  225. #set end $[word 2,$[$[anim]_frames]]
  226. #endif
  227. $[target] : $[source]
  228. $[TAB]maya2egg $[MAYA2EGG_OPTS] -a chan -cn "$[CHAR_NAME]" -o $[target] -sf $[begin] $[if $[end],-ef $[end]] $[source]
  229. #end anim
  230. #end maya_char_egg
  231. // Unpack the Soft scene database from its multifile.
  232. #formap scene_file soft_scenes
  233. #define target $[scene_file]
  234. #define source $[scene_file:$[DATABASE]/SCENES/%.1-0.dsc=$[DATABASE]/%.mf]
  235. $[target] : $[source]
  236. $[TAB]multify xf $[source] -C $[DATABASE]
  237. #end scene_file
  238. // Egg character model generation from Soft databases.
  239. #forscopes soft_char_egg
  240. #if $[POLY_MODEL]
  241. #define target $[EGG_PREFIX]$[POLY_MODEL].egg
  242. #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc
  243. #define source $[DATABASE]/SCENES/$[scene]
  244. $[target] : $[source]
  245. $[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -p -M $[target] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene]
  246. #endif
  247. #if $[NURBS_MODEL]
  248. #define target $[EGG_PREFIX]$[NURBS_MODEL].egg
  249. #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc
  250. #define source $[DATABASE]/SCENES/$[scene]
  251. $[target] : $[source]
  252. $[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -n -M $[target] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene]
  253. #endif
  254. #end soft_char_egg
  255. // Egg animation generation from Soft database.
  256. #forscopes soft_char_egg
  257. #foreach anim $[ANIMS]
  258. #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg
  259. #define scene $[SCENE_PREFIX]$[anim].1-0.dsc
  260. #define source $[DATABASE]/SCENES/$[scene]
  261. #define begin 1
  262. #define end
  263. #if $[$[anim]_frames]
  264. #set begin $[word 1,$[$[anim]_frames]]
  265. #set end $[word 2,$[$[anim]_frames]]
  266. #endif
  267. $[target] : $[source]
  268. $[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -a -A $[target] -N $[CHAR_NAME] -d $[DATABASE] -s $[scene] $[begin:%=-b%] $[end:%=-e%]
  269. #end anim
  270. #end soft_char_egg
  271. // Generic egg filters.
  272. #forscopes filter_egg
  273. #foreach egg $[SOURCES]
  274. #define source $[source_prefix]$[egg]
  275. #define target $[TARGET_DIR]/$[notdir $[egg]]
  276. $[target] : $[source] $[pt] $[TARGET_DIR]/stamp
  277. $[TAB]$[COMMAND]
  278. #end egg
  279. #end filter_egg
  280. // Generic character egg filter; applies an effect to all models and
  281. // animations of a particular character.
  282. #forscopes filter_char_egg
  283. #define sources $[SOURCES:%=$[source_prefix]%]
  284. #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]]
  285. // A bunch of rules to make each generated egg file depend on the
  286. // first one.
  287. #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]]
  288. $[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp
  289. $[TAB]touch $[TARGET_DIR]/$[egg]
  290. #end egg
  291. // And this is the actual optchar pass.
  292. $[target] : $[sources] $[TARGET_DIR]/stamp
  293. $[TAB]$[COMMAND]
  294. #end filter_char_egg
  295. // Character optimization.
  296. #forscopes optchar_egg
  297. #define sources $[SOURCES:%=$[source_prefix]%]
  298. #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]]
  299. // A bunch of rules to make each generated egg file depend on the
  300. // first one.
  301. #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]]
  302. $[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp
  303. $[TAB]touch $[TARGET_DIR]/$[egg]
  304. #end egg
  305. // And this is the actual optchar pass.
  306. $[target] : $[sources] $[TARGET_DIR]/stamp
  307. $[TAB]egg-optchar $[OPTCHAR_OPTS] -d $[TARGET_DIR] $[sources]
  308. #end optchar_egg
  309. // Palettization rules.
  310. #forscopes install_egg
  311. #foreach egg $[SOURCES]
  312. #define pt $[egg:%.egg=$[source_prefix]%.pt]
  313. #define source $[source_prefix]$[egg]
  314. #define target $[pal_egg_dir]/$[notdir $[egg]]
  315. $[target] : $[source] $[pt] $[pal_egg_dir]/stamp
  316. #if $[PHASE]
  317. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dr $[install_dir] -dm $[install_dir]/%g/maps -ds $[install_dir]/shadow_pal -g phase_$[PHASE] -gdir phase_$[PHASE] -o $[target] $[source]
  318. #else
  319. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dr $[install_dir] -dm $[install_dir]/%g/maps -ds $[install_dir]/shadow_pal -o $[target] $[source]
  320. #endif
  321. $[pt] :
  322. $[TAB]touch $[pt]
  323. #end egg
  324. #end install_egg
  325. // Bam file creation.
  326. #forscopes install_egg
  327. #foreach egg $[SOURCES]
  328. #define source $[pal_egg_dir]/$[notdir $[egg]]
  329. #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]]
  330. $[target] : $[source] $[bam_dir]/stamp
  331. $[TAB]egg2bam -pp $[install_dir] -ps rel -pd $[install_dir] $[EGG2BAM_OPTS] -o $[target] $[source]
  332. #end egg
  333. #foreach egg $[UNPAL_SOURCES]
  334. #define source $[source_prefix]$[egg]
  335. #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]]
  336. $[target] : $[source] $[bam_dir]/stamp
  337. $[TAB]egg2bam $[EGG2BAM_OPTS] -o $[target] $[source]
  338. #end egg
  339. #foreach egg $[UNPAL_SOURCES_NC]
  340. #define source $[source_prefix]$[egg]
  341. #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]]
  342. $[target] : $[source] $[bam_dir]/stamp
  343. $[TAB]egg2bam $[EGG2BAM_OPTS] -NC -o $[target] $[source]
  344. #end egg
  345. #end install_egg
  346. // Bam file installation.
  347. #forscopes install_egg
  348. #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]
  349. #foreach egg $[filter-out $[language_egg_filters],$[egglist]]
  350. #define local $[egg:%.egg=%.bam]
  351. #define sourcedir $[bam_dir]
  352. #define dest $[install_model_dir]
  353. $[dest]/$[local] : $[sourcedir]/$[local]
  354. // cd ./$[sourcedir] && $[INSTALL]
  355. $[TAB]rm -f $[dest]/$[local]
  356. $[TAB]cp $[sourcedir]/$[local] $[dest]
  357. #end egg
  358. #if $[LANGUAGES]
  359. // Now look for the eggs of the current language.
  360. #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]]
  361. #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg]
  362. #if $[filter $[wantegg],$[egglist]]
  363. // The current language file exists.
  364. #define local $[wantegg:%.egg=%.bam]
  365. #else
  366. //#print Warning: $[wantegg] not listed, using $[egg]
  367. #define local $[egg:%.egg=%.bam]
  368. #endif
  369. #define remote $[egg:%_$[DEFAULT_LANGUAGE].egg=%.bam]
  370. #define sourcedir $[bam_dir]
  371. #define dest $[install_model_dir]
  372. $[dest]/$[remote] : $[sourcedir]/$[local]
  373. // cd ./$[sourcedir] && $[INSTALL]
  374. $[TAB]rm -f $[dest]/$[remote]
  375. $[TAB]cp $[sourcedir]/$[local] $[dest]/$[remote]
  376. #end egg
  377. #endif
  378. #end install_egg
  379. // Bam file uninstallation.
  380. uninstall-bam :
  381. #forscopes install_egg
  382. #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]
  383. #define generic_egglist $[filter-out $[language_egg_filters],$[egglist]]
  384. #if $[LANGUAGES]
  385. #define language_egglist $[patsubst %_$[DEFAULT_LANGUAGE].egg,%.egg,%,,$[egglist]]
  386. #endif
  387. #define files $[patsubst %.egg,$[install_model_dir]/%.bam,$[generic_egglist] $[language_egglist]]
  388. #if $[files]
  389. $[TAB]rm -f $[files]
  390. #endif
  391. #end install_egg
  392. // DNA file installation.
  393. #forscopes install_dna
  394. #foreach file $[filter-out $[language_dna_filters],$[SOURCES]]
  395. #define local $[file]
  396. #define remote $[notdir $[file]]
  397. #define dest $[install_model_dir]
  398. $[dest]/$[remote] : $[local]
  399. // $[INSTALL]
  400. $[TAB]rm -f $[dest]/$[remote]
  401. $[TAB]cp $[local] $[dest]
  402. #end file
  403. #if $[LANGUAGES]
  404. // Now files of the current langauge.
  405. #foreach file $[filter %_$[DEFAULT_LANGUAGE].dna,$[SOURCES]]
  406. #define wantfile $[file:%_$[DEFAULT_LANGUAGE].dna=%_$[LANGUAGE].dna]
  407. #if $[filter $[wantfile],$[SOURCES]]
  408. // The current language file exists.
  409. #define local $[wantfile]
  410. #else
  411. //#print Warning: $[wantfile] not listed, using $[file]
  412. #define local $[file]
  413. #endif
  414. #define remote $[notdir $[file:%_$[DEFAULT_LANGUAGE].dna=%.dna]]
  415. #define dest $[install_model_dir]
  416. $[dest]/$[remote] : $[local]
  417. // cd ./$[sourcedir] && $[INSTALL]
  418. $[TAB]rm -f $[dest]/$[remote]
  419. $[TAB]cp $[local] $[dest]/$[remote]
  420. #end file
  421. #endif
  422. #end install_dna
  423. // DNA file uninstallation.
  424. uninstall-other:
  425. #forscopes install_dna
  426. #define sources $[notdir $[SOURCES]]
  427. #define generic_sources $[filter-out $[language_dna_filters],$[sources]]
  428. #if $[LANGUAGES]
  429. #define language_sources $[patsubst %_$[DEFAULT_LANGUAGE].dna,%.dna,%,,$[sources]]
  430. #endif
  431. #define files $[patsubst %,$[install_model_dir]/%,$[generic_sources] $[language_sources]]
  432. #if $[files]
  433. $[TAB]rm -f $[files]
  434. #endif
  435. #end install_dna
  436. // Miscellaneous file installation.
  437. #forscopes install_audio install_icons install_misc
  438. #foreach file $[SOURCES]
  439. #define local $[file]
  440. #define remote $[notdir $[file]]
  441. #define dest $[install_model_dir]
  442. $[dest]/$[remote] : $[local]
  443. // $[INSTALL]
  444. $[TAB]rm -f $[dest]/$[remote]
  445. $[TAB]cp $[local] $[dest]
  446. #end file
  447. #end install_audio install_icons install_misc
  448. // Miscellaneous file uninstallation.
  449. uninstall-other:
  450. #forscopes install_audio install_icons install_misc
  451. #define files $[patsubst %,$[install_model_dir]/%,$[SOURCES]]
  452. #if $[files]
  453. $[TAB]rm -f $[files]
  454. #endif
  455. #end install_audio install_icons install_misc
  456. #end Makefile
  457. //////////////////////////////////////////////////////////////////////
  458. #elif $[eq $[DIR_TYPE], models_group]
  459. //////////////////////////////////////////////////////////////////////
  460. // This is a group directory: a directory above a collection of source
  461. // directories, e.g. $DTOOL/src. We don't need to output anything in
  462. // this directory.
  463. //////////////////////////////////////////////////////////////////////
  464. #elif $[eq $[DIR_TYPE], models_toplevel]
  465. //////////////////////////////////////////////////////////////////////
  466. // This is the toplevel directory for a models tree, e.g. $TTMODELS.
  467. // Here we build the root makefile.
  468. #map subdirs
  469. // Iterate through all of our known source files. Each models type
  470. // file gets its corresponding Makefile listed here.
  471. #forscopes */
  472. #if $[eq $[DIR_TYPE], models]
  473. #if $[build_directory]
  474. #addmap subdirs $[DIRNAME]
  475. #endif
  476. #endif
  477. #end */
  478. #output Makefile
  479. #format makefile
  480. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  481. ################################# DO NOT EDIT ###########################
  482. all : egg pal repal $[subdirs]
  483. egg : $[subdirs:%=egg-%]
  484. pal : $[subdirs:%=pal-%]
  485. bam : $[subdirs:%=bam-%]
  486. clean-bam : $[subdirs:%=clean-bam-%]
  487. clean-pal : $[subdirs:%=clean-pal-%]
  488. clean : $[subdirs:%=clean-%]
  489. cleanall : $[subdirs:%=cleanall-%]
  490. unpack-soft : $[subdirs:%=unpack-soft-%]
  491. install-bam : egg pal repal $[subdirs:%=install-bam-%]
  492. install-other : $[subdirs:%=install-other-%]
  493. install : egg pal repal $[subdirs:%=install-%]
  494. uninstall-bam : $[subdirs:%=uninstall-bam-%]
  495. uninstall-other : $[subdirs:%=uninstall-other-%]
  496. uninstall : $[subdirs:%=uninstall-%]
  497. #
  498. # opt-pal : reorder and resize the palettes to be as optimal as
  499. # possible. This forces a rebuild of all the egg files.
  500. #
  501. opt-pal : pal do-opt-pal install
  502. optimize-palettes : opt-pal
  503. do-opt-pal :
  504. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -opt -egg
  505. #
  506. # repal : reexamine the textures.txa file and do whatever needs to be
  507. # done to bring everything up to sync with it. Also make sure all egg
  508. # files are up-to-date.
  509. #
  510. repal :
  511. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -all -egg
  512. re-pal : repal
  513. #
  514. # fix-pal : something has gone wrong with the palettes; rebuild all
  515. # palette images to fix it.
  516. #
  517. fix-pal :
  518. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -redo -all -egg
  519. #
  520. # undo-pal : blow away all the palettization information and start fresh.
  521. #
  522. undo-pal : clean-pal
  523. $[TAB]rm -f $[texattrib_file:%.txa=%.boo]
  524. #
  525. # pi : report the palettization information to standard output for the
  526. # user's perusal.
  527. #
  528. pi :
  529. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -pi
  530. .PHONY: pi.txt
  531. pi.txt :
  532. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -pi >pi.txt
  533. #
  534. # pal-stats : report palettization statistics to standard output for the
  535. # user's perusal.
  536. #
  537. pal-stats :
  538. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -s
  539. stats-pal : pal-stats
  540. // Somehow, something in the cttools confuses some shells, so that
  541. // when we are attached, 'cd foo' doesn't work, but 'cd ./foo' does.
  542. // Weird. We get around this by putting a ./ in front of each cd
  543. // target below.
  544. #formap dirname subdirs
  545. $[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]
  546. $[TAB]cd ./$[RELDIR] && $(MAKE) all
  547. #end dirname
  548. #formap dirname subdirs
  549. egg-$[dirname] :
  550. $[TAB]cd ./$[RELDIR] && $(MAKE) egg
  551. #end dirname
  552. #formap dirname subdirs
  553. bam-$[dirname] :
  554. $[TAB]cd ./$[RELDIR] && $(MAKE) bam
  555. #end dirname
  556. #formap dirname subdirs
  557. pal-$[dirname] :
  558. $[TAB]cd ./$[RELDIR] && $(MAKE) pal
  559. #end dirname
  560. #formap dirname subdirs
  561. clean-bam-$[dirname] :
  562. $[TAB]cd ./$[RELDIR] && $(MAKE) clean-bam
  563. #end dirname
  564. #formap dirname subdirs
  565. clean-pal-$[dirname] :
  566. $[TAB]cd ./$[RELDIR] && $(MAKE) clean-pal
  567. #end dirname
  568. #formap dirname subdirs
  569. clean-$[dirname] :
  570. $[TAB]cd ./$[RELDIR] && $(MAKE) clean
  571. #end dirname
  572. #formap dirname subdirs
  573. cleanall-$[dirname] :
  574. $[TAB]cd ./$[RELDIR] && $(MAKE) cleanall
  575. #end dirname
  576. #formap dirname subdirs
  577. unpack-soft-$[dirname] :
  578. $[TAB]cd ./$[RELDIR] && $(MAKE) unpack-soft
  579. #end dirname
  580. #formap dirname subdirs
  581. install-bam-$[dirname] :
  582. $[TAB]cd ./$[RELDIR] && $(MAKE) install-bam
  583. #end dirname
  584. #formap dirname subdirs
  585. install-other-$[dirname] :
  586. $[TAB]cd ./$[RELDIR] && $(MAKE) install-other
  587. #end dirname
  588. #formap dirname subdirs
  589. install-$[dirname] :
  590. $[TAB]cd ./$[RELDIR] && $(MAKE) install
  591. #end dirname
  592. #formap dirname subdirs
  593. uninstall-bam-$[dirname] :
  594. $[TAB]cd ./$[RELDIR] && $(MAKE) uninstall-bam
  595. #end dirname
  596. #formap dirname subdirs
  597. uninstall-other-$[dirname] :
  598. $[TAB]cd ./$[RELDIR] && $(MAKE) uninstall-other
  599. #end dirname
  600. #formap dirname subdirs
  601. uninstall-$[dirname] :
  602. $[TAB]cd ./$[RELDIR] && $(MAKE) uninstall
  603. #end dirname
  604. #end Makefile
  605. //////////////////////////////////////////////////////////////////////
  606. #endif // DIR_TYPE