diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index bece9141d2..a50326f37c 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -118,8 +118,8 @@ #endif #if $[and $[HAVE_MAYA],$[MAYA_LOCATION]] - #define maya_ipath -I$[MAYA_LOCATION]/include - #define maya_lpath -L$[MAYA_LOCATION]/lib + #define maya_ipath $[MAYA_LOCATION]/include + #define maya_lpath $[MAYA_LOCATION]/lib #define maya_ld $[MAYA_LOCATION]/bin/mayald #endif @@ -394,7 +394,7 @@ // This function returns the appropriate value for ld for the target. #defun get_ld #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[COMPONENT_LD]],] - mayald + $[maya_ld] #endif #end get_ld diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index 25b0562e92..39c403d39b 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -53,18 +53,45 @@ #define lxx_so_sources $[filter %.lxx,$[so_sources]] #define lxx_st_sources $[filter %.lxx,$[st_sources]] +// This map variable gets us all the various source files from all the +// targets in this directory. We need it to look up the context in +// which to build a particular source file, since some targets may +// have different requirements than other targets. #map all_sources get_sources(metalib_target lib_target noinst_lib_target static_lib_target bin_target noinst_bin_target test_bin_target) -#defer complete_local_libs $[sort $[closure all_libs,$[active_libs]]] +// We define $[complete_local_libs] as the full set of libraries (from +// within this tree) that we must link a particular target with. It +// is the transitive closure of our dependent libs: the libraries we +// depend on, plus the libraries *those* libraries depend on, and so +// on. +#defer complete_local_libs $[unique $[closure all_libs,$[active_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 +// each directory named in the $[complete_local_libs], above, plus +// whatever else the user might have explicitly named in +// $[LOCAL_INCS]. #defer complete_ipath $[all_libs $[RELDIR],$[complete_local_libs]] $[RELDIR($[LOCAL_INCS:%=%/])] -#defer file_ipath $[other_trees:%=%/include] $[TOPDIR] $[sort $[all_sources $[complete_ipath],$[file]]] $[all_sources $[get_ipath],$[file]] + +// $[target_ipath] is the proper ipath to put on the command line, +// from the context of a particular target. #defer target_ipath $[other_trees:%=%/include] $[TOPDIR] $[sort $[complete_ipath]] $[get_ipath] +// $[file_ipath] is the ipath from the context of a particular source +// file, given in $[file]. It uses the all_sources map to look up +// the target the source file belongs on, to get the proper context. +#defer file_ipath $[all_sources $[target_ipath],$[file]] + #defer cflags $[all_sources $[get_cflags] $[CFLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]] #defer c++flags $[all_sources $[get_cflags] $[C++FLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]] -#defer target_lpath $[other_trees:%=%/lib] $[sort $[static_libs $[RELDIR:%=%/$[st_dir]],$[complete_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[so_dir]],$[complete_local_libs]]] -#defer lpath $[target_lpath] $[get_lpath] +// $[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]],$[complete_local_libs]] $[dynamic_libs $[RELDIR:%=%/$[so_dir]],$[complete_local_libs]] + +// $[lpath] is like $[target_ipath]: it's the list of directories we +// should add to our -L list. +#defer lpath $[other_trees:%=%/lib] $[sort $[complete_lpath]] $[get_lpath] #defer libs $[unique $[complete_local_libs] $[patsubst %:m,,%:c %,%,$[OTHER_LIBS]] $[get_libs]] #output Makefile @@ -292,7 +319,7 @@ $[install_lib_dir]/lib$[TARGET].a : $[st_dir]/lib$[TARGET].a // be processed with sed to produce an executable script. Pretty // Unix-specific, so we'd better not have too many of these. $[st_dir]/$[TARGET] : $[SOURCE] - $[SED] $[COMMAND] $^ >$@ + $[SED] $[COMMAND] $[SOURCE] >$@ chmod +x $@ #define installed_files \ diff --git a/dtool/src/egg-build/Makefile.a2egg-static.rules b/dtool/src/egg-build/Makefile.a2egg-static.rules index 1930f52e6b..6397eac94a 100644 --- a/dtool/src/egg-build/Makefile.a2egg-static.rules +++ b/dtool/src/egg-build/Makefile.a2egg-static.rules @@ -4,7 +4,7 @@ # for things which are not characters but are modeled in Alias. # -include $(DTOOL)/inc/Makefile.inst-egg.vars +include $(DTOOL)/include/Makefile.inst-egg.vars ifeq ($(A2E),) A2E = a2egg diff --git a/dtool/src/egg-build/Makefile.a2egg.rules b/dtool/src/egg-build/Makefile.a2egg.rules index 1a4104a9aa..15a9ced883 100644 --- a/dtool/src/egg-build/Makefile.a2egg.rules +++ b/dtool/src/egg-build/Makefile.a2egg.rules @@ -51,5 +51,5 @@ A2C_RULE = $(UNOPT)$(CHAN_FILE_PREFIX)$(ANIM)$(CHAN_FILE_SUFFIX).egg : $(FIND_CH A2C = $(A2EGG_CHAN) -c $@ $(A2C_OPTS) -include $(DTOOL)/inc/Makefile.char-egg.rules +include $(DTOOL)/include/Makefile.char-egg.rules diff --git a/dtool/src/egg-build/Makefile.char-egg.rules b/dtool/src/egg-build/Makefile.char-egg.rules index ffc3b7fbfa..94a0747e50 100644 --- a/dtool/src/egg-build/Makefile.char-egg.rules +++ b/dtool/src/egg-build/Makefile.char-egg.rules @@ -3,7 +3,7 @@ # and then into pfb's. # -include $(DTOOL)/inc/Makefile.inst-egg.vars +include $(DTOOL)/include/Makefile.inst-egg.vars ifeq ($(EGG_PALETTIZE),) EGG_PALETTIZE = egg-palettize diff --git a/dtool/src/egg-build/Makefile.flt-egg.rules b/dtool/src/egg-build/Makefile.flt-egg.rules index 9148c23556..d4ed5847ed 100644 --- a/dtool/src/egg-build/Makefile.flt-egg.rules +++ b/dtool/src/egg-build/Makefile.flt-egg.rules @@ -4,7 +4,7 @@ # automatically resolve and convert referenced files. # -include $(DTOOL)/inc/Makefile.inst-egg.vars +include $(DTOOL)/include/Makefile.inst-egg.vars ifeq ($(RFLT2EGG),) RFLT2EGG = rflt2egg diff --git a/dtool/src/egg-build/Makefile.soft2egg.rules b/dtool/src/egg-build/Makefile.soft2egg.rules index 21b32a1e54..b0900591d9 100644 --- a/dtool/src/egg-build/Makefile.soft2egg.rules +++ b/dtool/src/egg-build/Makefile.soft2egg.rules @@ -60,6 +60,6 @@ MAKE_NURBS_MODEL = $(S2E) -s $(SOFT_MODEL) $(NURBS_OPTS) $(S2E_OPTS) MAKE_TX_MODEL = a2egg -nsk -m $@ $(MAKE_TX_OPTS) $(TX_WIRE_FILE) -include $(DTOOL)/inc/Makefile.char-egg.rules +include $(DTOOL)/include/Makefile.char-egg.rules diff --git a/dtool/src/egg-build/Makefile.source-egg.rules b/dtool/src/egg-build/Makefile.source-egg.rules index 4566ea4a54..b2081e0f22 100644 --- a/dtool/src/egg-build/Makefile.source-egg.rules +++ b/dtool/src/egg-build/Makefile.source-egg.rules @@ -3,7 +3,7 @@ # into pfb's. # -include $(DTOOL)/inc/Makefile.inst-egg.vars +include $(DTOOL)/include/Makefile.inst-egg.vars ifeq ($(EGG_RESTRUCTURE),) EGG_RESTRUCTURE = egg-restructure