diff --git a/dtool/pptempl/Depends.pp b/dtool/pptempl/Depends.pp index 6034614476..019b95567b 100644 --- a/dtool/pptempl/Depends.pp +++ b/dtool/pptempl/Depends.pp @@ -80,7 +80,7 @@ // Define what the object files are. #foreach file $[c_sources] $[cxx_sources] $[yxx_sources] $[lxx_sources] - #define $[file]_obj $[patsubst %.c %.cxx %.cpp %.yxx %.lxx,$[ODIR]/$[TARGET]_%$[OBJ],$[notdir $[file]]] + #define $[file]_obj $[patsubst %.c %.cxx %.cpp %.yxx %.lxx,$[ODIR]/$[obj_prefix]%$[OBJ],$[notdir $[file]]] #push 1 $[file]_obj #end file diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index d5ec4a923a..9204441b38 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -527,6 +527,15 @@ Warning: Variable $[upcase $[tree]]_INSTALL is not set! // platforms will leave this empty. #define dllext +// $[obj_prefix] defines the prefix that is prepended to the name of +// the object files. It can be used to avoid potential collisions +// when a source file is used by multiple targets but with different +// compile options for each. +// +// $[obj_prefix] may be redefined by one of the Global.platform.pp +// files. +#defer obj_prefix $[TARGET]_ + // Caution! interrogate_ipath might be redefined in the // Global.platform.pp file. #defer interrogate_ipath $[target_ipath:%=-I%]