update unix build

This commit is contained in:
David Rose 2002-06-05 23:29:23 +00:00
parent d278b08422
commit 692a1bcf28
4 changed files with 285 additions and 333 deletions

View File

@ -451,6 +451,12 @@
//#defer ODIR Opt$[OPTIMIZE]-$[PLATFORM]$[USE_COMPILER]
#defer ODIR Opt$[OPTIMIZE]-$[PLATFORM]
// What is the normal extension of a compiled object file?
#if $[WINDOWS_PLATFORM]
#define OBJ .obj
#else
#define OBJ .o
#endif
///////////////////////////////////////////////////////////////////////

View File

@ -70,7 +70,7 @@
// Define what the object files are.
#foreach file $[c_sources] $[cxx_sources] $[yxx_sources] $[lxx_sources]
#define $[file]_obj $[patsubst %.c %.cxx %.yxx %.lxx,$[ODIR]/$[TARGET]_%.obj,$[file]]
#define $[file]_obj $[patsubst %.c %.cxx %.yxx %.lxx,$[ODIR]/$[TARGET]_%$[OBJ],$[file]]
#push 1 $[file]_obj
#end file
@ -81,7 +81,7 @@
#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
#define $[composite_file]_obj $[ODIR]/$[TARGET]_composite$[OBJ]
#push 1 $[composite_file]_sources
#push 1 $[composite_file]_obj
#set cxx_sources $[composite_file]
@ -92,7 +92,7 @@
#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
#define $[composite_file]_obj $[ODIR]/$[TARGET]_composite_c$[OBJ]
#push 1 $[composite_file]_sources
#push 1 $[composite_file]_obj
#set c_sources $[composite_file]
@ -105,21 +105,21 @@
// 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,$[ODIR]/$[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]_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]_obj $[get_igatemout:%.cxx=%$[OBJ]]
#define $[generated_file]_sources none
#push 1 $[generated_file]_obj
#set cxx_sources $[cxx_sources] $[generated_file]

View File

@ -107,7 +107,7 @@
// $[target_ipath] is the proper ipath to put on the command line,
// from the context of a particular target.
#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%\include] $[get_ipath]
#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%/include] $[get_ipath]
// These are the complete set of extra flags the compiler requires.
#defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]]

View File

@ -1,11 +1,9 @@
//
//
// Template.unix.pp
//
// This file defines the set of output files that will be generated to
// support a generic Unix-style build system. It generates a number
// of shared libraries named libtarget.so for each lib_target, assumes
// object files are named file.o, and makes other Unix-like
// assumptions.
// support a generic Unix-style build system.
//
// Before this file is processed, the following files are read and
@ -20,29 +18,33 @@
// $DTOOL/pptempl/System.pp
// All of the Sources.pp files in the current source hierarchy
// $DTOOL/pptempl/Global.pp
// $DTOOL/pptempl/Global.unix.pp
// $DTOOL/pptempl/Global.gmsvc.pp
// $DTOOL/pptempl/Depends.pp, once for each Sources.pp file
// Template.unix.pp (this file), once for each Sources.pp file
// Template.gmsvc.pp (this file), once for each Sources.pp file
#if $[ne $[DTOOL],]
#define dtool_ver_dir_cyg $[DTOOL]/src/dtoolbase
#define dtool_ver_dir $[osfilename $[dtool_ver_dir_cyg]]
#endif
//////////////////////////////////////////////////////////////////////
#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib]]
//////////////////////////////////////////////////////////////////////
// For a source directory, build a single Makefile with rules to build
// each target.
#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.
#if $[build_directory]
#define lib_targets $[active_target(metalib_target lib_target ss_lib_target noinst_lib_target):%=$[so_dir]/lib%.so]
#define static_lib_targets $[active_target(static_lib_target):%=$[st_dir]/lib%.a]
#define bin_targets $[active_target(bin_target noinst_bin_target sed_bin_target):%=$[st_dir]/%]
#define test_bin_targets $[active_target(test_bin_target):%=$[st_dir]/%]
#define lib_targets $[active_target(metalib_target lib_target ss_lib_target noinst_lib_target):%=$[ODIR]/lib%.so]
#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]/%]
// And these variables will define the various things we need to
// install.
@ -55,52 +57,27 @@
#define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_CONFIG]]
#define install_igatedb $[sort $[get_igatedb(metalib_target lib_target ss_lib_target)]]
// $[so_sources] is the set of sources that belong on a shared object,
// and $[st_sources] is the set of sources that belong on a static
// object, like a static library or an executable. We make the
// distinction because some architectures require a special parameter
// to the compiler when we're compiling something to be put in a
// shared object (to make the code relocatable).
#define so_sources $[get_sources(metalib_target lib_target ss_lib_target noinst_lib_target)]
#define st_sources $[get_sources(static_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
// freshen the cache file.
#define dep_sources $[sort $[filter %.c %.cxx %.yxx %.lxx %.h %.I %.T,$[so_sources] $[st_sources]]]
#if $[eq $[so_dir],$[st_dir]]
// If the static and shared directories are the same, we have to use the
// same rules to build both shared and static targets.
#set st_sources $[so_sources] $[st_sources]
#set so_sources
#endif
#define dep_sources $[sort $[filter %.c %.cxx %.yxx %.lxx %.h %.I %.T,$[dep_sources_1]]]
#endif // $[build_directory]
// And these are the various source files, extracted out by type.
#define cxx_so_sources $[filter_out %_src.cxx,$[filter %.cxx,$[so_sources]]]
#define cxx_st_sources $[filter_out %_src.cxx,$[filter %.cxx,$[st_sources]]]
#define c_so_sources $[filter %.c,$[so_sources]]
#define c_st_sources $[filter %.c,$[st_sources]]
#define yxx_so_sources $[filter %.yxx,$[so_sources]]
#define yxx_st_sources $[filter %.yxx,$[st_sources]]
#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 (e.g. different local_libs, or
// different USE_this or USE_that) than other targets.
#map all_sources get_sources(metalib_target lib_target ss_lib_target noinst_lib_target static_lib_target bin_target noinst_bin_target test_bin_target)
// 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.
// depend on, plus the libraries *those* libraries depend on, and so on.
#defer complete_local_libs $[unique $[closure all_libs,$[active_libs]]]
#defer actual_local_libs $[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
@ -111,35 +88,66 @@
// $[target_ipath] is the proper ipath to put on the command line,
// from the context of a particular target.
#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%/include] $[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]]
// These are the complete set of extra flags the compiler requires,
// from the context of a particular file, given in $[file].
#defer cflags $[all_sources $[get_cflags] $[CFLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]] $[if $[>= $[OPTIMIZE],2],$[OPTFLAGS]]
#defer c++flags $[all_sources $[get_cflags] $[C++FLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]] $[if $[>= $[OPTIMIZE],2],$[OPTFLAGS]]
// These are the same flags, sans the compiler optimizations.
#defer noopt_c++flags $[all_sources $[get_cflags] $[C++FLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]]
// These are the complete set of extra flags the compiler requires.
#defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]]
#defer c++flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]]
// $[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]]
#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.
#defer lpath $[sort $[complete_lpath]] $[other_trees:%=%/lib] $[get_lpath]
// And $[libs] is the set of libraries we will link with.
#defer libs $[unique $[complete_local_libs] $[patsubst %:m,,%:c %,%,$[OTHER_LIBS]] $[get_libs]]
#defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]]
// This is the set of files we might copy into *.prebuilt, if we have
// bison and flex (or copy from *.prebuilt if we don't have them).
#define bison_prebuilt $[patsubst %.yxx,%.h,$[yxx_so_sources] $[yxx_st_sources]] $[patsubst %.yxx,%.cxx,$[yxx_so_sources] $[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_so_sources] $[lxx_st_sources]]
#define bison_prebuilt $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]]
// Rather than making a rule to generate each install directory later,
// we create the directories now. This reduces problems from
// multiprocess builds.
#mkdir $[sort \
$[if $[install_lib],$[install_lib_dir]] \
$[if $[install_bin] $[install_scripts],$[install_bin_dir]] \
$[if $[install_headers],$[install_headers_dir]] \
$[if $[install_parser_inc],$[install_parser_inc_dir]] \
$[if $[install_data],$[install_data_dir]] \
$[if $[install_config],$[install_config_dir]] \
$[if $[install_igatedb],$[install_igatedb_dir]] \
]
// Similarly, we need to ensure that $[ODIR] exists. Trying to make
// the makefiles do this automatically just causes problems with
// multiprocess builds.
#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
// more effective (and more portable) way is simply to compile all the
// similar source files in one pass.
// We do this by generating a *_composite.cxx file that has an
// #include line for each of several actual source files, and then we
// compile the composite file instead of the original files.
#foreach composite_file $[composite_list]
#output $[composite_file] notouch
#format collapse
/* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */
/* ################################# DO NOT EDIT ########################### */
#foreach file $[$[composite_file]_sources]
##include "$[file]"
#end file
#end $[composite_file]
#end composite_file
// Okay, we're ready. Start outputting the Makefile now.
#output Makefile
@ -147,58 +155,66 @@
#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE].
################################# DO NOT EDIT ###########################
// If we are using GNU make, this will automatically enable the
// multiprocessor build mode according to the value in
// NUMBER_OF_PROCESSORS, which should be set by NT. Maybe this isn't
// a good idea to do all the time, but you can always disable it by
// explicitly unsetting NUMBER_OF_PROCESSORS, or by setting it to 1.
#if $[NUMBER_OF_PROCESSORS]
MAKEFLAGS := -j$[NUMBER_OF_PROCESSORS]
#endif
// The 'all' rule makes all the stuff in the directory except for the
// test_bin_targets. It doesn't do any installation, however.
#define all_targets \
Makefile \
$[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \
$[if $[so_sources],$[so_dir]] \
$[if $[st_sources],$[st_dir]] \
$[sort $[lib_targets] $[static_lib_targets] $[bin_targets]] \
$[TARGET(special_target)]
$[deferred_objs]
all : $[all_targets]
// The 'test' rule makes all the test_bin_targets.
test : $[test_bin_targets]
// We implement 'clean' simply by removing the odirs, since all of our
// generated output ends up in one or the other of these. Effective.
// It does assume that the odirs are not '.', however.
clean :
#if $[so_sources]
$[TAB]rm -rf $[so_dir]
#endif
#if $[st_sources]
$[TAB]rm -rf $[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.
// 'cleanall' is not much more thorough than 'clean': At the moment,
// it also cleans up the bison and flex output, as well as the
// dependency cache file.
// 'cleanall' is intended to undo all the effects of running ppremake
// and building. It removes everything except the Makefile.
cleanall : clean
#if $[yxx_so_sources] $[yxx_st_sources] $[lxx_so_sources] $[lxx_st_sources]
$[TAB]rm -f $[patsubst %.yxx %.lxx,%.cxx,$[yxx_so_sources] $[yxx_st_sources] $[lxx_so_sources] $[lxx_st_sources]]
#if $[st_sources]
$[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]]
#endif
#if $[ne $[DEPENDENCY_CACHE_FILENAME],]
$[TAB] rm -f $[DEPENDENCY_CACHE_FILENAME]
#endif
#if $[composite_list]
$[TAB] rm -f $[composite_list]
#endif
clean-igate :
#forscopes metalib_target lib_target ss_lib_target
#define igatedb $[get_igatedb]
#define igateoutput $[get_igateoutput]
#define igatemscan $[components $[get_igatedb:%=$[RELDIR]/$[so_dir]/%],$[active_component_libs]]
#define igatemout $[if $[igatemscan],lib$[TARGET]_module.cxx]
#define igatemscan $[get_igatemscan]
#define igatemout $[get_igatemout]
#if $[igatedb]
$[TAB]rm -f $[so_dir]/$[igatedb]
$[TAB] rm -f $[igatedb]
#endif
#if $[igateoutput]
$[TAB]rm -f $[so_dir]/$[igateoutput] $[igateoutput:%.cxx=$[so_dir]/%.o]
$[TAB] rm -f $[igateoutput] $[$[igateoutput]_obj]
#endif
#if $[igatemout]
$[TAB]rm -f $[so_dir]/$[igatemout] $[igatemout:%.cxx=$[so_dir]/%.o]
$[TAB] rm -f $[igatemout] $[$[igatemout]_obj]
#endif
#end metalib_target lib_target ss_lib_target
@ -213,26 +229,18 @@ $[TAB]rm -f $[so_dir]/$[igatemout] $[igatemout:%.cxx=$[so_dir]/%.o]
$[INSTALL_CONFIG:%=$[install_config_dir]/%]
#define installed_igate_files \
$[get_igatedb(metalib_target lib_target ss_lib_target):%=$[install_igatedb_dir]/%]
$[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%]
#define install_targets \
$[sort \
$[if $[install_lib],$[install_lib_dir]] \
$[if $[install_bin] $[install_scripts],$[install_bin_dir]] \
$[if $[install_headers],$[install_headers_dir]] \
$[if $[install_parser_inc],$[install_parser_inc_dir]] \
$[if $[install_data],$[install_data_dir]] \
$[if $[install_config],$[install_config_dir]] \
$[if $[install_igatedb],$[install_igatedb_dir]] \
] \
$[active_target(metalib_target lib_target ss_lib_target static_lib_target):%=install-lib%] \
$[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=install-lib%] \
$[active_target(bin_target sed_bin_target):%=install-%] \
$[installed_files]
install : all $[install_targets]
install-igate : $[sort $[installed_igate_files]]
uninstall : $[TARGET(metalib_target lib_target ss_lib_target static_lib_target):%=uninstall-lib%] $[TARGET(bin_target):%=uninstall-%]
uninstall : $[active_target(metalib_target lib_target static_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%]
#if $[installed_files]
$[TAB] rm -f $[sort $[installed_files]]
#endif
@ -245,41 +253,15 @@ $[TAB]rm -f $[sort $[installed_igate_files]]
#if $[HAVE_BISON]
prebuild-bison : $[patsubst %,%.prebuilt,$[bison_prebuilt]]
clean-prebuild-bison :
#if $[bison_prebuilt]
$[TAB] rm -f $[sort $[patsubst %,%.prebuilt,$[bison_prebuilt]]]
#endif
// We need a rule for each directory we might need to make. This
// loops through the full set of directories and creates a rule to
// make each one, as needed.
#foreach directory $[sort \
$[if $[so_sources],$[so_dir]] \
$[if $[st_sources],$[st_dir]] \
$[if $[install_lib],$[install_lib_dir]] \
$[if $[install_bin] $[install_scripts],$[install_bin_dir]] \
$[if $[install_headers],$[install_headers_dir]] \
$[if $[install_parser_inc],$[install_parser_inc_dir]] \
$[if $[install_data],$[install_data_dir]] \
$[if $[install_config],$[install_config_dir]] \
$[if $[install_igatedb],$[install_igatedb_dir]] \
]
$[directory] :
$[TAB]@test -d $[directory] || echo mkdir -p $[directory]
$[TAB]@test -d $[directory] || mkdir -p $[directory]
#end directory
#endif
// Now it's time to start generating the rules to make our actual
// targets.
// Determine which files will be generated during the interrogate
// pass, and make a special "igate" rule to generate all of them.
#define build_igate
#forscopes metalib_target lib_target ss_lib_target
#define igatemscan $[components $[get_igatedb],$[active_component_libs]]
#define igatemout $[if $[igatemscan],lib$[TARGET]_module.cxx]
#set build_igate $[build_igate] $[get_igatedb:%=$[so_dir]/%] $[igatemout:%=$[so_dir]/%]
#end metalib_target lib_target ss_lib_target
igate : $[sort $[build_igate]]
igate : $[get_igatedb(metalib_target lib_target ss_lib_target)]
/////////////////////////////////////////////////////////////////////
@ -287,7 +269,13 @@ igate : $[sort $[build_igate]]
// is a dynamic library.
/////////////////////////////////////////////////////////////////////
#forscopes metalib_target lib_target ss_lib_target
#forscopes metalib_target lib_target
// In Unix, we always build all the libraries, unlike Windows.
#define build_it 1
// We don't need a BUILDING_ symbol for Unix; that's a Windows thing.
#define building_var
// $[igatescan] is the set of C++ headers and source files that we
// need to scan for interrogate. $[igateoutput] is the name of the
@ -310,15 +298,22 @@ igate : $[sort $[build_igate]]
// component libraries. If it is nonempty, then we do need to
// generate a module, and $[igatemout] is the name of the .cxx file
// that interrogate will produce to make this module.
#define igatemscan $[components $[get_igatedb:%=$[RELDIR]/$[so_dir]/%],$[active_component_libs]]
#define igatemout $[if $[igatemscan],lib$[TARGET]_module.cxx]
#define igatemscan $[get_igatemscan]
#define igatemout $[get_igatemout]
#if $[build_it]
// Now output the rule to actually link the library from all of its
// various .o files.
// various .obj files.
#define sources \
$[patsubst %,$[%_obj],$[compile_sources]] \
$[components $[patsubst %,$[RELDIR]/$[%_obj],$[compile_sources]],$[active_component_libs]]
#define varname $[subst -,_,lib$[TARGET]_so]
$[varname] = $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[so_dir]/%.o,%,,$[get_sources] $[igateoutput] $[igatemout]]]
#define target $[so_dir]/lib$[TARGET].so
$[varname] = $[sources]
#define target $[ODIR]/lib$[TARGET].so
#define sources $($[varname])
$[target] : $[sources]
#if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
$[TAB] $[SHARED_LIB_C++]
@ -326,6 +321,8 @@ $[TAB]$[SHARED_LIB_C++]
$[TAB] $[SHARED_LIB_C]
#endif
#endif
// Here are the rules to install and uninstall the library and
// everything that goes along with it.
#define installed_files \
@ -334,7 +331,7 @@ $[TAB]$[SHARED_LIB_C]
$[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
$[INSTALL_DATA:%=$[install_data_dir]/%] \
$[INSTALL_CONFIG:%=$[install_config_dir]/%] \
$[igatedb:%=$[install_igatedb_dir]/%]
$[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%]
install-lib$[TARGET] : $[installed_files]
@ -343,10 +340,10 @@ uninstall-lib$[TARGET] :
$[TAB] rm -f $[sort $[installed_files]]
#endif
$[install_lib_dir]/lib$[TARGET].so : $[so_dir]/lib$[TARGET].so
$[install_lib_dir]/lib$[TARGET].so : $[ODIR]/lib$[TARGET].so
#define local lib$[TARGET].so
#define dest $[install_lib_dir]
$[TAB]cd ./$[so_dir] && $[INSTALL_PROG]
$[TAB] cp -f $[ODIR]/$[local] $[dest]
#if $[igatescan]
// Now, some additional rules to generate and compile the interrogate
@ -361,26 +358,21 @@ $[TAB]cd ./$[so_dir] && $[INSTALL_PROG]
#define igatemod $[TARGET]
#endif
$[install_igatedb_dir]/$[igatedb] : $[so_dir]/$[igatedb]
$[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] : $[igatedb]
#define local $[igatedb]
#define dest $[install_igatedb_dir]
$[TAB]cd ./$[so_dir] && $[INSTALL]
$[TAB] cp -f $[local] $[dest]
// We have to split this out as a separate rule to properly support
// parallel make.
$[so_dir]/$[igatedb] : $[so_dir]/$[igateoutput]
$[igatedb] : $[igateoutput]
lib$[TARGET]_igatescan = $[igatescan]
$[so_dir]/$[igateoutput] : $[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]
$[TAB]$[INTERROGATE] -od $[so_dir]/$[igatedb] -oc $[so_dir]/$[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
$[igateoutput] : $[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]
$[TAB] $[INTERROGATE] -od $[igatedb] -oc $[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $(lib$[TARGET]_igatescan)
#endif // igatescan
#define target $[igateoutput:%.cxx=$[so_dir]/%.o]
#define source $[so_dir]/$[igateoutput]
#define ipath . $[target_ipath]
#define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[if $[>= $[OPTIMIZE],2],$[OPTFLAGS]] $[CFLAGS_SHARED]
$[target] : $[source]
$[TAB]$[COMPILE_C++]
#endif // $[igatescan]
#if $[igatemout]
// And finally, some additional rules to build the interrogate module
@ -391,20 +383,15 @@ $[TAB]$[COMPILE_C++]
#define igatemod $[TARGET]
lib$[TARGET]_igatemscan = $[igatemscan]
#define target $[so_dir]/$[igatemout]
#define target $[igatemout]
#define sources $(lib$[TARGET]_igatemscan)
$[target] : $[sources]
$[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] $[sources]
#define target $[igatemout:%.cxx=$[so_dir]/%.o]
#define source $[so_dir]/$[igatemout]
#define ipath . $[target_ipath]
#define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[if $[>= $[OPTIMIZE],2],$[OPTFLAGS]] $[CFLAGS_SHARED]
$[target] : $[source]
$[TAB]$[COMPILE_C++]
#endif // $[igatescan]
#endif // igatemout
#end metalib_target lib_target ss_lib_target
#end metalib_target lib_target
@ -419,8 +406,8 @@ $[TAB]$[COMPILE_C++]
#forscopes noinst_lib_target
#define varname $[subst -,_,lib$[TARGET]_so]
$[varname] = $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[so_dir]/%.o,%,,$[get_sources]]]
#define target $[so_dir]/lib$[TARGET].so
$[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
#define target $[ODIR]/lib$[TARGET].so
#define sources $($[varname])
$[target] : $[sources]
#if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
@ -439,10 +426,10 @@ $[TAB]$[SHARED_LIB_C]
// a metalib, making the rules relatively simple.
/////////////////////////////////////////////////////////////////////
#forscopes static_lib_target
#forscopes static_lib_target ss_lib_target
#define varname $[subst -,_,lib$[TARGET]_a]
$[varname] = $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[st_dir]/%.o,%,,$[get_sources]]]
#define target $[st_dir]/lib$[TARGET].a
$[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
#define target $[ODIR]/lib$[TARGET]$[dllext].a
#define sources $($[varname])
$[target] : $[sources]
#if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
@ -450,12 +437,9 @@ $[TAB]$[STATIC_LIB_C++]
#else
$[TAB] $[STATIC_LIB_C]
#endif
#if $[RANLIB]
$[TAB]$[RANLIB]
#endif
#define installed_files \
$[install_lib_dir]/lib$[TARGET].a \
$[install_lib_dir]/lib$[TARGET]$[dllext].a \
$[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \
$[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
$[INSTALL_DATA:%=$[install_data_dir]/%] \
@ -468,12 +452,12 @@ uninstall-lib$[TARGET] :
$[TAB] rm -f $[sort $[installed_files]]
#endif
$[install_lib_dir]/lib$[TARGET].a : $[st_dir]/lib$[TARGET].a
#define local lib$[TARGET].a
$[install_lib_dir]/lib$[TARGET]$[dllext].a : $[ODIR]/lib$[TARGET]$[dllext].a
#define local lib$[TARGET]$[dllext].a
#define dest $[install_lib_dir]
$[TAB]cd ./$[st_dir] && $[INSTALL]
$[TAB] cp -f $[ODIR]/$[local] $[dest]
#end static_lib_target
#end static_lib_target ss_lib_target
@ -484,9 +468,9 @@ $[TAB]cd ./$[st_dir] && $[INSTALL]
/////////////////////////////////////////////////////////////////////
#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]
@ -503,10 +487,10 @@ uninstall-$[TARGET] :
$[TAB] rm -f $[sort $[installed_files]]
#endif
$[install_bin_dir]/$[TARGET] : $[st_dir]/$[TARGET]
#define local $[TARGET]
#define dest $[install_bin_dir]
$[TAB]cd ./$[st_dir] && $[INSTALL_PROG]
$[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET]
$[TAB] cp -f $[ODIR]/$[local] $[dest]
#end sed_bin_target
@ -517,17 +501,17 @@ $[TAB]cd ./$[st_dir] && $[INSTALL_PROG]
/////////////////////////////////////////////////////////////////////
#forscopes bin_target
$[TARGET] : $[st_dir]/$[TARGET]
$[TARGET] : $[ODIR]/$[TARGET]
#define varname $[subst -,_,bin_$[TARGET]]
$[varname] = $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[st_dir]/%.o,%,,$[get_sources]]]
#define target $[st_dir]/$[TARGET]
$[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
#define target $[ODIR]/$[TARGET]
#define sources $($[varname])
#define ld $[get_ld]
$[target] : $[sources]
#if $[ld]
// If there's a custom linker defined for the target, we have to use it.
$[TAB]$[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]$[TAB]
$[TAB] $[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]
#else
// Otherwise, we can use the normal linker.
#if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
@ -551,10 +535,10 @@ uninstall-$[TARGET] :
$[TAB] rm -f $[sort $[installed_files]]
#endif
$[install_bin_dir]/$[TARGET] : $[st_dir]/$[TARGET]
$[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET]
#define local $[TARGET]
#define dest $[install_bin_dir]
$[TAB]cd ./$[st_dir] && $[INSTALL_PROG]
$[TAB] cp -f $[ODIR]/$[local] $[dest]
#end bin_target
@ -566,11 +550,11 @@ $[TAB]cd ./$[st_dir] && $[INSTALL_PROG]
/////////////////////////////////////////////////////////////////////
#forscopes noinst_bin_target test_bin_target
$[TARGET] : $[st_dir]/$[TARGET]
$[TARGET] : $[ODIR]/$[TARGET]
#define varname $[subst -,_,bin_$[TARGET]]
$[varname] = $[unique $[patsubst %_src.cxx,,%.cxx %.c %.yxx %.lxx,$[st_dir]/%.o,%,,$[get_sources]]]
#define target $[st_dir]/$[TARGET]
$[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
#define target $[ODIR]/$[TARGET]
#define sources $($[varname])
$[target] : $[sources]
#if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
@ -583,132 +567,102 @@ $[TAB]$[LINK_BIN_C]
/////////////////////////////////////////////////////////////////////
// Finally, we put in the rules to compile each source file into a .o
// file.
// Rules to run bison and/or flex as needed.
/////////////////////////////////////////////////////////////////////
// Rules to generate a C++ file from a Bison input file.
#foreach file $[sort $[yxx_so_sources] $[yxx_st_sources]]
#foreach file $[sort $[yxx_st_sources]]
#define target $[patsubst %.yxx,%.cxx,$[file]]
#define target_header $[patsubst %.yxx,%.h,$[file]]
#define target_prebuilt $[target].prebuilt
#define target_header_prebuilt $[target_header].prebuilt
#if $[HAVE_BISON]
#define source $[file]
$[target] : $[source]
$[TAB]$[BISON] -y $[YFLAGS] $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[source]
$[target] : $[file]
$[TAB] $[BISON] $[YFLAGS] -y $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[file]
$[TAB] mv y.tab.c $[target]
$[TAB] mv y.tab.h $[target_header]
$[target_header] : $[target]
$[target].prebuilt : $[target]
$[TAB]cp $[target] $[target].prebuilt
$[target_header].prebuilt : $[target_header]
$[TAB]cp $[target_header] $[target_header].prebuilt
$[target_prebuilt] : $[target]
$[TAB] cp $[target] $[target_prebuilt]
$[target_header_prebuilt] : $[target_header]
$[TAB] cp $[target_header] $[target_header_prebuilt]
#else // HAVE_BISON
#define source $[target].prebuilt
$[target] : $[source]
$[TAB]cp $[source] $[target]
#define source $[target_header].prebuilt
$[target_header] : $[source]
$[TAB]cp $[source] $[target_header]
$[target] : $[target_prebuilt]
$[TAB] cp $[target_prebuilt] $[target]
$[target_header] : $[target_header_prebuilt]
$[TAB] cp $[target_header_prebuilt] $[target_header]
#endif // HAVE_BISON
#end file
// Rules to generate a C++ file from a Flex input file.
#foreach file $[sort $[lxx_so_sources] $[lxx_st_sources]]
#foreach file $[sort $[lxx_st_sources]]
#define target $[patsubst %.lxx,%.cxx,$[file]]
#define target_prebuilt $[target].prebuilt
#if $[HAVE_BISON]
#define source $[file]
$[target] : $[source]
$[TAB]$[FLEX] $[LFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[source]
$[target] : $[file]
$[TAB] $[FLEX] $[LFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[file]
#define source lex.yy.c
#define script /#include <unistd.h>/d
$[TAB] $[SED]
$[TAB]rm $[source]
$[target].prebuilt : $[target]
$[TAB]cp $[target] $[target].prebuilt
$[TAB] rm lex.yy.c
$[target_prebuilt] : $[target]
$[TAB] cp $[target] $[target_prebuilt]
#else // HAVE_BISON
#define source $[target].prebuilt
$[target] : $[source]
$[TAB]cp $[source] $[target]
$[target] : $[target_prebuilt]
$[TAB] cp $[target_prebuilt] $[target]
#endif // HAVE_BISON
#end file
// Rules to compile ordinary C files that appear on a shared library.
#foreach file $[sort $[c_so_sources]]
#define target $[patsubst %.c,$[so_dir]/%.o,$[file]]
#define source $[file]
#define ipath $[file_ipath]
#define flags $[cflags] $[CFLAGS_SHARED]
$[target] : $[source] $[dependencies $[source]]
$[TAB]$[COMPILE_C]
/////////////////////////////////////////////////////////////////////
// Finally, we put in the rules to compile each source file into a .obj
// file.
/////////////////////////////////////////////////////////////////////
#end file
#forscopes metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target
// Rules to compile ordinary C files that appear on a static library
// or in an executable.
#foreach file $[sort $[c_st_sources]]
#define target $[patsubst %.c,$[st_dir]/%.o,$[file]]
// Rules to compile ordinary C files.
#foreach file $[sort $[c_sources]]
#define target $[$[file]_obj]
#define source $[file]
#define ipath $[file_ipath]
#define ipath $[target_ipath]
#define flags $[cflags]
$[target] : $[source] $[dependencies $[source]]
#if $[ne $[file], $[notdir $file]]
// If the source file is not in the current directory, tack on "."
// to front of the ipath.
#set ipath . $[ipath]
#endif
$[target] : $[source] $[get_depends $[source]]
$[TAB] $[COMPILE_C]
#end file
// Rules to compile C++ files that appear on a shared library.
#foreach file $[sort $[cxx_so_sources]]
#define target $[patsubst %.cxx,$[so_dir]/%.o,$[file]]
#define source $[file]
#define ipath $[file_ipath]
#define flags $[c++flags] $[CFLAGS_SHARED]
// Yacc must run before some files can be compiled, so all files
// depend on yacc having run.
$[target] : $[source] $[dependencies $[file]] $[yxx_so_sources:%.yxx=%.h]
$[TAB]$[COMPILE_C++]
// Rules to compile C++ files.
#end file
// Rules to compile C++ files that appear on a static library or in an
// executable.
#foreach file $[sort $[cxx_st_sources]]
#define target $[patsubst %.cxx,$[st_dir]/%.o,$[file]]
#foreach file $[sort $[cxx_sources]]
#define target $[$[file]_obj]
#define source $[file]
#define ipath $[file_ipath]
#define ipath $[target_ipath]
#define flags $[c++flags]
$[target] : $[source] $[dependencies $[file]] $[yxx_st_sources:%.yxx=%.h]
$[TAB]$[COMPILE_C++]
#if $[ne $[file], $[notdir $file]]
// If the source file is not in the current directory, tack on "."
// to front of the ipath.
#set ipath . $[ipath]
#endif
#end file
// Rules to compile generated C++ files that appear on a shared library.
#foreach file $[sort $[yxx_so_sources] $[lxx_so_sources]]
#define target $[patsubst %.lxx %.yxx,$[so_dir]/%.o,$[file]]
#define source $[patsubst %.lxx %.yxx,%.cxx,$[file]]
#define ipath $[file_ipath]
#define flags $[noopt_c++flags] $[CFLAGS_SHARED]
// Yacc must run before some files can be compiled, so all files
// depend on yacc having run.
$[target] : $[source] $[dependencies $[file]] $[yxx_so_sources:%.yxx=%.h]
$[target] : $[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h]
$[TAB] $[COMPILE_C++]
#end file
// Rules to compile generated C++ files that appear on a static
// library or in an executable.
#foreach file $[sort $[yxx_st_sources] $[lxx_st_sources]]
#define target $[patsubst %.lxx %.yxx,$[st_dir]/%.o,$[file]]
#define source $[patsubst %.lxx %.yxx,%.cxx,$[file]]
#define ipath $[file_ipath]
#define flags $[noopt_c++flags]
$[target] : $[source] $[dependencies $[file]] $[yxx_st_sources:%.yxx=%.h]
$[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
// And now the rules to install the auxiliary files, like headers and
// data files.
@ -716,35 +670,35 @@ $[TAB]$[COMPILE_C++]
$[install_bin_dir]/$[file] : $[file]
#define local $[file]
#define dest $[install_bin_dir]
$[TAB]$[INSTALL_PROG]
$[TAB] cp -f $[local] $[dest]
#end file
#foreach file $[install_headers]
$[install_headers_dir]/$[file] : $[file]
#define local $[file]
#define dest $[install_headers_dir]
$[TAB]$[INSTALL]
$[TAB] cp -f $[local] $[dest]
#end file
#foreach file $[install_parser_inc]
$[install_parser_inc_dir]/$[file] : $[file]
#define local $[file]
#define dest $[install_parser_inc_dir]
$[TAB]$[INSTALL]
$[TAB] cp -f $[local] $[dest]
#end file
#foreach file $[install_data]
$[install_data_dir]/$[file] : $[file]
#define local $[file]
#define dest $[install_data_dir]
$[TAB]$[INSTALL]
$[TAB] cp -f $[local] $[dest]
#end file
#foreach file $[install_config]
$[install_config_dir]/$[file] : $[file]
#define local $[file]
#define dest $[install_config_dir]
$[TAB]$[INSTALL]
$[TAB] cp -f $[local] $[dest]
#end file
// Finally, all the special targets. These are commands that just need
@ -765,10 +719,8 @@ $[DEPENDENCY_CACHE_FILENAME] : $[dep_sources]
$[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME]
#endif
#end Makefile
//////////////////////////////////////////////////////////////////////
#elif $[eq $[DIR_TYPE], group]
//////////////////////////////////////////////////////////////////////
@ -825,11 +777,6 @@ prebuild-bison : $[subdirs:%=prebuild-bison-%]
clean-prebuild-bison : $[subdirs:%=clean-prebuild-bison-%]
#endif
// Somehow, something in the cttools confuses some shells, so that
// when we are attached, 'cd foo' doesn't work, but 'cd ./foo' does.
// Weird. We get around this by putting a ./ in front of each cd
// target below.
#formap dirname subdirs
#define depends
$[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]
@ -898,7 +845,7 @@ $[TAB]@test -d $[install_headers_dir] || mkdir -p $[install_headers_dir]
$[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER]
#define local $[CONFIG_HEADER]
#define dest $[install_headers_dir]
$[TAB]$[INSTALL]
$[TAB] cp -f $[local] $[dest]
#endif
#end Makefile
@ -910,7 +857,6 @@ $[TAB]$[INSTALL]
#sinclude $[TOPDIRPREFIX]LocalSetup.pp
//////////////////////////////////////////////////////////////////////
#elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]]
//////////////////////////////////////////////////////////////////////