Template.nmake.pp 46 KB

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