From ae6288a1656e312ff5b2f7f52bba2c67a1bcf4e0 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 5 Jun 2002 22:39:50 +0000 Subject: [PATCH] replace st_dir with ODIR, other cleanup --- dtool/Config.pp | 10 ++-- dtool/pptempl/Depends.pp | 18 ++++-- dtool/pptempl/Global.pp | 9 +-- dtool/pptempl/Template.gmsvc.pp | 100 ++++++++++++++++---------------- 4 files changed, 70 insertions(+), 67 deletions(-) diff --git a/dtool/Config.pp b/dtool/Config.pp index 7a18b61771..ff0d25ba1e 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -444,14 +444,12 @@ #defer SED ppremake -s '$[script]' <$[source] >$[target] // What directory name (within each source directory) should the .o -// (or .obj) files be written to, for both shared and static sources? -// In general, it is safe to define these to be the same. However, -// don't define these to be '.', or you will be very sad the next time -// you run 'make clean'. +// (or .obj) files be written to? This can be any name, and it can be +// used to differentiate different builds within the same tree. +// However, don't define this to be '.', or you will be very sad the +// next time you run 'make clean'. //#defer ODIR Opt$[OPTIMIZE]-$[PLATFORM]$[USE_COMPILER] #defer ODIR Opt$[OPTIMIZE]-$[PLATFORM] -#defer ODIR_SHARED $[ODIR] -#defer ODIR_STATIC $[ODIR] diff --git a/dtool/pptempl/Depends.pp b/dtool/pptempl/Depends.pp index 2786a71301..da05ca6173 100644 --- a/dtool/pptempl/Depends.pp +++ b/dtool/pptempl/Depends.pp @@ -70,28 +70,31 @@ // Define what the object files are. #foreach file $[c_sources] $[cxx_sources] $[yxx_sources] $[lxx_sources] - #define $[file]_obj $[patsubst %.c %.cxx %.yxx %.lxx,$[st_dir]/$[TARGET]_%.obj,$[file]] + #define $[file]_obj $[patsubst %.c %.cxx %.yxx %.lxx,$[ODIR]/$[TARGET]_%.obj,$[file]] + #push 1 $[file]_obj #end file #if $[USE_SINGLE_COMPOSITE_SOURCEFILE] #if $[> $[words $[cxx_sources]], 1] // If we have multiple C++ files, put them together into one // composite file. - #define composite_file $[st_dir]/$[TARGET]_composite.cxx + #define composite_file $[ODIR]/$[TARGET]_composite.cxx #set composite_list $[composite_list] $[composite_file] #define $[composite_file]_sources $[cxx_sources] + #define $[composite_file]_obj $[ODIR]/$[TARGET]_composite.obj #push 1 $[composite_file]_sources - #define $[composite_file]_obj $[st_dir]/$[TARGET]_composite.obj + #push 1 $[composite_file]_obj #set cxx_sources $[composite_file] #endif #if $[> $[words $[c_sources]], 1] // If we have multiple C files, put them together into one // composite file also. - #define composite_file $[st_dir]/$[TARGET]_composite_c.c + #define composite_file $[ODIR]/$[TARGET]_composite_c.c #set composite_list $[composite_list] $[composite_file] #define $[composite_file]_sources $[c_sources] + #define $[composite_file]_obj $[ODIR]/$[TARGET]_composite_c.obj #push 1 $[composite_file]_sources - #define $[composite_file]_obj $[st_dir]/$[TARGET]_composite_c.obj + #push 1 $[composite_file]_obj #set c_sources $[composite_file] #endif #endif @@ -102,20 +105,23 @@ // tend to be very large files themselves. #foreach source_file $[yxx_sources] $[lxx_sources] #define generated_file $[patsubst %.yxx %.lxx,%.cxx,$[source_file]] - #define $[generated_file]_obj $[patsubst %.yxx %.lxx,$[st_dir]/$[TARGET]_%.obj,$[source_file]] + #define $[generated_file]_obj $[patsubst %.yxx %.lxx,$[ODIR]/$[TARGET]_%.obj,$[source_file]] #define $[generated_file]_sources $[source_file] + #push 1 $[generated_file]_obj #set cxx_sources $[cxx_sources] $[generated_file] #end source_file #if $[get_igateoutput] #define generated_file $[get_igateoutput] #define $[generated_file]_obj $[get_igateoutput:%.cxx=%.obj] #define $[generated_file]_sources $[get_igatescan] + #push 1 $[generated_file]_obj #set cxx_sources $[cxx_sources] $[generated_file] #endif #if $[get_igatemout] #define generated_file $[get_igatemout] #define $[generated_file]_obj $[get_igatemout:%.cxx=%.obj] #define $[generated_file]_sources none + #push 1 $[generated_file]_obj #set cxx_sources $[cxx_sources] $[generated_file] #endif diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index 00653c3d92..7fc7371ab1 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -306,21 +306,21 @@ // the target is not to be interrogated. #defer get_igatedb \ $[if $[and $[run_interrogate],$[IGATESCAN]], \ - $[st_dir]/lib$[TARGET]$[dllext].in] + $[ODIR]/lib$[TARGET]$[dllext].in] // This variable returns the name of the interrogate code file // that will be generated for a particular target, or empty string if // the target is not to be interrogated. #defer get_igateoutput \ $[if $[and $[run_interrogate],$[IGATESCAN]], \ - $[st_dir]/lib$[TARGET]_igate.cxx] + $[ODIR]/lib$[TARGET]_igate.cxx] // This variable is the set of .in files generated by all of our // component libraries. If it is nonempty, then we do need to // generate a module, and $[get_igatemout] is the name of the .cxx file // that interrogate will produce to make this module. #defer get_igatemscan $[components $[get_igatedb:%=$[RELDIR]/%],$[active_component_libs]] -#defer get_igatemout $[if $[get_igatemscan],$[st_dir]/lib$[TARGET]_module.cxx] +#defer get_igatemout $[if $[get_igatemscan],$[ODIR]/lib$[TARGET]_module.cxx] // This variable returns the set of external packages used by this // target, and by all the components shared by this target. @@ -478,9 +478,6 @@ // Define a few directories that will be useful. -#define so_dir $[ODIR_SHARED] -#define st_dir $[ODIR_STATIC] - #define install_dir $[$[upcase $[PACKAGE]]_INSTALL] #if $[eq $[install_dir],] #error Variable $[upcase $[PACKAGE]]_INSTALL is not set! Cannot install! diff --git a/dtool/pptempl/Template.gmsvc.pp b/dtool/pptempl/Template.gmsvc.pp index 905fe4d7ae..17fc620350 100644 --- a/dtool/pptempl/Template.gmsvc.pp +++ b/dtool/pptempl/Template.gmsvc.pp @@ -57,12 +57,12 @@ // $[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 $[patsubst %,$[st_dir]/lib%$[dllext].$[dlllib],$[active_target(metalib_target noinst_lib_target)] $[real_lib_targets]] - #define static_lib_targets $[active_target(static_lib_target ss_lib_target):%=$[st_dir]/lib%$[dllext].lib] + #define lib_targets $[patsubst %,$[ODIR]/lib%$[dllext].$[dlllib],$[active_target(metalib_target noinst_lib_target)] $[real_lib_targets]] + #define static_lib_targets $[active_target(static_lib_target ss_lib_target):%=$[ODIR]/lib%$[dllext].lib] #define bin_targets \ - $[active_target(bin_target noinst_bin_target):%=$[st_dir]/%.exe] \ - $[active_target(sed_bin_target):%=$[st_dir]/%] - #define test_bin_targets $[active_target(test_bin_target):%=$[st_dir]/%.exe] + $[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] // And these variables will define the various things we need to // install. @@ -75,13 +75,12 @@ #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target static_lib_target ss_lib_target bin_target)] $[INSTALL_CONFIG]] #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target)]] - // Since we don't make a distinction in Windows between building for - // static or dynamic targets, let's eliminate so_sources and just - // use st_sources for simplicity. - #define st_sources $[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 $[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 $[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 $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_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)]] // 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 @@ -116,7 +115,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:%=%/$[st_dir]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[st_dir]],$[actual_local_libs]] +#defer complete_lpath $[static_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] // $[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. @@ -142,10 +141,10 @@ $[if $[install_igatedb],$[install_igatedb_dir]] \ ] -// Similarly, we need to ensure that $[st_dir] exists. Trying to make +// Similarly, we need to ensure that $[ODIR] exists. Trying to make // the makefiles do this automatically just causes problems with // multiprocess builds. -#mkdir $[st_dir] +#mkdir $[ODIR] // Pre-compiled headers are one way to speed the compilation of many // C++ source files that include similar headers, but it turns out a @@ -197,7 +196,10 @@ test : $[test_bin_targets] clean : #if $[st_sources] -$[TAB] rm -f $[st_dir]/* +$[TAB] rm -f $[patsubst %,$[%_obj],$[st_sources]] +#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] #endif $[TAB] rm -f *.pyc *.pyo // Also scrub out old generated Python code. @@ -205,7 +207,7 @@ $[TAB] rm -f *.pyc *.pyo // Also scrub out old generated Python code. // and building. It removes everything except the Makefile. cleanall : clean #if $[st_sources] -$[TAB] rm -rf $[st_dir] +$[TAB] rm -rf $[ODIR] #endif #if $[yxx_st_sources] $[lxx_st_sources] $[TAB] rm -f $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] @@ -245,7 +247,7 @@ $[TAB] rm -f $[igatemout] $[$[igatemout]_obj] $[INSTALL_CONFIG:%=$[install_config_dir]/%] #define installed_igate_files \ - $[get_igatedb(metalib_target lib_target ss_lib_target):$[st_dir]/%=$[install_igatedb_dir]/%] + $[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%] \ @@ -289,7 +291,7 @@ igate : $[get_igatedb(metalib_target lib_target ss_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 library? +// metalib. Is this one such a library? #define build_it $[eq $[module $[TARGET],$[TARGET]],] // We might need to define a BUILDING_ symbol for win32. We use the @@ -332,7 +334,7 @@ igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] #define varname $[subst -,_,lib$[TARGET]_so] $[varname] = $[sources] - #define target $[st_dir]/lib$[TARGET]$[dllext].$[dlllib] + #define target $[ODIR]/lib$[TARGET]$[dllext].$[dlllib] #define sources $($[varname]) #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%] #define mybasename $[basename $[notdir $[target]]] @@ -362,10 +364,10 @@ $[TAB] $[SHARED_LIB_C] #endif #if $[build_dlls] -$[st_dir]/lib$[TARGET]$[dllext].lib : $[st_dir]/lib$[TARGET]$[dllext].dll +$[ODIR]/lib$[TARGET]$[dllext].lib : $[ODIR]/lib$[TARGET]$[dllext].dll #endif #if $[build_pdbs] -$[st_dir]/lib$[TARGET]$[dllext].pdb : $[st_dir]/lib$[TARGET]$[dllext].dll +$[ODIR]/lib$[TARGET]$[dllext].pdb : $[ODIR]/lib$[TARGET]$[dllext].dll #endif #endif @@ -382,7 +384,7 @@ $[st_dir]/lib$[TARGET]$[dllext].pdb : $[st_dir]/lib$[TARGET]$[dllext].dll $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ $[INSTALL_DATA:%=$[install_data_dir]/%] \ $[INSTALL_CONFIG:%=$[install_config_dir]/%] \ - $[igatedb:$[st_dir]/%=$[install_igatedb_dir]/%] + $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] install-lib$[TARGET] : $[installed_files] @@ -392,22 +394,22 @@ $[TAB] rm -f $[sort $[installed_files]] #endif #if $[build_dlls] -$[install_lib_dir]/lib$[TARGET]$[dllext].dll : $[st_dir]/lib$[TARGET]$[dllext].dll +$[install_lib_dir]/lib$[TARGET]$[dllext].dll : $[ODIR]/lib$[TARGET]$[dllext].dll #define local lib$[TARGET]$[dllext].dll #define dest $[install_lib_dir] -$[TAB] cp -f $[st_dir]/$[local] $[dest] +$[TAB] cp -f $[ODIR]/$[local] $[dest] #endif -$[install_lib_dir]/lib$[TARGET]$[dllext].lib : $[st_dir]/lib$[TARGET]$[dllext].lib +$[install_lib_dir]/lib$[TARGET]$[dllext].lib : $[ODIR]/lib$[TARGET]$[dllext].lib #define local lib$[TARGET]$[dllext].lib #define dest $[install_lib_dir] -$[TAB] cp -f $[st_dir]/$[local] $[dest] +$[TAB] cp -f $[ODIR]/$[local] $[dest] #if $[and $[build_dlls],$[build_pdbs]] -$[install_lib_dir]/lib$[TARGET]$[dllext].pdb : $[st_dir]/lib$[TARGET]$[dllext].pdb +$[install_lib_dir]/lib$[TARGET]$[dllext].pdb : $[ODIR]/lib$[TARGET]$[dllext].pdb #define local lib$[TARGET]$[dllext].pdb #define dest $[install_lib_dir] -$[TAB] cp -f $[st_dir]/$[local] $[dest] +$[TAB] cp -f $[ODIR]/$[local] $[dest] #endif #if $[igatescan] @@ -423,7 +425,7 @@ $[TAB] cp -f $[st_dir]/$[local] $[dest] #define igatemod $[TARGET] #endif -$[igatedb:$[st_dir]/%=$[install_igatedb_dir]/%] : $[igatedb] +$[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] : $[igatedb] #define local $[igatedb] #define dest $[install_igatedb_dir] $[TAB] cp -f $[local] $[dest] @@ -472,7 +474,7 @@ $[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 $[st_dir]/lib$[TARGET]$[dllext].$[dlllib] +#define target $[ODIR]/lib$[TARGET]$[dllext].$[dlllib] #define sources $($[varname]) $[target] : $[sources] #if $[filter %.cxx %.yxx %.lxx,$[get_sources]] @@ -482,10 +484,10 @@ $[TAB] $[SHARED_LIB_C] #endif #if $[build_dlls] -$[st_dir]/lib$[TARGET]$[dllext].lib : $[st_dir]/lib$[TARGET]$[dllext].dll +$[ODIR]/lib$[TARGET]$[dllext].lib : $[ODIR]/lib$[TARGET]$[dllext].dll #endif #if $[build_pdbs] -$[st_dir]/lib$[TARGET]$[dllext].pdb : $[st_dir]/lib$[TARGET]$[dllext].dll +$[ODIR]/lib$[TARGET]$[dllext].pdb : $[ODIR]/lib$[TARGET]$[dllext].dll #endif #end noinst_lib_target @@ -501,7 +503,7 @@ $[st_dir]/lib$[TARGET]$[dllext].pdb : $[st_dir]/lib$[TARGET]$[dllext].dll #forscopes static_lib_target ss_lib_target #define varname $[subst -,_,lib$[TARGET]_a] $[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[st_dir]/lib$[TARGET]$[dllext].lib +#define target $[ODIR]/lib$[TARGET]$[dllext].lib #define sources $($[varname]) $[target] : $[sources] #if $[filter %.cxx %.yxx %.lxx,$[get_sources]] @@ -524,10 +526,10 @@ uninstall-lib$[TARGET] : $[TAB] rm -f $[sort $[installed_files]] #endif -$[install_lib_dir]/lib$[TARGET]$[dllext].lib : $[st_dir]/lib$[TARGET]$[dllext].lib +$[install_lib_dir]/lib$[TARGET]$[dllext].lib : $[ODIR]/lib$[TARGET]$[dllext].lib #define local lib$[TARGET]$[dllext].lib #define dest $[install_lib_dir] -$[TAB] cp -f $[st_dir]/$[local] $[dest] +$[TAB] cp -f $[ODIR]/$[local] $[dest] #end static_lib_target ss_lib_target @@ -540,9 +542,9 @@ $[TAB] cp -f $[st_dir]/$[local] $[dest] ///////////////////////////////////////////////////////////////////// #forscopes sed_bin_target -$[TARGET] : $[st_dir]/$[TARGET] +$[TARGET] : $[ODIR]/$[TARGET] -#define target $[st_dir]/$[TARGET] +#define target $[ODIR]/$[TARGET] #define source $[SOURCE] #define script $[COMMAND] $[target] : $[source] @@ -561,8 +563,8 @@ $[TAB] rm -f $[sort $[installed_files]] #define local $[TARGET] #define dest $[install_bin_dir] -$[install_bin_dir]/$[TARGET] : $[st_dir]/$[TARGET] -$[TAB] cp -f $[st_dir]/$[local] $[dest] +$[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET] +$[TAB] cp -f $[ODIR]/$[local] $[dest] #end sed_bin_target @@ -573,11 +575,11 @@ $[TAB] cp -f $[st_dir]/$[local] $[dest] ///////////////////////////////////////////////////////////////////// #forscopes bin_target -$[TARGET] : $[st_dir]/$[TARGET].exe +$[TARGET] : $[ODIR]/$[TARGET].exe #define varname $[subst -,_,bin_$[TARGET]] $[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[st_dir]/$[TARGET].exe +#define target $[ODIR]/$[TARGET].exe #define sources $($[varname]) #define ld $[get_ld] $[target] : $[sources] @@ -594,7 +596,7 @@ $[TAB] $[LINK_BIN_C] #endif #if $[build_pdbs] -$[st_dir]/$[TARGET].pdb : $[st_dir]/$[TARGET].exe +$[ODIR]/$[TARGET].pdb : $[ODIR]/$[TARGET].exe #endif #define installed_files \ @@ -612,16 +614,16 @@ uninstall-$[TARGET] : $[TAB] rm -f $[sort $[installed_files]] #endif -$[install_bin_dir]/$[TARGET].exe : $[st_dir]/$[TARGET].exe +$[install_bin_dir]/$[TARGET].exe : $[ODIR]/$[TARGET].exe #define local $[TARGET].exe #define dest $[install_bin_dir] -$[TAB] cp -f $[st_dir]/$[local] $[dest] +$[TAB] cp -f $[ODIR]/$[local] $[dest] #if $[build_pdbs] -$[install_bin_dir]/$[TARGET].pdb : $[st_dir]/$[TARGET].pdb +$[install_bin_dir]/$[TARGET].pdb : $[ODIR]/$[TARGET].pdb #define local $[TARGET].pdb #define dest $[install_bin_dir] -$[TAB] cp -f $[st_dir]/$[local] $[dest] +$[TAB] cp -f $[ODIR]/$[local] $[dest] #endif #end bin_target @@ -634,11 +636,11 @@ $[TAB] cp -f $[st_dir]/$[local] $[dest] ///////////////////////////////////////////////////////////////////// #forscopes noinst_bin_target test_bin_target -$[TARGET] : $[st_dir]/$[TARGET].exe +$[TARGET] : $[ODIR]/$[TARGET].exe #define varname $[subst -,_,bin_$[TARGET]] $[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[st_dir]/$[TARGET].exe +#define target $[ODIR]/$[TARGET].exe #define sources $($[varname]) $[target] : $[sources] #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]