Template.gmsvc.pp 40 KB

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