Template.models.pp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  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. #if $[NURBS_MODEL]
  216. #define target $[EGG_PREFIX]$[NURBS_MODEL].egg
  217. #define source $[MAYA_PREFIX]$[or $[MODEL],$[NURBS_MODEL]].mb
  218. $[target] : $[source]
  219. $[TAB]maya2egg $[MAYA2EGG_OPTS] -a model -cn "$[CHAR_NAME]" -o $[target] $[source]
  220. #endif
  221. #end maya_char_egg
  222. // Egg animation generation from Maya files.
  223. #forscopes maya_char_egg
  224. #foreach anim $[ANIMS]
  225. #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg
  226. #define source $[MAYA_PREFIX]$[anim].mb
  227. #define begin 0
  228. #define end
  229. #if $[$[anim]_frames]
  230. #set begin $[word 1,$[$[anim]_frames]]
  231. #set end $[word 2,$[$[anim]_frames]]
  232. #endif
  233. $[target] : $[source]
  234. $[TAB]maya2egg $[MAYA2EGG_OPTS] -a chan -cn "$[CHAR_NAME]" -o $[target] -sf $[begin] $[if $[end],-ef $[end]] $[source]
  235. #end anim
  236. #end maya_char_egg
  237. // Unpack the Soft scene database from its multifile.
  238. #formap scene_file soft_scenes
  239. #define target $[scene_file]
  240. #define source $[scene_file:$[DATABASE]/SCENES/%.1-0.dsc=$[DATABASE]/%.mf]
  241. $[target] : $[source]
  242. $[TAB]multify xf $[source] -C $[DATABASE]
  243. #end scene_file
  244. // Egg character model generation from Soft databases.
  245. #forscopes soft_char_egg
  246. #if $[POLY_MODEL]
  247. #define target $[EGG_PREFIX]$[POLY_MODEL].egg
  248. #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc
  249. #define source $[DATABASE]/SCENES/$[scene]
  250. $[target] : $[source]
  251. $[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -p -M $[target] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene]
  252. #endif
  253. #if $[NURBS_MODEL]
  254. #define target $[EGG_PREFIX]$[NURBS_MODEL].egg
  255. #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc
  256. #define source $[DATABASE]/SCENES/$[scene]
  257. $[target] : $[source]
  258. $[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -n -M $[target] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene]
  259. #endif
  260. #end soft_char_egg
  261. // Egg animation generation from Soft database.
  262. #forscopes soft_char_egg
  263. #foreach anim $[ANIMS]
  264. #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg
  265. #define scene $[SCENE_PREFIX]$[anim].1-0.dsc
  266. #define source $[DATABASE]/SCENES/$[scene]
  267. #define begin 1
  268. #define end
  269. #if $[$[anim]_frames]
  270. #set begin $[word 1,$[$[anim]_frames]]
  271. #set end $[word 2,$[$[anim]_frames]]
  272. #endif
  273. $[target] : $[source]
  274. $[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%]
  275. #end anim
  276. #end soft_char_egg
  277. // Generic egg filters.
  278. #forscopes filter_egg
  279. #foreach egg $[SOURCES]
  280. #define source $[source_prefix]$[egg]
  281. #define target $[TARGET_DIR]/$[notdir $[egg]]
  282. $[target] : $[source] $[pt] $[TARGET_DIR]/stamp
  283. $[TAB]$[COMMAND]
  284. #end egg
  285. #end filter_egg
  286. // Generic character egg filter; applies an effect to all models and
  287. // animations of a particular character.
  288. #forscopes filter_char_egg
  289. #define sources $[SOURCES:%=$[source_prefix]%]
  290. #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]]
  291. // A bunch of rules to make each generated egg file depend on the
  292. // first one.
  293. #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]]
  294. $[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp
  295. $[TAB]touch $[TARGET_DIR]/$[egg]
  296. #end egg
  297. // And this is the actual optchar pass.
  298. $[target] : $[sources] $[TARGET_DIR]/stamp
  299. $[TAB]$[COMMAND]
  300. #end filter_char_egg
  301. // Character optimization.
  302. #forscopes optchar_egg
  303. #define sources $[SOURCES:%=$[source_prefix]%]
  304. #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]]
  305. // A bunch of rules to make each generated egg file depend on the
  306. // first one.
  307. #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]]
  308. $[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp
  309. $[TAB]touch $[TARGET_DIR]/$[egg]
  310. #end egg
  311. // And this is the actual optchar pass.
  312. $[target] : $[sources] $[TARGET_DIR]/stamp
  313. $[TAB]egg-optchar $[OPTCHAR_OPTS] -d $[TARGET_DIR] $[sources]
  314. #end optchar_egg
  315. // Palettization rules.
  316. #forscopes install_egg
  317. #foreach egg $[SOURCES]
  318. #define pt $[egg:%.egg=$[source_prefix]%.pt]
  319. #define source $[source_prefix]$[egg]
  320. #define target $[pal_egg_dir]/$[notdir $[egg]]
  321. $[target] : $[source] $[pt] $[pal_egg_dir]/stamp
  322. #if $[PHASE]
  323. $[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]
  324. #else
  325. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dr $[install_dir] -dm $[install_dir]/%g/maps -ds $[install_dir]/shadow_pal -o $[target] $[source]
  326. #endif
  327. $[pt] :
  328. $[TAB]touch $[pt]
  329. #end egg
  330. #end install_egg
  331. // Bam file creation.
  332. #forscopes install_egg
  333. #foreach egg $[SOURCES]
  334. #define source $[pal_egg_dir]/$[notdir $[egg]]
  335. #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]]
  336. $[target] : $[source] $[bam_dir]/stamp
  337. $[TAB]egg2bam -pp $[install_dir] -ps rel -pd $[install_dir] $[EGG2BAM_OPTS] -o $[target] $[source]
  338. #end egg
  339. #foreach egg $[UNPAL_SOURCES]
  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] -o $[target] $[source]
  344. #end egg
  345. #foreach egg $[UNPAL_SOURCES_NC]
  346. #define source $[source_prefix]$[egg]
  347. #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]]
  348. $[target] : $[source] $[bam_dir]/stamp
  349. $[TAB]egg2bam $[EGG2BAM_OPTS] -NC -o $[target] $[source]
  350. #end egg
  351. #end install_egg
  352. // Bam file installation.
  353. #forscopes install_egg
  354. #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]
  355. #foreach egg $[filter-out $[language_egg_filters],$[egglist]]
  356. #define local $[egg:%.egg=%.bam]
  357. #define sourcedir $[bam_dir]
  358. #define dest $[install_model_dir]
  359. $[dest]/$[local] : $[sourcedir]/$[local]
  360. // cd ./$[sourcedir] && $[INSTALL]
  361. $[TAB]rm -f $[dest]/$[local]
  362. $[TAB]cp $[sourcedir]/$[local] $[dest]
  363. #end egg
  364. #if $[LANGUAGES]
  365. // Now look for the eggs of the current language.
  366. #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]]
  367. #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg]
  368. #if $[filter $[wantegg],$[egglist]]
  369. // The current language file exists.
  370. #define local $[wantegg:%.egg=%.bam]
  371. #else
  372. //#print Warning: $[wantegg] not listed, using $[egg]
  373. #define local $[egg:%.egg=%.bam]
  374. #endif
  375. #define remote $[egg:%_$[DEFAULT_LANGUAGE].egg=%.bam]
  376. #define sourcedir $[bam_dir]
  377. #define dest $[install_model_dir]
  378. $[dest]/$[remote] : $[sourcedir]/$[local]
  379. // cd ./$[sourcedir] && $[INSTALL]
  380. $[TAB]rm -f $[dest]/$[remote]
  381. $[TAB]cp $[sourcedir]/$[local] $[dest]/$[remote]
  382. #end egg
  383. #endif
  384. #end install_egg
  385. // Bam file uninstallation.
  386. uninstall-bam :
  387. #forscopes install_egg
  388. #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]
  389. #define generic_egglist $[filter-out $[language_egg_filters],$[egglist]]
  390. #if $[LANGUAGES]
  391. #define language_egglist $[patsubst %_$[DEFAULT_LANGUAGE].egg,%.egg,%,,$[egglist]]
  392. #endif
  393. #define files $[patsubst %.egg,$[install_model_dir]/%.bam,$[generic_egglist] $[language_egglist]]
  394. #if $[files]
  395. $[TAB]rm -f $[files]
  396. #endif
  397. #end install_egg
  398. // DNA file installation.
  399. #forscopes install_dna
  400. #foreach file $[filter-out $[language_dna_filters],$[SOURCES]]
  401. #define local $[file]
  402. #define remote $[notdir $[file]]
  403. #define dest $[install_model_dir]
  404. $[dest]/$[remote] : $[local]
  405. // $[INSTALL]
  406. $[TAB]rm -f $[dest]/$[remote]
  407. $[TAB]cp $[local] $[dest]
  408. #end file
  409. #if $[LANGUAGES]
  410. // Now files of the current langauge.
  411. #foreach file $[filter %_$[DEFAULT_LANGUAGE].dna,$[SOURCES]]
  412. #define wantfile $[file:%_$[DEFAULT_LANGUAGE].dna=%_$[LANGUAGE].dna]
  413. #if $[filter $[wantfile],$[SOURCES]]
  414. // The current language file exists.
  415. #define local $[wantfile]
  416. #else
  417. //#print Warning: $[wantfile] not listed, using $[file]
  418. #define local $[file]
  419. #endif
  420. #define remote $[notdir $[file:%_$[DEFAULT_LANGUAGE].dna=%.dna]]
  421. #define dest $[install_model_dir]
  422. $[dest]/$[remote] : $[local]
  423. // cd ./$[sourcedir] && $[INSTALL]
  424. $[TAB]rm -f $[dest]/$[remote]
  425. $[TAB]cp $[local] $[dest]/$[remote]
  426. #end file
  427. #endif
  428. #end install_dna
  429. // DNA file uninstallation.
  430. uninstall-other:
  431. #forscopes install_dna
  432. #define sources $[notdir $[SOURCES]]
  433. #define generic_sources $[filter-out $[language_dna_filters],$[sources]]
  434. #if $[LANGUAGES]
  435. #define language_sources $[patsubst %_$[DEFAULT_LANGUAGE].dna,%.dna,%,,$[sources]]
  436. #endif
  437. #define files $[patsubst %,$[install_model_dir]/%,$[generic_sources] $[language_sources]]
  438. #if $[files]
  439. $[TAB]rm -f $[files]
  440. #endif
  441. #end install_dna
  442. // Miscellaneous file installation.
  443. #forscopes install_audio install_icons install_misc
  444. #foreach file $[SOURCES]
  445. #define local $[file]
  446. #define remote $[notdir $[file]]
  447. #define dest $[install_model_dir]
  448. $[dest]/$[remote] : $[local]
  449. // $[INSTALL]
  450. $[TAB]rm -f $[dest]/$[remote]
  451. $[TAB]cp $[local] $[dest]
  452. #end file
  453. #end install_audio install_icons install_misc
  454. // Miscellaneous file uninstallation.
  455. uninstall-other:
  456. #forscopes install_audio install_icons install_misc
  457. #define files $[patsubst %,$[install_model_dir]/%,$[SOURCES]]
  458. #if $[files]
  459. $[TAB]rm -f $[files]
  460. #endif
  461. #end install_audio install_icons install_misc
  462. #end Makefile
  463. //////////////////////////////////////////////////////////////////////
  464. #elif $[eq $[DIR_TYPE], models_group]
  465. //////////////////////////////////////////////////////////////////////
  466. // This is a group directory: a directory above a collection of source
  467. // directories, e.g. $DTOOL/src. We don't need to output anything in
  468. // this directory.
  469. //////////////////////////////////////////////////////////////////////
  470. #elif $[eq $[DIR_TYPE], models_toplevel]
  471. //////////////////////////////////////////////////////////////////////
  472. // This is the toplevel directory for a models tree, e.g. $TTMODELS.
  473. // Here we build the root makefile.
  474. #map subdirs
  475. // Iterate through all of our known source files. Each models type
  476. // file gets its corresponding Makefile listed here.
  477. #forscopes */
  478. #if $[eq $[DIR_TYPE], models]
  479. #if $[build_directory]
  480. #addmap subdirs $[DIRNAME]
  481. #endif
  482. #endif
  483. #end */
  484. #output Makefile
  485. #format makefile
  486. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  487. ################################# DO NOT EDIT ###########################
  488. all : egg pal repal $[subdirs]
  489. egg : $[subdirs:%=egg-%]
  490. pal : $[subdirs:%=pal-%]
  491. bam : $[subdirs:%=bam-%]
  492. clean-bam : $[subdirs:%=clean-bam-%]
  493. clean-pal : $[subdirs:%=clean-pal-%]
  494. clean : $[subdirs:%=clean-%]
  495. cleanall : $[subdirs:%=cleanall-%]
  496. unpack-soft : $[subdirs:%=unpack-soft-%]
  497. install-bam : egg pal repal $[subdirs:%=install-bam-%]
  498. install-other : $[subdirs:%=install-other-%]
  499. install : egg pal repal $[subdirs:%=install-%]
  500. uninstall-bam : $[subdirs:%=uninstall-bam-%]
  501. uninstall-other : $[subdirs:%=uninstall-other-%]
  502. uninstall : $[subdirs:%=uninstall-%]
  503. #
  504. # opt-pal : reorder and resize the palettes to be as optimal as
  505. # possible. This forces a rebuild of all the egg files.
  506. #
  507. opt-pal : pal do-opt-pal install
  508. optimize-palettes : opt-pal
  509. do-opt-pal :
  510. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -opt -egg
  511. #
  512. # repal : reexamine the textures.txa file and do whatever needs to be
  513. # done to bring everything up to sync with it. Also make sure all egg
  514. # files are up-to-date.
  515. #
  516. repal :
  517. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -all -egg
  518. re-pal : repal
  519. #
  520. # fix-pal : something has gone wrong with the palettes; rebuild all
  521. # palette images to fix it.
  522. #
  523. fix-pal :
  524. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -redo -all -egg
  525. #
  526. # undo-pal : blow away all the palettization information and start fresh.
  527. #
  528. undo-pal : clean-pal
  529. $[TAB]rm -f $[texattrib_file:%.txa=%.boo]
  530. #
  531. # pi : report the palettization information to standard output for the
  532. # user's perusal.
  533. #
  534. pi :
  535. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -pi
  536. .PHONY: pi.txt
  537. pi.txt :
  538. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -pi >pi.txt
  539. #
  540. # pal-stats : report palettization statistics to standard output for the
  541. # user's perusal.
  542. #
  543. pal-stats :
  544. $[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -s
  545. stats-pal : pal-stats
  546. // Somehow, something in the cttools confuses some shells, so that
  547. // when we are attached, 'cd foo' doesn't work, but 'cd ./foo' does.
  548. // Weird. We get around this by putting a ./ in front of each cd
  549. // target below.
  550. #formap dirname subdirs
  551. $[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]
  552. $[TAB]cd ./$[RELDIR] && $(MAKE) all
  553. #end dirname
  554. #formap dirname subdirs
  555. egg-$[dirname] :
  556. $[TAB]cd ./$[RELDIR] && $(MAKE) egg
  557. #end dirname
  558. #formap dirname subdirs
  559. bam-$[dirname] :
  560. $[TAB]cd ./$[RELDIR] && $(MAKE) bam
  561. #end dirname
  562. #formap dirname subdirs
  563. pal-$[dirname] :
  564. $[TAB]cd ./$[RELDIR] && $(MAKE) pal
  565. #end dirname
  566. #formap dirname subdirs
  567. clean-bam-$[dirname] :
  568. $[TAB]cd ./$[RELDIR] && $(MAKE) clean-bam
  569. #end dirname
  570. #formap dirname subdirs
  571. clean-pal-$[dirname] :
  572. $[TAB]cd ./$[RELDIR] && $(MAKE) clean-pal
  573. #end dirname
  574. #formap dirname subdirs
  575. clean-$[dirname] :
  576. $[TAB]cd ./$[RELDIR] && $(MAKE) clean
  577. #end dirname
  578. #formap dirname subdirs
  579. cleanall-$[dirname] :
  580. $[TAB]cd ./$[RELDIR] && $(MAKE) cleanall
  581. #end dirname
  582. #formap dirname subdirs
  583. unpack-soft-$[dirname] :
  584. $[TAB]cd ./$[RELDIR] && $(MAKE) unpack-soft
  585. #end dirname
  586. #formap dirname subdirs
  587. install-bam-$[dirname] :
  588. $[TAB]cd ./$[RELDIR] && $(MAKE) install-bam
  589. #end dirname
  590. #formap dirname subdirs
  591. install-other-$[dirname] :
  592. $[TAB]cd ./$[RELDIR] && $(MAKE) install-other
  593. #end dirname
  594. #formap dirname subdirs
  595. install-$[dirname] :
  596. $[TAB]cd ./$[RELDIR] && $(MAKE) install
  597. #end dirname
  598. #formap dirname subdirs
  599. uninstall-bam-$[dirname] :
  600. $[TAB]cd ./$[RELDIR] && $(MAKE) uninstall-bam
  601. #end dirname
  602. #formap dirname subdirs
  603. uninstall-other-$[dirname] :
  604. $[TAB]cd ./$[RELDIR] && $(MAKE) uninstall-other
  605. #end dirname
  606. #formap dirname subdirs
  607. uninstall-$[dirname] :
  608. $[TAB]cd ./$[RELDIR] && $(MAKE) uninstall
  609. #end dirname
  610. #end Makefile
  611. //////////////////////////////////////////////////////////////////////
  612. #endif // DIR_TYPE