Template.models.pp 22 KB

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