Template.models.pp 23 KB

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