<compilation>

<!-- predefined vars:
   $outdir -> output directory for temporary compile files
   $id     -> identifier of this benchmark run
-->

<!-- ********************************************************** -->
<compile cname="Cray-XE6-HECToR">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DUNDERSCORE_CALLS 
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'                    : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'                    : ' '`  
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'                    : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'                    : ' '`  
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'                    : ' '`
					`index('$IHPCT_HWC','on')>-1    ? '-DIHPCT_HWC'                    : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                         : ' '`
					`index('$PAPI','on')>-1         ? '-DPAPI -I $(SARA_PAPI_ROOT)/include'    : ' '`
					`index('$IHPCT_MPITR','on')>-1  ? '-g -I $(IHPCT_BASE)/include'            : ' '`" /> 

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags -Mnomain 
					`index('$GPROF','on')>-1       ? '-g -pg'                                                : ' '`" />
        <sub from="#LDLIBS#"        to="`index('$PAPI','on')==0        ? '-L $(SARA_PAPI_ROOT)/lib64 -lpapi'                     : ' '`
	                                `index('$IHPCT_MPITR','on')==0 ? '-L $(IHPCT_BASE)/lib64 -llicense -lmpitrace'           : ' '`
				        `index('$IHPCT_HWC','on')==0   ? '-L $(IHPCT_BASE)/lib64 -lhpm -llicense -lm'            : ' '`" />

				        

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="cray" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                        	`index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower_ $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$cpp" />
	<sub from="#FPPFLAGS#"      to="-F -C -P" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>


    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double                                        -msse3 -DSSE3 -DP4 -Wstrict-prototypes -fstrict-aliasing -Werror
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DMPI -DPARALLELXYZT -D_GAUGE_COPY
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DARCH=0 -I./include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- issue build command -->
    <command>( cd kernel_A; sh fixLouhiPP.sh; cd ..; source /opt/modules/default/init/sh; `index('$CRAYPAT','on')==0 ? 'module load xt-craypat;' : ' '` make `index('$CRAYPAT','on')==0 ? '; pat_build -v -u -g $CRAYPAT_GROUP -o ${execname}+pat $execname; cp ${execname}+pat $execname' : ' '`)</command>    
</compile>

<!-- ********************************************************** -->
<compile cname="Cray-XE6-HERMIT">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DUNDERSCORE_CALLS 
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'                    : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'                    : ' '`  
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'                    : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'                    : ' '`  
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'                    : ' '`
					`index('$IHPCT_HWC','on')>-1    ? '-DIHPCT_HWC'                    : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                         : ' '`
					`index('$PAPI','on')>-1         ? '-DPAPI -I $(SARA_PAPI_ROOT)/include'    : ' '`
					`index('$IHPCT_MPITR','on')>-1  ? '-g -I $(IHPCT_BASE)/include'            : ' '`" /> 

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags -Mnomain 
					`index('$GPROF','on')>-1       ? '-g -pg'                                                : ' '`" />
        <sub from="#LDLIBS#"        to="`index('$PAPI','on')==0        ? '-L $(SARA_PAPI_ROOT)/lib64 -lpapi'                     : ' '`
	                                `index('$IHPCT_MPITR','on')==0 ? '-L $(IHPCT_BASE)/lib64 -llicense -lmpitrace'           : ' '`
				        `index('$IHPCT_HWC','on')==0   ? '-L $(IHPCT_BASE)/lib64 -lhpm -llicense -lm'            : ' '`" />

				        

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="cray" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                        	`index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower_ $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$cpp" />
	<sub from="#FPPFLAGS#"      to="-F -C -P" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>


    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DMPI -DPARALLELXYZT -D_GAUGE_COPY
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DARCH=0 -I./include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- issue build command -->
    <command>( cd kernel_A; sh fixLouhiPP.sh; cd ..; source /opt/modules/default/init/sh; `index('$CRAYPAT','on')==0 ? 'module load xt-craypat;' : ' '` make `index('$CRAYPAT','on')==0 ? '; pat_build -v -u -g $CRAYPAT_GROUP -o ${execname}+pat $execname; cp ${execname}+pat $execname' : ' '`)</command>    
</compile>

<!-- ********************************************************** -->
<compile cname="Cray-XT4-Louhi">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DLOUHI -DUNDERSCORE_CALLS 
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'                    : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'                    : ' '`  
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'                    : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'                    : ' '`  
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'                    : ' '`
					`index('$IHPCT_HWC','on')>-1    ? '-DIHPCT_HWC'                    : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                         : ' '`
					`index('$PAPI','on')>-1         ? '-DPAPI -I $(SARA_PAPI_ROOT)/include'    : ' '`
					`index('$IHPCT_MPITR','on')>-1  ? '-g -I $(IHPCT_BASE)/include'            : ' '`" /> 

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags -Mnomain 
					`index('$GPROF','on')>-1       ? '-g -pg'                                                : ' '`" />
        <sub from="#LDLIBS#"        to="`index('$PAPI','on')==0        ? '-L $(SARA_PAPI_ROOT)/lib64 -lpapi'                     : ' '`
	                                `index('$IHPCT_MPITR','on')==0 ? '-L $(IHPCT_BASE)/lib64 -llicense -lmpitrace'           : ' '`
				        `index('$IHPCT_HWC','on')==0   ? '-L $(IHPCT_BASE)/lib64 -lhpm -llicense -lm'            : ' '`" />

				        

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="cray" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                        	`index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower_ $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$cpp" />
	<sub from="#FPPFLAGS#"      to="-F -C -P" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>


    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DMPI -DPARALLELXYZT -D_GAUGE_COPY
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DARCH=0 -I./include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- issue build command -->
    <command>( cd kernel_A; sh fixLouhiPP.sh; cd ..; source /opt/modules/default/init/sh; `index('$CRAYPAT','on')==0 ? 'module load xt-craypat;' : ' '` make `index('$CRAYPAT','on')==0 ? '; pat_build -v -u -g $CRAYPAT_GROUP -o ${execname}+pat $execname; cp ${execname}+pat $execname' : ' '`)</command>    
</compile>

<!-- ********************************************************** -->
<compile cname="IBM-SP6-Huygens">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DHUYGENS
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'                    : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'                    : ' '`  
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'                    : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'                    : ' '`  
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'                    : ' '`
					`index('$IHPCT_HWC','on')>-1    ? '-DIHPCT_HWC'                    : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                         : ' '`
					`index('$PAPI','on')>-1         ? '-DPAPI -I $(SARA_PAPI_ROOT)/include'    : ' '`
					`index('$IHPCT_MPITR','on')>-1  ? '-g -I $(IHPCT_BASE)/include'            : ' '`" /> 

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags $optflags
					`index('$GPROF','on')>-1       ? '-g -pg'                                                : ' '`" />
        <sub from="#LDLIBS#"        to="`index('$PAPI','on')==0        ? '-L $(SARA_PAPI_ROOT)/lib64 -lpapi'                     : ' '`
	                                `index('$IHPCT_MPITR','on')==0 ? '-L $(IHPCT_BASE)/lib64 -llicense -lmpitrace'           : ' '`
				        `index('$IHPCT_HWC','on')==0   ? '-L $(IHPCT_BASE)/lib64 -lhpm -llicense -lm'            : ' '`" />

				        

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="ibm" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags -qzerosize
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                        	`index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$mpi_cc" />
	<sub from="#FPPFLAGS#"      to="-g -E -C" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>

    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DMPI -DPARALLELXYZT -D_GAUGE_COPY
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DARCH=0 -I./include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- issue build command -->
    <command>(`index('$PAPI','on')==0 ? 'module load papi;' : ' '` `index('$IHPCT_HWC','on')==0 || index('$IHPCT_MPITR','on')==0 ? 'module load hpct;' : ' '` make)</command>
    
</compile>


<!-- ********************************************************** -->
<compile cname="IBM-BGP-Jugene">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'              : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'              : ' '` 
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'              : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'              : ' '`
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'              : ' '`
					`index('$IHPCT_HWC','on')>-1    ? '$ihpct_inc -DIHPCT_HWC -DIHPCT_ALL' : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                   : ' '`
					`index('$IHPCT_MPITR','on')>-1  ? '-g'                       : ' '`" /> 

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags 
					`index('$GPROF','on')>-1 ? '-g -pg' : ' '`" />
        <sub from="#LDLIBS#"        to="`index('$IHPCT_MPITR','on')==0 ? '$ihpct_dir -lmpitrace -lgfortran -llicense' : ' '`
				        `index('$IHPCT_HWC','on')==0   ? '$ihpct_dir -lhpm -lm ${ihpct_base}/lib/fake_dlfcn.o $ihpct_base/lib/mirror.o -llicense'  : ' '`" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="ibm" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags 
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                        	`index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$mpi_cc" />
	<sub from="#FPPFLAGS#"      to="-g -E -C" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>

    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DMPI -DPARALLELXYZT -D_GAUGE_COPY
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -I./include -I./../include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


    <!-- issue build command -->
    <command>(make)</command>
    
</compile>


<!-- ********************************************************** -->
<compile cname="IBM-BGQ-Juqueen">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'              : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'              : ' '` 
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'              : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'              : ' '`
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'              : ' '`
					`index('$IHPCT_HWC','on')>-1    ? '$ihpct_inc -DIHPCT_HWC -DIHPCT_ALL' : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                   : ' '`
					`index('$IHPCT_MPITR','on')>-1  ? '-g'                       : ' '`" /> 

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags 
					`index('$GPROF','on')>-1 ? '-g -pg' : ' '`" />
        <sub from="#LDLIBS#"        to="`index('$IHPCT_MPITR','on')==0 ? '$ihpct_dir -lmpitrace -lgfortran -llicense' : ' '`
				        `index('$IHPCT_HWC','on')==0   ? '$ihpct_dir -lhpm -lm ${ihpct_base}/lib/fake_dlfcn.o $ihpct_base/lib/mirror.o -llicense'  : ' '`" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="ibm" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags 
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                        	`index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$mpi_cc" />
	<sub from="#FPPFLAGS#"      to="-g -E -C" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>

    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DMPI -DPARALLELXYZT -D_GAUGE_COPY
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -I./include -I./../include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


    <!-- issue build command -->
    <command>(make)</command>
    
</compile>


<!-- ********************************************************** -->

<compile cname="Intel-Nehalem-JUROPA">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DUNDERSCORE_CALLS
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'              : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'              : ' '` 
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'              : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'              : ' '`
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'              : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                   : ' '`" />

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags -nofor_main
					`index('$GPROF','on')>-1 ? '-g -pg' : ' '`" />
        <sub from="#LDLIBS#"        to=" " /> 

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="intel" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags 
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower_ $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$cpp" />
	<sub from="#FPPFLAGS#"      to="-E -C" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>

    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '` "/>
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -c99 -DMPI -DPARALLELXYZT -D_GAUGE_COPY
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -I./include -I./../include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


    <!-- issue build command -->
    <command>(cd kernel_A; sh fixLouhiPP.sh; cd ..; make)</command>
    
</compile>


<!-- ********************************************************** -->

<compile cname="IBM-SP6-Jump">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'     : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'     : ' '` 
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'     : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'              : ' '`
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'              : ' '`
					`index('$IHPCT_HWC','on')>-1    ? '-DIHPCT_HWC'     : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'          : ' '`
					`index('$IHPCT_MPITR','on')>-1  ? '-g'              : ' '`" /> 

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags 
					`index('$GPROF','on')>-1       ? '-g -pg'                       : ' '`" />
        <sub from="#LDLIBS#"        to="`index('$IHPCT_MPITR','on')==0 ? '-llicense -lmpitrace'         : ' '`
				        `index('$IHPCT_HWC','on')==0   ? '-lhpm -llicense -lpmapi -lm'  : ' '`" />


        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="ibm" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="-X64 $arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags 
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                        	`index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$mpi_cc" />
	<sub from="#FPPFLAGS#"      to="-g -E -C" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>

    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="-X64 $arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="-X64 $arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -qlanglvl=stdc99 -DMPI -DPARALLELXYZT -D_GAUGE_COPY -DHAVE_CONFIG_H
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DPOSIX_MEMALIGN -qlanglvl=stdc99 -I./../include -I./include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`
	                                `index('$IHPCT_MPITR','on')>-1  ? '-g'     : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


    <!-- issue build command -->
    <command>(`index('$IHPCT_HWC','on')==0 || index('$IHPCT_MPITR','on')==0 ? 'module load ihpct;' : ' '` make)</command>
    
</compile>

<!-- ********************************************************** -->

<compile cname="Intel-Haswell-Cartesius">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DUNDERSCORE_CALLS
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'              : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'              : ' '` 
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'              : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'              : ' '`
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'              : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                   : ' '`" />

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags -nofor_main -fno-range-check
					`index('$GPROF','on')>-1 ? '-g -pg' : ' '`" />
        <sub from="#LDLIBS#"        to=" " /> 

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="intel" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags 
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower_ $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$cpp" />
	<sub from="#FPPFLAGS#"      to="-E -C" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>

    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '` "/>
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -std=c99 -DMPI -DPARALLELXYZT -D_GAUGE_COPY -DHAVE_CONFIG_H
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -I./include -I./../include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


    <!-- issue build command -->
    <command>(cd kernel_A; sh fixLouhiPP.sh; cd ..; make)</command>
    
</compile>

<compile cname="Intel-Broadwell-Marconi">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
				kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DUNDERSCORE_CALLS
	                                `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'              : ' '` 
					`index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'              : ' '` 
					`index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'              : ' '`
					`index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'              : ' '`
					`index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'              : ' '`
					`index('$GPROF','on')>-1        ? '-g -pg'                   : ' '`" />

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags -nofor_main -fno-range-check
					`index('$GPROF','on')>-1 ? '-g -pg' : ' '`" />
        <sub from="#LDLIBS#"        to=" " /> 

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
					`index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
					`index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
					`index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
					`index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="intel" />	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
	
    </substitute>

    <!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#RANLIB#"        to="$ranlib" />
	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags 
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower_ $optflags
           				`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

	<sub from="#d3_buffer_vol#" to="" />

	<sub from="#FPP#"           to="$cpp" />
	<sub from="#FPPFLAGS#"      to="-E -C" />

	<sub from="#SYSLIBS#"       to="" />

	<sub from="#FAST_MAKE#"     to="gmake -j 8" />

	<sub from="#RM#"            to="$rm" />

	<sub from="#CKSUM_O#"       to="cksum.o" />
	<sub from="#RANDOM_O#"      to="ran.o ranf.o" />
	<sub from="#UUU_O#"         to="uuu_f90.o" />
	
	<sub from="#KA_LIBD#"       to="$KA_LIBD" />
	<sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
	<sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>

    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

	<sub from="#MAKE#"          to="$make" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#CC#"            to="$cc" />
	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '` "/>
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
	<!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
	-msse3 -DSSE3 -DP4 -Wstrict-prototypes 
	-fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

    	<sub from="#NPROC0#"         to="$KC_PX" />
    	<sub from="#NPROC1#"         to="$KC_PY" />
    	<sub from="#NPROC2#"         to="$KC_PZ" />
    	<sub from="#NPROC3#"         to="$KC_PT" />

    	<sub from="#L0#"         to="$KC_NX" />
    	<sub from="#L1#"         to="$KC_NY" />
    	<sub from="#L2#"         to="$KC_NZ" />
    	<sub from="#L3#"         to="$KC_NT" />

    </substitute>    

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -std=c99 -DMPI -DPARALLELXYZT -D_GAUGE_COPY -DHAVE_CONFIG_H
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

    	<sub from="#SHELL#"         to="bash" />

	<sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
	<sub from="#RM#"            to="$rm" />

	<sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -I./include -I./../include
					`index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
	
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


    <!-- issue build command -->
    <command>(cd kernel_A; sh fixLouhiPP.sh; cd ..; make)</command>
    
</compile>

<compile cname="Intel-SNB-supermuc">

    <src directory="src" files="Makefile.in qcd-bench.c qcd-diag.h
                                kernel_A kernel_B kernel_C kernel_D kernel_E" />

    <!-- Create the main makefile -->
    <substitute infile="Makefile.in" outfile="Makefile">

        <sub from="#RM#"            to="$rm" />

        <sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -DUNDERSCORE_CALLS
                                        `index('$KERNELS','A')>-1       ? '-DKA_ACTIVE'              : ' '` 
                                        `index('$KERNELS','B')>-1       ? '-DKB_ACTIVE'              : ' '` 
                                        `index('$KERNELS','C')>-1       ? '-DKC_ACTIVE'              : ' '`
                                        `index('$KERNELS','D')>-1       ? '-DKD_ACTIVE'              : ' '`
                                        `index('$KERNELS','E')>-1       ? '-DKE_ACTIVE'              : ' '`
                                        `index('$GPROF','on')>-1        ? '-g -pg'                   : ' '`" />

        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags -nofor_main
                                        `index('$GPROF','on')>-1 ? '-g -pg' : ' '`" />
        <sub from="#LDLIBS#"        to=" " /> 

        <sub from="#EXECNAME#"      to="$execname" />

        <sub from="#KERNEL_ARCHS#"  to="`index('$KERNELS','A')>-1 ? 'kernel_A.a' : ' '` 
                                        `index('$KERNELS','B')>-1 ? 'kernel_B.a' : ' '` 
                                        `index('$KERNELS','C')>-1 ? 'kernel_C.a' : ' '` 
                                        `index('$KERNELS','D')>-1 ? 'kernel_D.a' : ' '` 
                                        `index('$KERNELS','E')>-1 ? 'kernel_E.a' : ' '`" />

        <sub from="#KA_PLATFORM#"   to="intel" />       
        <sub from="#KA_LIBD#"       to="$KA_LIBD" />
        <sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
        <sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />
        
    </substitute>

<!-- Create kernel_A/makefile.defs and substitute parameters -->
    <substitute infile="kernel_A/Makefile.defs.in" outfile="kernel_A/Makefile.defs">

        <sub from="#SHELL#"         to="bash" />

        <sub from="#RANLIB#"        to="$ranlib" />
        <sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
        <sub from="#RM#"            to="$rm" />

        <sub from="#MPI_F90#"       to="$mpi_f90" />
        <sub from="#F90FLAGS#"      to="$f90flags $optflags 
                                        `index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />

        <sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags -DLongLong -DNamesToLower_ $optflags
                                        `index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
    
        <sub from="#LD#"            to="$mpi_f90" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

        <sub from="#EXECNAME#"      to="$execname" />

        <sub from="#d3_buffer_vol#" to="" />

        <sub from="#FPP#"           to="$cpp" />
        <sub from="#FPPFLAGS#"      to="-E -C" />

        <sub from="#SYSLIBS#"       to="" />

        <sub from="#FAST_MAKE#"     to="gmake -j 8" />

        <sub from="#RM#"            to="$rm" />

        <sub from="#CKSUM_O#"       to="cksum.o" />
        <sub from="#RANDOM_O#"      to="ran.o ranf.o" />
        <sub from="#UUU_O#"         to="uuu_f90.o" />
        
        <sub from="#KA_LIBD#"       to="$KA_LIBD" />
        <sub from="#KA_LIBCOMM#"    to="$KA_LIBCOMM" />
        <sub from="#KA_LIBCLOVER#"  to="$KA_LIBCLOVER" />

    </substitute>


    <!-- Create kernel_B/makefile.defs and substitute parameters -->
    <substitute infile="kernel_B/Makefile.defs.in" outfile="kernel_B/Makefile.defs">

        <sub from="#MAKE#"          to="$make" />

        <sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
        <sub from="#RM#"            to="$rm" />

        <sub from="#CC#"            to="$cc" />
        <sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
                                        `index('$GPROF','on')>-1        ? '-g -pg' : ' '` "/>
    
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


   <!-- Create kernel_C/makefile.defs and substitute parameters -->
    <substitute infile="kernel_C/Makefile.defs.in" outfile="kernel_C/Makefile.defs">

        <sub from="#SHELL#"         to="bash" />

        <sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
        <sub from="#RM#"            to="$rm" />

        <sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags
                                        `index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
        
        <!-- -std=c89 -pedantic -Wall -Wno-long-long -m32 -malign-double 
        -msse3 -DSSE3 -DP4 -Wstrict-prototypes 
        -fstrict-aliasing -Werror -->
    
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <substitute infile="kernel_C/global.defs.in" outfile="kernel_C/global.defs">

        <sub from="#NPROC0#"         to="$KC_PX" />
        <sub from="#NPROC1#"         to="$KC_PY" />
        <sub from="#NPROC2#"         to="$KC_PZ" />
        <sub from="#NPROC3#"         to="$KC_PT" />

        <sub from="#L0#"         to="$KC_NX" />
        <sub from="#L1#"         to="$KC_NY" />
        <sub from="#L2#"         to="$KC_NZ" />
        <sub from="#L3#"         to="$KC_NT" />

    </substitute>   

    <!-- Create kernel_D/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_D/Makefile.defs.in" outfile="kernel_D/Makefile.defs">

        <sub from="#SHELL#"         to="bash" />

        <sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
        <sub from="#RM#"            to="$rm" />

        <sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -std=c99 -DMPI -DPARALLELXYZT -D_GAUGE_COPY -DHAVE_CONFIG_H
                                        `index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
        
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    

    <!-- Create kernel_E/Makefile.defs and substitute parameters -->
    <substitute infile="kernel_E/Makefile.defs.in" outfile="kernel_E/Makefile.defs">

        <sub from="#SHELL#"         to="bash" />

        <sub from="#AR#"            to="$ar" />
        <sub from="#ARFLAGS#"       to="$arflags" />
        <sub from="#RM#"            to="$rm" />

        <sub from="#MPI_CC#"        to="$mpi_cc" />
        <sub from="#CFLAGS#"        to="$cflags $optflags -I./include -I./../include
                                        `index('$GPROF','on')>-1        ? '-g -pg' : ' '`" />
        
        <sub from="#LD#"            to="$ld" />
        <sub from="#LDFLAGS#"       to="$ldflags" />

    </substitute>    


    <!-- issue build command -->
    <command>(cd kernel_A; sh fixLouhiPP.sh; cd ..; make)</command>
    
</compile>

</compilation>
