Template.nmake.pp 46 KB

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