/* Set the default PRIMARY_TARGET (WEPS) directory structure here */

#if [matches tstpmat [command-line-goals]]
	PRIMARY_TARGET = tstpmat;		/* Primary target of build (tstpmat) */
#elif [matches tstpmat_debug [command-line-goals]]
	PRIMARY_TARGET = tstpmat;		/* Primary target of build (tstpmat_debug) */
#elif [matches tstasd [command-line-goals]]
	PRIMARY_TARGET = tstasd;		/* Primary target of build (tstasd) */
#elif [matches tstasd_debug [command-line-goals]]
	PRIMARY_TARGET = tstasd;		/* Primary target of build (tstasd_debug) */
#elif [matches tstsoil [command-line-goals]]
	PRIMARY_TARGET = tstsoil;		/* Primary target of build (tstsoil) */
#elif [matches tstsoil_debug [command-line-goals]]
	PRIMARY_TARGET = tstsoil;		/* Primary target of build (tstsoil_debug) */
#elif [matches tsterode [command-line-goals]]
	PRIMARY_TARGET = tsterode;		/* Primary target of build (tsterode) */
#elif [matches tsterode_debug [command-line-goals]]
	PRIMARY_TARGET = tsterode;		/* Primary target of build (tsterode_debug) */
#elif [matches season [command-line-goals]]
	PRIMARY_TARGET = season;		/* Primary target of build (season) */
#elif [matches season_debug [command-line-goals]]
	PRIMARY_TARGET = season;		/* Primary target of build (season_debug) */
#elif [matches tsthydro [command-line-goals]]
	PRIMARY_TARGET = tsthydro;		/* Primary target of build (tsthydro) */
#elif [matches tstinternode [command-line-goals]]
	PRIMARY_TARGET = tstinternode;		/* Primary target of build (tstinternode) */
#elif [matches tstinternode_debug [command-line-goals]]
	PRIMARY_TARGET = tstinternode;		/* Primary target of build (tstinternode_debug) */
#elif [matches tstsax1 [command-line-goals]]
	PRIMARY_TARGET = tstsax1;		/* Primary target of build (tstsax1) */
#elif [matches tstsax2 [command-line-goals]]
	PRIMARY_TARGET = tstsax2;		/* Primary target of build (tstsax2) */
#elif [matches tstsax3 [command-line-goals]]
	PRIMARY_TARGET = tstsax3;		/* Primary target of build (tstsax3) */
#elif [matches tstsax4 [command-line-goals]]
	PRIMARY_TARGET = tstsax4;		/* Primary target of build (tstsax4) */
#elif [matches tstsax_simple [command-line-goals]]
	PRIMARY_TARGET = tstsax_simple;		/* Primary target of build (tstsax_simple) */
#elif [matches tstsax_count [command-line-goals]]
	PRIMARY_TARGET = tstsax_count;		/* Primary target of build (tstsax_count) */
#elif [matches tstsax_features [command-line-goals]]
	PRIMARY_TARGET = tstsax_features;		/* Primary target of build (tstsax_features) */
#elif [matches tstsax_pseudo [command-line-goals]]
	PRIMARY_TARGET = tstsax_pseudo;		/* Primary target of build (tstsax_pseudo) */
#elif [matches tstsax_xmlcheck [command-line-goals]]
	PRIMARY_TARGET = tstsax_xmlcheck;		/* Primary target of build (tstsax_xmlcheck) */
#elif [matches tstsax_cropxml [command-line-goals]]
	PRIMARY_TARGET = tstsax_cropxml;		/* Primary target of build (tstsax_cropxml) */
#elif [matches test_crop [command-line-goals]]
	PRIMARY_TARGET = test_crop;		/* Primary target of build (test_crop) */
#elif [matches test_crop_debug [command-line-goals]]
	PRIMARY_TARGET = test_crop;		/* Primary target of build (test_crop_debug) */
#elif [matches test_crop_src.zip [command-line-goals]]
	PRIMARY_TARGET = test_crop_src.zip;	/* Primary target of build (test_crop_src.zip) */
#elif [matches tsterode_src.zip [command-line-goals]]
	PRIMARY_TARGET = tsterode_src.zip;	/* Primary target of build (tsterode_src.zip) */
#elif [matches weps_src.zip [command-line-goals]]
	PRIMARY_TARGET = weps_src.zip;		/* Primary target of build (weps_src.zip) */
#elif [matches weps_driver [command-line-goals]]
        PRIMARY_TARGET = weps_driver;           /* Primary target of build (weps_driver) */
#elif [matches weps_driver_debug [command-line-goals]]
        PRIMARY_TARGET = weps_driver_debug;	/* Primary target of build (weps_driver_debug) */
#else
	PRIMARY_TARGET = weps;			/* Primary target of build (weps) */
#endif

#ifndef TARGET_BIN
	TARGET_BIN = bin;	/* Primary target (weps) default "bin" (relative) path/name */
#endif

#ifndef TARGET_INC
	TARGET_INC = inc;	/* Primary target (weps) default include (relative) path */
#endif

#ifndef TARGET_MOD
	TARGET_MOD = mod;	/* Primary target (weps) default module (relative) path */
#endif

BIN = [TARGET_BIN];
INC = [TARGET_INC];
MOD = [TARGET_MOD];

/* check if any commandline macros have been defined */
#ifndef OPT
	OPT = 0;
#endif
#ifndef DEBUG
	DEBUG = 0;
#endif
#ifndef RELEASE
	RELEASE = 0;
#endif

/*
Note: No suffixes in dir names are currently allowed, ie:
      (dir1.src and dir2/dir1.abc not allowed)
Note: Directory names currently must be unique, ie:
      (both dir1 and dir2/dir1 not allowed)
*/

#include "cookbook/compiler.weps" /* determine host/compiler */

tsterode_src_dirs = erosion erosion/test util/date util/misc;
test_crop_src_dirs = crop/test_crop util/date util/math util/misc util/solar util/strings util/sax crop mproc;

weps_driver_src_dirs = airpact airpact/weps_driver util/date util/misc main manage erosion soil hydro manage crop;
weps_driver_src_dirs += decomp asd wepp mproc util/odepack util/solar reports util/confidence util/math util/minpack util/normal;

/* list all PRIMARY_TARGET src directories */
#if [matches tstpmat [command-line-goals]]
	src_dirs = util/math;
#elif [matches tstpmat_debug [command-line-goals]]
	src_dirs = util/math;
#elif [matches tstasd [command-line-goals]]
	src_dirs = asd/test asd util/math;
#elif [matches tstasd_debug [command-line-goals]]
	src_dirs = asd/test asd util/math;
#elif [matches tstsoil [command-line-goals]]
    src_dirs = soil/test soil asd util/date util/misc;
#elif [matches tstsoil_debug [command-line-goals]]
    src_dirs = soil/test soil asd util/date util/misc;
#elif [matches tsterode [command-line-goals]]
	src_dirs = [tsterode_src_dirs];
#elif [matches tsthydro [command-line-goals]]
	src_dirs = hydro crop util/odepack util/date util/misc util/solar main;
#elif [matches tstinternode [command-line-goals]]
	src_dirs = ;
#elif [matches tstinternode_debug [command-line-goals]]
	src_dirs = ;
#elif [matches season [command-line-goals]]
	src_dirs = crop/test crop util/date util/misc util/solar;
    src_dirs += manage;
#elif [matches season_debug [command-line-goals]]
	src_dirs = crop/test crop util/date util/misc util/solar;
    src_dirs += manage;
#elif [matches tstsax1 [command-line-goals]]
	src_dirs = util/sax/tstsax1 util/strings util/sax;
#elif [matches tstsax2 [command-line-goals]]
	src_dirs = util/sax/tstsax2 util/strings util/sax;
#elif [matches tstsax3 [command-line-goals]]
	src_dirs = util/sax/tstsax3 util/strings util/sax;
#elif [matches tstsax4 [command-line-goals]]
	src_dirs = util/sax/tstsax4 util/strings util/sax;
#elif [matches tstsax_simple [command-line-goals]]
	src_dirs = util/sax/tstsax_simple util/strings util/sax;
#elif [matches tstsax_count [command-line-goals]]
	src_dirs = util/sax/tstsax_count util/strings util/sax;
#elif [matches tstsax_features [command-line-goals]]
	src_dirs = util/sax/tstsax_features util/strings util/sax;
#elif [matches tstsax_pseudo [command-line-goals]]
	src_dirs = util/sax/tstsax_pseudo util/strings util/sax;
#elif [matches tstsax_xmlcheck [command-line-goals]]
	src_dirs = util/sax/tstsax_xmlcheck util/strings util/sax;
#elif [matches tstsax_cropxml [command-line-goals]]
	src_dirs = util/sax/tstsax_cropxml util/strings util/sax;
#elif [matches test_crop [command-line-goals]]
	src_dirs = [test_crop_src_dirs];
#elif [matches test_crop_debug [command-line-goals]]
	src_dirs = [test_crop_src_dirs];
#elif [matches weps_driver [command-line-goals]]
        src_dirs = [weps_driver_src_dirs];
#elif [matches weps_driver_debug [command-line-goals]]
        src_dirs = [weps_driver_src_dirs];
#else /* weps */
	src_dirs = crop decomp hydro main manage mproc soil erosion wepp;
	src_dirs += asd util/date util/math util/misc util/odepack util/solar;
	/* src_dirs += util/strings util/sax; */
	src_dirs += reports;
	src_dirs += util/confidence util/minpack util/normal;
#endif


UNIX_SYS = [shell uname -s]; setenv UNIX_SYS = [UNIX_SYS];
#if [in [UNIX_SYS]  SunOS ]
    test_crop_src_dirs += util/unix;
    src_dirs += util/unix;
#endif
#if [in [UNIX_SYS]  Linux ]
    test_crop_src_dirs += util/unix;
    src_dirs += util/unix;
#endif
#if [in [UNIX_SYS]  OSF1 ]
    test_crop_src_dirs += util/unix;
    src_dirs += util/unix;
#endif
#if [in [UNIX_SYS]  CYGWIN_NT-4.0 ]
    test_crop_src_dirs += util/unix;
    src_dirs += util/nt;
#endif
#if [in [UNIX_SYS]  CYGWIN_NT-5.0 ]
    test_crop_src_dirs += util/nt;
    src_dirs += util/nt;
#endif
#if [in [UNIX_SYS]  CYGWIN_NT-5.1 ]
    test_crop_src_dirs += util/nt;
    src_dirs += util/nt;
#endif

#ifdef RELEASE
	src_dirs += util/build;			/* Use modified functions */
#else
	src_dirs += util/templates;		/* Use default functions */
#endif

/* list possible dirs with include files beside [src_dirs] */
inc_dirs = [INC] [addprefix [INC]/ [src_dirs]];

/* list possible dirs with module files beside [src_dirs] */
mod_dirs = [MOD] [addprefix [MOD]/ [src_dirs]];

#include "cookbook/cook.weps"
#include "cookbook/recipes.weps"	/* determines the correct recipe file */
#include "cookbook/recipes.dep" 	/* recipes for dependency files */
#include "cookbook/target.weps"

show:
{
	function print "PRIMARY_TARGET = " [PRIMARY_TARGET];
	function print "FC: " [FC];
	function print "src_dirs: " [src_dirs];
	function print "inc_dirs: " [inc_dirs];
	function print "manifest: " [manifest];
	function print "src_files: " [src_files];
	function print "inc_files: " [inc_files];
	function print "obj_files: " [obj_files];
	function print "dep_files: " [dep_files];
	function print "command line variables: " [command-line-goals];
	function print "OPT: " [OPT];
	function print "DEBUG: " [DEBUG];
	function print "RELEASE: " [RELEASE];
	function print "module_src_files: " [module_src_files];
	function print "module_names: " [module_names];
	function print "module_files: " [module_files];
	function print "tsterode_src_dirs: " [tsterode_src_dirs];
	function print "tsterode_src_files: " [tsterode_src_files];
	function print "test_crop_src_dirs: " [test_crop_src_dirs];
	function print "test_crop_src_files: " [test_crop_src_files];
        function print "weps_driver_src_dirs: " [weps_driver_src_dirs];
    function print "os machine = " [os machine];
    function print "os = " [os];
	function print "getenv WEPS_COMPILER = " [getenv WEPS_COMPILER];
}