diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index 7e3c831f4b..c31e802a5e 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -455,8 +455,6 @@ #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] @@ -465,12 +463,12 @@ #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 static_lib_c $[STATIC_LIB_C] +#defer static_lib_c++ $[STATIC_LIB_C++] +#defer bundle_lib_c $[BUNDLE_LIB_C++] +#defer bundle_lib_c++ $[BUNDLE_LIB_C++] // "lib" is the default prefix applied to every generated library. // This comes from Unix convention. This can be redefined on a @@ -478,13 +476,22 @@ #define LIB_PREFIX lib #defer lib_prefix $[LIB_PREFIX] +// OSX has a "bundle" concept. This is kind of like a dylib, but not +// quite. Sometimes you might want to link a library *as* a bundle +// instead of as a dylib; sometimes you might want to link a library +// into a dylib *and* a bundle. +#defer bundle_ext $[BUNDLE_EXT] +#defer link_as_bundle $[and $[OSX_PLATFORM],$[LINK_AS_BUNDLE]] +#defer link_extra_bundle $[and $[OSX_PLATFORM],$[LINK_EXTRA_BUNDLE],$[not $[LINK_AS_BUNDLE]]] + // The default library extension various based on the OS. #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 lib_ext $[if $[link_as_bundle],$[bundle_ext],$[if $[lib_is_static],$[static_lib_ext],$[dynamic_lib_ext]]] + +#defer link_lib_c $[if $[link_as_bundle],$[bundle_lib_c],$[if $[lib_is_static],$[static_lib_c],$[shared_lib_c]]] +#defer link_lib_c++ $[if $[link_as_bundle],$[bundle_lib_c++],$[if $[lib_is_static],$[static_lib_c++],$[shared_lib_c++]]] -// OSX also has a "bundle" concept. -#defer bundle_ext $[BUNDLE_EXT] // If BUILD_COMPONENTS is not true, we don't actually build all the // libraries. In particular, we don't build any libraries that are @@ -530,7 +537,8 @@ // 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 active_target_libprefext $[if $[build_target],$[lib_prefix]$[TARGET]$[lib_ext]] +#defer active_target_bundleext $[if $[and $[build_target],$[link_bundle]],$[lib_prefix]$[TARGET]$[bundle_ext]] #defer get_combined_sources $[COMBINED_SOURCES] // This subroutine will set up the sources variable to reflect the diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index 8362729ccc..20490fc7c1 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -39,11 +39,8 @@ // 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 lib_targets $[active_target_libprefext(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target noinst_lib_target):%=$[ODIR]/%] + #define bundle_targets $[active_target_bundleext(metalib_target):%=$[ODIR]/%] #define bin_targets $[active_target(bin_target noinst_bin_target sed_bin_target):%=$[ODIR]/%] #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%] @@ -348,7 +345,7 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] #define cxx_ld $[or $[get_ld],$[CXX]] #define varname $[subst -,_,.,_,$[lib_prefix]$[TARGET]$[lib_ext]] -$[varname] = $[sources] $[if $[not $[bundle_ext]],$[interrogate_sources]] +$[varname] = $[sources] $[interrogate_sources] #define target $[ODIR]/$[lib_prefix]$[TARGET]$[lib_ext] #define sources $($[varname]) @@ -359,7 +356,7 @@ $[TAB] $[link_lib_c++] $[TAB] $[link_lib_c] #endif - #if $[bundle_ext] + #if $[link_extra_bundle] // Also generate the bundles (on OSX only). #define target $[ODIR]/$[lib_prefix]$[TARGET]$[bundle_ext] #define sources $[interrogate_sources] $[ODIR]/$[lib_prefix]$[TARGET]$[lib_ext] @@ -372,7 +369,7 @@ $[TAB] $[BUNDLE_LIB_C++] // everything that goes along with it. #define installed_files \ $[install_lib_dir]/$[lib_prefix]$[TARGET]$[lib_ext] \ - $[if $[bundle_ext],$[install_lib_dir]/$[lib_prefix]$[TARGET]$[bundle_ext]] \ + $[if $[link_extra_bundle],$[install_lib_dir]/$[lib_prefix]$[TARGET]$[bundle_ext]] \ $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ $[INSTALL_DATA:%=$[install_data_dir]/%] \ @@ -391,12 +388,12 @@ $[install_lib_dir]/$[lib_prefix]$[TARGET]$[lib_ext] : $[ODIR]/$[lib_prefix]$[TAR #define dest $[install_lib_dir] $[TAB] $[INSTALL] -#if $[bundle_ext] +#if $[link_extra_bundle] $[install_lib_dir]/$[lib_prefix]$[TARGET]$[bundle_ext] : $[ODIR]/$[lib_prefix]$[TARGET]$[bundle_ext] #define local $[ODIR]/$[lib_prefix]$[TARGET]$[bundle_ext] #define dest $[install_lib_dir] $[TAB] $[INSTALL] -#endif // BUNDLE_EXT +#endif // link_extra_bundle #if $[igatescan] // Now, some additional rules to generate and compile the interrogate