Template.msvc.pp 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. //
  2. // Template.msvc.pp
  3. //
  4. // This file defines the set of output files that will be generated to
  5. // support a makefile build system invoking Microsoft's Visual C++
  6. // command-line compiler. It rolls libraries into their metalibs,
  7. // generates .dll files, compiles source files to .obj files, and does
  8. // other Windows-specific things.
  9. //
  10. // Before this file is processed, the following files are read and
  11. // processed (in order):
  12. // The Package.pp file in the root of the current source hierarchy
  13. // (e.g. $PANDA/Package.pp)
  14. // $DTOOL/Package.pp
  15. // $DTOOL/Config.pp
  16. // $DTOOL/Config.Platform.pp
  17. // The user's PPREMAKE_CONFIG file.
  18. // $DTOOL/pptempl/System.pp
  19. // All of the Sources.pp files in the current source hierarchy
  20. // $DTOOL/pptempl/Global.pp
  21. // $DTOOL/pptempl/Global.msvc.pp
  22. // $DTOOL/pptempl/Depends.pp, once for each Sources.pp file
  23. // Template.msvc.pp (this file), once for each Sources.pp file
  24. #defun decygwin frompat,topat,path
  25. #foreach file $[path]
  26. #if $[isfullpath $[file]]
  27. $[patsubstw $[frompat],$[topat],$[cygpath_w $[file]]]
  28. #else
  29. $[patsubstw $[frompat],$[topat],$[osfilename $[file]]]
  30. #endif
  31. #end file
  32. #end decygwin
  33. // should overwrite read-only files
  34. #define NT_COPYCMD xcopy /Y /Q /R
  35. #if $[ne $[DTOOL],]
  36. #define dtool_ver_dir_cyg $[DTOOL]/src/dtoolbase
  37. #define dtool_ver_dir $[decygwin %,%,$[dtool_ver_dir_cyg]]
  38. #endif
  39. #define win_temp_output_dir $[decygwin %,%,$[TEMP]]
  40. //////////////////////////////////////////////////////////////////////
  41. #if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib]]
  42. //////////////////////////////////////////////////////////////////////
  43. // For a source directory, build a single Makefile with rules to build
  44. // each target.
  45. #if $[build_directory]
  46. // This is the real set of lib_targets we'll be building. On Windows,
  47. // we don't build the shared libraries which are included on metalibs.
  48. #define real_lib_targets
  49. #define deferred_objs
  50. #forscopes lib_target
  51. #if $[eq $[module $[TARGET],$[TARGET]],]
  52. // This library is not on a metalib, so we can build it.
  53. #set real_lib_targets $[real_lib_targets] $[TARGET]
  54. #else
  55. // This library is on a metalib, so we can't build it, but we
  56. // should build all the obj's that go into it.
  57. #set deferred_objs $[deferred_objs] \
  58. $[patsubst %_src.cxx,,%.c %.cxx %.yxx %.lxx,$[so_dir]\%.obj,%,,$[get_sources] $[get_igateoutput]]
  59. #endif
  60. #end lib_target
  61. // We need to know the various targets we'll be building.
  62. // $[lib_targets] will be the list of dynamic libraries,
  63. // $[static_lib_targets] the list of static libraries, and
  64. // $[bin_targets] the list of binaries. $[test_bin_targets] is the
  65. // list of binaries that are to be built only when specifically asked
  66. // for.
  67. #define lib_targets $[patsubst %,$[so_dir]\lib%$[dllext].$[dlllib],$[active_target(metalib_target noinst_lib_target)] $[real_lib_targets]]
  68. #define static_lib_targets $[active_target(static_lib_target ss_lib_target):%=$[st_dir]\lib%$[dllext].lib]
  69. #define bin_targets \
  70. $[active_target(bin_target noinst_bin_target):%=$[st_dir]\%.exe] \
  71. $[active_target(sed_bin_target):%=$[st_dir]\%]
  72. #define test_bin_targets $[active_target(test_bin_target):%=$[st_dir]\%.exe]
  73. // And these variables will define the various things we need to
  74. // install.
  75. #define install_lib $[active_target(metalib_target static_lib_target ss_lib_target)] $[real_lib_targets]
  76. #define install_bin $[active_target(bin_target)]
  77. #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_SCRIPTS]]
  78. #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_HEADERS]]
  79. #define install_parser_inc $[sort $[INSTALL_PARSER_INC]]
  80. #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_DATA]]
  81. #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_CONFIG]]
  82. #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target)]]
  83. // $[so_sources] is the set of sources that belong on a shared object,
  84. // and $[st_sources] is the set of sources that belong on a static
  85. // object, like a static library or an executable. In Windows, we
  86. // don't need to make this distinction, but we do anyway in case we
  87. // might in the future for some nutty reason.
  88. #define so_sources $[get_sources(metalib_target lib_target noinst_lib_target)]
  89. #define st_sources $[get_sources(static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]
  90. // These are the source files that our dependency cache file will
  91. // depend on. If it's an empty list, we won't bother writing rules to
  92. // freshen the cache file.
  93. #define dep_sources $[sort $[filter %.c %.cxx %.yxx %.lxx %.h %.I %.I,$[so_sources] $[st_sources]]]
  94. #if $[eq $[so_dir],$[st_dir]]
  95. // If the static and shared directories are the same, we have to use the
  96. // same rules to build both shared and static targets.
  97. #set st_sources $[so_sources] $[st_sources]
  98. #set so_sources
  99. #endif
  100. #endif // $[build_directory]
  101. // And these are the various source files, extracted out by type.
  102. #define cxx_so_sources $[filter_out %_src.cxx,$[filter %.cxx,$[so_sources]]]
  103. #define cxx_st_sources $[filter_out %_src.cxx,$[filter %.cxx,$[st_sources]]]
  104. #define c_so_sources $[filter %.c,$[so_sources]]
  105. #define c_st_sources $[filter %.c,$[st_sources]]
  106. #define yxx_so_sources $[filter %.yxx,$[so_sources]]
  107. #define yxx_st_sources $[filter %.yxx,$[st_sources]]
  108. #define lxx_so_sources $[filter %.lxx,$[so_sources]]
  109. #define lxx_st_sources $[filter %.lxx,$[st_sources]]
  110. #if $[DO_PCH]
  111. #define pch_header_source $[get_precompiled_header(metalib_target lib_target noinst_lib_target)]
  112. #define st_pch_files $[patsubst %.h,$[st_dir]\%.pch,$[pch_header_source]]
  113. #define st_pch_obj_files $[patsubst %.h,$[st_dir]\%.obj,$[pch_header_source]]
  114. #endif
  115. // This map variable gets us all the various source files from all the
  116. // targets in this directory. We need it to look up the context in
  117. // which to build a particular source file, since some targets may
  118. // have different requirements (e.g. different local_libs, or
  119. // different USE_this or USE_that) than other targets.
  120. #map all_sources get_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)
  121. // We define $[complete_local_libs] as the full set of libraries (from
  122. // within this tree) that we must link a particular target with. It
  123. // is the transitive closure of our dependent libs: the libraries we
  124. // depend on, plus the libraries *those* libraries depend on, and so
  125. // on.
  126. #defer complete_local_libs $[unique $[closure all_libs,$[active_libs]]]
  127. #defer actual_local_libs $[get_metalibs $[TARGET],$[complete_local_libs]]
  128. // And $[complete_ipath] is the list of directories (from within this
  129. // tree) we should add to our -I list. It's basically just one for
  130. // each directory named in the $[complete_local_libs], above, plus
  131. // whatever else the user might have explicitly named in
  132. // $[LOCAL_INCS].
  133. #defer complete_ipath $[all_libs $[RELDIR],$[complete_local_libs]] $[RELDIR($[LOCAL_INCS:%=%\])]
  134. // $[target_ipath] is the proper ipath to put on the command line,
  135. // from the context of a particular target.
  136. #defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%\include] $[get_ipath]
  137. // $[file_ipath] is the ipath from the context of a particular source
  138. // file, given in $[file]. It uses the all_sources map to look up
  139. // the target the source file belongs on, to get the proper context.
  140. #defer file_ipath $[all_sources $[target_ipath],$[file]]
  141. // These are the complete set of extra flags the compiler requires,
  142. // from the context of a particular file, given in $[file].
  143. #defer cflags $[all_sources $[get_cflags] $[CFLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]]
  144. #defer c++flags $[all_sources $[get_cflags] $[C++FLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]]
  145. // These are the same flags, sans the compiler optimizations.
  146. #defer noopt_c++flags $[all_sources $[get_cflags] $[C++FLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]]
  147. // $[complete_lpath] is rather like $[complete_ipath]: the list of
  148. // directories (from within this tree) we should add to our -L list.
  149. #defer complete_lpath $[static_libs $[RELDIR:%=%\$[st_dir]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%\$[so_dir]],$[actual_local_libs]]
  150. // $[lpath] is like $[target_ipath]: it's the list of directories we
  151. // should add to our -L list, from the context of a particular target.
  152. #defer lpath $[sort $[complete_lpath]] $[other_trees:%=%\lib] $[get_lpath]
  153. // And $[libs] is the set of libraries we will link with.
  154. #defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]]
  155. // This is the set of files we might copy into *.prebuilt, if we have
  156. // bison and flex (or copy from *.prebuilt if we don't have them).
  157. #define bison_prebuilt $[patsubst %.yxx,%.h,$[yxx_so_sources] $[yxx_st_sources]] $[patsubst %.yxx,%.cxx,$[yxx_so_sources] $[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_so_sources] $[lxx_st_sources]]
  158. // for single-processor builds (all nmake msvc-type builds can use only a single-proc),
  159. // write out *_composite.cxx files that include all composite
  160. // files into 1 in order to speed the build of our heavily templated source
  161. #forscopes lib_target bin_target static_lib_target ss_lib_target
  162. #if $[and $[eq $[NO_COMBINED_SOURCES],], $[ne $[COMBINED_SOURCES],]]
  163. #output $[TARGET]_composite.cxx notouch
  164. #format collapse
  165. /* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */
  166. /* ################################# DO NOT EDIT ########################### */
  167. #foreach file $[COMBINED_SOURCES]
  168. ##include "$[file]"
  169. #end file
  170. #end $[TARGET]_composite.cxx
  171. #endif
  172. #end lib_target bin_target static_lib_target ss_lib_target
  173. // Okay, we're ready. Start outputting the Makefile now.
  174. #output Makefile
  175. #format makefile
  176. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  177. ################################# DO NOT EDIT ###########################
  178. // The 'all' rule makes all the stuff in the directory except for the
  179. // test_bin_targets. It doesn't do any installation, however.
  180. #define all_targets \
  181. Makefile \
  182. $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \
  183. $[if $[so_sources],$[so_dir]] \
  184. $[if $[st_sources],$[st_dir]] \
  185. $[sort $[lib_targets] $[static_lib_targets] $[bin_targets]] \
  186. $[deferred_objs] \
  187. $[TARGET(special_target)]
  188. all : $[all_targets]
  189. // The 'test' rule makes all the test_bin_targets.
  190. test : $[test_bin_targets]
  191. // We implement 'clean' simply by removing the odirs, since all of our
  192. // generated output ends up in one or the other of these. Effective.
  193. // It does assume that the odirs are not '.', however.
  194. clean :
  195. #if $[so_sources]
  196. $[TAB] -rmdir /s /q $[so_dir]
  197. #endif
  198. #if $[st_sources]
  199. $[TAB] -rmdir /s /q $[st_dir]
  200. #endif
  201. $[TAB] -del /f *.pyc *.pyo // Also scrub out old generated Python code.
  202. // 'cleanall' is not much more thorough than 'clean': At the moment,
  203. // it also cleans up the bison and flex output, as well as the
  204. // dependency cache file.
  205. cleanall : clean
  206. #if $[yxx_so_sources] $[yxx_st_sources] $[lxx_so_sources] $[lxx_st_sources]
  207. $[TAB] -del /f $[patsubst %.yxx %.lxx,%.cxx,$[yxx_so_sources] $[yxx_st_sources] $[lxx_so_sources] $[lxx_st_sources]]
  208. #endif
  209. #if $[ne $[DEPENDENCY_CACHE_FILENAME],]
  210. $[TAB] -del /f $[DEPENDENCY_CACHE_FILENAME]
  211. #endif
  212. $[TAB] rm -f *_composite.cxx // eliminate generated *_composite.cxx files for uniprocessor builds
  213. clean-igate :
  214. #forscopes metalib_target lib_target ss_lib_target
  215. #define igatedb $[get_igatedb]
  216. #define igateoutput $[get_igateoutput]
  217. #define igatemscan $[components $[get_igatedb:%=$[RELDIR]/$[so_dir]/%],$[active_component_libs]]
  218. #define igatemout $[if $[igatemscan],lib$[TARGET]_module.cxx]
  219. #if $[igatedb]
  220. $[TAB] -del /f $[so_dir]\$[igatedb]
  221. #endif
  222. #if $[igateoutput]
  223. $[TAB] -del /f $[so_dir]\$[igateoutput] $[igateoutput:%.cxx=$[so_dir]\%.obj]
  224. #endif
  225. #if $[igatemout]
  226. $[TAB] -del /f $[so_dir]\$[igatemout] $[igatemout:%.cxx=$[so_dir]\%.obj]
  227. #endif
  228. #end metalib_target lib_target ss_lib_target
  229. // Now, 'install' and 'uninstall'. These simply copy files into the
  230. // install directory (or remove them). The 'install' rule also makes
  231. // the directories if necessary.
  232. #define installed_files \
  233. $[INSTALL_SCRIPTS:%=$[install_bin_dir]\%] \
  234. $[INSTALL_HEADERS:%=$[install_headers_dir]\%] \
  235. $[INSTALL_PARSER_INC:%=$[install_parser_inc_dir]\%] \
  236. $[INSTALL_DATA:%=$[install_data_dir]\%] \
  237. $[INSTALL_CONFIG:%=$[install_config_dir]\%]
  238. #define installed_igate_files \
  239. $[get_igatedb(metalib_target lib_target ss_lib_target):%=$[install_igatedb_dir]\%]
  240. #define install_targets \
  241. $[sort \
  242. $[if $[install_lib],$[install_lib_dir]] \
  243. $[if $[install_bin] $[install_scripts],$[install_bin_dir]] \
  244. $[if $[install_headers],$[install_headers_dir]] \
  245. $[if $[install_parser_inc],$[install_parser_inc_dir]] \
  246. $[if $[install_data],$[install_data_dir]] \
  247. $[if $[install_config],$[install_config_dir]] \
  248. $[if $[install_igatedb],$[install_igatedb_dir]] \
  249. ] \
  250. $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=install-lib%] \
  251. $[active_target(bin_target sed_bin_target):%=install-%] \
  252. $[installed_files]
  253. install : all $[install_targets]
  254. install-igate : $[sort $[installed_igate_files]]
  255. uninstall : $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%]
  256. #foreach file $[sort $[installed_files]]
  257. $[TAB] -del /f $[file]
  258. #end file
  259. uninstall-igate :
  260. #foreach file $[sort $[installed_igate_files]]
  261. $[TAB] -del /f $[file]
  262. #end file
  263. #if $[HAVE_BISON]
  264. prebuild-bison : $[patsubst %,%.prebuilt,$[bison_prebuilt]]
  265. clean-prebuild-bison :
  266. #foreach file $[sort $[patsubst %,%.prebuilt,$[bison_prebuilt]]]
  267. $[TAB] -del /f $[file]
  268. #end file
  269. #endif
  270. // We need a rule for each directory we might need to make. This
  271. // loops through the full set of directories and creates a rule to
  272. // make each one, as needed.
  273. #foreach directory $[sort \
  274. $[if $[so_sources],$[so_dir]] \
  275. $[if $[st_sources],$[st_dir]] \
  276. $[if $[install_lib],$[install_lib_dir]] \
  277. $[if $[install_bin] $[install_scripts],$[install_bin_dir]] \
  278. $[if $[install_headers],$[install_headers_dir]] \
  279. $[if $[install_parser_inc],$[install_parser_inc_dir]] \
  280. $[if $[install_data],$[install_data_dir]] \
  281. $[if $[install_config],$[install_config_dir]] \
  282. $[if $[install_igatedb],$[install_igatedb_dir]] \
  283. ]
  284. $[osfilename $[directory]] :
  285. $[TAB] mkdir $[osfilename $[directory]]
  286. #end directory
  287. // Now it's time to start generating the rules to make our actual
  288. // targets.
  289. igate : $[get_igatedb(metalib_target lib_target ss_lib_target):%=$[so_dir]\%]
  290. /////////////////////////////////////////////////////////////////////
  291. // First, the dynamic libraries. Each lib_target and metalib_target
  292. // is a dynamic library.
  293. /////////////////////////////////////////////////////////////////////
  294. #forscopes metalib_target lib_target
  295. // In Windows, we don't actually build all the libraries. In
  296. // particular, we don't build any libraries that are listed on a
  297. // metalib. Is this one such library?
  298. #define build_it $[eq $[module $[TARGET],$[TARGET]],]
  299. // We might need to define a BUILDING_ symbol for win32. We use the
  300. // BUILDING_DLL variable name, defined typically in the metalib, for
  301. // this; but in some cases, where the library isn't part of a metalib,
  302. // we define BUILDING_DLL directly for the target.
  303. #define building_var $[or $[BUILDING_DLL],$[module $[BUILDING_DLL],$[TARGET]]]
  304. // $[igatescan] is the set of C++ headers and source files that we
  305. // need to scan for interrogate. $[igateoutput] is the name of the
  306. // generated .cxx file that interrogate will produce (and which we
  307. // should compile into the library). $[igatedb] is the name of the
  308. // generated .in file that interrogate will produce (and which should
  309. // be installed into the /etc directory).
  310. #define igatescan $[get_igatescan]
  311. #define igateoutput $[get_igateoutput]
  312. #define igatedb $[get_igatedb]
  313. // If this is a metalib, it may have a number of components that
  314. // include interrogated interfaces. If so, we need to generate a
  315. // 'module' file within this library. This is mainly necessary for
  316. // Python; it contains a table of all of the interrogated functions,
  317. // so we can load the library as a Python module and have access to
  318. // the interrogated functions.
  319. // $[igatemscan] is the set of .in files generated by all of our
  320. // component libraries. If it is nonempty, then we do need to
  321. // generate a module, and $[igatemout] is the name of the .cxx file
  322. // that interrogate will produce to make this module.
  323. #define igatemscan $[components $[get_igatedb:%=$[RELDIR]\$[so_dir]\%],$[active_component_libs]]
  324. #define igatemout $[if $[igatemscan],lib$[TARGET]_module.cxx]
  325. #if $[build_it]
  326. // Now output the rule to actually link the library from all of its
  327. // various .obj files.
  328. #define sources \
  329. $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[so_dir]\%.obj,%,,$[get_sources] $[igateoutput] $[igatemout]]] \
  330. $[components $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[RELDIR]/$[so_dir]/%.obj,%,,$[get_sources] $[get_igateoutput] $[get_pch_outputcxx]]],$[active_component_libs]]
  331. #define varname $[subst -,_,lib$[TARGET]_so]
  332. $[varname] = $[osfilename $[sources]]
  333. #define target $[so_dir]\lib$[TARGET]$[dllext].$[dlllib]
  334. #define sources $($[varname])
  335. #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%]
  336. #if $[GENERATE_BUILDDATE]
  337. $[target] : $[sources] "$[dtool_ver_dir]\version.rc" "$[dtool_ver_dir]\$[DLLBASEADDRFILENAME]"
  338. // first generate builddate for rc compiler
  339. $[TAB] cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp" > "$[win_temp_output_dir]\verdate.h"
  340. $[TAB] rc /n /I"$[win_temp_output_dir]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[ver_resource] $[filter /D%, $[flags]] "$[dtool_ver_dir]\version.rc"
  341. $[TAB] rm -f "$[dtool_ver_dir]\verdate.h"
  342. #else
  343. $[target] : $[sources]
  344. #endif
  345. #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
  346. $[TAB] $[SHARED_LIB_C++]
  347. #else
  348. $[TAB] $[SHARED_LIB_C]
  349. #endif
  350. #if $[build_dlls]
  351. $[so_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].dll
  352. #endif
  353. #if $[build_pdbs]
  354. $[so_dir]\lib$[TARGET]$[dllext].pdb : $[so_dir]\lib$[TARGET]$[dllext].dll
  355. #endif
  356. #endif
  357. // Here are the rules to install and uninstall the library and
  358. // everything that goes along with it.
  359. #define installed_files \
  360. $[if $[build_it], \
  361. $[if $[build_dlls],$[install_lib_dir]\lib$[TARGET]$[dllext].dll] \
  362. $[install_lib_dir]\lib$[TARGET]$[dllext].lib \
  363. $[if $[and $[build_dlls],$[build_pdbs]],$[install_lib_dir]\lib$[TARGET]$[dllext].pdb] \
  364. ] \
  365. $[INSTALL_SCRIPTS:%=$[install_bin_dir]\%] \
  366. $[INSTALL_HEADERS:%=$[install_headers_dir]\%] \
  367. $[INSTALL_DATA:%=$[install_data_dir]\%] \
  368. $[INSTALL_CONFIG:%=$[install_config_dir]\%] \
  369. $[igatedb:%=$[install_igatedb_dir]\%]
  370. install-lib$[TARGET] : $[installed_files]
  371. uninstall-lib$[TARGET] :
  372. #foreach file $[sort $[installed_files]]
  373. $[TAB] -del /f $[file]
  374. #end file
  375. #if $[build_dlls]
  376. $[install_lib_dir]\lib$[TARGET]$[dllext].dll : $[so_dir]\lib$[TARGET]$[dllext].dll
  377. #define local lib$[TARGET]$[dllext].dll
  378. #define dest $[install_lib_dir]
  379. $[TAB] $[NT_COPYCMD] $[so_dir]\$[local] $[dest]
  380. #endif
  381. $[install_lib_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].lib
  382. #define local lib$[TARGET]$[dllext].lib
  383. #define dest $[install_lib_dir]
  384. $[TAB] $[NT_COPYCMD] $[so_dir]\$[local] $[dest]
  385. #if $[and $[build_dlls],$[build_pdbs]]
  386. $[install_lib_dir]\lib$[TARGET]$[dllext].pdb : $[so_dir]\lib$[TARGET]$[dllext].pdb
  387. #define local lib$[TARGET]$[dllext].pdb
  388. #define dest $[install_lib_dir]
  389. $[TAB] $[NT_COPYCMD] $[so_dir]\$[local] $[dest]
  390. #endif
  391. #if $[igatescan]
  392. // Now, some additional rules to generate and compile the interrogate
  393. // data, if needed.
  394. // The library name is based on this library.
  395. #define igatelib lib$[TARGET]
  396. // The module name comes from the metalib that includes this library.
  397. #define igatemod $[module $[TARGET],$[TARGET]]
  398. #if $[eq $[igatemod],]
  399. // Unless no metalib includes this library.
  400. #define igatemod $[TARGET]
  401. #endif
  402. $[install_igatedb_dir]\$[igatedb] : $[so_dir]\$[igatedb]
  403. #define local $[igatedb]
  404. #define dest $[install_igatedb_dir]
  405. $[TAB] $[NT_COPYCMD] $[so_dir]\$[local] $[dest]
  406. lib$[TARGET]_igatescan = $[osfilename $[igatescan]]
  407. $[so_dir]\$[igatedb] $[so_dir]\$[igateoutput] : $[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]
  408. // We use forward slash for interrogate because it prefers those.
  409. $[TAB] $[INTERROGATE] -od $[so_dir]/$[igatedb] -oc $[so_dir]/$[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
  410. #define target $[igateoutput:%.cxx=$[so_dir]\%.obj]
  411. #define source $[so_dir]\$[igateoutput]
  412. #define ipath . $[target_ipath]
  413. #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%]
  414. $[target] : $[source]
  415. $[TAB] $[COMPILE_C++]
  416. #endif // $[igatescan]
  417. #if $[igatemout]
  418. // And finally, some additional rules to build the interrogate module
  419. // file into the library, if this is a metalib that includes
  420. // interrogated components.
  421. #define igatelib lib$[TARGET]
  422. #define igatemod $[TARGET]
  423. lib$[TARGET]_igatemscan = $[osfilename $[igatemscan]]
  424. #define target $[so_dir]\$[igatemout]
  425. #define sources $(lib$[TARGET]_igatemscan)
  426. $[target] : $[sources]
  427. $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] $[sources]
  428. #define target $[igatemout:%.cxx=$[so_dir]\%.obj]
  429. #define source $[so_dir]\$[igatemout]
  430. #define ipath . $[target_ipath]
  431. #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%]
  432. $[target] : $[source]
  433. $[TAB] $[COMPILE_C++]
  434. #endif // $[igatescan]
  435. #end metalib_target lib_target
  436. /////////////////////////////////////////////////////////////////////
  437. // Now, the noninstalled dynamic libraries. These are presumably used
  438. // only within this directory, or at the most within this tree, and
  439. // also presumably will never include interrogate data. That, plus
  440. // the fact that we don't need to generate install rules, makes it a
  441. // lot simpler.
  442. /////////////////////////////////////////////////////////////////////
  443. #forscopes noinst_lib_target
  444. #define varname $[subst -,_,lib$[TARGET]_so]
  445. $[varname] = $[osfilename $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[so_dir]\%.obj,%,,$[get_sources]]]]
  446. #define target $[so_dir]\lib$[TARGET]$[dllext].$[dlllib]
  447. #define sources $($[varname])
  448. $[target] : $[sources]
  449. #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
  450. $[TAB] $[SHARED_LIB_C++]
  451. #else
  452. $[TAB] $[SHARED_LIB_C]
  453. #endif
  454. #if $[build_dlls]
  455. $[so_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].dll
  456. #endif
  457. #if $[build_pdbs]
  458. $[so_dir]\lib$[TARGET]$[dllext].pdb : $[so_dir]\lib$[TARGET]$[dllext].dll
  459. #endif
  460. #end noinst_lib_target
  461. /////////////////////////////////////////////////////////////////////
  462. // Now the static libraries. Again, we assume there's no interrogate
  463. // interfaces going on in here, and there's no question of this being
  464. // a metalib, making the rules relatively simple.
  465. /////////////////////////////////////////////////////////////////////
  466. #forscopes static_lib_target ss_lib_target
  467. #define varname $[subst -,_,lib$[TARGET]_a]
  468. $[varname] = $[osfilename $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[st_dir]\%.obj,%,,$[get_sources]]]]
  469. #define target $[st_dir]\lib$[TARGET]$[dllext].lib
  470. #define sources $($[varname])
  471. $[target] : $[sources]
  472. #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
  473. $[TAB] $[STATIC_LIB_C++]
  474. #else
  475. $[TAB] $[STATIC_LIB_C]
  476. #endif
  477. #define installed_files \
  478. $[install_lib_dir]\lib$[TARGET]$[dllext].lib \
  479. $[INSTALL_SCRIPTS:%=$[install_bin_dir]\%] \
  480. $[INSTALL_HEADERS:%=$[install_headers_dir]\%] \
  481. $[INSTALL_DATA:%=$[install_data_dir]\%] \
  482. $[INSTALL_CONFIG:%=$[install_config_dir]\%]
  483. install-lib$[TARGET] : $[installed_files]
  484. uninstall-lib$[TARGET] :
  485. #foreach file $[sort $[installed_files]]
  486. $[TAB] -del /f $[file]
  487. #end file
  488. $[install_lib_dir]\lib$[TARGET]$[dllext].lib : $[st_dir]\lib$[TARGET]$[dllext].lib
  489. #define local lib$[TARGET]$[dllext].lib
  490. #define dest $[install_lib_dir]
  491. $[TAB] $[NT_COPYCMD] $[st_dir]\$[local] $[dest]
  492. #end static_lib_target ss_lib_target
  493. /////////////////////////////////////////////////////////////////////
  494. // The sed_bin_targets are a special bunch. These are scripts that
  495. // are to be preprocessed with sed before being installed, for
  496. // instance to insert a path or something in an appropriate place.
  497. /////////////////////////////////////////////////////////////////////
  498. #forscopes sed_bin_target
  499. $[TARGET] : $[st_dir]\$[TARGET]
  500. #define target $[st_dir]\$[TARGET]
  501. #define source $[SOURCE]
  502. #define script $[COMMAND]
  503. $[target] : $[source]
  504. $[TAB] $[SED]
  505. #define installed_files \
  506. $[install_bin_dir]\$[TARGET]
  507. install-$[TARGET] : $[installed_files]
  508. uninstall-$[TARGET] :
  509. #foreach file $[sort $[installed_files]]
  510. $[TAB] -del /f $[file]
  511. #end file
  512. #define local $[TARGET]
  513. #define dest $[install_bin_dir]
  514. $[install_bin_dir]\$[TARGET] : $[st_dir]\$[TARGET]
  515. $[TAB] $[NT_COPYCMD] $[st_dir]\$[local] $[dest]
  516. #end sed_bin_target
  517. /////////////////////////////////////////////////////////////////////
  518. // And now, the bin_targets. These are normal C++ executables. No
  519. // interrogate, metalibs, or any such nonsense here.
  520. /////////////////////////////////////////////////////////////////////
  521. #forscopes bin_target
  522. $[TARGET] : $[st_dir]\$[TARGET].exe
  523. #define varname $[subst -,_,bin_$[TARGET]]
  524. $[varname] = $[osfilename $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[st_dir]\%.obj,%,,$[get_sources]]]]
  525. #define target $[st_dir]\$[TARGET].exe
  526. #define sources $($[varname])
  527. #define ld $[get_ld]
  528. #define transitive_link $[complete_local_libs]
  529. $[target] : $[sources]
  530. #if $[ld]
  531. // If there's a custom linker defined for the target, we have to use it.
  532. $[TAB] $[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
  533. #else
  534. // Otherwise, we can use the normal linker.
  535. #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
  536. $[TAB] $[LINK_BIN_C++]
  537. #else
  538. $[TAB] $[LINK_BIN_C]
  539. #endif
  540. #endif
  541. #define transitive_link
  542. #if $[build_pdbs]
  543. $[st_dir]\$[TARGET].pdb : $[st_dir]\$[TARGET].exe
  544. #endif
  545. #define installed_files \
  546. $[install_bin_dir]\$[TARGET].exe \
  547. $[if $[build_pdbs],$[install_bin_dir]\$[TARGET].pdb] \
  548. $[INSTALL_SCRIPTS:%=$[install_bin_dir]\%] \
  549. $[INSTALL_HEADERS:%=$[install_headers_dir]\%] \
  550. $[INSTALL_DATA:%=$[install_data_dir]\%] \
  551. $[INSTALL_CONFIG:%=$[install_config_dir]\%]
  552. install-$[TARGET] : $[installed_files]
  553. uninstall-$[TARGET] :
  554. #foreach file $[sort $[installed_files]]
  555. $[TAB] -del /f $[file]
  556. #end file
  557. $[install_bin_dir]\$[TARGET].exe : $[st_dir]\$[TARGET].exe
  558. #define local $[TARGET].exe
  559. #define dest $[install_bin_dir]
  560. $[TAB] $[NT_COPYCMD] $[st_dir]\$[local] $[dest]
  561. #if $[build_pdbs]
  562. $[install_bin_dir]\$[TARGET].pdb : $[st_dir]\$[TARGET].pdb
  563. #define local $[TARGET].pdb
  564. #define dest $[install_bin_dir]
  565. $[TAB] $[NT_COPYCMD] $[st_dir]\$[local] $[dest]
  566. #endif
  567. #end bin_target
  568. /////////////////////////////////////////////////////////////////////
  569. // The noinst_bin_targets and the test_bin_targets share the property
  570. // of being built (when requested), but having no install rules.
  571. /////////////////////////////////////////////////////////////////////
  572. #forscopes noinst_bin_target test_bin_target
  573. $[TARGET] : $[st_dir]\$[TARGET].exe
  574. #define varname $[subst -,_,bin_$[TARGET]]
  575. $[varname] = $[osfilename $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[st_dir]\%.obj,%,,$[get_sources]]]]
  576. #define target $[st_dir]\$[TARGET].exe
  577. #define sources $($[varname])
  578. $[target] : $[sources]
  579. #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
  580. $[TAB] $[LINK_BIN_C++]
  581. #else
  582. $[TAB] $[LINK_BIN_C]
  583. #endif
  584. #end noinst_bin_target test_bin_target
  585. /////////////////////////////////////////////////////////////////////
  586. // Finally, we put in the rules to compile each source file into a .obj
  587. // file.
  588. /////////////////////////////////////////////////////////////////////
  589. // Rules to generate a C++ file from a Bison input file.
  590. #foreach file $[sort $[yxx_so_sources] $[yxx_st_sources]]
  591. #define target $[patsubst %.yxx,%.cxx,$[file]]
  592. #define target_header $[patsubst %.yxx,%.h,$[file]]
  593. #if $[HAVE_BISON]
  594. #define source $[file]
  595. $[target] : $[source]
  596. $[TAB] $[BISON] $[YFLAGS] -y $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[source]
  597. $[TAB] move y.tab.c $[target]
  598. $[TAB] move y.tab.h $[patsubst %.yxx,%.h,$[source]]
  599. $[target_header] : $[target]
  600. $[target].prebuilt : $[target]
  601. $[TAB] copy $[target] $[target].prebuilt
  602. $[target_header].prebuilt : $[target_header]
  603. $[TAB] copy $[target_header] $[target_header].prebuilt
  604. #else // HAVE_BISON
  605. #define source $[target].prebuilt
  606. $[target] : $[source]
  607. $[TAB] copy $[source] $[target]
  608. #define source $[target_header].prebuilt
  609. $[target_header] : $[source]
  610. $[TAB] copy $[source] $[target_header]
  611. #endif // HAVE_BISON
  612. #end file
  613. // Rules to generate a C++ file from a Flex input file.
  614. #foreach file $[sort $[lxx_so_sources] $[lxx_st_sources]]
  615. #define target $[patsubst %.lxx,%.cxx,$[file]]
  616. #if $[HAVE_BISON]
  617. #define source $[file]
  618. $[target] : $[source]
  619. $[TAB] $[FLEX] $[LFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[source]
  620. #define source lex.yy.c
  621. #define script /#include <unistd.h>/d
  622. $[TAB] $[SED]
  623. $[TAB] -del $[source]
  624. $[target].prebuilt : $[target]
  625. $[TAB] copy $[target] $[target].prebuilt
  626. #else // HAVE_BISON
  627. #define source $[target].prebuilt
  628. $[target] : $[source]
  629. $[TAB] copy $[source] $[target]
  630. #endif // HAVE_BISON
  631. #end file
  632. // Rules to compile ordinary C files that appear on a shared library.
  633. #foreach file $[sort $[c_so_sources]]
  634. #define target $[patsubst %.c,$[so_dir]\%.obj,$[file]]
  635. #define source $[file]
  636. #define ipath $[file_ipath]
  637. #define flags $[cflags] $[CFLAGS_SHARED] $[all_sources $[building_var:%=/D%],$[file]]
  638. $[target] : $[source] $[dependencies $[source]]
  639. $[TAB] $[COMPILE_C]
  640. #end file
  641. // Rules to compile ordinary C files that appear on a static library
  642. // or in an executable.
  643. #foreach file $[sort $[c_st_sources]]
  644. #define target $[patsubst %.c,$[st_dir]\%.obj,$[file]]
  645. #define source $[file]
  646. #define ipath $[file_ipath]
  647. #define flags $[cflags] $[all_sources $[building_var:%=/D%],$[file]]
  648. $[target] : $[source] $[dependencies $[source]] $[st_pch_files]
  649. $[TAB] $[COMPILE_C]
  650. #end file
  651. // Rules to compile C++ files that appear on a shared library.
  652. #foreach file $[sort $[cxx_so_sources]]
  653. #define target $[patsubst %.cxx,$[so_dir]\%.obj,$[file]]
  654. #define source $[file]
  655. #define ipath $[file_ipath]
  656. #if $[DO_PCH]
  657. // best way to find out if file use pch (and needs /Yu) is to check dependencies
  658. // these must be defined before flags (or could defer them)
  659. #define target_pch $[subst \./,\,$[patsubst %.h,$[so_dir]\%.pch,$[filter %_headers.h, $[dependencies $[file]]]]]
  660. #endif
  661. // COMPILE_LINE uses flags which uses pdb_filename
  662. #define flags $[c++flags] $[CFLAGS_SHARED] $[all_sources $[building_var:%=/D%],$[file]]
  663. #if $[target_pch]
  664. // for pch, pch .pdb filename must match .obj filename
  665. #define pdb_filename $[osfilename $[so_dir]/$[TARGET(lib_target)]] // assumes pch only occurs in lib_target scope, not metalib_target or in interrogate
  666. #define COMPILE_LINE $[patsubst /Fd%, /Fd"$[pdb_filename].pdb",$[COMPILE_C_WITH_PCH]]
  667. #else
  668. #define COMPILE_LINE $[COMPILE_C++]
  669. #endif
  670. // Yacc must run before some files can be compiled, so all files
  671. // depend on yacc having run.
  672. $[target] : $[source] $[dependencies $[file]] $[yxx_st_sources:%.yxx=%.h] $[target_pch]
  673. $[TAB] $[COMPILE_LINE]
  674. #end file
  675. // Rules to compile C++ files that appear on a static library or in an
  676. // executable.
  677. #foreach file $[sort $[cxx_st_sources]]
  678. #define target $[patsubst %.cxx,$[st_dir]\%.obj,$[file]]
  679. #define source $[file]
  680. #define ipath $[file_ipath]
  681. #define pdb_filename $[st_dir]/$[TARGET(lib_target metalib_target)]
  682. #if $[DO_PCH]
  683. // best way to find out if file use pch (and needs /Yu) is to check dependencies
  684. // these must be defined before flags (or could defer them)
  685. #define target_pch $[subst \./,\,$[patsubst %.h,$[st_dir]\%.pch,$[filter %_headers.h, $[dependencies $[file]]]]]
  686. #endif
  687. #define flags $[c++flags] $[all_sources $[building_var:%=/D%],$[file]]
  688. #if $[target_pch]
  689. // for pch, pch .pdb filename must match .obj filename
  690. #define pdb_filename $[osfilename $[st_dir]/$[TARGET(lib_target)]] // assumes pch only occurs in lib_target scope, not metalib_target or in interrogate
  691. #define COMPILE_LINE $[patsubst /Fd%, /Fd"$[pdb_filename].pdb",$[COMPILE_C_WITH_PCH]]
  692. #else
  693. #define COMPILE_LINE $[COMPILE_C++]
  694. #endif
  695. // Yacc must run before some files can be compiled, so all files
  696. // depend on yacc having run.
  697. $[target] : $[source] $[dependencies $[file]] $[yxx_st_sources:%.yxx=%.h] $[target_pch]
  698. $[TAB] $[COMPILE_LINE]
  699. #end file
  700. #if $[DO_PCH]
  701. // Rules to compile _headers.pch from _header.h in static lib
  702. #foreach file $[pch_header_source]
  703. #define target_pch $[patsubst %.h,$[st_dir]\%.pch,$[file]]
  704. #define target_obj $[patsubst %.h,$[st_dir]\%.obj,$[file]]
  705. #define target $[target_obj]
  706. #define source $[file]
  707. #define ipath $[file_ipath]
  708. #define flags $[c++flags] $[CFLAGS_SHARED] $[all_sources $[building_var:%=/D%],$[file]]
  709. #define pdb_filename $[osfilename $[st_dir]/$[TARGET(lib_target)]] // assumes pch only occurs in lib_target scope, not metalib_target or in interrogate
  710. #define COMPILE_CXXSTYLE_PCH $[patsubst /Fd%, /Fd"$[pdb_filename].pdb",$[COMPILE_CXXSTYLE_PCH]]
  711. // Yacc must run before some files can be compiled, so all files
  712. // depend on yacc having run.
  713. $[target_obj] : $[source] $[dependencies $[file]]
  714. $[TAB] $[COMPILE_CXXSTYLE_PCH]
  715. $[target_pch] : $[target_obj]
  716. #end file
  717. #endif
  718. // Rules to compile generated C++ files that appear on a shared library.
  719. #foreach file $[sort $[yxx_so_sources] $[lxx_so_sources]]
  720. #define target $[patsubst %.lxx %.yxx,$[so_dir]\%.obj,$[file]]
  721. #define source $[patsubst %.lxx %.yxx,%.cxx,$[file]]
  722. #define ipath $[file_ipath]
  723. #define flags $[noopt_c++flags] $[CFLAGS_SHARED] $[all_sources $[building_var:%=/D%],$[file]]
  724. // Yacc must run before some files can be compiled, so all files
  725. // depend on yacc having run.
  726. $[target] : $[source] $[dependencies $[file]] $[yxx_so_sources:%.yxx=%.h]
  727. $[TAB] $[COMPILE_C++]
  728. #end file
  729. // Rules to compile generated C++ files that appear on a static
  730. // library or in an executable.
  731. #foreach file $[sort $[yxx_st_sources] $[lxx_st_sources]]
  732. #define target $[patsubst %.lxx %.yxx,$[st_dir]\%.obj,$[file]]
  733. #define source $[patsubst %.lxx %.yxx,%.cxx,$[file]]
  734. #define ipath $[file_ipath]
  735. #define flags $[noopt_c++flags] $[all_sources $[building_var:%=/D%],$[file]]
  736. $[target] : $[source] $[dependencies $[file]] $[yxx_st_sources:%.yxx=%.h]
  737. $[TAB] $[COMPILE_C++]
  738. #end file
  739. // And now the rules to install the auxiliary files, like headers and
  740. // data files.
  741. #foreach file $[install_scripts]
  742. $[install_bin_dir]\$[file] : $[file]
  743. #define local $[file]
  744. #define dest $[install_bin_dir]
  745. $[TAB] $[NT_COPYCMD] $[local] $[dest]
  746. #end file
  747. #foreach file $[install_headers]
  748. $[install_headers_dir]\$[file] : $[file]
  749. #define local $[file]
  750. #define dest $[install_headers_dir]
  751. $[TAB] $[NT_COPYCMD] $[local] $[dest]
  752. #end file
  753. #foreach file $[install_parser_inc]
  754. $[install_parser_inc_dir]\$[file] : $[file]
  755. #define local $[file]
  756. #define dest $[install_parser_inc_dir]
  757. $[TAB] $[NT_COPYCMD] $[local] $[dest]
  758. #end file
  759. #foreach file $[install_data]
  760. $[install_data_dir]\$[file] : $[file]
  761. #define local $[file]
  762. #define dest $[install_data_dir]
  763. $[TAB] $[NT_COPYCMD] $[local] $[dest]
  764. #end file
  765. #foreach file $[install_config]
  766. $[install_config_dir]\$[file] : $[file]
  767. #define local $[file]
  768. #define dest $[install_config_dir]
  769. $[TAB] $[NT_COPYCMD] $[local] $[dest]
  770. #end file
  771. // Finally, all the special targets. These are commands that just need
  772. // to be invoked; we don't pretend to know what they are.
  773. #forscopes special_target
  774. $[TARGET] :
  775. $[TAB] $[COMMAND]
  776. #end special_target
  777. // Finally, the rules to freshen the Makefile itself.
  778. Makefile : $[SOURCE_FILENAME]
  779. $[TAB] ppremake
  780. #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
  781. $[DEPENDENCY_CACHE_FILENAME] : $[dep_sources]
  782. $[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME]
  783. #endif
  784. #end Makefile
  785. //////////////////////////////////////////////////////////////////////
  786. #elif $[eq $[DIR_TYPE], group]
  787. //////////////////////////////////////////////////////////////////////
  788. // This is a group directory: a directory above a collection of source
  789. // directories, e.g. $DTOOL/src. We don't need to output anything in
  790. // this directory.
  791. //////////////////////////////////////////////////////////////////////
  792. #elif $[eq $[DIR_TYPE], toplevel]
  793. //////////////////////////////////////////////////////////////////////
  794. // This is the toplevel directory, e.g. $DTOOL. Here we build the
  795. // root makefile and also synthesize the dtool_config.h (or whichever
  796. // file) we need.
  797. #map subdirs
  798. // Iterate through all of our known source files. Each src and
  799. // metalib type file gets its corresponding Makefile listed
  800. // here. However, we test for $[DIR_TYPE] of toplevel, because the
  801. // source directories typically don't define their own DIR_TYPE
  802. // variable, and they end up inheriting this one dynamically.
  803. #forscopes */
  804. #if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib],$[and $[eq $[DIR_TYPE], toplevel],$[ne $[DIRNAME],top]]]
  805. #if $[build_directory]
  806. #addmap subdirs $[DIRNAME]
  807. #endif
  808. #endif
  809. #end */
  810. #output Makefile
  811. #format makefile
  812. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  813. ################################# DO NOT EDIT ###########################
  814. all : $[subdirs]
  815. test : $[subdirs:%=test-%]
  816. igate : $[subdirs:%=igate-%]
  817. clean : $[subdirs:%=clean-%]
  818. clean-igate : $[subdirs:%=clean-igate-%]
  819. cleanall : $[subdirs:%=cleanall-%]
  820. install : $[if $[CONFIG_HEADER],$[install_headers_dir] $[install_headers_dir]\$[CONFIG_HEADER]] $[subdirs:%=install-%]
  821. install-igate : $[subdirs:%=install-igate-%]
  822. uninstall : $[subdirs:%=uninstall-%]
  823. #if $[CONFIG_HEADER]
  824. $[TAB] -del /f $[install_headers_dir]\$[CONFIG_HEADER]
  825. #endif
  826. uninstall-igate : $[subdirs:%=uninstall-igate-%]
  827. #if $[HAVE_BISON]
  828. prebuild-bison : $[subdirs:%=prebuild-bison-%]
  829. clean-prebuild-bison : $[subdirs:%=clean-prebuild-bison-%]
  830. #endif
  831. #formap dirname subdirs
  832. #define depends
  833. $[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]
  834. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo all
  835. #end dirname
  836. #formap dirname subdirs
  837. test-$[dirname] :
  838. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo test
  839. #end dirname
  840. #formap dirname subdirs
  841. igate-$[dirname] :
  842. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo igate
  843. #end dirname
  844. #formap dirname subdirs
  845. clean-$[dirname] :
  846. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo clean
  847. #end dirname
  848. #formap dirname subdirs
  849. clean-igate-$[dirname] :
  850. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo clean-igate
  851. #end dirname
  852. #formap dirname subdirs
  853. cleanall-$[dirname] : $[patsubst %,cleanall-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]
  854. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo cleanall
  855. #end dirname
  856. #formap dirname subdirs
  857. install-$[dirname] : $[patsubst %,install-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]
  858. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo install
  859. #end dirname
  860. #formap dirname subdirs
  861. install-igate-$[dirname] :
  862. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo install-igate
  863. #end dirname
  864. #formap dirname subdirs
  865. uninstall-$[dirname] :
  866. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo uninstall
  867. #end dirname
  868. #formap dirname subdirs
  869. uninstall-igate-$[dirname] :
  870. $[TAB] cd $[osfilename $[PATH]] && $(MAKE) /nologo uninstall-igate
  871. #end dirname
  872. #if $[HAVE_BISON]
  873. #formap dirname subdirs
  874. prebuild-bison-$[dirname] :
  875. $[TAB]cd $[osfilename $[PATH]] && $(MAKE) /nologo prebuild-bison
  876. clean-prebuild-bison-$[dirname] :
  877. $[TAB]cd $[osfilename $[PATH]] && $(MAKE) /nologo clean-prebuild-bison
  878. #end dirname
  879. #endif
  880. #if $[ne $[CONFIG_HEADER],]
  881. $[install_headers_dir] :
  882. $[TAB] mkdir $[install_headers_dir]
  883. $[install_headers_dir]\$[CONFIG_HEADER] : $[CONFIG_HEADER]
  884. #define local $[CONFIG_HEADER]
  885. #define dest $[install_headers_dir]
  886. $[TAB] $[NT_COPYCMD] $[local] $[dest]
  887. #endif
  888. #end Makefile
  889. // If there is a file called LocalSetup.pp in the package's top
  890. // directory, then invoke that. It might contain some further setup
  891. // instructions.
  892. #sinclude $[TOPDIRPREFIX]LocalSetup.msvc.pp
  893. #sinclude $[TOPDIRPREFIX]LocalSetup.pp
  894. //////////////////////////////////////////////////////////////////////
  895. #elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]]
  896. //////////////////////////////////////////////////////////////////////
  897. #include $[THISDIRPREFIX]Template.models.pp
  898. //////////////////////////////////////////////////////////////////////
  899. #endif // DIR_TYPE