Template.nmake.pp 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  1. //
  2. // Template.nmake.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, similar to Template.msvc.pp
  7. //
  8. // It is a clone of Template.gmsvc.pp that has been adapter do work
  9. // with nmake and visual studio. I didn't call it Template.msvc.pp
  10. // so as not to confuse it with the previous Template.msvc.pp which
  11. // attempts to create visual studio projects.
  12. //
  13. // Steven "Sauce" Osman, July 17, 2003
  14. //
  15. // Note:
  16. // There's one weird behavior when running interrogate, specifically
  17. // with its -od directive. This is because the pathname specified
  18. // in -od is dropped into a string in a c++ source file. This makes
  19. // the c++ compiler interpret all back-slashes as escape sequences.
  20. // To fix this, the back-slashes were replaced by double backslashes.
  21. // This doesn't seem to break interrogate's ability to open the files
  22. // (because additional slashes don't bother the OS), and it allows
  23. // the escape character interpretation to work.
  24. //
  25. // Note:
  26. // The SED variable uses single quotes around the command. A
  27. // substitution was added to make them double quotes.
  28. // Before this file is processed, the following files are read and
  29. // processed (in order):
  30. // The Package.pp file in the root of the current source hierarchy
  31. // (e.g. $PANDA/Package.pp)
  32. // $DTOOL/Package.pp
  33. // $DTOOL/Config.pp
  34. // $DTOOL/Config.Platform.pp
  35. // The user's PPREMAKE_CONFIG file.
  36. // $DTOOL/pptempl/System.pp
  37. // All of the Sources.pp files in the current source hierarchy
  38. // $DTOOL/pptempl/Global.pp
  39. // $DTOOL/pptempl/Global.nmake.pp
  40. // $DTOOL/pptempl/Depends.pp, once for each Sources.pp file
  41. // Template.nmake.pp (this file), once for each Sources.pp file
  42. #if $[ne $[CTPROJS],]
  43. #define dtool_ver_dir_cyg $[DTOOL]/src/dtoolbase
  44. #define dtool_ver_dir $[osfilename $[DTOOL]/src/dtoolbase]
  45. #endif
  46. //////////////////////////////////////////////////////////////////////
  47. #if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib]]
  48. //////////////////////////////////////////////////////////////////////
  49. // For a source directory, build a single Makefile with rules to build
  50. // each target.
  51. #if $[build_directory]
  52. // This is the real set of lib_targets we'll be building. On Windows,
  53. // we don't build the shared libraries which are included on metalibs.
  54. #define real_lib_targets
  55. #define real_lib_target_libs
  56. #define deferred_objs
  57. #forscopes lib_target
  58. #if $[eq $[module $[TARGET],$[TARGET]],]
  59. // This library is not on a metalib, so we can build it.
  60. #set real_lib_targets $[real_lib_targets] $[TARGET]
  61. #set real_lib_target_libs $[real_lib_target_libs] $[ODIR]/$[get_dllname $[TARGET]].$[dlllib]
  62. #else
  63. // This library is on a metalib, so we can't build it, but we
  64. // should build all the obj's that go into it.
  65. #set deferred_objs $[deferred_objs] \
  66. $[patsubst %,$[%_obj],$[compile_sources]]
  67. #endif
  68. #end lib_target
  69. // We need to know the various targets we'll be building.
  70. // $[lib_targets] will be the list of dynamic libraries,
  71. // $[static_lib_targets] the list of static libraries, and
  72. // $[bin_targets] the list of binaries. $[test_bin_targets] is the
  73. // list of binaries that are to be built only when specifically asked for.
  74. #define lib_targets $[forscopes metalib_target noinst_lib_target test_lib_target,$[if $[build_target],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]] $[real_lib_target_libs]
  75. #define static_lib_targets $[forscopes static_lib_target ss_lib_target,$[if $[build_target],$[ODIR]/$[get_dllname $[TARGET]].lib]]
  76. #define bin_targets \
  77. $[active_target(bin_target noinst_bin_target):%=$[ODIR]/%.exe] \
  78. $[active_target(sed_bin_target):%=$[ODIR]/%]
  79. #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%.exe]
  80. #defer test_lib_targets $[active_target(test_lib_target):%=$[if $[TEST_ODIR],$[TEST_ODIR],$[ODIR]]/%.$[dlllib]]
  81. // And these variables will define the various things we need to
  82. // install.
  83. #define install_lib $[active_target(metalib_target static_lib_target ss_lib_target)] $[real_lib_targets]
  84. #define install_bin $[active_target(bin_target)]
  85. #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_SCRIPTS]]
  86. #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_HEADERS]]
  87. #define install_parser_inc $[sort $[INSTALL_PARSER_INC]]
  88. #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_DATA]]
  89. #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_CONFIG]]
  90. #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target)]]
  91. // These are the various sources collected from all targets within the
  92. // directory.
  93. #define st_sources $[sort $[compile_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]]
  94. #define yxx_st_sources $[sort $[yxx_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]]
  95. #define lxx_st_sources $[sort $[lxx_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]]
  96. #define dep_sources_1 $[sort $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]]
  97. // If there is an __init__.py in the directory, then all Python
  98. // files in the directory just get installed without having to be
  99. // named.
  100. #if $[and $[INSTALL_PYTHON_SOURCE],$[wildcard $[TOPDIR]/$[DIRPREFIX]__init__.py]]
  101. #define py_sources $[wildcard $[TOPDIR]/$[DIRPREFIX]*.py]
  102. #endif
  103. #define install_py $[py_sources:$[TOPDIR]/$[DIRPREFIX]%=%]
  104. // These are the source files that our dependency cache file will
  105. // depend on. If it's an empty list, we won't bother writing rules to
  106. // freshen the cache file.
  107. #define dep_sources $[sort $[filter %.c %.cxx %.cpp %.yxx %.lxx %.h %.I %.T,$[dep_sources_1]]]
  108. #endif // $[build_directory]
  109. // We define $[complete_local_libs] as the full set of libraries (from
  110. // within this tree) that we must link a particular target with. It
  111. // is the transitive closure of our dependent libs: the libraries we
  112. // depend on, plus the libraries *those* libraries depend on, and so on.
  113. #defer complete_local_libs $[unique $[closure all_libs,$[active_libs]]]
  114. #defer actual_local_libs $[get_metalibs $[TARGET],$[complete_local_libs]]
  115. // $[static_lib_dependencies] is the set of libraries we will link
  116. // with that happen to be static libs. We will introduce dependency
  117. // rules for these. (We don't need dependency rules for dynamic libs,
  118. // since these don't get burned in at build time.)
  119. #defer static_lib_dependencies $[all_libs $[if $[lib_is_static],$[RELDIR:%=%/$[ODIR]/lib$[TARGET]$[dllext].lib]],$[complete_local_libs]]
  120. // And $[complete_ipath] is the list of directories (from within this
  121. // tree) we should add to our -I list. It's basically just one for
  122. // each directory named in the $[complete_local_libs], above, plus
  123. // whatever else the user might have explicitly named in
  124. // $[LOCAL_INCS]. LOCAL_INCS MUST be a ppremake src dir! (RELDIR only checks those)
  125. // To add an arbitrary extra include dir, define EXTRA_IPATH in the Sources.pp
  126. #defer complete_ipath $[all_libs $[RELDIR],$[complete_local_libs]] $[RELDIR($[LOCAL_INCS:%=%/])] $[EXTRA_IPATH]
  127. // $[target_ipath] is the proper ipath to put on the command line,
  128. // from the context of a particular target.
  129. #defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%/include] $[get_ipath]
  130. // These are the complete set of extra flags the compiler requires.
  131. #defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]]
  132. #defer c++flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]]
  133. // $[complete_lpath] is rather like $[complete_ipath]: the list of
  134. // directories (from within this tree) we should add to our -L list.
  135. #defer complete_lpath $[static_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]]
  136. // $[lpath] is like $[target_ipath]: it's the list of directories we
  137. // should add to our -L list, from the context of a particular target.
  138. #defer lpath $[sort $[complete_lpath]] $[other_trees:%=%/lib] $[get_lpath]
  139. // And $[libs] is the set of libraries we will link with.
  140. #defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]]
  141. // This is the set of files we might copy into *.prebuilt, if we have
  142. // bison and flex (or copy from *.prebuilt if we don't have them).
  143. #define bison_prebuilt $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]]
  144. // Rather than making a rule to generate each install directory later,
  145. // we create the directories now. This reduces problems from
  146. // multiprocess builds.
  147. #mkdir $[sort \
  148. $[if $[install_lib],$[install_lib_dir]] \
  149. $[if $[install_bin] $[install_scripts],$[install_bin_dir]] \
  150. $[if $[install_headers],$[install_headers_dir]] \
  151. $[if $[install_parser_inc],$[install_parser_inc_dir]] \
  152. $[if $[install_data],$[install_data_dir]] \
  153. $[if $[install_config],$[install_config_dir]] \
  154. $[if $[install_igatedb],$[install_igatedb_dir]] \
  155. $[if $[install_py],$[install_py_dir] $[install_py_package_dir]] \
  156. ]
  157. // Similarly, we need to ensure that $[ODIR] exists. Trying to make
  158. // the makefiles do this automatically just causes problems with
  159. // multiprocess builds.
  160. #mkdir $[ODIR] $[TEST_ODIR]
  161. // Pre-compiled headers are one way to speed the compilation of many
  162. // C++ source files that include similar headers, but it turns out a
  163. // more effective (and more portable) way is simply to compile all the
  164. // similar source files in one pass.
  165. // We do this by generating a *_composite.cxx file that has an
  166. // #include line for each of several actual source files, and then we
  167. // compile the composite file instead of the original files.
  168. #foreach composite_file $[composite_list]
  169. #output $[composite_file] notouch
  170. #format collapse
  171. /* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */
  172. /* ################################# DO NOT EDIT ########################### */
  173. #foreach file $[$[composite_file]_sources]
  174. ##include "$[file]"
  175. #end file
  176. #end $[composite_file]
  177. #end composite_file
  178. // Okay, we're ready. Start outputting the Makefile now.
  179. #output Makefile
  180. #format makefile
  181. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  182. ################################# DO NOT EDIT ###########################
  183. // The 'all' rule makes all the stuff in the directory except for the
  184. // test_bin_targets. It doesn't do any installation, however.
  185. #define all_targets \
  186. Makefile \
  187. $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \
  188. $[sort $[lib_targets] $[static_lib_targets] $[bin_targets]] \
  189. $[deferred_objs]
  190. all : $[patsubst %,$[osfilename %],$[all_targets]]
  191. // The 'test' rule makes all the test_bin_targets.
  192. test : $[patsubst %,$[osfilename %],$[test_bin_targets] $[test_lib_targets]]
  193. clean : clean-igate
  194. #forscopes metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target
  195. #foreach file $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  196. $[TAB] if exist $[file] del /f $[file]
  197. #end file
  198. #end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target
  199. #if $[deferred_objs]
  200. #foreach file $[patsubst %,$[osfilename %],$[deferred_objs]]
  201. $[TAB] if exist $[file] del /f $[file]
  202. #end file
  203. #endif
  204. #if $[lib_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets]
  205. #foreach file $[patsubst %,$[osfilename %],$[lib_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets]]
  206. $[TAB] if exist $[file] del /f $[file]
  207. #end file
  208. #endif
  209. $[TAB] if exist *.pyc del *.pyc
  210. $[TAB] if exist *.pyo del *.pyo // Also scrub out old generated Python code.
  211. // 'cleanall' is intended to undo all the effects of running ppremake
  212. // and building. It removes everything except the Makefile.
  213. cleanall : clean
  214. #if $[st_sources]
  215. $[TAB] if exist $[osfilename $[ODIR]\*.*] del /f/s/q $[osfilename $[ODIR]\*.*]
  216. #endif
  217. #if $[yxx_st_sources] $[lxx_st_sources]
  218. #foreach file $[patsubst %,$[osfilename %],$[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]]]
  219. $[TAB] if exist $[file] del /f $[file]
  220. #end file
  221. #endif
  222. #if $[ne $[DEPENDENCY_CACHE_FILENAME],]
  223. $[TAB] if exist $[osfilename $[DEPENDENCY_CACHE_FILENAME]] del /f $[osfilename $[DEPENDENCY_CACHE_FILENAME]]
  224. #endif
  225. #if $[composite_list]
  226. #foreach file $[patsubst %,$[osfilename %],$[composite_list]]
  227. $[TAB] if exist $[file] del /f $[file]
  228. #end file
  229. #endif
  230. clean-igate :
  231. #forscopes metalib_target lib_target ss_lib_target
  232. #define igatedb $[get_igatedb]
  233. #define igateoutput $[get_igateoutput]
  234. #define igatemscan $[get_igatemscan]
  235. #define igatemout $[get_igatemout]
  236. #if $[igatedb]
  237. $[TAB] if exist $[osfilename $[igatedb]] del /f $[osfilename $[igatedb]]
  238. #endif
  239. #if $[igateoutput]
  240. #foreach file $[patsubst %,$[osfilename %],$[igateoutput] $[$[igateoutput]_obj]]
  241. $[TAB] if exist $[file] del /f $[file]
  242. #end file
  243. #endif
  244. #if $[igatemout]
  245. #foreach file $[patsubst %,$[osfilename %],$[igatemout] $[$[igatemout]_obj]]
  246. $[TAB] if exist $[file] del /f $[file]
  247. #end file
  248. #endif
  249. #end metalib_target lib_target ss_lib_target
  250. // Now, 'install' and 'uninstall'. These simply copy files into the
  251. // install directory (or remove them). The 'install' rule also makes
  252. // the directories if necessary.
  253. #define installed_files \
  254. $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
  255. $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
  256. $[INSTALL_PARSER_INC:%=$[install_parser_inc_dir]/%] \
  257. $[INSTALL_DATA:%=$[install_data_dir]/%] \
  258. $[INSTALL_CONFIG:%=$[install_config_dir]/%] \
  259. $[if $[install_py],$[install_py:%=$[install_py_dir]/%] $[install_py_package_dir]/__init__.py]
  260. #define installed_igate_files \
  261. $[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%]
  262. #define install_targets \
  263. $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=install-lib%] \
  264. $[active_target(bin_target sed_bin_target):%=install-%] \
  265. $[installed_files]
  266. install : $[patsubst %,$[osfilename %],all $[install_targets]]
  267. install-igate : $[patsubst %,$[osfilename %],$[sort $[installed_igate_files]]]
  268. uninstall : $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%]
  269. #if $[installed_files]
  270. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  271. $[TAB] if exist $[file] del /f $[file]
  272. #end file
  273. #endif
  274. uninstall-igate :
  275. #if $[installed_igate_files]
  276. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_igate_files]]]
  277. $[TAB] if exist $[file] del /f $[file]
  278. #end file
  279. #endif
  280. #if $[HAVE_BISON]
  281. prebuild-bison : $[patsubst %,$[osfilename %],$[patsubst %,%.prebuilt,$[bison_prebuilt]]]
  282. clean-prebuild-bison :
  283. #if $[bison_prebuilt]
  284. #foreach file $[patsubst %,$[osfilename %],$[sort $[patsubst %,%.prebuilt,$[bison_prebuilt]]]]
  285. $[TAB] if exist $[file] del /f $[file]
  286. #end file
  287. #endif
  288. #endif
  289. // Now it's time to start generating the rules to make our actual
  290. // targets.
  291. igate : $[patsubst %,$[osfilename %],$[get_igatedb(metalib_target lib_target ss_lib_target)]]
  292. /////////////////////////////////////////////////////////////////////
  293. // First, the dynamic libraries. Each lib_target and metalib_target
  294. // is a dynamic library.
  295. /////////////////////////////////////////////////////////////////////
  296. #forscopes metalib_target lib_target
  297. // In Windows, we don't actually build all the libraries. In
  298. // particular, we don't build any libraries that are listed on a
  299. // metalib. Is this one such a library?
  300. #define build_it $[eq $[module $[TARGET],$[TARGET]],]
  301. // We might need to define a BUILDING_ symbol for win32. We use the
  302. // BUILDING_DLL variable name, defined typically in the metalib, for
  303. // this; but in some cases, where the library isn't part of a metalib,
  304. // we define BUILDING_DLL directly for the target.
  305. #define building_var $[or $[BUILDING_DLL],$[module $[BUILDING_DLL],$[TARGET]]]
  306. // $[igatescan] is the set of C++ headers and source files that we
  307. // need to scan for interrogate. $[igateoutput] is the name of the
  308. // generated .cxx file that interrogate will produce (and which we
  309. // should compile into the library). $[igatedb] is the name of the
  310. // generated .in file that interrogate will produce (and which should
  311. // be installed into the /etc directory).
  312. #define igatescan $[get_igatescan]
  313. #define igateoutput $[get_igateoutput]
  314. #define igatedb $[get_igatedb]
  315. // If this is a metalib, it may have a number of components that
  316. // include interrogated interfaces. If so, we need to generate a
  317. // 'module' file within this library. This is mainly necessary for
  318. // Python; it contains a table of all of the interrogated functions,
  319. // so we can load the library as a Python module and have access to
  320. // the interrogated functions.
  321. // $[igatemscan] is the set of .in files generated by all of our
  322. // component libraries. If it is nonempty, then we do need to
  323. // generate a module, and $[igatemout] is the name of the .cxx file
  324. // that interrogate will produce to make this module.
  325. #define igatemscan $[get_igatemscan]
  326. #define igatemout $[get_igatemout]
  327. #if $[build_it]
  328. // Now output the rule to actually link the library from all of its
  329. // various .obj files.
  330. #define sources \
  331. $[patsubst %,$[%_obj],$[compile_sources]] \
  332. $[components $[patsubst %,$[RELDIR]/$[%_obj],$[compile_sources]],$[active_component_libs]]
  333. #define varname $[subst -,_,lib$[TARGET]_so]
  334. $[varname] = $[patsubst %,$[osfilename %],$[sources]]
  335. #define target $[ODIR]/$[get_dllname $[TARGET]].$[dlllib]
  336. #define sources $($[varname])
  337. #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%]
  338. #define mybasename $[basename $[notdir $[target]]]
  339. #define tmpdirname_cyg $[install_lib_dir]/$[mybasename]
  340. #define tmpdirname_win $[osfilename $[tmpdirname_cyg]]
  341. // not parallel (requires gmake 3.79) because of link.exe conflicts in TMP dir (see audiotraits dir)
  342. #if $[GENERATE_BUILDDATE]
  343. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies] $[dtool_ver_dir]/version.rc $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%]]
  344. // first generate builddate for rc compiler using compiler preprocessor
  345. $[TAB] if not exist $[osfilename $[tmpdirname_cyg]] mkdir $[osfilename $[tmpdirname_cyg]] // this dir-creation-stuff is leftover from trying to resolve parallel link difficulties
  346. #define VER_RESOURCE "$[tmpdirname_win]\$[mybasename].res"
  347. $[TAB] cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp" > "$[tmpdirname_win]\verdate.h"
  348. $[TAB] rc /n /I"$[tmpdirname_win]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[VER_RESOURCE] $[filter /D%, $[flags]] "$[dtool_ver_dir]\version.rc"
  349. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  350. $[TAB] $[SHARED_LIB_C++] $[VER_RESOURCE]
  351. #else
  352. $[TAB] $[SHARED_LIB_C] $[VER_RESOURCE]
  353. #endif
  354. #else
  355. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%]]
  356. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  357. $[TAB] $[SHARED_LIB_C++]
  358. #else
  359. $[TAB] $[SHARED_LIB_C]
  360. #endif
  361. #endif
  362. #if $[eq $[USE_COMPILER], MSVC8]
  363. $[TAB] mt -nologo -manifest $[target].manifest -outputresource:$[target];2
  364. #endif
  365. #if $[build_dlls]
  366. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  367. #endif
  368. #if $[build_pdbs]
  369. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  370. #endif
  371. #endif
  372. // Here are the rules to install and uninstall the library and
  373. // everything that goes along with it.
  374. #define installed_files \
  375. $[if $[build_it], \
  376. $[if $[build_dlls],$[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib]] \
  377. $[install_lib_dir]/$[get_dllname $[TARGET]].lib \
  378. $[if $[and $[build_dlls],$[build_pdbs]],$[install_lib_dir]/$[get_dllname $[TARGET]].pdb] \
  379. ] \
  380. $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
  381. $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
  382. $[INSTALL_DATA:%=$[install_data_dir]/%] \
  383. $[INSTALL_CONFIG:%=$[install_config_dir]/%] \
  384. $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%]
  385. install-lib$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  386. uninstall-lib$[TARGET] :
  387. #if $[installed_files]
  388. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  389. $[TAB] if exist $[file] del /f $[file]
  390. #end file
  391. #endif
  392. #if $[build_dlls]
  393. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  394. #define local $[get_dllname $[TARGET]].$[dlllib]
  395. #define dest $[install_lib_dir]
  396. #if $[eq $[USE_COMPILER], MSVC8]
  397. $[TAB] mt -nologo -manifest $[ODIR]/$[local].manifest -outputresource:$[ODIR]/$[local];2
  398. #endif
  399. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  400. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local].manifest] $[osfilename $[dest]]
  401. #endif
  402. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].lib]
  403. #define local $[get_dllname $[TARGET]].lib
  404. #define dest $[install_lib_dir]
  405. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  406. #if $[and $[build_dlls],$[build_pdbs]]
  407. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].pdb]
  408. #define local $[get_dllname $[TARGET]].pdb
  409. #define dest $[install_lib_dir]
  410. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  411. #endif
  412. #if $[igatescan]
  413. // Now, some additional rules to generate and compile the interrogate
  414. // data, if needed.
  415. // The library name is based on this library.
  416. #define igatelib lib$[TARGET]
  417. // The module name comes from the metalib that includes this library.
  418. #define igatemod $[module $[TARGET],$[TARGET]]
  419. #if $[eq $[igatemod],]
  420. // Unless no metalib includes this library.
  421. #define igatemod $[TARGET]
  422. #endif
  423. $[osfilename $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%]] : $[patsubst %,$[osfilename %],$[igatedb]]
  424. #define local $[igatedb]
  425. #define dest $[install_igatedb_dir]
  426. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  427. // We have to split this out as a separate rule to properly support
  428. // parallel make.
  429. $[osfilename $[igatedb]] : $[patsubst %,$[osfilename %],$[igateoutput]]
  430. lib$[TARGET]_igatescan = $[patsubst %,$[osfilename %],$[igatescan]]
  431. $[osfilename $[igateoutput]] : $[patsubst %,$[osfilename %],$[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]]
  432. //// Sauce
  433. //// There's a bug here. The -od is being passed into a string in the file. This
  434. //// makes slashes look like escape sequences.
  435. //// The hacky fix is to use \\ instead of \. Windows seems to still let you open files if you
  436. //// include multiple slashes in them. Then, when quoted, the string will properly
  437. //// be created.
  438. //$[TAB] $[INTERROGATE] -od $[subst \,\\,$[osfilename $[igatedb]]] -oc $[osfilename $[igateoutput]] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
  439. // Actually, drose kindly fixed that
  440. $[TAB] $[INTERROGATE] -od $[osfilename $[igatedb]] -oc $[osfilename $[igateoutput]] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
  441. #endif // igatescan
  442. #if $[igatemout]
  443. // And finally, some additional rules to build the interrogate module
  444. // file into the library, if this is a metalib that includes
  445. // interrogated components.
  446. #define igatelib lib$[TARGET]
  447. #define igatemod $[TARGET]
  448. lib$[TARGET]_igatemscan = $[patsubst %,$[osfilename %],$[igatemscan]]
  449. #define target $[igatemout]
  450. #define sources $(lib$[TARGET]_igatemscan)
  451. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources]]
  452. $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] $[sources]
  453. #endif // igatemout
  454. #end metalib_target lib_target
  455. /////////////////////////////////////////////////////////////////////
  456. // Now, the noninstalled dynamic libraries. These are presumably used
  457. // only within this directory, or at the most within this tree, and
  458. // also presumably will never include interrogate data. That, plus
  459. // the fact that we don't need to generate install rules, makes it a
  460. // lot simpler.
  461. /////////////////////////////////////////////////////////////////////
  462. #forscopes noinst_lib_target test_lib_target
  463. #define varname $[subst -,_,lib$[TARGET]_so]
  464. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  465. #define target $[ODIR]/$[get_dllname $[TARGET]].$[dlllib]
  466. #define sources $($[varname])
  467. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies] $[GENERATED_SOURCES]]
  468. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  469. $[TAB] $[SHARED_LIB_C++] $[COMPILED_RESOURCES]
  470. #else
  471. $[TAB] $[SHARED_LIB_C] $[COMPILED_RESOURCES]
  472. #endif
  473. #if $[eq $[USE_COMPILER], MSVC8]
  474. $[TAB] mt -nologo -manifest $[target].manifest -outputresource:$[target];2
  475. #endif
  476. #if $[build_dlls]
  477. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  478. #endif
  479. #if $[build_pdbs]
  480. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  481. #endif
  482. // this section is all very clunky and not generalized enough
  483. // assuming tgt dirs and such
  484. #define rc_to_gen $[filter %.rc, $[GENERATED_SOURCES]]
  485. #if $[rc_to_gen]
  486. $[osfilename $[rc_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_RC_DEPENDENCIES]]
  487. $[TAB] $[RC_GENERATOR_RULE]
  488. $[osfilename $[ODIR]/$[RC_BASENAME].res] : $[patsubst %,$[osfilename %],$[rc_to_gen]]
  489. $[TAB] $[COMPILE_RC] /I"$[ODIR]" /Fo"$[ODIR]/$[RC_BASENAME].res" $[ODIR]/$[RC_BASENAME].rc
  490. #endif
  491. #define inf_to_gen $[filter %.inf, $[GENERATED_SOURCES]]
  492. #if $[inf_to_gen]
  493. $[osfilename $[inf_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_INF_DEPENDENCIES]]
  494. $[TAB] $[INF_GENERATOR_RULE]
  495. #endif
  496. #define rgs_to_gen $[filter %.rgs, $[GENERATED_SOURCES]]
  497. #if $[rgs_to_gen]
  498. $[osfilename $[rgs_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_RGS_DEPENDENCIES]]
  499. $[TAB] $[RGS_GENERATOR_RULE]
  500. #endif
  501. #define verhdr_to_gen $[filter %Version.h, $[GENERATED_SOURCES]]
  502. #if $[verhdr_to_gen]
  503. $[osfilename $[verhdr_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_VERHEADER_DEPENDENCIES]]
  504. $[TAB] $[VERHEADER_GENERATOR_RULE]
  505. $[osfilename $[VERHEADER_DEPENDENTS]] : $[patsubst %,$[osfilename %],$[verhdr_to_gen]]
  506. #endif
  507. #define MIDL_COMMAND $[COMPILE_IDL] /out $[ODIR] $[ODIR]/$[IDL_BASENAME].idl
  508. #define idl_to_gen $[filter %.idl, $[GENERATED_SOURCES]]
  509. #if $[idl_to_gen]
  510. $[osfilename $[idl_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_IDL_DEPENDENCIES]]
  511. $[TAB] $[IDL_GENERATOR_RULE]
  512. $[osfilename $[ODIR]/$[IDL_BASENAME].h] : $[patsubst %,$[osfilename %],$[idl_to_gen]]
  513. $[TAB] $[MIDL_COMMAND]
  514. // this is a complete hack. I dont know how add a generated .h to the dependency list of $[IDL_BASENAME].cpp.
  515. // it is already there, but in the wrong directory. should really add this to official dependency list
  516. #foreach file $[GENERATED_IDL_H_DEPENDENTS]
  517. $[osfilename $[file]] : $[patsubst %,$[osfilename %],$[ODIR]/$[IDL_BASENAME].h]
  518. $[TAB] // empty, dependency-only 'rule'
  519. #end file
  520. $[osfilename $[ODIR]/$[IDL_BASENAME].tlb] : $[patsubst %,$[osfilename %],$[idl_to_gen]]
  521. $[TAB] $[MIDL_COMMAND]
  522. #endif
  523. #end noinst_lib_target test_lib_target
  524. /////////////////////////////////////////////////////////////////////
  525. // Now the static libraries. Again, we assume there's no interrogate
  526. // interfaces going on in here, and there's no question of this being
  527. // a metalib, making the rules relatively simple.
  528. /////////////////////////////////////////////////////////////////////
  529. #forscopes static_lib_target ss_lib_target
  530. #define varname $[subst -,_,lib$[TARGET]_a]
  531. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  532. #define target $[ODIR]/$[get_dllname $[TARGET]].lib
  533. #define sources $($[varname])
  534. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources]]
  535. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  536. $[TAB] $[STATIC_LIB_C++]
  537. #else
  538. $[TAB] $[STATIC_LIB_C]
  539. #endif
  540. #define installed_files \
  541. $[install_lib_dir]/$[get_dllname $[TARGET]].lib \
  542. $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
  543. $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
  544. $[INSTALL_DATA:%=$[install_data_dir]/%] \
  545. $[INSTALL_CONFIG:%=$[install_config_dir]/%]
  546. install-lib$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  547. uninstall-lib$[TARGET] :
  548. #if $[installed_files]
  549. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  550. $[TAB] if exist $[file] del /f $[file]
  551. #end file
  552. #endif
  553. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].lib]
  554. #define local $[get_dllname $[TARGET]].lib
  555. #define dest $[install_lib_dir]
  556. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  557. #end static_lib_target ss_lib_target
  558. /////////////////////////////////////////////////////////////////////
  559. // The sed_bin_targets are a special bunch. These are scripts that
  560. // are to be preprocessed with sed before being installed, for
  561. // instance to insert a path or something in an appropriate place.
  562. /////////////////////////////////////////////////////////////////////
  563. #forscopes sed_bin_target
  564. $[osfilename $[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET]]
  565. #define target $[ODIR]/$[TARGET]
  566. #define source $[SOURCE]
  567. #define script $[COMMAND]
  568. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source]]
  569. $[TAB] $[subst ',",$[SED]]
  570. // $[TAB] chmod +x $[target] // WILL THIS BREAK IN WINDOWS?
  571. #define installed_files \
  572. $[install_bin_dir]/$[TARGET]
  573. install-$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  574. uninstall-$[TARGET] :
  575. #if $[installed_files]
  576. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  577. $[TAB] if exist $[file] del /f $[file]
  578. #end file
  579. #endif
  580. #define local $[TARGET]
  581. #define dest $[install_bin_dir]
  582. $[osfilename $[install_bin_dir]/$[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET]]
  583. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  584. #end sed_bin_target
  585. /////////////////////////////////////////////////////////////////////
  586. // And now, the bin_targets. These are normal C++ executables. No
  587. // interrogate, metalibs, or any such nonsense here.
  588. /////////////////////////////////////////////////////////////////////
  589. #forscopes bin_target
  590. $[osfilename $[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  591. #define varname $[subst -,_,bin_$[TARGET]]
  592. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  593. #define target $[ODIR]/$[TARGET].exe
  594. #define sources $($[varname])
  595. #define ld $[get_ld]
  596. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies]]
  597. #if $[ld]
  598. // If there's a custom linker defined for the target, we have to use it.
  599. $[TAB] $[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
  600. #else
  601. // Otherwise, we can use the normal linker.
  602. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  603. $[TAB] $[LINK_BIN_C++]
  604. #else
  605. $[TAB] $[LINK_BIN_C]
  606. #endif
  607. #endif
  608. #if $[eq $[USE_COMPILER], MSVC8]
  609. $[TAB] mt -nologo -manifest $[target].manifest -outputresource:$[target];1
  610. #endif
  611. #if $[build_pdbs]
  612. $[osfilename $[ODIR]/$[TARGET].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  613. #endif
  614. #define installed_files \
  615. $[install_bin_dir]/$[TARGET].exe \
  616. $[if $[build_pdbs],$[install_bin_dir]/$[TARGET].pdb] \
  617. $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
  618. $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
  619. $[INSTALL_DATA:%=$[install_data_dir]/%] \
  620. $[if $[bin_postprocess_target],$[install_bin_dir]/$[bin_postprocess_target].exe] \
  621. $[INSTALL_CONFIG:%=$[install_config_dir]/%]
  622. install-$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  623. uninstall-$[TARGET] :
  624. #if $[installed_files]
  625. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  626. $[TAB] if exist $[file] del /f $[file]
  627. #end file
  628. #endif
  629. $[osfilename $[install_bin_dir]/$[TARGET].exe] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  630. #define local $[TARGET].exe
  631. #define dest $[install_bin_dir]
  632. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  633. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local].manifest] $[osfilename $[dest]]
  634. #if $[build_pdbs]
  635. $[osfilename $[install_bin_dir]/$[TARGET].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].pdb]
  636. #define local $[TARGET].pdb
  637. #define dest $[install_bin_dir]
  638. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  639. #endif
  640. #if $[bin_postprocess_target]
  641. #define input_exe $[ODIR]/$[TARGET].exe
  642. #define output_exe $[ODIR]/$[bin_postprocess_target].exe
  643. $[osfilename $[output_exe]] : $[patsubst %,$[osfilename %],$[input_exe]]
  644. $[TAB] if exist $[osfilename $[output_exe]] del /f $[osfilename $[output_exe]]
  645. $[TAB] $[bin_postprocess_cmd] $[bin_postprocess_arg1] $[input_exe] $[bin_postprocess_arg2] $[output_exe]
  646. $[TAB] if exist $[file] del /f $[file]
  647. $[osfilename $[install_bin_dir]/$[bin_postprocess_target].exe] : $[patsubst %,$[osfilename %],$[output_exe]]
  648. $[TAB] xcopy /I/Y $[osfilename $[output_exe]] $[osfilename $[install_bin_dir]]
  649. #endif
  650. #end bin_target
  651. /////////////////////////////////////////////////////////////////////
  652. // The noinst_bin_targets and the test_bin_targets share the property
  653. // of being built (when requested), but having no install rules.
  654. /////////////////////////////////////////////////////////////////////
  655. #forscopes noinst_bin_target test_bin_target test_lib_target
  656. $[osfilename $[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  657. #define varname $[subst -,_,bin_$[TARGET]]
  658. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  659. #define target $[ODIR]/$[TARGET].exe
  660. #define sources $($[varname])
  661. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies]]
  662. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  663. $[TAB] $[LINK_BIN_C++]
  664. #else
  665. $[TAB] $[LINK_BIN_C]
  666. #endif
  667. #if $[eq $[USE_COMPILER], MSVC8]
  668. $[TAB] mt -nologo -manifest $[target].manifest -outputresource:$[target];1
  669. #endif
  670. #end noinst_bin_target test_bin_target test_lib_target
  671. /////////////////////////////////////////////////////////////////////
  672. // Rules to run bison and/or flex as needed.
  673. /////////////////////////////////////////////////////////////////////
  674. // Rules to generate a C++ file from a Bison input file.
  675. #foreach file $[sort $[yxx_st_sources]]
  676. #define target $[patsubst %.yxx,%.cxx,$[file]]
  677. #define target_header $[patsubst %.yxx,%.h,$[file]]
  678. #define target_prebuilt $[target].prebuilt
  679. #define target_header_prebuilt $[target_header].prebuilt
  680. #if $[HAVE_BISON]
  681. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[file]]
  682. $[TAB] $[BISON] $[YFLAGS] -y $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[file]
  683. $[TAB] move /y y.tab.c $[target]
  684. $[TAB] move /y y.tab.h $[target_header]
  685. $[osfilename $[target_header]] : $[patsubst %,$[osfilename %],$[target]]
  686. $[osfilename $[target_prebuilt]] : $[patsubst %,$[osfilename %],$[target]]
  687. $[TAB] copy /Y $[osfilename $[target]] $[osfilename $[target_prebuilt]]
  688. $[osfilename $[target_header_prebuilt]] : $[patsubst %,$[osfilename %],$[target_header]]
  689. $[TAB] copy /Y $[osfilename $[target_header]] $[osfilename $[target_header_prebuilt]]
  690. #else // HAVE_BISON
  691. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[target_prebuilt]]
  692. $[TAB] copy /Y $[osfilename $[target_prebuilt]] $[osfilename $[target]]
  693. $[osfilename $[target_header]] : $[patsubst %,$[osfilename %],$[target_header_prebuilt]]
  694. $[TAB] copy /Y $[osfilename $[target_header_prebuilt]] $[osfilename $[target_header]]
  695. #endif // HAVE_BISON
  696. #end file
  697. // Rules to generate a C++ file from a Flex input file.
  698. #foreach file $[sort $[lxx_st_sources]]
  699. #define target $[patsubst %.lxx,%.cxx,$[file]]
  700. #define target_prebuilt $[target].prebuilt
  701. #if $[HAVE_BISON]
  702. #define source $[file]
  703. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[file]]
  704. $[TAB] $[FLEX] $[LFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[file]
  705. #define source lex.yy.c
  706. #define script /#include <unistd.h>/d
  707. $[TAB] $[subst ',",$[SED]]
  708. $[TAB] if exist lex.yy.c del /f lex.yy.c
  709. $[osfilename $[target_prebuilt]] : $[patsubst %,$[osfilename %],$[target]]
  710. $[TAB] copy /Y $[osfilename $[target]] $[osfilename $[target_prebuilt]]
  711. #else // HAVE_BISON
  712. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[target_prebuilt]]
  713. $[TAB] copy /Y $[osfilename $[target_prebuilt]] $[osfilename $[target]]
  714. #endif // HAVE_BISON
  715. #end file
  716. /////////////////////////////////////////////////////////////////////
  717. // Finally, we put in the rules to compile each source file into a .obj
  718. // file.
  719. /////////////////////////////////////////////////////////////////////
  720. #forscopes metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target
  721. // need to use #print to avoid printing to Makefile
  722. // printvar prints the unevaluated defn of the var
  723. // #print TARGET=$[TARGET]
  724. // #printvar TARGET
  725. // Rules to compile ordinary C files.
  726. #foreach file $[sort $[c_sources]]
  727. #define target $[$[file]_obj]
  728. #define source $[file]
  729. #define ipath $[target_ipath]
  730. #define flags $[cflags] $[building_var:%=/D%]
  731. #if $[ne $[file], $[notdir $file]]
  732. // If the source file is not in the current directory, tack on "."
  733. // to front of the ipath.
  734. #set ipath . $[ipath]
  735. #endif
  736. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source] $[get_depends $[source]]]
  737. $[TAB] $[COMPILE_C]
  738. #end file
  739. // Rules to compile C++ files.
  740. #foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]]
  741. #define target $[$[file]_obj]
  742. #define source $[file]
  743. #define ipath $[target_ipath]
  744. #define flags $[c++flags] $[building_var:%=/D%]
  745. #if $[ne $[file], $[notdir $file]]
  746. // If the source file is not in the current directory, tack on "."
  747. // to front of the ipath.
  748. #set ipath . $[ipath]
  749. #endif
  750. // Yacc must run before some files can be compiled, so all files
  751. // depend on yacc having run.
  752. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h]]
  753. $[TAB] $[COMPILE_C++]
  754. #end file
  755. #end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target
  756. // And now the rules to install the auxiliary files, like headers and
  757. // data files.
  758. #foreach file $[install_scripts]
  759. $[osfilename $[install_bin_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  760. #define local $[file]
  761. #define dest $[install_bin_dir]
  762. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  763. #end file
  764. #foreach file $[install_headers]
  765. $[osfilename $[install_headers_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  766. #define local $[file]
  767. #define dest $[install_headers_dir]
  768. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  769. #end file
  770. #foreach file $[install_parser_inc]
  771. #if $[ne $[dir $[file]], ./]
  772. $[osfilename $[install_parser_inc_dir]/$[file]] : $[osfilename $[notdir $[file]]]
  773. #define local $[notdir $[file]]
  774. #define dest $[install_parser_inc_dir]/$[dir $[file]]
  775. $[TAB] if not exist $[osfilename $[install_parser_inc_dir]/$[dir $[file]]] mkdir $[osfilename $[install_parser_inc_dir]/$[dir $[file]]] || echo
  776. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  777. #else
  778. $[osfilename $[install_parser_inc_dir]/$[file]] : $[osfilename $[file]]
  779. #define local $[file]
  780. #define dest $[install_parser_inc_dir]
  781. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  782. #endif
  783. #end file
  784. #foreach file $[install_data]
  785. $[osfilename $[install_data_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  786. #define local $[file]
  787. #define dest $[install_data_dir]
  788. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  789. #end file
  790. #foreach file $[install_config]
  791. $[osfilename $[install_config_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  792. #define local $[file]
  793. #define dest $[install_config_dir]
  794. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  795. #end file
  796. #foreach file $[install_py]
  797. $[osfilename $[install_py_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  798. #define local $[file]
  799. #define dest $[install_py_dir]
  800. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  801. #end file
  802. #if $[install_py]
  803. $[osfilename $[install_py_package_dir]/__init__.py] :
  804. $[TAB] echo. > $[osfilename $[install_py_package_dir]/__init__.py]
  805. #endif
  806. // Finally, all the special targets. These are commands that just need
  807. // to be invoked; we don't pretend to know what they are.
  808. #forscopes special_target
  809. $[osfilename $[TARGET]] :
  810. $[TAB] $[COMMAND]
  811. #end special_target
  812. // Finally, the rules to freshen the Makefile itself.
  813. Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]]
  814. $[TAB] ppremake
  815. #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
  816. $[osfilename $[DEPENDENCY_CACHE_FILENAME]] : $[patsubst %,$[osfilename %],$[dep_sources]]
  817. $[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME]
  818. #endif
  819. #end Makefile
  820. //////////////////////////////////////////////////////////////////////
  821. #elif $[eq $[DIR_TYPE], group]
  822. //////////////////////////////////////////////////////////////////////
  823. // This is a group directory: a directory above a collection of source
  824. // directories, e.g. $DTOOL/src. We don't need to output anything in
  825. // this directory.
  826. //////////////////////////////////////////////////////////////////////
  827. #elif $[eq $[DIR_TYPE], toplevel]
  828. //////////////////////////////////////////////////////////////////////
  829. // This is the toplevel directory, e.g. $DTOOL. Here we build the
  830. // root makefile and also synthesize the dtool_config.h (or whichever
  831. // file) we need.
  832. #map subdirs
  833. // Iterate through all of our known source files. Each src and
  834. // metalib type file gets its corresponding Makefile listed
  835. // here. However, we test for $[DIR_TYPE] of toplevel, because the
  836. // source directories typically don't define their own DIR_TYPE
  837. // variable, and they end up inheriting this one dynamically.
  838. #forscopes */
  839. #if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib],$[and $[eq $[DIR_TYPE], toplevel],$[ne $[DIRNAME],top]]]
  840. #if $[build_directory]
  841. #addmap subdirs $[DIRNAME]
  842. #endif
  843. #endif
  844. #end */
  845. #if $[PYTHON_PACKAGE]
  846. #include $[THISDIRPREFIX]PythonPackageInit.pp
  847. #endif
  848. #output Makefile
  849. #format makefile
  850. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  851. ################################# DO NOT EDIT ###########################
  852. all : $[subdirs]
  853. test : $[subdirs:%=test-%]
  854. igate : $[subdirs:%=igate-%]
  855. clean : $[subdirs:%=clean-%]
  856. clean-igate : $[subdirs:%=clean-igate-%]
  857. cleanall : $[subdirs:%=cleanall-%]
  858. install : $[patsubst %,$[osfilename %],$[if $[CONFIG_HEADER],$[install_headers_dir] $[install_headers_dir]/$[CONFIG_HEADER]] $[subdirs:%=install-%]]
  859. install-igate : $[subdirs:%=install-igate-%]
  860. uninstall : $[subdirs:%=uninstall-%]
  861. #if $[CONFIG_HEADER]
  862. $[TAB] if exist $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] del /f $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]]
  863. #endif
  864. uninstall-igate : $[subdirs:%=uninstall-igate-%]
  865. #if $[HAVE_BISON]
  866. prebuild-bison : $[subdirs:%=prebuild-bison-%]
  867. clean-prebuild-bison : $[subdirs:%=clean-prebuild-bison-%]
  868. #endif
  869. #formap dirname subdirs
  870. #define depends
  871. $[osfilename $[dirname]] : $[patsubst %,$[osfilename %],$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]
  872. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) all
  873. #end dirname
  874. #formap dirname subdirs
  875. test-$[dirname] :
  876. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) test
  877. #end dirname
  878. #formap dirname subdirs
  879. igate-$[dirname] :
  880. $[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) igate
  881. #end dirname
  882. #formap dirname subdirs
  883. clean-$[dirname] :
  884. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) clean
  885. #end dirname
  886. #formap dirname subdirs
  887. clean-igate-$[dirname] :
  888. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) clean-igate
  889. #end dirname
  890. #formap dirname subdirs
  891. cleanall-$[dirname] : $[patsubst %,$[osfilename %],$[patsubst %,cleanall-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]]
  892. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) cleanall
  893. #end dirname
  894. #formap dirname subdirs
  895. install-$[dirname] : $[patsubst %,$[osfilename %],$[patsubst %,install-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]]
  896. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) install
  897. #end dirname
  898. #formap dirname subdirs
  899. install-igate-$[dirname] :
  900. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) install-igate
  901. #end dirname
  902. #formap dirname subdirs
  903. uninstall-$[dirname] :
  904. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) uninstall
  905. #end dirname
  906. #formap dirname subdirs
  907. uninstall-igate-$[dirname] :
  908. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) uninstall-igate
  909. #end dirname
  910. #if $[HAVE_BISON]
  911. #formap dirname subdirs
  912. prebuild-bison-$[dirname] :
  913. $[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) prebuild-bison
  914. clean-prebuild-bison-$[dirname] :
  915. $[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) clean-prebuild-bison
  916. #end dirname
  917. #endif
  918. #if $[ne $[CONFIG_HEADER],]
  919. $[osfilename $[install_headers_dir]] :
  920. $[TAB] if not exist $[osfilename $[install_headers_dir]] echo mkdir $[osfilename $[install_headers_dir]]
  921. $[TAB] if not exist $[osfilename $[install_headers_dir]] mkdir $[osfilename $[install_headers_dir]]
  922. $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] : $[patsubst %,$[osfilename %],$[CONFIG_HEADER]]
  923. #define local $[CONFIG_HEADER]
  924. #define dest $[install_headers_dir]
  925. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  926. #endif
  927. // Finally, the rules to freshen the Makefile itself.
  928. Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]]
  929. $[TAB] ppremake
  930. #end Makefile
  931. // If there is a file called LocalSetup.pp in the package's top
  932. // directory, then invoke that. It might contain some further setup
  933. // instructions.
  934. #sinclude $[TOPDIRPREFIX]LocalSetup.nmake.pp
  935. #sinclude $[TOPDIRPREFIX]LocalSetup.pp
  936. //////////////////////////////////////////////////////////////////////
  937. #elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]]
  938. //////////////////////////////////////////////////////////////////////
  939. #include $[THISDIRPREFIX]Template.models.nmake.pp
  940. //////////////////////////////////////////////////////////////////////
  941. #endif // DIR_TYPE