diff --git a/dtool/Config.Win32.pp b/dtool/Config.Win32.pp index fb3875f518..ac680c3e9a 100644 --- a/dtool/Config.Win32.pp +++ b/dtool/Config.Win32.pp @@ -166,6 +166,7 @@ // The dynamic library file extension (usually .so .dll or .dylib): #define DYNAMIC_LIB_EXT .dll +#define STATIC_LIB_EXT .lib #define BUNDLE_EXT diff --git a/dtool/Config.pp b/dtool/Config.pp index 939ed827e3..721736cedb 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -923,6 +923,28 @@ // dynamic libraries. //#define LINK_ALL_STATIC yes +// The panda source tree is made up of a bunch of component libraries +// (e.g. express, downloader, pgraph, egg) which are ultimately +// combined into a smaller group of meta libraries or metalibs +// (e.g. libpandaexpress, libpanda, libpandaegg). Depending on your +// build configuration, these component libraries might have their own +// existence, or they might disappear completely and be contained +// entirely within their metalibs. The former is more convenient for +// rapid development, while the latter might be more convenient for +// distribution. + +// Define this variable to compile and link each component as a +// separate library so that the resulting metalibs are small and there +// are many separate component libraries; leave it undefined to link +// component object files directly into their containing metalibs so +// that the resutling metalib files are large and component libraries +// don't actually exist. The Windows has traditionally been built +// with this cleared (because of the original Win32 STL requirements), +// while the Unix build has traditionally been built with it set. +// Changing this from the traditional platform-specific setting is not +// 100% supported yet. +#define BUILD_COMPONENTS $[not $[WINDOWS_PLATFORM]] + // Define this to export the templates from the DLL. This is only // meaningful if LINK_ALL_STATIC is not defined, and we are building // on Windows. Some Windows compilers may not support this syntax. diff --git a/dtool/pptempl/Depends.pp b/dtool/pptempl/Depends.pp index 2a687e0ac2..764d393b5b 100644 --- a/dtool/pptempl/Depends.pp +++ b/dtool/pptempl/Depends.pp @@ -44,22 +44,21 @@ // $[compile_sources] from the different directories. #define composite_list // Tag all the static libraries by defining the "lib_is_static" variable. + #forscopes static_lib_target + #define lib_is_static 1 + #end static_lib_target #if $[WINDOWS_PLATFORM] - #forscopes static_lib_target ss_lib_target + #forscopes ss_lib_target #define lib_is_static 1 - #end static_lib_target ss_lib_target - #else - #forscopes static_lib_target - #define lib_is_static 1 - #end static_lib_target + #end ss_lib_target #endif #if $[LINK_ALL_STATIC] - #forscopes ss_lib_target lib_target + #forscopes metalib_target ss_lib_target lib_target #define lib_is_static 1 - #end ss_lib_target lib_target + #end metalib_target ss_lib_target lib_target #endif - #forscopes metalib_target lib_target noinst_lib_target test_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target + #forscopes metalib_target lib_target noinst_lib_target test_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target // We can optimize quite a bit by evaluating now several of the key // deferred variables defined in Globals.pp. This way they won't need // to get repeatedly reevaluated as each directory examines each @@ -163,7 +162,7 @@ #define compile_sources $[c_sources] $[cxx_sources] $[cxx_interrogate_sources] - #end metalib_target lib_target noinst_lib_target test_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target + #end metalib_target lib_target noinst_lib_target test_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target // Allow the user to define additional EXTRA_DEPENDS targets in each // Sources.pp. diff --git a/dtool/pptempl/Global.gmsvc.pp b/dtool/pptempl/Global.gmsvc.pp index f821674744..e984f4f52c 100644 --- a/dtool/pptempl/Global.gmsvc.pp +++ b/dtool/pptempl/Global.gmsvc.pp @@ -55,17 +55,6 @@ #define CFLAGS_SHARED -// Define LINK_ALL_STATIC to generate static libs instead of DLL's. -#if $[ne $[LINK_ALL_STATIC],] - #define build_dlls - #define build_libs yes - #define dlllib lib -#else - #define build_dlls yes - #define build_libs - #define dlllib dll -#endif - #include $[THISDIRPREFIX]compilerSettings.pp #if $[TEST_INLINING] @@ -164,9 +153,3 @@ #defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH] $[tau_lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] $[tau_libs] /OUT:"$[osfilename $[target]]"$[if $[eq $[USE_COMPILER], MSVC9],; $[MT_BIN] -nologo -manifest $[target].manifest -outputresource:$[target]\;1,] #defer LINK_BIN_C++ $[LINK_BIN_C] - -#if $[ne $[LINK_ALL_STATIC],] - #defer SHARED_LIB_C $[STATIC_LIB_C] - #defer SHARED_LIB_C++ $[STATIC_LIB_C++] - #defer ODIR_SHARED $[ODIR_STATIC] -#endif diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index 40b6af6f82..998c43d8ca 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -34,27 +34,13 @@ // variable as set for the dconfig library (that is, the expression // $[SOURCES] is evaluated within the named scope whose key is // "dconfig"--whose variable $[TARGET] was defined to be "dconfig"). -#map all_libs TARGET(*/static_lib_target */ss_lib_target */lib_target */noinst_lib_target */test_lib_target */metalib_target) +#map all_libs TARGET(*/static_lib_target */dynamic_lib_target */ss_lib_target */lib_target */noinst_lib_target */test_lib_target */metalib_target) // This map variable allows us to look up global variables that might // be defined in a particular Sources.pp, e.g. in the "toplevel" file. #map dir_type DIR_TYPE(*/) -// These allow us to determine whether a particular local library is a -// static or a dynamic library. If the library name appears in the -// static_libs map, it is a static library (i.e. libname.a); -// otherwise, it is a dynamic library (libname.so). The target -// ss_lib_target is a special case: these libraries are dynamic where -// it's easy to make them so (e.g. on Unix platforms), and static on -// platforms where dynamic libraries aren't quite so robust (e.g. on -// Windows). -#if $[WINDOWS_PLATFORM] - #map static_libs TARGET(*/static_lib_target */ss_lib_target) - #map dynamic_libs TARGET(*/lib_target */noinst_lib_target */test_lib_target */metalib_target) -#else - #map static_libs TARGET(*/static_lib_target) - #map dynamic_libs TARGET(*/lib_target */ss_lib_target */noinst_lib_target */test_lib_target */metalib_target) -#endif +#map libs TARGET(*/lib_target */static_lib_target */dynamic_lib_target */ss_lib_target */noinst_lib_target */test_lib_target */metalib_target) // This lets us identify which metalib, if any, is including each // named library. That is, $[module $[TARGET],name] will return @@ -441,6 +427,8 @@ #defer link_bin_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS] #defer shared_lib_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C] $[TAU_CFLAGS] #defer shared_lib_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS] +#defer static_lib_c $[STATIC_LIB_C] +#defer static_lib_c++ $[STATIC_LIB_C++] #else #defer compile_c $[COMPILE_C] @@ -449,17 +437,29 @@ #defer link_bin_c++ $[LINK_BIN_C++] #defer shared_lib_c $[SHARED_LIB_C] #defer shared_lib_c++ $[SHARED_LIB_C++] +#defer static_lib_c $[STATIC_LIB_C] +#defer static_lib_c++ $[STATIC_LIB_C++] #endif // USE_TAU +#defer link_lib_c $[if $[lib_is_static],$[static_lib_c],$[shared_lib_c]] +#defer link_lib_c++ $[if $[lib_is_static],$[static_lib_c++],$[shared_lib_c++]] + #defer dynamic_lib_ext $[DYNAMIC_LIB_EXT] +#defer static_lib_ext $[STATIC_LIB_EXT] +#defer lib_ext $[if $[lib_is_static],$[static_lib_ext],$[dynamic_lib_ext]] #defer bundle_ext $[BUNDLE_EXT] -#if $[LINK_ALL_STATIC] -#defer shared_lib_c $[STATIC_LIB_C] -#defer shared_lib_c++ $[STATIC_LIB_C++] -#defer dynamic_lib_ext $[STATIC_LIB_EXT] -#defer bundle_ext -#endif // LINK_ALL_STATIC +// If BUILD_COMPONENTS is not true, we don't actually build all the +// libraries. In particular, we don't build any libraries that are +// listed on a metalib. This variable can be evaluated within a +// library's scope to determine whether it should be built according +// to this rule. +#defer build_lib $[or $[BUILD_COMPONENTS],$[eq $[module $[TARGET],$[TARGET]],]] + +// This variable is true if the lib has an associated pdb (Windows +// only). It appears that pdb's are generated only for dll's, not for +// static libs. +#defer has_pdb $[and $[build_pdbs],$[not $[lib_is_static]]] // This takes advantage of the above two variables to get the actual @@ -493,6 +493,7 @@ // string if the target is not to be built, or the target name if it // is. #defer active_target $[if $[build_target],$[TARGET]] +#defer active_target_libext $[if $[build_target],$[TARGET]$[lib_ext]] #defer get_combined_sources $[COMBINED_SOURCES] // This subroutine will set up the sources variable to reflect the @@ -725,7 +726,7 @@ #end lib_target noinst_lib_target test_lib_target // These will never be part of a metalib. - #forscopes static_lib_target ss_lib_target bin_target noinst_bin_target metalib_target + #forscopes static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target metalib_target #foreach depend $[LOCAL_LIBS] #define depend_metalib $[module $[TARGET],$[depend]] #if $[ne $[depend_metalib],] @@ -740,7 +741,7 @@ #set depend_libs $[depend_libs] $[depend] #endif #end depend - #end static_lib_target ss_lib_target bin_target noinst_bin_target metalib_target + #end static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target metalib_target // In case we're defining any metalibs, these depend directly on // their components as well. diff --git a/dtool/pptempl/Template.gmsvc.pp b/dtool/pptempl/Template.gmsvc.pp index 3f8c4613f3..8f8b978afb 100644 --- a/dtool/pptempl/Template.gmsvc.pp +++ b/dtool/pptempl/Template.gmsvc.pp @@ -56,7 +56,7 @@ #if $[eq $[module $[TARGET],$[TARGET]],] // This library is not on a metalib, so we can build it. #set real_lib_targets $[real_lib_targets] $[TARGET] - #set real_lib_target_libs $[real_lib_target_libs] $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] + #set real_lib_target_libs $[real_lib_target_libs] $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #else // This library is on a metalib, so we can't build it, but we // should build all the obj's that go into it. @@ -66,38 +66,37 @@ #end lib_target // We need to know the various targets we'll be building. - // $[lib_targets] will be the list of dynamic libraries, - // $[static_lib_targets] the list of static libraries, and - // $[bin_targets] the list of binaries. $[test_bin_targets] is the - // list of binaries that are to be built only when specifically asked for. + // $[lib_targets] will be the list of dynamic and static libraries, + // and $[bin_targets] the list of binaries. $[test_bin_targets] is + // the list of binaries that are to be built only when specifically + // asked for. - #define lib_targets $[forscopes metalib_target noinst_lib_target test_lib_target,$[if $[build_target],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]] $[real_lib_target_libs] - #define static_lib_targets $[forscopes static_lib_target ss_lib_target,$[if $[build_target],$[ODIR]/$[get_dllname $[TARGET]].lib]] + #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]/$[get_dllname $[TARGET]]$[lib_ext]]] $[real_lib_target_libs] #define bin_targets \ $[active_target(bin_target noinst_bin_target):%=$[ODIR]/%.exe] \ $[active_target(sed_bin_target):%=$[ODIR]/%] #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%.exe] - #defer test_lib_targets $[active_target(test_lib_target):%=$[if $[TEST_ODIR],$[TEST_ODIR],$[ODIR]]/%.$[dlllib]] + #defer test_lib_targets $[active_target(test_lib_target):%=$[if $[TEST_ODIR],$[TEST_ODIR],$[ODIR]]/%$[lib_ext]] // And these variables will define the various things we need to // install. - #define install_lib $[active_target(metalib_target static_lib_target ss_lib_target)] $[real_lib_targets] + #define install_lib $[active_target(metalib_target static_lib_target dynamic_lib_target ss_lib_target)] $[real_lib_targets] #define install_bin $[active_target(bin_target)] - #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_SCRIPTS]] - #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_HEADERS]] + #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_SCRIPTS]] + #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_HEADERS]] #define install_parser_inc $[sort $[INSTALL_PARSER_INC]] - #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_DATA]] - #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_CONFIG]] + #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_DATA]] + #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_CONFIG]] #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target)]] // These are the various sources collected from all targets within the // directory. - #define st_sources $[sort $[compile_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define yxx_st_sources $[sort $[yxx_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define lxx_st_sources $[sort $[lxx_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define dep_sources_1 $[sort $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] + #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)]] + #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)]] + #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)]] + #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)]] // If there is an __init__.py in the directory, then all Python // files in the directory just get installed without having to be @@ -120,7 +119,7 @@ // with that happen to be static libs. We will introduce dependency // rules for these. (We don't need dependency rules for dynamic libs, // since these don't get burned in at build time.) -#defer static_lib_dependencies $[all_libs $[if $[lib_is_static],$[RELDIR:%=%/$[ODIR]/lib$[TARGET]$[dllext].lib]],$[complete_local_libs]] +#defer static_lib_dependencies $[all_libs $[if $[and $[lib_is_static],$[build_lib]],$[RELDIR:%=%/$[ODIR]/lib$[TARGET]$[dllext]$[lib_ext]]],$[complete_local_libs]] // $[target_ipath] is the proper ipath to put on the command line, // from the context of a particular target. @@ -133,7 +132,7 @@ // $[complete_lpath] is rather like $[complete_ipath]: the list of // directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[static_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] +#defer complete_lpath $[libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] // $[lpath] is like $[target_ipath]: it's the list of directories we // should add to our -L list, from the context of a particular target. @@ -213,7 +212,7 @@ #define all_targets \ Makefile \ $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \ - $[sort $[lib_targets] $[static_lib_targets] $[bin_targets]] \ + $[sort $[lib_targets] $[bin_targets]] \ $[deferred_objs] all : $[all_targets] @@ -221,16 +220,16 @@ all : $[all_targets] test : $[test_bin_targets] $[test_lib_targets] clean : clean-igate -#forscopes metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target +#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 #if $[compile_sources] $[TAB] rm -f $[patsubst %,$[%_obj],$[compile_sources]] #endif -#end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target +#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 #if $[deferred_objs] $[TAB] rm -f $[deferred_objs] #endif -#if $[lib_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] -$[TAB] rm -f $[lib_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] +#if $[lib_targets] $[bin_targets] $[test_bin_targets] +$[TAB] rm -f $[lib_targets] $[bin_targets] $[test_bin_targets] #endif #if $[yxx_st_sources] $[lxx_st_sources] $[TAB] rm -f $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] @@ -287,7 +286,7 @@ $[TAB] rm -f $[igatemout] $[$[igatemout]_obj] $[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%] #define install_targets \ - $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=install-lib%] \ + $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=install-lib%] \ $[active_target(bin_target sed_bin_target):%=install-%] \ $[installed_files] @@ -295,7 +294,7 @@ install : all $[install_targets] install-igate : $[sort $[installed_igate_files]] -uninstall : $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] +uninstall : $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] #if $[installed_files] $[TAB] rm -f $[sort $[installed_files]] #endif @@ -320,16 +319,10 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] ///////////////////////////////////////////////////////////////////// -// First, the dynamic libraries. Each lib_target and metalib_target -// is a dynamic library. +// First, the dynamic and static libraries. ///////////////////////////////////////////////////////////////////// -#forscopes metalib_target lib_target - -// In Windows, we don't actually build all the libraries. In -// particular, we don't build any libraries that are listed on a -// metalib. Is this one such a library? -#define build_it $[eq $[module $[TARGET],$[TARGET]],] +#forscopes metalib_target lib_target static_lib_target dynamic_lib_target // We might need to define a BUILDING_ symbol for win32. We use the // BUILDING_DLL variable name, defined typically in the metalib, for @@ -361,17 +354,21 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] #define igatemscan $[get_igatemscan] #define igatemout $[get_igatemout] -#if $[build_it] +#if $[build_lib] // Now output the rule to actually link the library from all of its // various .obj files. #define sources \ - $[patsubst %,$[%_obj],$[compile_sources]] \ - $[components $[patsubst %,$[RELDIR]/$[%_obj],$[compile_sources]],$[active_component_libs]] + $[patsubst %,$[%_obj],$[compile_sources]] + #if $[not $[BUILD_COMPONENTS]] + // Also link in all of the component files directly into the metalib. + #define sources $[sources] \ + $[components $[patsubst %,$[RELDIR]/$[%_obj],$[compile_sources]],$[active_component_libs]] + #endif - #define varname $[subst -,_,lib$[TARGET]_so] + #define varname $[subst -,_,.,_,lib$[TARGET]$[lib_ext]] $[varname] = $[sources] - #define target $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] + #define target $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #define sources $($[varname]) #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%] #define mybasename $[basename $[notdir $[target]]] @@ -387,25 +384,27 @@ $[TAB] mkdir -p $[tmpdirname_cyg] // this dir-creation-stuff is leftover from $[TAB] cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp" > "$[tmpdirname_win]\verdate.h" $[TAB] rc /n /I"$[tmpdirname_win]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[VER_RESOURCE] $[filter /D%, $[flags]] "$[dtool_ver_dir]\version.rc" #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[shared_lib_c++] +$[TAB] $[link_lib_c++] #else -$[TAB] $[shared_lib_c] +$[TAB] $[link_lib_c] #endif #else #define VER_RESOURCE .NOTPARALLEL $[target] : $[sources] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%] #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[shared_lib_c++] +$[TAB] $[link_lib_c++] #else -$[TAB] $[shared_lib_c] +$[TAB] $[link_lib_c] #endif #endif -#if $[build_dlls] -$[ODIR]/$[get_dllname $[TARGET]].lib : $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] +// Additional dependency rules for the implicit files that get built +// along with a .dll. +#if $[not $[lib_is_static]] +$[ODIR]/$[get_dllname $[TARGET]].lib : $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #endif -#if $[build_pdbs] -$[ODIR]/$[get_dllname $[TARGET]].pdb : $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] +#if $[has_pdb] +$[ODIR]/$[get_dllname $[TARGET]].pdb : $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #endif #endif @@ -413,10 +412,10 @@ $[ODIR]/$[get_dllname $[TARGET]].pdb : $[ODIR]/$[get_dllname $[TARGET]].$[dlllib // Here are the rules to install and uninstall the library and // everything that goes along with it. #define installed_files \ - $[if $[build_it], \ - $[if $[build_dlls],$[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib]] \ - $[install_lib_dir]/$[get_dllname $[TARGET]].lib \ - $[if $[and $[build_dlls],$[build_pdbs]],$[install_lib_dir]/$[get_dllname $[TARGET]].pdb] \ + $[if $[build_lib], \ + $[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext] \ + $[if $[not $[lib_is_static]],$[install_lib_dir]/$[get_dllname $[TARGET]].lib] \ + $[if $[has_pdb],$[install_lib_dir]/$[get_dllname $[TARGET]].pdb] \ ] \ $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ @@ -431,9 +430,8 @@ uninstall-lib$[TARGET] : $[TAB] rm -f $[sort $[installed_files]] #endif -#if $[build_dlls] -$[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib] : $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] -#define local $[get_dllname $[TARGET]].$[dlllib] +$[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext] : $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] +#define local $[get_dllname $[TARGET]]$[lib_ext] #define dest $[install_lib_dir] #if $[eq $[USE_COMPILER], MSVC8] $[TAB] mt -manifest $[ODIR]/$[local].manifest -outputresource:$[ODIR]/$[local]\;2 @@ -441,16 +439,16 @@ $[TAB] cp $[install_dash_p] -f $[ODIR]/$[local].manifest $[dest] #endif $[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ -#endif - - +// Install the .lib associated with a .dll. +#if $[not $[lib_is_static]] $[install_lib_dir]/$[get_dllname $[TARGET]].lib : $[ODIR]/$[get_dllname $[TARGET]].lib #define local $[get_dllname $[TARGET]].lib #define dest $[install_lib_dir] $[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ +#endif -#if $[and $[build_dlls],$[build_pdbs]] +#if $[has_pdb] $[install_lib_dir]/$[get_dllname $[TARGET]].pdb : $[ODIR]/$[get_dllname $[TARGET]].pdb #define local $[get_dllname $[TARGET]].pdb #define dest $[install_lib_dir] @@ -503,7 +501,7 @@ $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[iga #endif // igatemout -#end metalib_target lib_target +#end metalib_target lib_target static_lib_target dynamic_lib_target ///////////////////////////////////////////////////////////////////// @@ -515,23 +513,21 @@ $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[iga ///////////////////////////////////////////////////////////////////// #forscopes noinst_lib_target test_lib_target -#define varname $[subst -,_,lib$[TARGET]_so] +#define varname $[subst -,_,.,_,lib$[TARGET]$[lib_ext]] $[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] +#define target $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #define sources $($[varname]) #define $[VER_RESOURCE] $[COMPILED_RESOURCES] $[target] : $[sources] $[static_lib_dependencies] $[GENERATED_SOURCES] #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[shared_lib_c++] +$[TAB] $[link_lib_c++] #else -$[TAB] $[shared_lib_c] +$[TAB] $[link_lib_c] #endif -#if $[build_dlls] -$[ODIR]/$[get_dllname $[TARGET]].lib : $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] -#endif -#if $[build_pdbs] -$[ODIR]/$[get_dllname $[TARGET]].pdb : $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] +$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] : $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] +#if $[has_pdb] +$[ODIR]/$[get_dllname $[TARGET]].pdb : $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #endif // this section is all very clunky and not generalized enough @@ -591,47 +587,6 @@ $[TAB] $[MIDL_COMMAND] #end noinst_lib_target test_lib_target -///////////////////////////////////////////////////////////////////// -// Now the static libraries. Again, we assume there's no interrogate -// interfaces going on in here, and there's no question of this being -// a metalib, making the rules relatively simple. -///////////////////////////////////////////////////////////////////// - -#forscopes static_lib_target ss_lib_target -#define varname $[subst -,_,lib$[TARGET]_a] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[get_dllname $[TARGET]].lib -#define sources $($[varname]) -$[target] : $[sources] -#if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[STATIC_LIB_C++] -#else -$[TAB] $[STATIC_LIB_C] -#endif - -#define installed_files \ - $[install_lib_dir]/$[get_dllname $[TARGET]].lib \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] - -install-lib$[TARGET] : $[installed_files] - -uninstall-lib$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -$[install_lib_dir]/$[get_dllname $[TARGET]].lib : $[ODIR]/$[get_dllname $[TARGET]].lib -#define local $[get_dllname $[TARGET]].lib -#define dest $[install_lib_dir] -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ - -#end static_lib_target ss_lib_target - - - ///////////////////////////////////////////////////////////////////// // The sed_bin_targets are a special bunch. These are scripts that // are to be preprocessed with sed before being installed, for @@ -820,7 +775,7 @@ $[TAB] cp $[target_prebuilt] $[target] // file. ///////////////////////////////////////////////////////////////////// -#forscopes metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target +#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 // need to use #print to avoid printing to Makefile // printvar prints the unevaluated defn of the var // #print TARGET=$[TARGET] @@ -906,7 +861,7 @@ $[TAB] $[COMPILE_C++] #end file -#end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target +#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 // And now the rules to install the auxiliary files, like headers and // data files. diff --git a/dtool/pptempl/Template.msvc.pp b/dtool/pptempl/Template.msvc.pp index d2240f1022..97ceb4f334 100644 --- a/dtool/pptempl/Template.msvc.pp +++ b/dtool/pptempl/Template.msvc.pp @@ -160,7 +160,7 @@ // $[complete_lpath] is rather like $[complete_ipath]: the list of // directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[static_libs $[RELDIR:%=%\$[ODIR]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%\$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] +#defer complete_lpath $[libs $[RELDIR:%=%\$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] // $[lpath] is like $[target_ipath]: it's the list of directories we // should add to our -L list, from the context of a particular target. diff --git a/dtool/pptempl/Template.nmake.pp b/dtool/pptempl/Template.nmake.pp index 23bb987299..2b30ab9d5d 100644 --- a/dtool/pptempl/Template.nmake.pp +++ b/dtool/pptempl/Template.nmake.pp @@ -63,7 +63,7 @@ #if $[eq $[module $[TARGET],$[TARGET]],] // This library is not on a metalib, so we can build it. #set real_lib_targets $[real_lib_targets] $[TARGET] - #set real_lib_target_libs $[real_lib_target_libs] $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] + #set real_lib_target_libs $[real_lib_target_libs] $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #else // This library is on a metalib, so we can't build it, but we // should build all the obj's that go into it. @@ -73,20 +73,19 @@ #end lib_target // We need to know the various targets we'll be building. - // $[lib_targets] will be the list of dynamic libraries, - // $[static_lib_targets] the list of static libraries, and + // $[lib_targets] will be the list of dynamic and static libraries, // $[bin_targets] the list of binaries. $[test_bin_targets] is the - // list of binaries that are to be built only when specifically asked for. + // list of binaries that are to be built only when specifically + // asked for. - #define lib_targets $[forscopes metalib_target noinst_lib_target test_lib_target,$[if $[build_target],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]]] $[real_lib_target_libs] - #define static_lib_targets $[forscopes static_lib_target ss_lib_target,$[if $[build_target],$[ODIR]/$[get_dllname $[TARGET]].lib]] + #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]/$[get_dllname $[TARGET]]$[lib_ext]]] $[real_lib_target_libs] #define bin_targets \ $[active_target(bin_target noinst_bin_target):%=$[ODIR]/%.exe] \ $[active_target(sed_bin_target):%=$[ODIR]/%] #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%.exe] - #defer test_lib_targets $[active_target(test_lib_target):%=$[if $[TEST_ODIR],$[TEST_ODIR],$[ODIR]]/%.$[dlllib]] + #defer test_lib_targets $[active_target(test_lib_target):%=$[if $[TEST_ODIR],$[TEST_ODIR],$[ODIR]]/%$[lib_ext]] // And these variables will define the various things we need to // install. @@ -133,7 +132,7 @@ // with that happen to be static libs. We will introduce dependency // rules for these. (We don't need dependency rules for dynamic libs, // since these don't get burned in at build time.) -#defer static_lib_dependencies $[all_libs $[if $[lib_is_static],$[RELDIR:%=%/$[ODIR]/lib$[TARGET]$[dllext].lib]],$[complete_local_libs]] +#defer static_lib_dependencies $[all_libs $[if $[lib_is_static],$[RELDIR:%=%/$[ODIR]/lib$[TARGET]$[dllext]$[lib_ext]]],$[complete_local_libs]] // And $[complete_ipath] is the list of directories (from within this // tree) we should add to our -I list. It's basically just one for @@ -155,7 +154,7 @@ // $[complete_lpath] is rather like $[complete_ipath]: the list of // directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[static_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] +#defer complete_lpath $[libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] // $[lpath] is like $[target_ipath]: it's the list of directories we // should add to our -L list, from the context of a particular target. @@ -391,7 +390,7 @@ igate : $[patsubst %,$[osfilename %],$[get_igatedb(metalib_target lib_target ss_ #define varname $[subst -,_,lib$[TARGET]_so] $[varname] = $[patsubst %,$[osfilename %],$[sources]] - #define target $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] + #define target $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #define sources $($[varname]) #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%] #define mybasename $[basename $[notdir $[target]]] @@ -407,16 +406,16 @@ $[TAB] if not exist $[osfilename $[tmpdirname_cyg]] mkdir $[osfilename $[tmpdir $[TAB] cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp" > "$[tmpdirname_win]\verdate.h" $[TAB] rc /n /I"$[tmpdirname_win]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[VER_RESOURCE] $[filter /D%, $[flags]] "$[dtool_ver_dir]\version.rc" #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[SHARED_LIB_C++] $[VER_RESOURCE] +$[TAB] $[link_lib_c++] $[VER_RESOURCE] #else -$[TAB] $[SHARED_LIB_C] $[VER_RESOURCE] +$[TAB] $[link_lib_c] $[VER_RESOURCE] #endif #else $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%]] #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[SHARED_LIB_C++] +$[TAB] $[link_lib_c++] #else -$[TAB] $[SHARED_LIB_C] +$[TAB] $[link_lib_c] #endif #endif #if $[eq $[USE_COMPILER], MSVC8] @@ -424,10 +423,10 @@ $[TAB] mt -nologo -manifest $[target].manifest -outputresource:$[target];2 #endif #if $[build_dlls] -$[osfilename $[ODIR]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]] +$[osfilename $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] #endif #if $[build_pdbs] -$[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]] +$[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] #endif #endif @@ -436,8 +435,8 @@ $[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename % // everything that goes along with it. #define installed_files \ $[if $[build_it], \ - $[if $[build_dlls],$[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib]] \ - $[install_lib_dir]/$[get_dllname $[TARGET]].lib \ + $[if $[build_dlls],$[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext]] \ + $[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext] \ $[if $[and $[build_dlls],$[build_pdbs]],$[install_lib_dir]/$[get_dllname $[TARGET]].pdb] \ ] \ $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ @@ -456,8 +455,8 @@ $[TAB] if exist $[file] del /f $[file] #endif #if $[build_dlls] -$[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].$[dlllib]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]] -#define local $[get_dllname $[TARGET]].$[dlllib] +$[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] +#define local $[get_dllname $[TARGET]]$[lib_ext] #define dest $[install_lib_dir] #if $[eq $[USE_COMPILER], MSVC8] $[TAB] mt -nologo -manifest $[ODIR]/$[local].manifest -outputresource:$[ODIR]/$[local];2 @@ -466,8 +465,8 @@ $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]] $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local].manifest] $[osfilename $[dest]] #endif -$[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].lib] -#define local $[get_dllname $[TARGET]].lib +$[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] +#define local $[get_dllname $[TARGET]]$[lib_ext] #define dest $[install_lib_dir] $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]] @@ -546,23 +545,23 @@ $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[iga #forscopes noinst_lib_target test_lib_target #define varname $[subst -,_,lib$[TARGET]_so] $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]] -#define target $[ODIR]/$[get_dllname $[TARGET]].$[dlllib] +#define target $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] #define sources $($[varname]) $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies] $[GENERATED_SOURCES]] #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[SHARED_LIB_C++] $[COMPILED_RESOURCES] +$[TAB] $[link_lib_c++] $[COMPILED_RESOURCES] #else -$[TAB] $[SHARED_LIB_C] $[COMPILED_RESOURCES] +$[TAB] $[link_lib_c] $[COMPILED_RESOURCES] #endif #if $[eq $[USE_COMPILER], MSVC8] $[TAB] mt -nologo -manifest $[target].manifest -outputresource:$[target];2 #endif #if $[build_dlls] -$[osfilename $[ODIR]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]] +$[osfilename $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] #endif #if $[build_pdbs] -$[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].$[dlllib]] +$[osfilename $[ODIR]/$[get_dllname $[TARGET]].pdb] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] #endif // this section is all very clunky and not generalized enough @@ -622,46 +621,46 @@ $[TAB] $[MIDL_COMMAND] #end noinst_lib_target test_lib_target -///////////////////////////////////////////////////////////////////// -// Now the static libraries. Again, we assume there's no interrogate -// interfaces going on in here, and there's no question of this being -// a metalib, making the rules relatively simple. -///////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////// +// // Now the static libraries. Again, we assume there's no interrogate +// // interfaces going on in here, and there's no question of this being +// // a metalib, making the rules relatively simple. +// ///////////////////////////////////////////////////////////////////// -#forscopes static_lib_target ss_lib_target -#define varname $[subst -,_,lib$[TARGET]_a] -$[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]] -#define target $[ODIR]/$[get_dllname $[TARGET]].lib -#define sources $($[varname]) -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources]] -#if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[STATIC_LIB_C++] -#else -$[TAB] $[STATIC_LIB_C] -#endif +// #forscopes static_lib_target ss_lib_target +// #define varname $[subst -,_,lib$[TARGET]_a] +// $[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]] +// #define target $[ODIR]/$[get_dllname $[TARGET]]$[lib_ext] +// #define sources $($[varname]) +// $[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources]] +// #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] +// $[TAB] $[STATIC_LIB_C++] +// #else +// $[TAB] $[STATIC_LIB_C] +// #endif -#define installed_files \ - $[install_lib_dir]/$[get_dllname $[TARGET]].lib \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] +// #define installed_files \ +// $[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext] \ +// $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ +// $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ +// $[INSTALL_DATA:%=$[install_data_dir]/%] \ +// $[INSTALL_CONFIG:%=$[install_config_dir]/%] -install-lib$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]] +// install-lib$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]] -uninstall-lib$[TARGET] : -#if $[installed_files] -#foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif +// uninstall-lib$[TARGET] : +// #if $[installed_files] +// #foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]] +// $[TAB] if exist $[file] del /f $[file] +// #end file +// #endif -$[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]].lib] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]].lib] -#define local $[get_dllname $[TARGET]].lib -#define dest $[install_lib_dir] -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]] +// $[osfilename $[install_lib_dir]/$[get_dllname $[TARGET]]$[lib_ext]] : $[patsubst %,$[osfilename %],$[ODIR]/$[get_dllname $[TARGET]]$[lib_ext]] +// #define local $[get_dllname $[TARGET]]$[lib_ext] +// #define dest $[install_lib_dir] +// $[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]] -#end static_lib_target ss_lib_target +// #end static_lib_target ss_lib_target diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index 73673a8366..6d7405a1e8 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -35,18 +35,16 @@ #if $[build_directory] // We need to know the various targets we'll be building. - // $[lib_targets] will be the list of dynamic libraries, - // $[static_lib_targets] the list of static libraries, and - // $[bin_targets] the list of binaries. $[test_bin_targets] is the - // list of binaries that are to be built only when specifically asked - // for. - #define lib_targets $[active_target(metalib_target lib_target ss_lib_target noinst_lib_target):%=$[ODIR]/lib%$[dynamic_lib_ext]] + // $[lib_targets] will be the list of dynamic and static libraries, + // and $[bin_targets] the list of binaries. $[test_bin_targets] is + // the list of binaries that are to be built only when specifically + // asked for. + #define lib_targets $[active_target_libext(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target noinst_lib_target):%=$[ODIR]/lib%] #define bundle_targets #if $[bundle_ext] #define bundle_targets $[active_target(metalib_target):%=$[ODIR]/lib%$[bundle_ext]] #endif - - #define static_lib_targets $[active_target(static_lib_target):%=$[ODIR]/lib%.a] + #define bin_targets $[active_target(bin_target noinst_bin_target sed_bin_target):%=$[ODIR]/%] #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%] @@ -57,16 +55,16 @@ #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_SCRIPTS]] #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_HEADERS]] #define install_parser_inc $[sort $[INSTALL_PARSER_INC]] - #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_DATA]] - #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_CONFIG]] + #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target bin_target)] $[INSTALL_DATA]] + #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target bin_target)] $[INSTALL_CONFIG]] #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target ss_lib_target)]] // These are the various sources collected from all targets within the // directory. - #define st_sources $[sort $[compile_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] - #define yxx_st_sources $[sort $[yxx_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] - #define lxx_st_sources $[sort $[lxx_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] - #define dep_sources_1 $[sort $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] + #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)]] + #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)]] + #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)]] + #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)]] // These are the source files that our dependency cache file will // depend on. If it's an empty list, we won't bother writing rules to @@ -89,7 +87,7 @@ // with that happen to be static libs. We will introduce dependency // rules for these. (We don't need dependency rules for dynamic libs, // since these don't get burned in at build time.) -#defer static_lib_dependencies $[all_libs $[if $[lib_is_static],$[RELDIR:%=%/$[ODIR]/lib$[TARGET]$[dllext].a]],$[complete_local_libs]] +#defer static_lib_dependencies $[all_libs $[if $[lib_is_static],$[RELDIR:%=%/$[ODIR]/lib$[TARGET]$[dllext]$[lib_ext]]],$[complete_local_libs]] // $[target_ipath] is the proper ipath to put on the command line, // from the context of a particular target. @@ -103,7 +101,7 @@ // $[complete_lpath] is rather like $[complete_ipath]: the list of // directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[static_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] +#defer complete_lpath $[libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] // $[lpath] is like $[target_ipath]: it's the list of directories we // should add to our -L list, from the context of a particular target. @@ -200,20 +198,20 @@ include $[TAU_MAKEFILE] #define all_targets \ Makefile \ $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \ - $[sort $[lib_targets] $[bundle_targets] $[static_lib_targets] $[bin_targets]] + $[sort $[lib_targets] $[bundle_targets] $[bin_targets]] all : $[all_targets] // The 'test' rule makes all the test_bin_targets. test : $[test_bin_targets] clean : clean-igate -#forscopes metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target +#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 #if $[compile_sources] $[TAB] rm -f $[patsubst %,$[%_obj],$[compile_sources]] #endif -#end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -#if $[lib_targets] $[bundle_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] -$[TAB] rm -f $[lib_targets] $[bundle_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] +#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 +#if $[lib_targets] $[bundle_targets] $[bin_targets] $[test_bin_targets] +$[TAB] rm -f $[lib_targets] $[bundle_targets] $[bin_targets] $[test_bin_targets] #endif #if $[yxx_st_sources] $[lxx_st_sources] $[TAB] rm -f $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] @@ -239,7 +237,7 @@ $[TAB] rm -f $[composite_list] #endif clean-igate : -#forscopes metalib_target lib_target ss_lib_target +#forscopes metalib_target lib_target ss_lib_target dynamic_lib_target #define igatedb $[get_igatedb] #define igateoutput $[get_igateoutput] #define igatemscan $[get_igatemscan] @@ -253,7 +251,7 @@ $[TAB] rm -f $[igateoutput] $[$[igateoutput]_obj] #if $[igatemout] $[TAB] rm -f $[igatemout] $[$[igatemout]_obj] #endif -#end metalib_target lib_target ss_lib_target +#end metalib_target lib_target ss_lib_target dynamic_lib_target // Now, 'install' and 'uninstall'. These simply copy files into the // install directory (or remove them). The 'install' rule also makes @@ -270,7 +268,7 @@ $[TAB] rm -f $[igatemout] $[$[igatemout]_obj] $[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%] #define install_targets \ - $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=install-lib%] \ + $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=install-lib%] \ $[active_target(bin_target sed_bin_target):%=install-%] \ $[installed_files] @@ -278,7 +276,7 @@ install : all $[install_targets] install-igate : $[sort $[installed_igate_files]] -uninstall : $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] +uninstall : $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] #if $[installed_files] $[TAB] rm -f $[sort $[installed_files]] #endif @@ -303,11 +301,10 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] ///////////////////////////////////////////////////////////////////// -// First, the dynamic libraries. Each lib_target and metalib_target -// is a dynamic library. +// First, the normally installed dynamic and static libraries. ///////////////////////////////////////////////////////////////////// -#forscopes metalib_target lib_target ss_lib_target +#forscopes metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target // In Unix, we always build all the libraries, unlike Windows. #define build_it 1 @@ -350,22 +347,22 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] #define cc_ld $[or $[get_ld],$[CC]] #define cxx_ld $[or $[get_ld],$[CXX]] - #define varname $[subst -,_,lib$[TARGET]_so] + #define varname $[subst -,_,.,_,lib$[TARGET]$[lib_ext]] $[varname] = $[sources] $[if $[not $[bundle_ext]],$[interrogate_sources]] - #define target $[ODIR]/lib$[TARGET]$[dynamic_lib_ext] + #define target $[ODIR]/lib$[TARGET]$[lib_ext] #define sources $($[varname]) $[target] : $[sources] $[static_lib_dependencies] #if $[filter %.mm %.cxx %.yxx %.lxx,$[get_sources]] -$[TAB] $[shared_lib_c++] +$[TAB] $[link_lib_c++] #else -$[TAB] $[shared_lib_c] +$[TAB] $[link_lib_c] #endif #if $[bundle_ext] // Also generate the bundles (on OSX only). #define target $[ODIR]/lib$[TARGET]$[bundle_ext] - #define sources $[interrogate_sources] $[ODIR]/lib$[TARGET]$[dynamic_lib_ext] + #define sources $[interrogate_sources] $[ODIR]/lib$[TARGET]$[lib_ext] $[target] : $[sources] $[static_lib_dependencies] $[TAB] $[BUNDLE_LIB_C++] #endif // BUNDLE_EXT @@ -374,7 +371,7 @@ $[TAB] $[BUNDLE_LIB_C++] // Here are the rules to install and uninstall the library and // everything that goes along with it. #define installed_files \ - $[install_lib_dir]/lib$[TARGET]$[dynamic_lib_ext] \ + $[install_lib_dir]/lib$[TARGET]$[lib_ext] \ $[if $[bundle_ext],$[install_lib_dir]/lib$[TARGET]$[bundle_ext]] \ $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ @@ -389,8 +386,8 @@ uninstall-lib$[TARGET] : $[TAB] rm -f $[sort $[installed_files]] #endif -$[install_lib_dir]/lib$[TARGET]$[dynamic_lib_ext] : $[ODIR]/lib$[TARGET]$[dynamic_lib_ext] -#define local $[ODIR]/lib$[TARGET]$[dynamic_lib_ext] +$[install_lib_dir]/lib$[TARGET]$[lib_ext] : $[ODIR]/lib$[TARGET]$[lib_ext] +#define local $[ODIR]/lib$[TARGET]$[lib_ext] #define dest $[install_lib_dir] $[TAB] $[INSTALL] @@ -447,7 +444,7 @@ $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[iga #endif // igatemout -#end metalib_target lib_target ss_lib_target +#end metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target @@ -463,60 +460,18 @@ $[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[iga #forscopes noinst_lib_target #define varname $[subst -,_,lib$[TARGET]_so] $[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/lib$[TARGET]$[dynamic_lib_ext] +#define target $[ODIR]/lib$[TARGET]$[lib_ext] #define sources $($[varname]) $[target] : $[sources] $[static_lib_dependencies] #if $[filter %.mm %.cxx %.yxx %.lxx,$[get_sources]] -$[TAB] $[shared_lib_c++] +$[TAB] $[link_lib_c++] #else -$[TAB] $[shared_lib_c] +$[TAB] $[link_lib_c] #endif #end noinst_lib_target - -///////////////////////////////////////////////////////////////////// -// Now the static libraries. Again, we assume there's no interrogate -// interfaces going on in here, and there's no question of this being -// a metalib, making the rules relatively simple. -///////////////////////////////////////////////////////////////////// - -#forscopes static_lib_target -#define varname $[subst -,_,lib$[TARGET]_a] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/lib$[TARGET]$[dllext].a -#define sources $($[varname]) -$[target] : $[sources] -#if $[filter %.mm %.cxx %.yxx %.lxx,$[get_sources]] -$[TAB] $[STATIC_LIB_C++] -#else -$[TAB] $[STATIC_LIB_C] -#endif - -#define installed_files \ - $[install_lib_dir]/lib$[TARGET]$[dllext].a \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] - -install-lib$[TARGET] : $[installed_files] - -uninstall-lib$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -$[install_lib_dir]/lib$[TARGET]$[dllext].a : $[ODIR]/lib$[TARGET]$[dllext].a -#define local $[ODIR]/lib$[TARGET]$[dllext].a -#define dest $[install_lib_dir] -$[TAB] $[INSTALL] - -#end static_lib_target - - - ///////////////////////////////////////////////////////////////////// // The sed_bin_targets are a special bunch. These are scripts that // are to be preprocessed with sed before being installed, for