# Makefile for upacking tar files of MILC code
#  C. DeTar 3/26/08

# Targets
#   all    gets all
#   <app>  gets only files needed for a specific application
#          where <app> is the name of an application directory

######################################################################
# Rules for unpacking

# We assume that the user has already untarred the primary
# file ${WORK_NAME_ROOT}.tar.gz or ${RELEASE_NAME_ROOT}.tar.gz
# into a clean directory
# NOTE: These targets WILL overwrite any files with the
# same names as the package files.

include Make_contents

all: ${TAR}
	for f in ${TAR} ;\
        do \
	tar -xf $$f ;\
	done

# The following targets are intended to give the user a subset of
# files needed for a selected application, in case the whole release
# is not unpacked.

ALL_APPS = \
  clover_dynamical \
  clover_invert2 \
  gluon_prop \
  heavy \
  ks_eigen \
  ks_imp_dyn \
  ks_imp_invert_multi \
  ks_imp_rhmc \
  pure_gauge \
  schroed_cl_inv \
  schroed_pg \
  smooth_inst \
  symanzik_sl32 \
  wilson_static

${ALL_APPS}: MAKE_basic

clover_dynamical:  	MAKE_generic_quark MAKE_generic_clover
clover_invert2:  	MAKE_generic_quark MAKE_generic_clover
gluon_prop:	        MAKE_generic_quark
heavy:  		MAKE_generic_quark 
hvy_qpot:
ks_eigen:		MAKE_generic_quark 
ks_imp_dyn:		MAKE_generic_quark 
ks_imp_invert_multi:	MAKE_generic_quark 
ks_imp_rhmc:		MAKE_generic_quark
pure_gauge: 		MAKE_generic_pg
schroed_cl_inv:  	MAKE_generic_quark MAKE_generic_clover MAKE_generic_schroed
schroed_pg:  		MAKE_generic_pg MAKE_generic_schroed
symanzik_sl32:		MAKE_generic_pg
wilson_dynamical:  	MAKE_generic_quark
wilson_static:  	MAKE_generic_quark

# Rules for the generic directories

MAKE_basic:
	tar -xf ${BASIC_TAR}

MAKE_generic_clover:
	tar -xf ${CLOVER_TAR} generic_clover

MAKE_generic_ks:
	tar -xf ${KS_TAR} generic_ks

MAKE_generic_pg:
	tar -xf ${PURE_GAUGE_TAR} generic_pg

MAKE_generic_wilson:
	tar -xf ${WILSON_TAR} generic_wilson

MAKE_generic_quark: MAKE_generic_ks MAKE_generic_wilson


# Rules for specific application directories

generic_pg \
pure_gauge \
hvy_qpot \
: ${PURE_GAUGE_TAR}
	tar -xf ${PURE_GAUGE_TAR} $@

generic_clover \
clover_dynamical \
clover_invert2 \
: ${CLOVER_TAR}
	tar -xf ${CLOVER_TAR} $@

generic_form \
: ${FORM_TAR}
	tar -xf ${FORM_TAR} $@

symanzik_sl32 \
: ${FP_TAR}
	tar -xf ${FP_TAR} $@

smooth_inst : ${INST_TAR}
	tar -xf ${INST_TAR} $@

dense_static_su3 \
generic_ks \
gluon_prop \
ks_eigen \
ks_imp_dyn \
ks_imp_rhmc \
ks_imp_invert_multi \
string_break \
: ${KS_TAR}
	tar -xf ${KS_TAR} $@

generic_schroed \
schroed_cl_inv \
schroed_pg \
: ${SF_TAR}
	tar -xf ${SF_TAR} $@

generic_wilson \
heavy \
wilson_dynamical \
wilson_schroed \
wilson_static \
: ${WILSON_TAR}
	tar -xf ${WILSON_TAR} $@
