Template.nmake.pp 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  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 wierd 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 $[build_dlls]
  363. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  364. #endif
  365. #if $[build_pdbs]
  366. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  367. #endif
  368. #endif
  369. // Here are the rules to install and uninstall the library and
  370. // everything that goes along with it.
  371. #define installed_files \
  372. $[if $[build_it], \
  373. $[if $[build_dlls],$[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib]] \
  374. $[install_lib_dir]/$[get_dllname $[TARGET]].lib \
  375. $[if $[and $[build_dlls],$[build_pdbs]],$[install_lib_dir]/$[get_dllname $[TARGET]].pdb] \
  376. ] \
  377. $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
  378. $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
  379. $[INSTALL_DATA:%=$[install_data_dir]/%] \
  380. $[INSTALL_CONFIG:%=$[install_config_dir]/%] \
  381. $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%]
  382. install-lib$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  383. uninstall-lib$[TARGET] :
  384. #if $[installed_files]
  385. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  386. $[TAB] if exist $[file] del /f $[file]
  387. #end file
  388. #endif
  389. #if $[build_dlls]
  390. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  391. #define local $[get_dllname $[TARGET]].$[dlllib]
  392. #define dest $[install_lib_dir]
  393. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  394. #endif
  395. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].lib]
  396. #define local $[get_dllname $[TARGET]].lib
  397. #define dest $[install_lib_dir]
  398. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  399. #if $[and $[build_dlls],$[build_pdbs]]
  400. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].pdb]
  401. #define local $[get_dllname $[TARGET]].pdb
  402. #define dest $[install_lib_dir]
  403. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  404. #endif
  405. #if $[igatescan]
  406. // Now, some additional rules to generate and compile the interrogate
  407. // data, if needed.
  408. // The library name is based on this library.
  409. #define igatelib lib$[TARGET]
  410. // The module name comes from the metalib that includes this library.
  411. #define igatemod $[module $[TARGET],$[TARGET]]
  412. #if $[eq $[igatemod],]
  413. // Unless no metalib includes this library.
  414. #define igatemod $[TARGET]
  415. #endif
  416. $[osfilename $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%]] : $[patsubst %,$[osfilename %],$[igatedb]]
  417. #define local $[igatedb]
  418. #define dest $[install_igatedb_dir]
  419. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  420. // We have to split this out as a separate rule to properly support
  421. // parallel make.
  422. $[osfilename $[igatedb]] : $[patsubst %,$[osfilename %],$[igateoutput]]
  423. lib$[TARGET]_igatescan = $[patsubst %,$[osfilename %],$[igatescan]]
  424. $[osfilename $[igateoutput]] : $[patsubst %,$[osfilename %],$[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]]
  425. //// Sauce
  426. //// There's a bug here. The -od is being passed into a string in the file. This
  427. //// makes slashes look like escape sequences.
  428. //// The hacky fix is to use \\ instead of \. Windows seems to still let you open files if you
  429. //// include multiple slashes in them. Then, when quoted, the string will properly
  430. //// be created.
  431. //$[TAB] $[INTERROGATE] -od $[subst \,\\,$[osfilename $[igatedb]]] -oc $[osfilename $[igateoutput]] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
  432. // Actually, drose kindly fixed that
  433. $[TAB] $[INTERROGATE] -od $[osfilename $[igatedb]] -oc $[osfilename $[igateoutput]] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
  434. #endif // igatescan
  435. #if $[igatemout]
  436. // And finally, some additional rules to build the interrogate module
  437. // file into the library, if this is a metalib that includes
  438. // interrogated components.
  439. #define igatelib lib$[TARGET]
  440. #define igatemod $[TARGET]
  441. lib$[TARGET]_igatemscan = $[patsubst %,$[osfilename %],$[igatemscan]]
  442. #define target $[igatemout]
  443. #define sources $(lib$[TARGET]_igatemscan)
  444. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources]]
  445. $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] $[sources]
  446. #endif // igatemout
  447. #end metalib_target lib_target
  448. /////////////////////////////////////////////////////////////////////
  449. // Now, the noninstalled dynamic libraries. These are presumably used
  450. // only within this directory, or at the most within this tree, and
  451. // also presumably will never include interrogate data. That, plus
  452. // the fact that we don't need to generate install rules, makes it a
  453. // lot simpler.
  454. /////////////////////////////////////////////////////////////////////
  455. #forscopes noinst_lib_target test_lib_target
  456. #define varname $[subst -,_,lib$[TARGET]_so]
  457. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  458. #define target $[ODIR]/$[get_dllname $[TARGET]].$[dlllib]
  459. #define sources $($[varname])
  460. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies] $[GENERATED_SOURCES]]
  461. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  462. $[TAB] $[SHARED_LIB_C++] $[COMPILED_RESOURCES]
  463. #else
  464. $[TAB] $[SHARED_LIB_C] $[COMPILED_RESOURCES]
  465. #endif
  466. #if $[build_dlls]
  467. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  468. #endif
  469. #if $[build_pdbs]
  470. $[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]
  471. #endif
  472. // this section is all very clunky and not generalized enough
  473. // assuming tgt dirs and such
  474. #define rc_to_gen $[filter %.rc, $[GENERATED_SOURCES]]
  475. #if $[rc_to_gen]
  476. $[osfilename $[rc_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_RC_DEPENDENCIES]]
  477. $[TAB] $[RC_GENERATOR_RULE]
  478. $[osfilename $[ODIR]/$[RC_BASENAME].res] : $[patsubst %,$[osfilename %],$[rc_to_gen]]
  479. $[TAB] $[COMPILE_RC] /I"$[ODIR]" /Fo"$[ODIR]/$[RC_BASENAME].res" $[ODIR]/$[RC_BASENAME].rc
  480. #endif
  481. #define inf_to_gen $[filter %.inf, $[GENERATED_SOURCES]]
  482. #if $[inf_to_gen]
  483. $[osfilename $[inf_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_INF_DEPENDENCIES]]
  484. $[TAB] $[INF_GENERATOR_RULE]
  485. #endif
  486. #define rgs_to_gen $[filter %.rgs, $[GENERATED_SOURCES]]
  487. #if $[rgs_to_gen]
  488. $[osfilename $[rgs_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_RGS_DEPENDENCIES]]
  489. $[TAB] $[RGS_GENERATOR_RULE]
  490. #endif
  491. #define verhdr_to_gen $[filter %Version.h, $[GENERATED_SOURCES]]
  492. #if $[verhdr_to_gen]
  493. $[osfilename $[verhdr_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_VERHEADER_DEPENDENCIES]]
  494. $[TAB] $[VERHEADER_GENERATOR_RULE]
  495. $[osfilename $[VERHEADER_DEPENDENTS]] : $[patsubst %,$[osfilename %],$[verhdr_to_gen]]
  496. #endif
  497. #define MIDL_COMMAND $[COMPILE_IDL] /out $[ODIR] $[ODIR]/$[IDL_BASENAME].idl
  498. #define idl_to_gen $[filter %.idl, $[GENERATED_SOURCES]]
  499. #if $[idl_to_gen]
  500. $[osfilename $[idl_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_IDL_DEPENDENCIES]]
  501. $[TAB] $[IDL_GENERATOR_RULE]
  502. $[osfilename $[ODIR]/$[IDL_BASENAME].h] : $[patsubst %,$[osfilename %],$[idl_to_gen]]
  503. $[TAB] $[MIDL_COMMAND]
  504. // this is a complete hack. I dont know how add a generated .h to the dependency list of $[IDL_BASENAME].cpp.
  505. // it is already there, but in the wrong directory. should really add this to official dependency list
  506. #foreach file $[GENERATED_IDL_H_DEPENDENTS]
  507. $[osfilename $[file]] : $[patsubst %,$[osfilename %],$[ODIR]/$[IDL_BASENAME].h]
  508. $[TAB] // empty, dependency-only 'rule'
  509. #end file
  510. $[osfilename $[ODIR]/$[IDL_BASENAME].tlb] : $[patsubst %,$[osfilename %],$[idl_to_gen]]
  511. $[TAB] $[MIDL_COMMAND]
  512. #endif
  513. #end noinst_lib_target test_lib_target
  514. /////////////////////////////////////////////////////////////////////
  515. // Now the static libraries. Again, we assume there's no interrogate
  516. // interfaces going on in here, and there's no question of this being
  517. // a metalib, making the rules relatively simple.
  518. /////////////////////////////////////////////////////////////////////
  519. #forscopes static_lib_target ss_lib_target
  520. #define varname $[subst -,_,lib$[TARGET]_a]
  521. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  522. #define target $[ODIR]/$[get_dllname $[TARGET]].lib
  523. #define sources $($[varname])
  524. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources]]
  525. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  526. $[TAB] $[STATIC_LIB_C++]
  527. #else
  528. $[TAB] $[STATIC_LIB_C]
  529. #endif
  530. #define installed_files \
  531. $[install_lib_dir]/$[get_dllname $[TARGET]].lib \
  532. $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
  533. $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
  534. $[INSTALL_DATA:%=$[install_data_dir]/%] \
  535. $[INSTALL_CONFIG:%=$[install_config_dir]/%]
  536. install-lib$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  537. uninstall-lib$[TARGET] :
  538. #if $[installed_files]
  539. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  540. $[TAB] if exist $[file] del /f $[file]
  541. #end file
  542. #endif
  543. $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].lib]
  544. #define local $[get_dllname $[TARGET]].lib
  545. #define dest $[install_lib_dir]
  546. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  547. #end static_lib_target ss_lib_target
  548. /////////////////////////////////////////////////////////////////////
  549. // The sed_bin_targets are a special bunch. These are scripts that
  550. // are to be preprocessed with sed before being installed, for
  551. // instance to insert a path or something in an appropriate place.
  552. /////////////////////////////////////////////////////////////////////
  553. #forscopes sed_bin_target
  554. $[osfilename $[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET]]
  555. #define target $[ODIR]/$[TARGET]
  556. #define source $[SOURCE]
  557. #define script $[COMMAND]
  558. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source]]
  559. $[TAB] $[subst ',",$[SED]]
  560. // $[TAB] chmod +x $[target] // WILL THIS BREAK IN WINDOWS?
  561. #define installed_files \
  562. $[install_bin_dir]/$[TARGET]
  563. install-$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  564. uninstall-$[TARGET] :
  565. #if $[installed_files]
  566. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  567. $[TAB] if exist $[file] del /f $[file]
  568. #end file
  569. #endif
  570. #define local $[TARGET]
  571. #define dest $[install_bin_dir]
  572. $[osfilename $[install_bin_dir]/$[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET]]
  573. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  574. #end sed_bin_target
  575. /////////////////////////////////////////////////////////////////////
  576. // And now, the bin_targets. These are normal C++ executables. No
  577. // interrogate, metalibs, or any such nonsense here.
  578. /////////////////////////////////////////////////////////////////////
  579. #forscopes bin_target
  580. $[osfilename $[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  581. #define varname $[subst -,_,bin_$[TARGET]]
  582. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  583. #define target $[ODIR]/$[TARGET].exe
  584. #define sources $($[varname])
  585. #define ld $[get_ld]
  586. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies]]
  587. #if $[ld]
  588. // If there's a custom linker defined for the target, we have to use it.
  589. $[TAB] $[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
  590. #else
  591. // Otherwise, we can use the normal linker.
  592. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  593. $[TAB] $[LINK_BIN_C++]
  594. #else
  595. $[TAB] $[LINK_BIN_C]
  596. #endif
  597. #endif
  598. #if $[build_pdbs]
  599. $[osfilename $[ODIR]/$[TARGET].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  600. #endif
  601. #define installed_files \
  602. $[install_bin_dir]/$[TARGET].exe \
  603. $[if $[build_pdbs],$[install_bin_dir]/$[TARGET].pdb] \
  604. $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
  605. $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
  606. $[INSTALL_DATA:%=$[install_data_dir]/%] \
  607. $[if $[bin_postprocess_target],$[install_bin_dir]/$[bin_postprocess_target].exe] \
  608. $[INSTALL_CONFIG:%=$[install_config_dir]/%]
  609. install-$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]]
  610. uninstall-$[TARGET] :
  611. #if $[installed_files]
  612. #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]]
  613. $[TAB] if exist $[file] del /f $[file]
  614. #end file
  615. #endif
  616. $[osfilename $[install_bin_dir]/$[TARGET].exe] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  617. #define local $[TARGET].exe
  618. #define dest $[install_bin_dir]
  619. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  620. #if $[build_pdbs]
  621. $[osfilename $[install_bin_dir]/$[TARGET].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].pdb]
  622. #define local $[TARGET].pdb
  623. #define dest $[install_bin_dir]
  624. $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]]
  625. #endif
  626. #if $[bin_postprocess_target]
  627. #define input_exe $[ODIR]/$[TARGET].exe
  628. #define output_exe $[ODIR]/$[bin_postprocess_target].exe
  629. $[osfilename $[output_exe]] : $[patsubst %,$[osfilename %],$[input_exe]]
  630. $[TAB] if exist $[osfilename $[output_exe]] del /f $[osfilename $[output_exe]]
  631. $[TAB] $[bin_postprocess_cmd] $[bin_postprocess_arg1] $[input_exe] $[bin_postprocess_arg2] $[output_exe]
  632. $[TAB] if exist $[file] del /f $[file]
  633. $[osfilename $[install_bin_dir]/$[bin_postprocess_target].exe] : $[patsubst %,$[osfilename %],$[output_exe]]
  634. $[TAB] xcopy /I/Y $[osfilename $[output_exe]] $[osfilename $[install_bin_dir]]
  635. #endif
  636. #end bin_target
  637. /////////////////////////////////////////////////////////////////////
  638. // The noinst_bin_targets and the test_bin_targets share the property
  639. // of being built (when requested), but having no install rules.
  640. /////////////////////////////////////////////////////////////////////
  641. #forscopes noinst_bin_target test_bin_target test_lib_target
  642. $[osfilename $[TARGET]] : $[patsubst %,$[osfilename %],$[ODIR]/$[TARGET].exe]
  643. #define varname $[subst -,_,bin_$[TARGET]]
  644. $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]]
  645. #define target $[ODIR]/$[TARGET].exe
  646. #define sources $($[varname])
  647. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies]]
  648. #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]]
  649. $[TAB] $[LINK_BIN_C++]
  650. #else
  651. $[TAB] $[LINK_BIN_C]
  652. #endif
  653. #end noinst_bin_target test_bin_target test_lib_target
  654. /////////////////////////////////////////////////////////////////////
  655. // Rules to run bison and/or flex as needed.
  656. /////////////////////////////////////////////////////////////////////
  657. // Rules to generate a C++ file from a Bison input file.
  658. #foreach file $[sort $[yxx_st_sources]]
  659. #define target $[patsubst %.yxx,%.cxx,$[file]]
  660. #define target_header $[patsubst %.yxx,%.h,$[file]]
  661. #define target_prebuilt $[target].prebuilt
  662. #define target_header_prebuilt $[target_header].prebuilt
  663. #if $[HAVE_BISON]
  664. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[file]]
  665. $[TAB] $[BISON] $[YFLAGS] -y $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[file]
  666. $[TAB] move /y y.tab.c $[target]
  667. $[TAB] move /y y.tab.h $[target_header]
  668. $[osfilename $[target_header]] : $[patsubst %,$[osfilename %],$[target]]
  669. $[osfilename $[target_prebuilt]] : $[patsubst %,$[osfilename %],$[target]]
  670. $[TAB] copy /Y $[osfilename $[target]] $[osfilename $[target_prebuilt]]
  671. $[osfilename $[target_header_prebuilt]] : $[patsubst %,$[osfilename %],$[target_header]]
  672. $[TAB] copy /Y $[osfilename $[target_header]] $[osfilename $[target_header_prebuilt]]
  673. #else // HAVE_BISON
  674. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[target_prebuilt]]
  675. $[TAB] copy /Y $[osfilename $[target_prebuilt]] $[osfilename $[target]]
  676. $[osfilename $[target_header]] : $[patsubst %,$[osfilename %],$[target_header_prebuilt]]
  677. $[TAB] copy /Y $[osfilename $[target_header_prebuilt]] $[osfilename $[target_header]]
  678. #endif // HAVE_BISON
  679. #end file
  680. // Rules to generate a C++ file from a Flex input file.
  681. #foreach file $[sort $[lxx_st_sources]]
  682. #define target $[patsubst %.lxx,%.cxx,$[file]]
  683. #define target_prebuilt $[target].prebuilt
  684. #if $[HAVE_BISON]
  685. #define source $[file]
  686. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[file]]
  687. $[TAB] $[FLEX] $[LFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[file]
  688. #define source lex.yy.c
  689. #define script /#include <unistd.h>/d
  690. $[TAB] $[subst ',",$[SED]]
  691. $[TAB] if exist lex.yy.c del /f lex.yy.c
  692. $[osfilename $[target_prebuilt]] : $[patsubst %,$[osfilename %],$[target]]
  693. $[TAB] copy /Y $[osfilename $[target]] $[osfilename $[target_prebuilt]]
  694. #else // HAVE_BISON
  695. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[target_prebuilt]]
  696. $[TAB] copy /Y $[osfilename $[target_prebuilt]] $[osfilename $[target]]
  697. #endif // HAVE_BISON
  698. #end file
  699. /////////////////////////////////////////////////////////////////////
  700. // Finally, we put in the rules to compile each source file into a .obj
  701. // file.
  702. /////////////////////////////////////////////////////////////////////
  703. #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
  704. // need to use #print to avoid printing to Makefile
  705. // printvar prints the unevaluated defn of the var
  706. // #print TARGET=$[TARGET]
  707. // #printvar TARGET
  708. // Rules to compile ordinary C files.
  709. #foreach file $[sort $[c_sources]]
  710. #define target $[$[file]_obj]
  711. #define source $[file]
  712. #define ipath $[target_ipath]
  713. #define flags $[cflags] $[building_var:%=/D%]
  714. #if $[ne $[file], $[notdir $file]]
  715. // If the source file is not in the current directory, tack on "."
  716. // to front of the ipath.
  717. #set ipath . $[ipath]
  718. #endif
  719. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source] $[get_depends $[source]]]
  720. $[TAB] $[COMPILE_C]
  721. #end file
  722. // Rules to compile C++ files.
  723. #foreach file $[sort $[cxx_sources]]
  724. #define target $[$[file]_obj]
  725. #define source $[file]
  726. #define ipath $[target_ipath]
  727. #define flags $[c++flags] $[building_var:%=/D%]
  728. #if $[ne $[file], $[notdir $file]]
  729. // If the source file is not in the current directory, tack on "."
  730. // to front of the ipath.
  731. #set ipath . $[ipath]
  732. #endif
  733. // Yacc must run before some files can be compiled, so all files
  734. // depend on yacc having run.
  735. $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h]]
  736. $[TAB] $[COMPILE_C++]
  737. #end file
  738. #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
  739. // And now the rules to install the auxiliary files, like headers and
  740. // data files.
  741. #foreach file $[install_scripts]
  742. $[osfilename $[install_bin_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  743. #define local $[file]
  744. #define dest $[install_bin_dir]
  745. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  746. #end file
  747. #foreach file $[install_headers]
  748. $[osfilename $[install_headers_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  749. #define local $[file]
  750. #define dest $[install_headers_dir]
  751. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  752. #end file
  753. #foreach file $[install_parser_inc]
  754. #if $[ne $[dir $[file]], ./]
  755. $[osfilename $[install_parser_inc_dir]/$[file]] : $[osfilename $[notdir $[file]]]
  756. #define local $[notdir $[file]]
  757. #define dest $[install_parser_inc_dir]/$[dir $[file]]
  758. $[TAB] if not exist $[osfilename $[install_parser_inc_dir]/$[dir $[file]]] mkdir $[osfilename $[install_parser_inc_dir]/$[dir $[file]]] || echo
  759. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  760. #else
  761. $[osfilename $[install_parser_inc_dir]/$[file]] : $[osfilename $[file]]
  762. #define local $[file]
  763. #define dest $[install_parser_inc_dir]
  764. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  765. #endif
  766. #end file
  767. #foreach file $[install_data]
  768. $[osfilename $[install_data_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  769. #define local $[file]
  770. #define dest $[install_data_dir]
  771. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  772. #end file
  773. #foreach file $[install_config]
  774. $[osfilename $[install_config_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  775. #define local $[file]
  776. #define dest $[install_config_dir]
  777. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  778. #end file
  779. #foreach file $[install_py]
  780. $[osfilename $[install_py_dir]/$[file]] : $[patsubst %,$[osfilename %],$[file]]
  781. #define local $[file]
  782. #define dest $[install_py_dir]
  783. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  784. #end file
  785. #if $[install_py]
  786. $[osfilename $[install_py_package_dir]/__init__.py] :
  787. $[TAB] echo. > $[osfilename $[install_py_package_dir]/__init__.py]
  788. #endif
  789. // Finally, all the special targets. These are commands that just need
  790. // to be invoked; we don't pretend to know what they are.
  791. #forscopes special_target
  792. $[osfilename $[TARGET]] :
  793. $[TAB] $[COMMAND]
  794. #end special_target
  795. // Finally, the rules to freshen the Makefile itself.
  796. Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]]
  797. $[TAB] ppremake
  798. #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
  799. $[osfilename $[DEPENDENCY_CACHE_FILENAME]] : $[patsubst %,$[osfilename %],$[dep_sources]]
  800. $[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME]
  801. #endif
  802. #end Makefile
  803. //////////////////////////////////////////////////////////////////////
  804. #elif $[eq $[DIR_TYPE], group]
  805. //////////////////////////////////////////////////////////////////////
  806. // This is a group directory: a directory above a collection of source
  807. // directories, e.g. $DTOOL/src. We don't need to output anything in
  808. // this directory.
  809. //////////////////////////////////////////////////////////////////////
  810. #elif $[eq $[DIR_TYPE], toplevel]
  811. //////////////////////////////////////////////////////////////////////
  812. // This is the toplevel directory, e.g. $DTOOL. Here we build the
  813. // root makefile and also synthesize the dtool_config.h (or whichever
  814. // file) we need.
  815. #map subdirs
  816. // Iterate through all of our known source files. Each src and
  817. // metalib type file gets its corresponding Makefile listed
  818. // here. However, we test for $[DIR_TYPE] of toplevel, because the
  819. // source directories typically don't define their own DIR_TYPE
  820. // variable, and they end up inheriting this one dynamically.
  821. #forscopes */
  822. #if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib],$[and $[eq $[DIR_TYPE], toplevel],$[ne $[DIRNAME],top]]]
  823. #if $[build_directory]
  824. #addmap subdirs $[DIRNAME]
  825. #endif
  826. #endif
  827. #end */
  828. #if $[PYTHON_PACKAGE]
  829. #include $[THISDIRPREFIX]PythonPackageInit.pp
  830. #endif
  831. #output Makefile
  832. #format makefile
  833. #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
  834. ################################# DO NOT EDIT ###########################
  835. all : $[subdirs]
  836. test : $[subdirs:%=test-%]
  837. igate : $[subdirs:%=igate-%]
  838. clean : $[subdirs:%=clean-%]
  839. clean-igate : $[subdirs:%=clean-igate-%]
  840. cleanall : $[subdirs:%=cleanall-%]
  841. install : $[patsubst %,$[osfilename %],$[if $[CONFIG_HEADER],$[install_headers_dir] $[install_headers_dir]/$[CONFIG_HEADER]] $[subdirs:%=install-%]]
  842. install-igate : $[subdirs:%=install-igate-%]
  843. uninstall : $[subdirs:%=uninstall-%]
  844. #if $[CONFIG_HEADER]
  845. $[TAB] if exist $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] del /f $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]]
  846. #endif
  847. uninstall-igate : $[subdirs:%=uninstall-igate-%]
  848. #if $[HAVE_BISON]
  849. prebuild-bison : $[subdirs:%=prebuild-bison-%]
  850. clean-prebuild-bison : $[subdirs:%=clean-prebuild-bison-%]
  851. #endif
  852. #formap dirname subdirs
  853. #define depends
  854. $[osfilename $[dirname]] : $[patsubst %,$[osfilename %],$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]
  855. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) all
  856. #end dirname
  857. #formap dirname subdirs
  858. test-$[dirname] :
  859. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) test
  860. #end dirname
  861. #formap dirname subdirs
  862. igate-$[dirname] :
  863. $[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) igate
  864. #end dirname
  865. #formap dirname subdirs
  866. clean-$[dirname] :
  867. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) clean
  868. #end dirname
  869. #formap dirname subdirs
  870. clean-igate-$[dirname] :
  871. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) clean-igate
  872. #end dirname
  873. #formap dirname subdirs
  874. cleanall-$[dirname] : $[patsubst %,$[osfilename %],$[patsubst %,cleanall-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]]
  875. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) cleanall
  876. #end dirname
  877. #formap dirname subdirs
  878. install-$[dirname] : $[patsubst %,$[osfilename %],$[patsubst %,install-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]]]
  879. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) install
  880. #end dirname
  881. #formap dirname subdirs
  882. install-igate-$[dirname] :
  883. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) install-igate
  884. #end dirname
  885. #formap dirname subdirs
  886. uninstall-$[dirname] :
  887. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) uninstall
  888. #end dirname
  889. #formap dirname subdirs
  890. uninstall-igate-$[dirname] :
  891. $[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) uninstall-igate
  892. #end dirname
  893. #if $[HAVE_BISON]
  894. #formap dirname subdirs
  895. prebuild-bison-$[dirname] :
  896. $[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) prebuild-bison
  897. clean-prebuild-bison-$[dirname] :
  898. $[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) clean-prebuild-bison
  899. #end dirname
  900. #endif
  901. #if $[ne $[CONFIG_HEADER],]
  902. $[osfilename $[install_headers_dir]] :
  903. $[TAB] if not exist $[osfilename $[install_headers_dir]] echo mkdir $[osfilename $[install_headers_dir]]
  904. $[TAB] if not exist $[osfilename $[install_headers_dir]] mkdir $[osfilename $[install_headers_dir]]
  905. $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] : $[patsubst %,$[osfilename %],$[CONFIG_HEADER]]
  906. #define local $[CONFIG_HEADER]
  907. #define dest $[install_headers_dir]
  908. $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
  909. #endif
  910. // Finally, the rules to freshen the Makefile itself.
  911. Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]]
  912. $[TAB] ppremake
  913. #end Makefile
  914. // If there is a file called LocalSetup.pp in the package's top
  915. // directory, then invoke that. It might contain some further setup
  916. // instructions.
  917. #sinclude $[TOPDIRPREFIX]LocalSetup.nmake.pp
  918. #sinclude $[TOPDIRPREFIX]LocalSetup.pp
  919. //////////////////////////////////////////////////////////////////////
  920. #elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]]
  921. //////////////////////////////////////////////////////////////////////
  922. #include $[THISDIRPREFIX]Template.models.pp
  923. //////////////////////////////////////////////////////////////////////
  924. #endif // DIR_TYPE