# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004  Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@

# "test/chpsim/testlib/Makefile.am"
#	$Id: Makefile.am,v 1.13 2008/06/03 18:47:25 fang Exp $
# Test auto-Makefile for chpsim.  

# "Make.test-head"
# include this first in every subdirectory's Makefile.am
#	$Id: Make.test-head,v 1.36 2007/08/19 04:00:41 fang Exp $
#	vi: ft=automake

# "Make.stddef"
#	vi: ft=automake
# make-independent definitions
# This Makefile fragment should be included as early as possible
# by other makefiles.  
#	$Id: Make.stddef,v 1.29 2008/12/04 21:27:08 fang Exp $

# "test/Make.test-tail"
#	vi: ft=automake
# a template makefile for testing, to be included in recursive invocations
# Include this Makefile at the end of every subdirectoy's Makefile.am.
# The counterpart header Makefile is "test/Make.test-head".
#	$Id: Make.test-tail,v 1.94 2009/08/28 20:45:40 fang Exp $

# "Make.test-compile"
#	vi: ft=automake
#	$Id: Make.test-compile,v 1.22 2008/07/30 05:26:55 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-flatten"
#	vi: ft=automake
#	$Id: Make.test-flatten,v 1.12 2008/07/30 22:55:01 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-create"
#	vi: ft=automake
#	$Id: Make.test-create,v 1.12 2007/08/17 00:36:34 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-alloc"
#	vi: ft=automake
#	$Id: Make.test-alloc,v 1.10 2007/08/17 00:36:33 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# TODO: organize this file by test, and accumulate variables

# "Make.test-cflat"
#	vi: ft=automake
#	$Id: Make.test-cflat,v 1.15 2008/03/17 23:03:26 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-graph"
#	vi: ft=automake
#	$Id: Make.test-graph,v 1.4 2007/08/16 06:11:05 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-prsim"
#	vi: ft=automake
#	$Id: Make.test-prsim,v 1.18 2009/02/01 18:21:05 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-vpi"
#	vi: ft=automake
#	$Id: Make.test-vpi,v 1.9 2009/08/28 20:45:40 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# known VCS issues:
# C-2009.06's vcs-generated Makefile does not properly
#	declare SUFFIXES and relies on implicit rules (fails with make -r)

# "Make.test-chpsim"
#	vi: ft=automake
#	$Id: Make.test-chpsim,v 1.24 2009/02/06 02:52:06 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-guile"
#	vi: ft=automake
#	$Id: Make.test-guile,v 1.19 2009/04/29 22:05:40 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.test-net"
#	vi: ft=automake
#	$Id: Make.test-net,v 1.2 2009/08/28 20:45:39 fang Exp $
# This is just a portion of the Make.test-tail template included by
# Makefile.am's in the test/ directory subtree.  
# This depends on variables defined in Make.test-tail, and thus, 
# should not be included by itself.  

# "Make.global"
#	vi: ft=automake
# Project-wide Makefile targets and dependencies.
# Generally, it is recommended to include this Makefile last.  
# This file may be used as an includable Makefile snippet, 
# or with automake for automatic inlining.  
# NOTE: standard definition macros appear in "Make.stddef" and should
# be included *before* the inclusion of this Makefile.  
# NOTE: the for-loop syntax used requires that SHELL = sh, not bash.
#	$Id: Make.global,v 1.33 2008/12/23 04:42:20 fang Exp $
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
	$(top_srcdir)/Make.global $(top_srcdir)/Make.stddef \
	$(top_srcdir)/test/Make.test-alloc \
	$(top_srcdir)/test/Make.test-cflat \
	$(top_srcdir)/test/Make.test-chpsim \
	$(top_srcdir)/test/Make.test-compile \
	$(top_srcdir)/test/Make.test-create \
	$(top_srcdir)/test/Make.test-flatten \
	$(top_srcdir)/test/Make.test-graph \
	$(top_srcdir)/test/Make.test-guile \
	$(top_srcdir)/test/Make.test-head \
	$(top_srcdir)/test/Make.test-net \
	$(top_srcdir)/test/Make.test-prsim \
	$(top_srcdir)/test/Make.test-tail \
	$(top_srcdir)/test/Make.test-vpi
# accumulate this variable over other Makefiles
@HAVE_CFLAT_TRUE@am__append_1 = .cast .castprs
@HAVE_CFLAT_TRUE@am__append_2 = .cast .castprs

# TESTS += $(HACKT_PARSE_TEST_SUBJECTS:=.hacktcmpltest)
# HACKT_CHPSIM_DOT_TEST_SUBJECTS += $(HACKT_CHPSIMRC_TEST_PASSES)
#	$(HACKNET_TEST_SUBJECTS:=.hac) \
#	$(HACKNET_TEST_SUBJECTS:=.spice-expect)
@CHECK_TESTS_TRUE@am__append_3 =  \
@CHECK_TESTS_TRUE@	$(HACKT_PARSE_TEST_PASSES:=.hacktcmpltest) \
@CHECK_TESTS_TRUE@	$(HACKT_CPP_PARSE_TEST_PASSES:=.hacktcmpltest) \
@CHECK_TESTS_TRUE@	$(HACKT_PARSE_TEST_WARNINGS:=.hacktcmplwarntest) \
@CHECK_TESTS_TRUE@	$(HACKT_PARSE_TEST_FAILURES:=.hacktcmplfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_CPP_PARSE_TEST_FAILURES:=.hacktcmplfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_OBJ_TEST_SUBJECTS:=.hacktobjtest) \
@CHECK_TESTS_TRUE@	$(HACKT_FLATTEN_TEST_PASSES:=.hacflattest) \
@CHECK_TESTS_TRUE@	$(HACKT_FLATTEN_TEST_FAILURES:=.hacflatfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_FLATTEN_PARSE_TEST_PASSES:=.hacfobjdifftest) \
@CHECK_TESTS_TRUE@	$(HACKT_FLATTEN_PARSE_TEST_FAILURES:=.compileflatdump-test) \
@CHECK_TESTS_TRUE@	$(HACKT_CREATE_TEST_PASSES:=.hacktcreatetest) \
@CHECK_TESTS_TRUE@	$(HACKT_CREATE_TEST_FAILURES:=.hacktcreatefailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_ALLOC_TEST_PASSES:=.hacktalloctest) \
@CHECK_TESTS_TRUE@	$(HACKT_ALLOC_TEST_FAILURES:=.hacktallocfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_ALLOC_TEST_PASSES:=.hacktallocfromhacotest) \
@CHECK_TESTS_TRUE@	$(HACKT_CFLAT_TEST_SUBJECTS:=.hacktcflattest) \
@CHECK_TESTS_TRUE@	$(HACKT_CFLAT_LVS_TEST_PASSES:=.hacktcflatlvstest) \
@CHECK_TESTS_TRUE@	$(HACKT_CFLAT_LVS_TEST_FAILURES:=.hacktcflatlvsfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_CFLAT_SEU_TEST_SUBJECTS:=.hacktcflatseutest) \
@CHECK_TESTS_TRUE@	$(HACKT_CFLAT_SPRS_TEST_SUBJECTS:=.hacktsprstest) \
@CHECK_TESTS_TRUE@	$(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.hacktprsimexprtest) \
@CHECK_TESTS_TRUE@	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimtest) \
@CHECK_TESTS_TRUE@	$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES:=.prsimfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_PRSIMTRACE_TEST_SUBJECTS:=.prsimtracetest) \
@CHECK_TESTS_TRUE@	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpttest) \
@CHECK_TESTS_TRUE@	$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES:=.prsimopttest) \
@CHECK_TESTS_TRUE@	$(HACKT_PRS_DOT_TEST_SUBJECTS:=.hacktprsdottest) \
@CHECK_TESTS_TRUE@	$(HACKT_VPI_TEST_SCRIPTS_PASSES:=.vpitest) \
@CHECK_TESTS_TRUE@	$(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS:=.chpsimalloctest) \
@CHECK_TESTS_TRUE@	$(HACKT_CHPSIM_DOT_TEST_SUBJECTS:=.chpsimdottest) \
@CHECK_TESTS_TRUE@	$(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES:=.chpsimtest) \
@CHECK_TESTS_TRUE@	$(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES:=.chpsimfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES:=.chpsimckpttest) \
@CHECK_TESTS_TRUE@	$(HACKT_GUILE_TEST_SCRIPTS_PASSES:=.hacscmtest) \
@CHECK_TESTS_TRUE@	$(HACKT_GUILE_TEST_SCRIPTS_FAILURES:=.hacscmfailtest) \
@CHECK_TESTS_TRUE@	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES:=.hacchpsimscmtest) \
@CHECK_TESTS_TRUE@	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_FAILURES:=.hacchpsimscmfailtest) \
@CHECK_TESTS_TRUE@	$(HACKNET_TEST_SCRIPTS_PASSES:=.hacknettest) \
@CHECK_TESTS_TRUE@	$(HACKNET_TEST_SCRIPTS_FAILURES:=.hacknetfailtest)
@HAVE_PRSIM_TRUE@am__append_4 = \
@HAVE_PRSIM_TRUE@	else \
@HAVE_PRSIM_TRUE@	case $* in \
@HAVE_PRSIM_TRUE@	echo* ) break ;; \
@HAVE_PRSIM_TRUE@	macro* ) break ;; \
@HAVE_PRSIM_TRUE@	spec* ) break ;; \
@HAVE_PRSIM_TRUE@	weak* ) break ;; \
@HAVE_PRSIM_TRUE@	*) @PRSIM@ "$$out" < /dev/null > /dev/null 2>&1 || \
@HAVE_PRSIM_TRUE@	  $(ECHO) "Error: @PRSIM@ rejected $$out." ;; \
@HAVE_PRSIM_TRUE@	esac

@HAVE_PRSIM_FALSE@am__append_5 = :
# requires env. LM_LICENSE_FILE
# COMMON_VCS_FLAGS += -comp64
@ABI_ILP64_TRUE@am__append_6 = -full64
@HAVE_VPI_TRUE@am__append_7 = \
@HAVE_VPI_TRUE@	$(HACKT_VPI_TEST_SCRIPTS_PASSES:=.vx-out) \
@HAVE_VPI_TRUE@	$(HACKT_VPI_TEST_SCRIPTS_PASSES:=.vx-out-filter) \
@HAVE_VPI_TRUE@	$(HACKT_VPI_TEST_SCRIPTS_PASSES:=.vx-diff)

@CHECK_TESTS_TRUE@@RANDOM_TESTS_TRUE@am__append_8 = $(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_PASSES:=.chpsimtest) \
@CHECK_TESTS_TRUE@@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_FAILURES:=.chpsimfailtest) \
@CHECK_TESTS_TRUE@@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIM_RANDOM_GUILE_TEST_SCRIPTS_PASSES:=.hacchpsimscmtest) \
@CHECK_TESTS_TRUE@@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIM_RANDOM_GUILE_TEST_SCRIPTS_FAILURES:=.hacchpsimscmfailtest)
@RANDOM_TESTS_TRUE@am__append_9 = \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_PASSES:=.chpsimrc-out) \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_PASSES:=.chpsimrc-out-filter) \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_PASSES:=.chpsimrc-diff) \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_FAILURES:=.chpsimrcfail-out) \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_FAILURES:=.chpsimrcfail-diff)

@BUILD_DARWIN_TRUE@am__append_10 = $(LTDL_SHLIBPATH_VAR)=$(PRE_INST_LDPATH)
@HAVE_LIBGUILE_TRUE@am__append_11 = \
@HAVE_LIBGUILE_TRUE@	obj=`$(CAT) $< | $(EXTRACT_HACO_PIPE)` ; \
@HAVE_LIBGUILE_TRUE@	$(ECHO) "$(HACKT_GUILE_ENV_EXE) -b $$obj < $< > $@" ; \
@HAVE_LIBGUILE_TRUE@	$(HACKT_GUILE_ENV_EXE) -b "$$obj" < $< 2>&1 | $(HACSCM_OUTPUT_FILTER) > $@

@HAVE_LIBGUILE_TRUE@am__append_12 = \
@HAVE_LIBGUILE_TRUE@	obj=`$(CAT) $< | $(EXTRACT_HACO_PIPE)` ; \
@HAVE_LIBGUILE_TRUE@	$(ECHO) "$(HACKT_CHPSIM_GUILE_ENV_EXE) -b $$obj < $< > $@" ; \
@HAVE_LIBGUILE_TRUE@	$(HACKT_CHPSIM_GUILE_ENV_EXE) -b "$$obj" < $< > $@ 2>&1

@HAVE_LIBGUILE_FALSE@am__append_13 = \
@HAVE_LIBGUILE_FALSE@	$(ECHO) "Not configured with libguile." > $@

@RANDOM_TESTS_TRUE@am__append_14 = \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_PASSES:=.hacchpsimscm-out) \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_PASSES:=.hacchpsimscm-diff) \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_FAILURES:=.hacchpsimscmfail-out) \
@RANDOM_TESTS_TRUE@	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_FAILURES:=.hacchpsimscmfail-diff)

@AUTO_CVSIGNORE_TRUE@am__append_15 = $(srcdir)/.cvsignore

# make cvsignore by default
@AUTO_CVSIGNORE_TRUE@am__append_16 = cvsignore-am

# automake doesn't like b/c RECURSIVE_TARGETS not defined early enough
@AUTO_CVSIGNORE_TRUE@am__append_17 = cvsignore-recursive
@AUTO_CVSIGNORE_TRUE@am__append_18 = clean-cvsignore-recursive
subdir = test/chpsim/testlib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/builtin_funcs.m4 \
	$(top_srcdir)/config/cc.m4 $(top_srcdir)/config/cxx.m4 \
	$(top_srcdir)/config/cxx_STL.m4 \
	$(top_srcdir)/config/documentation.m4 \
	$(top_srcdir)/config/guile.m4 $(top_srcdir)/config/hackt.m4 \
	$(top_srcdir)/config/header_validation.m4 \
	$(top_srcdir)/config/lexyacc.m4 $(top_srcdir)/config/os.m4 \
	$(top_srcdir)/config/rl_el.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/__config__.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI_ILP32_FALSE = @ABI_ILP32_FALSE@
ABI_ILP32_TRUE = @ABI_ILP32_TRUE@
ABI_ILP64_FALSE = @ABI_ILP64_FALSE@
ABI_ILP64_TRUE = @ABI_ILP64_TRUE@
ACLOCAL = @ACLOCAL@
ACLOCAL_FLAGS = @ACLOCAL_FLAGS@
ALLOCA = @ALLOCA@
ALWAYS_TRUE_FALSE = @ALWAYS_TRUE_FALSE@
ALWAYS_TRUE_TRUE = @ALWAYS_TRUE_TRUE@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AUTO_CPPFLAGS = @AUTO_CPPFLAGS@
AUTO_CVSIGNORE_FALSE = @AUTO_CVSIGNORE_FALSE@
AUTO_CVSIGNORE_TRUE = @AUTO_CVSIGNORE_TRUE@
AUTO_LDFLAGS = @AUTO_LDFLAGS@
AWK = @AWK@
BIBTEX = @BIBTEX@
BIN_TEST = @BIN_TEST@
BUILD_DARWIN_FALSE = @BUILD_DARWIN_FALSE@
BUILD_DARWIN_TRUE = @BUILD_DARWIN_TRUE@
CALLMAKE = @CALLMAKE@
# std-options

# useful standard utility definitions
# consider autoconf-ing these...
CAT = @CAT@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAT = @CFLAT@
CHECK_TESTS_FALSE = @CHECK_TESTS_FALSE@
CHECK_TESTS_TRUE = @CHECK_TESTS_TRUE@
CHMOD = @CHMOD@
CIRCO = @CIRCO@
CONFIGDATE = @CONFIGDATE@
CONVENIENCE_LTDL_FALSE = @CONVENIENCE_LTDL_FALSE@
CONVENIENCE_LTDL_TRUE = @CONVENIENCE_LTDL_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
# not gcc -E
CPP_TRADITIONAL = @CPP_TRADITIONAL@
CUT = @CUT@
CVS = @CVS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CXX_VERSION = @CXX_VERSION@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DIFF = @DIFF@
DOT = @DOT@
DOTTY = @DOTTY@
DOT_PATH = @DOT_PATH@
DOXYGEN = @DOXYGEN@
# -B: ignore blank line diffs
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EL_INCLUDE = @EL_INCLUDE@
EL_LDPATH = @EL_LDPATH@
EL_LIB = @EL_LIB@
ENABLE_DOCS_FALSE = @ENABLE_DOCS_FALSE@
ENABLE_DOCS_TRUE = @ENABLE_DOCS_TRUE@
ENABLE_HEADER_VALIDATION_FALSE = @ENABLE_HEADER_VALIDATION_FALSE@
ENABLE_HEADER_VALIDATION_TRUE = @ENABLE_HEADER_VALIDATION_TRUE@
EXEEXT = @EXEEXT@
F77 = @F77@
FANG_DIALECT_FLAGS = @FANG_DIALECT_FLAGS@
FANG_WARN_CFLAGS = @FANG_WARN_CFLAGS@
FANG_WARN_CXXFLAGS = @FANG_WARN_CXXFLAGS@
FANG_WARN_FLAGS = @FANG_WARN_FLAGS@
FDP = @FDP@
FFLAGS = @FFLAGS@
FIG2DEV = @FIG2DEV@
FIG2DEV_PDFTEX_FALSE = @FIG2DEV_PDFTEX_FALSE@
FIG2DEV_PDFTEX_TRUE = @FIG2DEV_PDFTEX_TRUE@
FIND = @FIND@
GMP_INCLUDE = @GMP_INCLUDE@
GMP_LDPATH = @GMP_LDPATH@
GMP_LIB = @GMP_LIB@
GREP = @GREP@
GUILE = @GUILE@
GUILE_CONFIG = @GUILE_CONFIG@
GUILE_CONFIG_VERSION = @GUILE_CONFIG_VERSION@
GUILE_CPPFLAGS = @GUILE_CPPFLAGS@
GUILE_LDFLAGS = @GUILE_LDFLAGS@
GUILE_PATH = @GUILE_PATH@
HAVE_BIBTEX_FALSE = @HAVE_BIBTEX_FALSE@
HAVE_BIBTEX_TRUE = @HAVE_BIBTEX_TRUE@
HAVE_BISON_FALSE = @HAVE_BISON_FALSE@
HAVE_BISON_TRUE = @HAVE_BISON_TRUE@
HAVE_BYACC_FALSE = @HAVE_BYACC_FALSE@
HAVE_BYACC_TRUE = @HAVE_BYACC_TRUE@
HAVE_CFLAT_FALSE = @HAVE_CFLAT_FALSE@
HAVE_CFLAT_TRUE = @HAVE_CFLAT_TRUE@
HAVE_CIRCO_FALSE = @HAVE_CIRCO_FALSE@
HAVE_CIRCO_TRUE = @HAVE_CIRCO_TRUE@
HAVE_CVS_FALSE = @HAVE_CVS_FALSE@
HAVE_CVS_TRUE = @HAVE_CVS_TRUE@
HAVE_DOT = @HAVE_DOT@
HAVE_DOTTY_FALSE = @HAVE_DOTTY_FALSE@
HAVE_DOTTY_TRUE = @HAVE_DOTTY_TRUE@
HAVE_DOT_FALSE = @HAVE_DOT_FALSE@
HAVE_DOT_TRUE = @HAVE_DOT_TRUE@
HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
HAVE_FDP_FALSE = @HAVE_FDP_FALSE@
HAVE_FDP_TRUE = @HAVE_FDP_TRUE@
HAVE_FIG2DEV_FALSE = @HAVE_FIG2DEV_FALSE@
HAVE_FIG2DEV_TRUE = @HAVE_FIG2DEV_TRUE@
HAVE_GXX_FALSE = @HAVE_GXX_FALSE@
HAVE_GXX_TRUE = @HAVE_GXX_TRUE@
HAVE_ICC_FALSE = @HAVE_ICC_FALSE@
HAVE_ICC_TRUE = @HAVE_ICC_TRUE@
HAVE_INFO_FALSE = @HAVE_INFO_FALSE@
HAVE_INFO_TRUE = @HAVE_INFO_TRUE@
HAVE_LATEX = @HAVE_LATEX@
HAVE_LATEX_FALSE = @HAVE_LATEX_FALSE@
HAVE_LATEX_TRUE = @HAVE_LATEX_TRUE@
HAVE_LEFTY_FALSE = @HAVE_LEFTY_FALSE@
HAVE_LEFTY_TRUE = @HAVE_LEFTY_TRUE@
HAVE_LIBGUILE_FALSE = @HAVE_LIBGUILE_FALSE@
HAVE_LIBGUILE_TRUE = @HAVE_LIBGUILE_TRUE@
HAVE_LVS_FALSE = @HAVE_LVS_FALSE@
HAVE_LVS_TRUE = @HAVE_LVS_TRUE@
HAVE_MAKEINDEX_FALSE = @HAVE_MAKEINDEX_FALSE@
HAVE_MAKEINDEX_TRUE = @HAVE_MAKEINDEX_TRUE@
HAVE_NEATO_FALSE = @HAVE_NEATO_FALSE@
HAVE_NEATO_TRUE = @HAVE_NEATO_TRUE@
HAVE_PDFLATEX = @HAVE_PDFLATEX@
HAVE_PDFLATEX_FALSE = @HAVE_PDFLATEX_FALSE@
HAVE_PDFLATEX_TRUE = @HAVE_PDFLATEX_TRUE@
HAVE_PKG_CONFIG_FALSE = @HAVE_PKG_CONFIG_FALSE@
HAVE_PKG_CONFIG_TRUE = @HAVE_PKG_CONFIG_TRUE@
HAVE_PRSIM_FALSE = @HAVE_PRSIM_FALSE@
HAVE_PRSIM_TRUE = @HAVE_PRSIM_TRUE@
HAVE_PS2EPSI_FALSE = @HAVE_PS2EPSI_FALSE@
HAVE_PS2EPSI_TRUE = @HAVE_PS2EPSI_TRUE@
HAVE_PS2PDF_FALSE = @HAVE_PS2PDF_FALSE@
HAVE_PS2PDF_TRUE = @HAVE_PS2PDF_TRUE@
HAVE_TWOPI_FALSE = @HAVE_TWOPI_FALSE@
HAVE_TWOPI_TRUE = @HAVE_TWOPI_TRUE@
HAVE_VCS_FALSE = @HAVE_VCS_FALSE@
HAVE_VCS_TRUE = @HAVE_VCS_TRUE@
HAVE_VPI_FALSE = @HAVE_VPI_FALSE@
HAVE_VPI_TRUE = @HAVE_VPI_TRUE@
HAVE_X11_FALSE = @HAVE_X11_FALSE@
HAVE_X11_TRUE = @HAVE_X11_TRUE@
HAVE_YACC_FALSE = @HAVE_YACC_FALSE@
HAVE_YACC_TRUE = @HAVE_YACC_TRUE@
HEAD = @HEAD@
HEXDUMP = @HEXDUMP@
INDENT = @INDENT@
INFO = @INFO@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@
INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTALL_TESTS_FALSE = @INSTALL_TESTS_FALSE@
INSTALL_TESTS_TRUE = @INSTALL_TESTS_TRUE@
INTERACTIVE_TESTS_FALSE = @INTERACTIVE_TESTS_FALSE@
INTERACTIVE_TESTS_TRUE = @INTERACTIVE_TESTS_TRUE@
LATEX = @LATEX@
LDFLAGS = @LDFLAGS@
LEFTY = @LEFTY@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LEX_VERSION = @LEX_VERSION@
LIBADD_DL = @LIBADD_DL@
LIBLTDL = @LIBLTDL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBTOOL_FLAGS = @LIBTOOL_FLAGS@
LN_S = @LN_S@
LTDLINCL = @LTDLINCL@
LTDL_OBJDIR = @LTDL_OBJDIR@
LTDL_SHLIBPATH_VAR = @LTDL_SHLIBPATH_VAR@
LTLIBOBJS = @LTLIBOBJS@
LVS = @LVS@
M4 = @M4@
MAKEINDEX = @MAKEINDEX@
MAKEINFO = @MAKEINFO@
NCURSES_INCLUDE = @NCURSES_INCLUDE@
NCURSES_LDPATH = @NCURSES_LDPATH@
NCURSES_LIB = @NCURSES_LIB@
NEATO = @NEATO@
OBJECT_ALIGN_CHECKING_FALSE = @OBJECT_ALIGN_CHECKING_FALSE@
OBJECT_ALIGN_CHECKING_TRUE = @OBJECT_ALIGN_CHECKING_TRUE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PASTE = @PASTE@
PATCH = @PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PDFLATEX = @PDFLATEX@
PERL = @PERL@
PERL_PATH = @PERL_PATH@
PKG_CONFIG = @PKG_CONFIG@
PRINTF = @PRINTF@
PRSIM = @PRSIM@
PS2EPSI = @PS2EPSI@
PS2PDF = @PS2PDF@
PSNUP = @PSNUP@
RANDOM_TESTS_FALSE = @RANDOM_TESTS_FALSE@
RANDOM_TESTS_TRUE = @RANDOM_TESTS_TRUE@
RANLIB = @RANLIB@
RL_INCLUDE = @RL_INCLUDE@
RL_LDPATH = @RL_LDPATH@
RL_LIB = @RL_LIB@
SED = sed
SET_MAKE = @SET_MAKE@
SH = @SH@

# force use of the ancient canonical bourne shell, 
# else configure may pick up bash as the shell interpreter.  
SHELL = @SH_PATH@
SH_PATH = @SH_PATH@
SLEEP = @SLEEP@
SORT = @SORT@
SRCDIR_BUILD_FALSE = @SRCDIR_BUILD_FALSE@
SRCDIR_BUILD_TRUE = @SRCDIR_BUILD_TRUE@
STRIP = @STRIP@
TAIL = @TAIL@
TEE = @TEE@
TEXI2HTML = @TEXI2HTML@
TOUCH = @TOUCH@
TR = @TR@
TRANSFIG = @TRANSFIG@
TWOPI = @TWOPI@
VCS = @VCS@
VERBOSE_CHECK_FALSE = @VERBOSE_CHECK_FALSE@
VERBOSE_CHECK_TRUE = @VERBOSE_CHECK_TRUE@
VERSION = @VERSION@
VPI_INCLUDE = @VPI_INCLUDE@
VPI_LDPATH = @VPI_LDPATH@
WANT_LIBMISCFUN_FALSE = @WANT_LIBMISCFUN_FALSE@
WANT_LIBMISCFUN_TRUE = @WANT_LIBMISCFUN_TRUE@
X11_INCLUDE = @X11_INCLUDE@
X11_LDPATH = @X11_LDPATH@
XARGS = @XARGS@
XDR_INCLUDE = @XDR_INCLUDE@
XDR_LDPATH = @XDR_LDPATH@
XDR_LIB = @XDR_LIB@
XFIG = @XFIG@
YACC = @YACC@
YACC_FIRST_TOKEN_ENUM = @YACC_FIRST_TOKEN_ENUM@
YACC_PURE_PARSER = @YACC_PURE_PARSER@
YACC_VERSION = @YACC_VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
# usually /bin/sh, but this is determined by configure
# add -v for verbose

# to control the version of automake (minimum)
AUTOMAKE_OPTIONS = 1.9 gnu
CP = cp -f
TEA = $(TEE) -a
PWD = @PWD@
RM = rm -f
MV = mv -f
SYNC = sync

# The following are detected and set by autoconf
# AR = ar
# ARFLAGS = -ru
# AWK = awk
# CPP = cpp
# LN = ln -fs
# RANLIB = ranlib

# defined with intention of self-modification... no used anymore
# THISMAKEFILE = Makefile

# standard automake targets to be initialized empty so subsequent uses
# may simply accumulate using +=, without having to worry about initialization

# filter-out is GNUMake feature
#	$($(filter-out $(HACKT_PARSE_TEST_PASSES), $(HACKT_PARSE_TEST_SUBJECTS)):=.stderr)

# must be previously defined
# CLEANFILES += $(TESTS)
# removed in favor of using pattern removes, for the sake of shortening
# shell commands' lengths, as some weaker shells have trouble with long cmds.
CLEANFILES = $(BOGUS_SUFFIX_TARGETS) \
	$(HACKT_CPP_PARSE_TEST_SUBJECTS:=.hac) $(EMPTY_CFLAT_PRS) \
	$(CLEAN_BOGUS_FILES) $(CHECK_SUMMARIES)
DISTCLEANFILES = .vcsmx_rebuild local.cvsignore check.log cvsdiffs \
	$(AUTO_DEPENDS)

# 'csrc' is the temporary directory used in VCS compilation
CLEANDIRS = csrc .csrc $(HACKT_VPI_TEST_SCRIPTS_BASES:=.csrc) \
	$(HACKT_VPI_TEST_SCRIPTS_BASES:=.vx.csrc) \
	$(HACKT_VPI_TEST_SCRIPTS_BASES:=.vxi.csrc) \
	$(HACKT_VPI_TEST_SCRIPTS_BASES:=.vx.daidir) \
	$(HACKT_VPI_TEST_SCRIPTS_BASES:=.vxi.daidir)
DISTCLEANDIRS = 

# this contains empty files to be removed, listed in EMPTY_CFLAT_PRS
EXTRA_DIST = $(HACKT_CFLAT_TEST_SUBJECTS:=.expect-prs)
TESTS = $(am__append_3) $(am__append_8)
# EXTRA_DIST files that should only be searched from the srcdir

# additional sources not already mentioned
# don't expect randomized tests with failures, do we?
srcdir_EXTRA_DIST = README $(HACKT_PARSE_TEST_SUBJECTS:=.hac) \
	$(HACKT_CPP_PARSE_TEST_SUBJECTS:=.hac-cpp) \
	$(HACKT_PARSE_TEST_FAILURES:=.stderr) \
	$(HACKT_CPP_PARSE_TEST_FAILURES:=.stderr) \
	$(HACKT_PARSE_TEST_WARNINGS:=.stderr) \
	$(BISON_OUTPUTS:=.stderr.bison) \
	$(HACKT_FLATTEN_TEST_SUBJECTS:=.hac) \
	$(HACKT_FLATTEN_TEST_SUBJECTS:=.hacf-expect) \
	$(HACKT_CREATE_TEST_SUBJECTS:=.createstderr) \
	$(HACKT_ALLOC_TEST_SUBJECTS:=.allocstderr) \
	$(HACKT_CFLAT_LVS_TEST_SUBJECTS:=.hac) \
	$(HACKT_CFLAT_LVS_TEST_SUBJECTS:=.expect-lvsprs) \
	$(HACKT_CFLAT_SEU_TEST_SUBJECTS:=.expect-prsseu) \
	$(HACKT_CFLAT_SPRS_TEST_SUBJECTS:=.expect-sprs) \
	$(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.expect-prsimexpr) \
	$(HACKT_PRSIMRC_TEST_SUBJECTS:=.hac) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_BASES:=.prsimrc) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_BASES:=.prsimrc-expect) \
	$(HACKT_PRSIMTRACE_TEST_SUBJECTS:=.prsimtrace-expect) \
	$(HACKT_VPI_TEST_SCRIPTS_BASES:=.v) \
	$(HACKT_VPI_TEST_SCRIPTS_BASES:=.expect-vpi) \
	$(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS:=.expect-chpsimalloc) \
	$(HACKT_CHPSIMRC_TEST_SUBJECTS:=.hac) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_BASES:=.chpsimrc) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_BASES:=.chpsimrc-expect) \
	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_BASES:=.chpsimrc) \
	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_BASES:=.chpsimrc-expect) \
	$(HACKT_GUILE_TEST_SCRIPTS_BASES:=.hacscm) \
	$(HACKT_GUILE_TEST_SCRIPTS_BASES:=.hacscm-expect) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_BASES:=.hacchpsimscm) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_BASES:=.hacchpsimscm-expect) \
	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_BASES:=.hacchpsimscm) \
	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_BASES:=.hacchpsimscm-expect) \
	$(HACKNET_TEST_SCRIPTS_BASES:=.hac) \
	$(HACKNET_TEST_SCRIPTS_BASES:=.spice-expect)

# pipe to strip out srcdir from a name
# NOTE: this was ripped from $(am__vpath_adj_setup)
#	and $(am__vpath_adj)
SED_srcdir_strip_setup = srcdirstrip=`$(ECHO) "$(srcdir)" | $(SED) 's|.|.|g'`
# SED_srcdir_strip_setup = $(am__vpath_adj_setup)
SED_srcdir_strip_fast = $(SED) "s|^$$srcdirstrip/||"
SED_srcdir_strip = { $(SED_srcdir_strip_setup) ; $(SED_srcdir_strip_fast) ;}

# strip all directory prefix (from am__strip_dir)
SED_stripdir = $(SED) 's|^.*/||'

# these files are automatically removed from distribution by dist-hook
DISTHOOK_CLEANFILES = $(CLEAN_BOGUS_FILES) $(EMPTY_CFLAT_PRS)

# The following macros are custom-defined for use with this project, 
# in particular for coupled use with Make.global.

# yeah, stupid place to put a globally useful script, move it later...
# WARNING: don't put spaces in file names!
# SPACES_TO_NEWLINE = $(AWK) '{gsub("[ \t]+","\n"); print;}'
SPACES_TO_NEWLINE = $(TR) '[:blank:]' '\n'

# to accumulate and generate automatic .cvsignore
# we've provided some project wide definitions in Make.global
# NOTE: only directory and file names here
# Wild-cards like "*.foo*" must be wrapped in quotes when listed

# consider using CLEANFILES

# list of files to automatically CVS ignore, accumulated over Makefile
AUTO_IGNORE = $(HACKT_COMPILE_CLEAN_IGNORE_PATTERNS) \
	$(HACKT_FLATTEN_CLEAN_IGNORE_PATTERNS) \
	$(HACKT_CREATE_CLEAN_IGNORE_PATTERNS) \
	$(HACKT_ALLOC_CLEAN_IGNORE_PATTERNS) \
	$(HACKT_CFLAT_CLEAN_IGNORE_PATTERNS) $(EMPTY_CFLAT_PRS) \
	$(HACKT_PRSIM_CLEAN_IGNORE_PATTERNS) \
	$(HACKT_VPI_CLEAN_IGNORE_PATTERNS) .vcsmx_rebuild \
	$(HACKT_CHPSIM_CLEAN_IGNORE_PATTERNS) \
	$(HACKT_GUILE_CLEAN_IGNORE_PATTERNS) \
	$(HACKNET_CLEAN_IGNORE_PATTERNS) local.cvsignore \
	$(CHECK_SUMMARIES) $(GENERAL_CLEAN_IGNORE_PATTERNS) \
	.gdb_history .cvsignore Makefile.in Makefile make.log ignore \
	backup temp $(CLEANFILES) $(DISTCLEANFILES)

# automatically built dependencies

# compilepasstest doesn't need autodependencies
AUTO_DEPENDS = hac-cpp.autodepend compileobjdiff.autodepend \
	compilewarntest.autodepend compilefailtest.autodepend \
	hacfobjdifftest.autodepend compileflattest.autodepend \
	hacflattest.autodepend hacflatfailtest.autodepend \
	createtest.autodepend createfailtest.autodepend \
	alloctest.autodepend allocfailtest.autodepend \
	allocfromhaco.autodepend cflatprstest.autodepend \
	cflatlvstest.autodepend cflatlvsfailtest.autodepend \
	cflatprsseutest.autodepend cflatsprstest.autodepend \
	hacktprsdottest.autodepend prsimtracetest.autodepend \
	prsimexprtest.autodepend prsimrc-out.autodepend \
	prsimrcfail-out.autodepend prsimtest.autodepend \
	prsimfailtest.autodepend prsimckpttest.autodepend \
	prsimopttest.autodepend vpitest.autodepend \
	chpsimalloctest.autodepend chpsimrc-out.autodepend \
	chpsimrcfail-out.autodepend chpsimrctest.autodepend \
	chpsimrcfailtest.autodepend chpsimckpttest.autodepend \
	hacscm-out.autodepend hacscmfail-out.autodepend \
	hacscmtest.autodepend hacscmfailtest.autodepend \
	hacchpsimscm-out.autodepend hacchpsimscmfail-out.autodepend \
	hacchpsimscmtest.autodepend hacchpsimscmfailtest.autodepend \
	hacknet.autodepend hacknettest.autodepend \
	hacknetfailtest.autodepend test.autodepend

# since automake doesn't allow appending RECURSIVE_TARGETS, we define our own:
MORE_RECURSIVE_TARGETS = force-recursive check-summaries-recursive \
	$(am__append_17) build-check-recursive
MORE_CLEAN_RECURSIVE_TARGETS = clean-tests-recursive \
	clean-summaries-recursive distclean-depend-recursive \
	cleaner-recursive $(am__append_18)

# This helper script is built by the top-level Makefile
# This is useful self-contained script for transforming program names
# to their installed names.  
INSTALL_TRANSFORM_SH = $(top_builddir)/install_transform.sh

# more robust way of removing patterns
# note: pattern arguments must be wrapped in quotes, e.g. "*.o"
RM_PATTERN = $(top_srcdir)/scripts/rm_pattern.sh

# for automatic regeneration of configured files:
RECONFIGURE = cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

# script to extract texinfo documentation from source:
# invokable after cd $(srcdir):
EXTRACT_TEXINFO_IN_SRCDIR = $(AWK) -f $(top_builddir)/scripts/extract_texinfo.awk
# invokable from any subdir:
EXTRACT_TEXINFO = $(AWK) -f $(top_srcdir)/scripts/extract_texinfo.awk

# suffixes used by all test directories' Makefiles
# automake will convert these into .SUFFIXES:
# (these can really be distributed across Makefiles...)
SUFFIXES = .hac .depend $(am__append_1) $(HACKT_COMPILE_SUFFIXES) \
	$(HACKT_COMPILE_TEST_SUFFIXES) $(HACKT_FLATTEN_SUFFIXES) \
	$(HACKT_FLATTEN_TEST_SUFFIXES) $(HACKT_CREATE_SUFFIXES) \
	$(HACKT_CREATE_TEST_SUFFIXES) $(HACKT_ALLOC_SUFFIXES) \
	$(HACKT_ALLOC_TEST_SUFFIXES) $(HACKT_CFLAT_SUFFIXES) \
	$(HACKT_CFLAT_TEST_SUFFIXES) $(HACKT_GRAPH_SUFFIXES) \
	$(HACKT_PRSIM_SUFFIXES) $(HACKT_PRSIM_TEST_SUFFIXES) \
	$(HACKT_VPI_SUFFIXES) $(HACKT_VPI_TEST_SUFFIXES) \
	$(HACKT_CHPSIM_SUFFIXES) $(HACKT_CHPSIM_TEST_SUFFIXES) \
	$(HACKT_GUILE_SUFFIXES) $(HACKT_GUILE_TEST_SUFFIXES) \
	$(HACKNET_SUFFIXES) $(HACKNET_TEST_SUFFIXES)

# if suffix substitutions ever result in target names with just the suffix
# then just touch empty files with name.
# NOTE: built test script should not be named here, as then need to be
# chmod-ed to be executable.  
BOGUS_SUFFIX_TARGETS = .hac .depend $(am__append_2) \
	$(HACKT_COMPILE_SUFFIXES) $(HACKT_FLATTEN_SUFFIXES) \
	$(HACKT_CREATE_SUFFIXES) $(HACKT_ALLOC_SUFFIXES) \
	$(HACKT_CFLAT_SUFFIXES) $(HACKT_GRAPH_SUFFIXES) \
	$(HACKT_PRSIM_SUFFIXES) $(HACKT_VPI_SUFFIXES) \
	$(HACKT_CHPSIM_SUFFIXES) $(HACKT_GUILE_SUFFIXES) \
	$(HACKNET_SUFFIXES)

# for compile include paths
HACO_FLAGS = -I$(srcdir)

# the {in,out,create,alloc}dump suffixes are just for testing convenience.  
# They follow the procedures in the test scripts.  

# names of test cases (without extension) whose compile error output
# differs when using bison vs. yacc (result of different state-machines)
BISON_OUTPUTS = 

# tests expecting empty .prs outputs
EMPTY_CFLAT_PRS_TESTS = 
HACKT_PARSE_TEST_PASSES = \
	bool-and bool-or bool-xor \
	bool-copy bool-source bool-sink \
	bool-sink-alt \
	bool-split bool-merge \
	bool-copy-test \
	bool-table bool-memory \
	bool-buf \
	bool-peekbuf \
	bool-alternator \
	bool-peekbuf-test \
	bool-sink-alt-test \
	int-source int-sink \
	int-table \
	int-buf int-copy \
	int-arith \
	int-sort \
	int-merge int-split \
	channel-sync channel-desync \
	fibonacci \
	void-sink void-source void-buf \
	round-robin round-robin-test \
	bitrouter bitrouter-dec \
	bitrouter-env bitrouter-test \
	quad-bitrouter

HACKT_CREATE_TEST_PASSES = \
	bool-copy-test \
	bool-peekbuf-test \
	bool-sink-alt-test \
	round-robin-test \
	bitrouter-test

HACKT_ALLOC_TEST_PASSES = $(HACKT_CREATE_TEST_PASSES)
HACKT_CHPSIM_ALLOC_TEST_SUBJECTS = $(HACKT_ALLOC_TEST_PASSES)
HACKT_CHPSIMRC_TEST_SUBJECTS = 
HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES = 

# HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES =
HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES = \
	bool-copy-test-01


# our collection of test programs/scripts/commands
HACKT_EXE = $(top_builddir)/src/hackt
PARSE_TEST_EXE = $(HACKT_EXE) parse_test
HACKT_COMPILE_EXE = $(top_builddir)/src/haco
HACKT_FLATTEN_EXE = $(top_builddir)/src/hacpp
HACKT_OBJDUMP_EXE = $(top_builddir)/src/hacobjdump
HACKT_CREATE_EXE = $(top_builddir)/src/haccreate
HACKT_ALLOC_EXE = $(top_builddir)/src/hacalloc
HACKT_CFLAT_EXE = $(top_builddir)/src/hflat
HACKT_CFLAT_PRSIM_EXE = $(HACKT_CFLAT_EXE) prsim
HACKT_CFLAT_PRSIM_SEU_EXE = $(HACKT_CFLAT_PRSIM_EXE) -f SEU
HACKT_CFLAT_SPRS_EXE = $(HACKT_CFLAT_PRSIM_EXE) -fsizes
HACKT_CFLAT_LVS_EXE = $(HACKT_CFLAT_EXE) lvs
HACKT_PRSIM_EXE = $(top_builddir)/src/hacprsim
HACKT_CHPSIM_EXE = $(top_builddir)/src/hacchpsim
HACKNET_EXE = $(top_builddir)/src/hacknet

# guile based tests will need a modified environment, see Make.test-guile
# -q flag inhibits loading of user's ~/.guile init file
SCM_SRCDIR = $(top_srcdir)/src/scm
HACKT_GUILE_EXE = $(GUILE) -q -l $(SCM_SRCDIR)/hacguile.scm --
HACKT_CHPSIM_GUILE_EXE = $(GUILE) -q -l $(SCM_SRCDIR)/hacchpsimguile.scm --

# install-time only test scripts and executables
INSTALLED_HACGUILE = hacguile
INSTALLED_HACCHPSIMGUILE = hacchpsimguile

# explicitly prepend path to force subshell to find installed executables first
INSTALL_PATH_OVERRIDE = $(bindir)$(PATH_SEPARATOR)"$$PATH"

# library path for running/linking/loading pre-installed libraries and modules
PRE_INST_LDPATH = $(top_builddir)/src$(PATH_SEPARATOR)$(top_builddir)/src/$(LTDL_OBJDIR)

# NOTE: these scripts are configure-generated from their .hac files.  
TEST_SRCDIR = $(top_srcdir)/test
TEST_BUILDDIR = $(top_builddir)/test

# SPACES_TO_NEWLINE defined as inline awk command in Make.stddef
POM_HEADER_FILTER = $(AWK) -f $(TEST_BUILDDIR)/POM-header-filter.awk
POM_INDEX_FILTER = $(AWK) -f $(TEST_SRCDIR)/POM-index-filter.awk
POM_SIZE_FILTER = $(AWK) -f $(TEST_SRCDIR)/POM-size-filter.awk
HEX_ADDRESS_FILTER = $(SED) -f $(TEST_SRCDIR)/address_filter.sed
HACKT_OBJ_DIFF_FILTER = $(POM_HEADER_FILTER) | $(GREP) -v "finish writing"
ANALYZE_DIFF_AWK = $(AWK) -f $(TEST_SRCDIR)/analyze-dump-diff.awk
CHPSIM_TRACE_BINARY_FILTER = $(AWK) -f $(TEST_SRCDIR)/chpsim-binary-size-filter.awk
# happens to be close enough to be reusable!
PRSIM_TRACE_BINARY_FILTER = $(CHPSIM_TRACE_BINARY_FILTER)

# objdump should NOT fail under any circumstances
# reminder: dump goes to stderr
DEFAULT_OBJDUMP_RULE_ACTION = $(HACKT_OBJDUMP_EXE) $< > $@ 2>&1
OBJDUMP_APPEND = $(HACKT_OBJDUMP_EXE) $< >> $@ 2>&1

# this dependency generator assumes default target suffix .haco
# caution: concurrent builds of .haco and .depend may clobber this
# if executable did not successfully build, then skip.
HAC_DEPEND_FILTER = $(SED) -e '/haco:/s|^$(srcdir)\/||g' \
	-e 's/haco:/haco $@:/g' -e 's/^:/$@:/' -e 's/\.depend:/.haco:/'

# the following works for VPATH, but need to test for srcdir = .
# -e 's|$(srcdir)|$$(srcdir)|g'

# arg, need to escape the friggin' hash!
SHELL_INTERPRETER = "\#!$(SHELL)"
DEFAULT_DIFF_TEST_SCRIPT = \
	$(ECHO) "Summarizing $@ ..." ; \
	{ $(ECHO) $(SHELL_INTERPRETER) ; \
	$(ECHO) "\# \"$@\"" ; \
	if test -s $< ; then \
	  $(ECHO) "$(ECHO) $< is non-empty!" ; \
	  $(ECHO) "exit 1" ; \
	fi ;} > $@ ; \
	$(CHMOD) +x $@

SKIP_TEST_SCRIPT = \
	$(ECHO) "Skipping $@ ..." ; \
	{ $(ECHO) $(SHELL_INTERPRETER) ; \
	  $(ECHO) "\# \"$@\"" ; \
	  $(ECHO) "exit 77" ;} > $@ ; \
	$(CHMOD) +x $@

DUMMY_TEST_SCRIPT = $(ECHO) "$(SHELL_INTERPRETER)" > $@ ; $(CHMOD) +x $@
@VERBOSE_CHECK_FALSE@ECHO_FILTERED = :
@VERBOSE_CHECK_TRUE@ECHO_FILTERED = $(ECHO) "Filtered $@"

# Each run-commands script should include the command to invoke
# for loading the object, e.g.: hackt prsim foo.haco-a
# This rule should deduce the input object from the source script.  

# to apply different compile flags to the same source file
EXTRACT_HACO_FLAGS_PIPE = $(GREP) "@haco-flags@" | $(HEAD) -n1 | \
	$(SED) 's/^.*@haco-flags@[ ]*//g'

EXTRACT_HACPP_FLAGS_PIPE = $(GREP) "@hacpp-flags@" | $(HEAD) -n1 | \
	$(SED) 's/^.*@hacpp-flags@[ ]*//g'

EXTRACT_HFLAT_FLAGS_PIPE = $(GREP) "@hflat-flags@" | $(HEAD) -n1 | \
	$(SED) 's/^.*@hflat-flags@[ ]*//g'


# useful for extracting object file name from a source script
# EXTRACT_HACO_PIPE = $(GREP) "^\#" ...
EXTRACT_HACO_PIPE = $(GREP) "@haco@" | $(HEAD) -n1 | \
	$(SED) 's/^.*@haco@[ ]*//'

#	$(AWK) '{ntok=split($$0, toks); print toks[ntok]; }'

# This analogously extracts the name of a tracefile from source.
EXTRACT_CHPSIMTRACE_PIPE = $(GREP) "@chpsimtrace@" | $(HEAD) -n1 | \
	$(AWK) '{ntok=split($$0, toks); print toks[ntok]; }'


# General script for extracting additional dependencies from source files.
EXTRACT_DEPS_PIPE = $(GREP) "@deps@" | $(SED) 's/^.*@deps@[ ]*//g'

# General script for extracting additional anti-dependencies from source files.
# Useful for automatically cleaning side-effect files.
EXTRACT_ANTIDEPS_PIPE = $(GREP) "@antideps@" | $(SED) 's/^.*@antideps@[ ]*//g'

# This mechanism could be generalized to produce extra dependencies
# that do not need to be named as arguments to the invoking command.  
# For example, dependencies known by the user or hard-coded names.  

# These included templates contain all the rules
BOGUS_TESTS = .hacktcmpltest .hacktcmplwarntest .hacktcmplfailtest \
	.hacktobjtest .hacflattest .hacflatfailtest .hacfobjdifftest \
	.compileflatdump-test .hacktcreatetest .hacktcreatefailtest \
	.hacktallocfromhacotest .hacktalloctest .hacktallocfailtest \
	.hacktcflattest .hacktcflatlvstest .hacktcflatlvsfailtest \
	.hacktcflatseutest .hacktsprstest .hacktprsdottest \
	.hacktprsimexprtest .prsimtest .prsimfailtest .prsimtracetest \
	.prsimckpttest .prsimopttest .vpitest .chpsimalloctest \
	.chpsimtest .chpsimdottest .chpsimfailtest .chpsimckpttest \
	.hacscmtest .hacscmfailtest .hacchpsimscmtest \
	.hacchpsimscmfailtest .hacknettest .hacknetfailtest
BOGUS_TARGETS = .hac .hac .hacf .hacf-fail .hacf-filter \
	.hacf-fail-filter .createstderr .createfaildiff \
	.createfaildump .allocstderr .expect-prs
HAC_COMPILE_OBJECT_TARGETS = $(HACKT_PARSE_TEST_SUBJECTS:=.haco) \
	$(HACKT_PRSIMRC_TEST_SUBJECTS:=.haco) \
	$(HACKT_CHPSIMRC_TEST_SUBJECTS:=.haco) \
	$(HACKT_GUILE_TEST_SUBJECTS:=.haco) \
	$(HACKT_CHPSIM_GUILE_TEST_SUBJECTS:=.haco) \
	$(HACKNET_TEST_SCRIPTS_BASES:=.haco)
# not bothering with unroll anymore...
HAC_CREATE_OBJECT_TARGETS = $(HACKT_PARSE_TEST_SUBJECTS:=.haco-c) \
	$(HACKT_PRSIMRC_TEST_SUBJECTS:=.haco-c) \
	$(HACKT_CHPSIMRC_TEST_SUBJECTS:=.haco-c) \
	$(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS:=.haco-c) \
	$(HACKT_GUILE_TEST_SUBJECTS:=.haco-c) \
	$(HACKT_CHPSIM_GUILE_TEST_SUBJECTS:=.haco-c) \
	$(HACKNET_TEST_SCRIPTS_BASES:=.haco-c)
HAC_ALLOC_OBJECT_TARGETS = $(HACKT_PARSE_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_PRSIMRC_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CHPSIMRC_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_GUILE_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CHPSIM_GUILE_TEST_SUBJECTS:=.haco-a) \
	$(HACKNET_TEST_SCRIPTS_BASES:=.haco-a)
CHECK_SUMMARIES = compilediffs compilewarndiffs compilefaildiffs \
	compileobjdiffs hacflatdiffs hacflatfaildiffs hacfobjdiffs \
	compileflatdiffs creatediffs createfaildiffs \
	creatediffs.noindex creatediffs.nosize allocdiffs \
	allocfaildiffs allocfromhacodiffs allocdiffs.noindex prsdiffs \
	prsdiffs.sort lvsprsdiffs lvsfaildiffs prsseudiffs \
	prsseudiffs.sort sprsdiffs sprsdiffs.sort prsimexprdiffs \
	prsimrcdiffs prsimrcfaildiffs prsimtracediffs prsimckptdiffs \
	prsimoptdiffs vpidiffs chpsimallocdiffs chpsimrcdiffs \
	chpsimrcdiffs.nosize chpsimrcfaildiffs chpsimckptdiffs \
	hacscmdiffs hacscmfaildiffs hacchpsimscmdiffs \
	hacchpsimscmfaildiffs hacknetdiffs hacknetfaildiffs
HACKT_COMPILE_SUFFIXES = \
	.hac-cpp .hacdepend .haco \
	.compiledump .compiledump-filter .compilewarndiff .compilefaildiff \
	.outdump .indump .haco-dump \
	.outdump-filter .indump-filter .compileobjdiff

HACKT_COMPILE_TEST_SUFFIXES = \
	.hacktcmpltest .hacktcmplwarntest .hacktcmplfailtest \
	.hacktobjtest

HACKT_COMPILE_CLEAN_IGNORE_PATTERNS = \
	"*.compiledump" \
	"*.compiledump-filter" \
	"*.compilewarndiff" \
	"*.compilefaildiff" \
	"*.test" \
	"*.nowarn" \
	"*.diff" \
	"*.test.filter" \
	"*.hacktcmpltest" \
	"*.hacktcmplwarntest" \
	"*.hacktcmplfailtest" \
	"*.stderr.filter" \
	"*.stderr.bison.filter" \
	"*.bison.diff" \
	"*.outdump" \
	"*.outdump-filter" \
	"*.indump" \
	"*.indump-filter" \
	"*.compileobjdiff" \
	"*.hacktobjtest"

HACKT_COMPILE_ERROR_FILTER = $(AWK) \
		-f $(TEST_SRCDIR)/hackt-parse-expect-filter.awk \
		-f $(TEST_SRCDIR)/state_enum_filter.awk \
		-f $(TEST_SRCDIR)/vpath_file_filter.awk

HACKT_COMPILE_SETUP = \
	depbase=`$(ECHO) $@ | $(SED) 's/\.haco$$//g'` && \
	log="$$depbase.compiledump" && \
	flags=`$(CAT) $< | $(EXTRACT_HACO_FLAGS_PIPE)`

HACKT_COMPILE_TEST_DEFAULT_SCRIPT = \
	$(HACKT_COMPILE_SETUP) && \
	$(ECHO) "$(HACKT_COMPILE_EXE) $(HACO_FLAGS) $$flags -M $$depbase.depend $< $@" && \
	if $(HACKT_COMPILE_EXE) $(HACO_FLAGS) $$flags -M "$$depbase.tmpd" $< $@ > "$$log" 2>&1 ; \
	then $(CAT) "$$depbase.tmpd" | \
		$(HAC_DEPEND_FILTER) > "$$depbase.depend" && \
		$(RM) "$$depbase.tmpd" ; \
	else $(RM) "$$depbase.tmpd" ; exit 1 ; \
	fi

#	$(HACKT_COMPILE_EXE) $(HACO_FLAGS) $< $@

# use this variant for piping stdin
HACKT_COMPILE_TEST_STDIN_SCRIPT = \
	$(HACKT_COMPILE_SETUP) && \
	flags="$$flags -p" && \
	$(ECHO) "$(HACKT_COMPILE_EXE) $(HACO_FLAGS) $$flags -M $$depbase.depend $@ < $<" && \
	if $(HACKT_COMPILE_EXE) $(HACO_FLAGS) $$flags -M "$$depbase.tmpd" $@ < $< > "$$log" 2>&1 ; \
	then $(CAT) "$$depbase.tmpd" | \
		$(HAC_DEPEND_FILTER) > "$$depbase.depend" ; \
		$(RM) "$$depbase.tmpd" ; \
	else $(RM) "$$depbase.tmpd" ; exit 1 ; \
	fi


# -MD generates dependencies as a side-effect of preprocessing
# HACKT_CPP_FLAGS = $(HACO_FLAGS) -MP -MD -MF $@depend -MT $@
HACKT_CPP_FLAGS = $(HACO_FLAGS)
HACKT_CPP_MKDEP_FLAGS = -M -MP
@VERBOSE_CHECK_FALSE@ECHO_COMPILEDUMP_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_COMPILEDUMP_COMMAND = $(ECHO) "Compile-dumping $< to .compiledump (expect-fail)"
@VERBOSE_CHECK_FALSE@ECHO_OUTDUMP_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_OUTDUMP_COMMAND = $(ECHO) "Compile-dumping $< to .outdump"
@VERBOSE_CHECK_FALSE@ECHO_OBJDUMP_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_OBJDUMP_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$odump $<"
@VERBOSE_CHECK_FALSE@ECHO_COMPILEWARN_DIFF_COMMAND = :

# additional dependencies:
# .compilewarndiff.stderr (srcdir)
@VERBOSE_CHECK_TRUE@ECHO_COMPILEWARN_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $$log"
@HAVE_BISON_TRUE@@VERBOSE_CHECK_FALSE@ECHO_BISON_DIFF_COMMAND = :
@HAVE_BISON_TRUE@@VERBOSE_CHECK_TRUE@ECHO_BISON_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr.bison $<"
@HAVE_BISON_FALSE@BISON_COMPILE_DIFF_SCRIPT = :
@HAVE_BISON_TRUE@BISON_COMPILE_DIFF_SCRIPT = \
@HAVE_BISON_TRUE@	if test -s $@ ; then \
@HAVE_BISON_TRUE@	  expect="$$expect".bison ; \
@HAVE_BISON_TRUE@	  if test -f "$$expect" ; then \
@HAVE_BISON_TRUE@	    $(ECHO_BISON_DIFF_COMMAND) ; \
@HAVE_BISON_TRUE@	    $(DIFF) -bu "$$expect" $< > $@-bison 2>&1 ; \
@HAVE_BISON_TRUE@	    if test ! -s $@-bison ; then $(MV) $@-bison $@ ; \
@HAVE_BISON_TRUE@	    else $(ECHO) "$@-bison is non-empty!" | $(TEE) $@ ; \
@HAVE_BISON_TRUE@	    fi ; \
@HAVE_BISON_TRUE@	  else \
@HAVE_BISON_TRUE@	    $(ECHO) "Missing $$expect or diffs unrelated to parser." | \
@HAVE_BISON_TRUE@	      $(TEA) $@ ; \
@HAVE_BISON_TRUE@	  fi ; \
@HAVE_BISON_TRUE@	fi

@VERBOSE_CHECK_FALSE@ECHO_COMPILEDUMP_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_COMPILEDUMP_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $<"
HACKT_PARSE_TEST_SUBJECTS = \
	$(HACKT_PARSE_TEST_PASSES) \
	$(HACKT_PARSE_TEST_WARNINGS) \
	$(HACKT_PARSE_TEST_FAILURES)

HACKT_CPP_PARSE_TEST_SUBJECTS = \
	$(HACKT_CPP_PARSE_TEST_PASSES) \
	$(HACKT_CPP_PARSE_TEST_FAILURES)

HACKT_OBJ_TEST_SUBJECTS = \
	$(HACKT_PARSE_TEST_PASSES) \
	$(HACKT_PARSE_TEST_WARNINGS) \
	$(HACKT_CPP_PARSE_TEST_PASSES)

HACKT_PARSE_FAIL_DUMPS = $(HACKT_PARSE_TEST_FAILURES:=.compiledump) \
	$(HACKT_CPP_PARSE_TEST_FAILURES:=.compiledump)
HACKT_COMPILE_OBJ_DUMPS = $(HACKT_OBJ_TEST_SUBJECTS:=.outdump)
HACKT_FLATTEN_ERROR_FILTER = $(AWK) \
		-f $(TEST_SRCDIR)/hackt-flatten-expect-filter.awk \
		-f $(TEST_SRCDIR)/vpath_file_filter.awk

HACKT_FLATTEN_SUFFIXES = \
	.hacf .hacf-filter .hacf-diff \
	.hacf-fail .hacf-fail-filter .hacf-fail-diff \
        .hacfo .compileflatdump .compileflatdump-filter \
        .compileflatdump-diff \
        .findump .findump-filter .hacfobjdiff

HACKT_FLATTEN_TEST_SUFFIXES = \
        .hacflattest \
        .hacflatfailtest \
	.hacfobjdifftest \
	.compileflatdump-test

HACKT_FLATTEN_CLEAN_IGNORE_PATTERNS = \
	"*.hacf" \
	"*.hacf-filter" \
	"*.hacf-diff" \
	"*.hacf-fail" \
	"*.hacf-fail-filter" \
	"*.hacf-fail-diff" \
	"*.hacflattest" \
	"*.hacflatfailtest" \
	"*.hacfo" \
	"*.compiledump-filter-tmp" \
	"*.compileflatdump" \
	"*.compileflatdump-filter" \
	"*.compileflatdump-diff" \
	"*.compileflatdump-test" \
	"*.findump" \
	"*.findump-filter" \
	"*.hacfobjdiff" \
	"*.hacfobjdifftest"


###############################################################################
# TODO: enable dependency tracking by default (see compile script)
HACKT_FLATTEN_TEST_DEFAULT_SCRIPT = \
	flags=`$(CAT) $< | $(EXTRACT_HACPP_FLAGS_PIPE)` && \
	cmd="$(HACKT_FLATTEN_EXE) $$flags $(HACO_FLAGS) $<" && \
	$(ECHO) "$$cmd > $@" && \
	$$cmd > $@ && \
	$(TOUCH) $@

#	@depbase=`$(ECHO) $@ | $(SED) 's/\.haco$$//g'` ; \
#	log="$$depbase.compiledump" ; \
#	$(ECHO) "$(HACKT_COMPILE_EXE) $(HACO_FLAGS) -M $$depbase.depend $< $@" ; \
#	if $(HACKT_COMPILE_EXE) $(HACO_FLAGS) -M "$$depbase.tmpd" $< $@ > "$$log" 2>&1 ; \
#	then $(CAT) "$$depbase.tmpd" | \
#		$(HAC_DEPEND_FILTER) > "$$depbase.depend" ; \
#		$(RM) "$$depbase.tmpd" ; \
#	else $(RM) "$$depbase.tmpd" ; exit 1 ; \
#	fi

# use this variant when piping stdin
HACKT_FLATTEN_TEST_STDIN_SCRIPT = \
	flags=`$(CAT) $< | $(EXTRACT_HACPP_FLAGS_PIPE)` && \
	cmd="$(HACKT_FLATTEN_EXE) $$flags $(HACO_FLAGS)" && \
	$(ECHO) "$$cmd < $< > $@" && \
	$$cmd < $< > $@ && \
	$(TOUCH) $@

@VERBOSE_CHECK_FALSE@ECHO_FLATTEN_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_FLATTEN_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$expect $<"
COMPILEFLATDUMP_EXTRA_FILTER = $(SED) -e '/^At:/s/\.hacf/.hac/' \
	-e '/(imported-root.*)/s|\[.*\]|\[\#POS\#\]|' \
	-e '/^At:.*:0:/d'

HACKT_FLATTEN_TEST_SUBJECTS = \
	$(HACKT_FLATTEN_TEST_PASSES) \
	$(HACKT_FLATTEN_TEST_WARNINGS) \
	$(HACKT_FLATTEN_TEST_FAILURES)


# cover all possible cases, whether they pass or fail
HACKT_FLATTEN_DUMPS = $(HACKT_FLATTEN_TEST_SUBJECTS:=.hacf) \
	$(HACKT_FLATTEN_TEST_SUBJECTS:=.hacf-fail)


# CREATE tests
HACKT_CREATE_SUFFIXES = \
	.haco-c .createdump .createdump-filter .createstderr .creatediff \
	.createfaildump .createfaildiff .haco-c-dump .haco-c-err \
	.haco-c-from-haco .haco-c-from-haco-err .create-from-haco-dump \
	.create-from-haco-dump-filter .create-from-haco-diff

HACKT_CREATE_TEST_SUFFIXES = \
	.hacktcreatetest .hacktcreatefailtest

HACKT_CREATE_CLEAN_IGNORE_PATTERNS = \
	"*.hacktcreatetest" \
	"*.hacktcreatefailtest" \
	"*.hacktcreatefromhacotest" \
	"*.haco-c" \
	"*.haco-c-err" \
	"*.createdump" \
	"*.creatediff" \
	"*.creatediff-orig" \
	"*.createfaildump" \
	"*.createfaildiff" \
	"*.haco-c-dump" \
	"*.createdump-filter" \
	"*.createdump-filter-noindex" \
	"*.createdump-filter-nosize" \
	"*.createdump.filter" \
	"*.createstderr-noindex" \
	"*.creatediff-noindex" \
	"*.createstderr-nosize" \
	"*.creatediff-nosize" \
	"*.create-from*" \
	"*.haco-c-from*"

CREATE_OBJDUMP_SCRIPT = \
	if test -s $<-err ; then \
	  $(CP) $<-err $@ ; $(ECHO) "---- END CREATE WARNINGS ---" >> $@ ; \
	else $(RM) $@ ; fi ; \
	$(OBJDUMP_APPEND)

HACKT_CREATE_TEST_DIFF = $(DIFF) -buw
@VERBOSE_CHECK_FALSE@ECHO_CREATEDUMP_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CREATEDUMP_DIFF_COMMAND = $(ECHO) "$(HACKT_CREATE_TEST_DIFF) $$""(srcdir)/$$stderr $<"
@ABI_ILP32_FALSE@CREATE_HEADER_DIFF_SCRIPT_PART2 = \
@ABI_ILP32_FALSE@	filtered2=`$(ECHO) $@ | $(SED) 's/\.creatediff$$/.createstderr-nosize/g'` ; \
@ABI_ILP32_FALSE@	diffout2=`$(ECHO) $@ | $(SED) 's/\.creatediff$$/.creatediff-nosize/g'` ; \
@ABI_ILP32_FALSE@	$(CAT) "$$expect" | $(POM_SIZE_FILTER) > "$$filtered2" ; \
@ABI_ILP32_FALSE@	$(CAT) $< | $(POM_SIZE_FILTER) > $<-nosize ; \
@ABI_ILP32_FALSE@	$(HACKT_CREATE_TEST_DIFF) "$$filtered2" $<-nosize > "$$diffout2" 2>&1 ; \
@ABI_ILP32_FALSE@	$(ANALYZE_DIFF_AWK) -v quiet=0 "$$diffout2" ; \
@ABI_ILP32_FALSE@	$(MV) $@ $@-orig ; \
@ABI_ILP32_FALSE@	$(CP) "$$diffout2" $@


# forgive size differences only for non-ILP32 platforms
@ABI_ILP32_TRUE@CREATE_HEADER_DIFF_SCRIPT_PART2 = :
@VERBOSE_CHECK_FALSE@ECHO_CREATEFAIL_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CREATEFAIL_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $<"
HACKT_CREATE_TEST_SUBJECTS = \
	$(HACKT_CREATE_TEST_PASSES) \
	$(HACKT_CREATE_TEST_FAILURES)

CREATE_BUILD_CHECK_LOCAL = \
	$(HACKT_CREATE_TEST_PASSES:=.haco-c) \
	$(HACKT_CREATE_TEST_PASSES:=.haco-c-err) \
	$(HACKT_CREATE_TEST_PASSES:=.createdump) \
	$(HACKT_CREATE_TEST_PASSES:=.createdump-filter) \
	$(HACKT_CREATE_TEST_PASSES:=.creatediff) \
	$(HACKT_CREATE_TEST_FAILURES:=.createfaildump) \
	$(HACKT_CREATE_TEST_FAILURES:=.createfaildiff)

ALLOC_FILTER = $(SED) -f $(TEST_SRCDIR)/alloc_filter.sed
HACKT_ALLOC_SUFFIXES = .haco-a .haco-a-dump .haco-a-dump-filter \
	.haco-a-from-haco .haco-a-from-haco-dump .haco-a-from-haco-dump-filter \
	.allocdump .allocfaildump .allocdump-filter \
	.allocdiff .alloc-from-haco-diff \
	.alloc-from-haco-dump .alloc-from-haco-dump-filter

HACKT_ALLOC_TEST_SUFFIXES = .hacktalloctest .hacktallocfromhacotest

# clean and cvsignore: list most suffixes, but protected in quotes
HACKT_ALLOC_CLEAN_IGNORE_PATTERNS = \
	"*.haco-a" \
	"*.hacktalloctest" \
	"*.hacktallocfailtest" \
	"*.hacktallocfromhacotest" \
	"*.allocdump" \
	"*.allocdump-filter" \
	"*.allocdump.filter" \
	"*.allocfaildump" \
	"*.allocdiff" \
	"*.allocfaildiff" \
	"*.haco-a-dump" \
	"*.alloc-from*" \
	"*.prsimexpr-O1"

@VERBOSE_CHECK_FALSE@ALLOCDUMP_FILTER_SCRIPT = @$(CAT) $< | $(ALLOC_FILTER) > $@
@VERBOSE_CHECK_TRUE@ALLOCDUMP_FILTER_SCRIPT = $(CAT) $< | $(ALLOC_FILTER) > $@
@VERBOSE_CHECK_FALSE@ECHO_ALLOCDUMP_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_ALLOCDUMP_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $<"
@VERBOSE_CHECK_FALSE@ECHO_ALLOCFAIL_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_ALLOCFAIL_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $<"
@VERBOSE_CHECK_FALSE@ECHO_ALLOCFROMHACO_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_ALLOCFROMHACO_DIFF_COMMAND = \
@VERBOSE_CHECK_TRUE@	$(ECHO) "$(DIFF) -bu $$expect1 $<" ; $(ECHO) "$(DIFF) -bu $$expect2 $<"

HACKT_ALLOC_TEST_SUBJECTS = \
	$(HACKT_ALLOC_TEST_PASSES) \
	$(HACKT_ALLOC_TEST_FAILURES)

ALLOC_BUILD_CHECK_LOCAL = \
	$(HACKT_ALLOC_TEST_PASSES:=.haco-a) \
	$(HACKT_ALLOC_TEST_PASSES:=.allocdump) \
	$(HACKT_ALLOC_TEST_PASSES:=.allocdump-filter) \
	$(HACKT_ALLOC_TEST_PASSES:=.allocdiff) \
	$(HACKT_ALLOC_TEST_FAILURES:=.allocfaildump) \
	$(HACKT_ALLOC_TEST_FAILURES:=.allocfaildiff) \
	$(HACKT_ALLOC_TEST_PASSES:=.haco-a-from-haco) \
	$(HACKT_ALLOC_TEST_PASSES:=.alloc-from-haco-dump) \
	$(HACKT_ALLOC_TEST_PASSES:=.alloc-from-haco-dump-filter) \
	$(HACKT_ALLOC_TEST_PASSES:=.alloc-from-haco-diff)

HACKT_CFLAT_SUFFIXES = \
	.prs .prsdiff .prs-sort .expect-prs .expect-prs-sort .prsdiff-sort \
	.sprs .sprs-sort .sprs-diff .sprsdiff-sort \
	.prsseu .prsseu-sort .prsseu-diff prsseudiff-sort \
	.lvsprs .expect-lvsprs .lvsprsdiff .lvsprs-sort \
	.expect-lvsprs-sort .lvsprsdiff-sort \
	.lvsfail .lvsfaildiff \
	.lvssprs

HACKT_CFLAT_TEST_SUFFIXES = \
	.hacktcflattest \
	.hacktcflatlvstest \
	.hacktcflatlvsfailtest \
	.hacktcflatseutest \
	.hacktsprstest


# CVS ignore and clean these patterns
HACKT_CFLAT_CLEAN_IGNORE_PATTERNS = \
	"*.hacktcflattest" \
	"*.hacktcflatlvstest" \
	"*.hacktcflatlvsfailtest" \
	"*.hacktsprstest" \
	"*.hacktcflatseutest" \
	"*.hacktprsimexprtest" \
	"*.hacktprsdottest" \
	"*.prs" \
	"*.prs-sort" \
	"*.prsdiff" \
	"*.prsdiff-sort" \
	"*.lvssprs" \
	"*.lvsprs" \
	"*.lvsprsdiff" \
	"*.lvsprsdiff-sort" \
	"*.lvsfail" \
	"*.lvsfaildiff" \
	"*.prsseu" \
	"*.prsseudiff" \
	"*.prsseu-diff" \
	"*.prsimexpr" \
	"*.prsimexprdiff" \
	"*.prs-dot" \
	"*.prs-dot-O1" \
	"*.prs-*-ps" \
	"*.prs-*-fig" \
	"*.prs-*-pdf" \
	"*.sprs" \
	"*.sprsdiff" \
	"*.sprsdiff-sort"


# CFLAT tests

# TODO: unify all prs tests into one set of Makefile suffix rules and
# embed the flags variations in the source files with @hflat-flags@.  
# Rationale: remove clutter of suffixes for some trivial variations.  
# Not all variations, because that would result in excessive 
# duplicate object files (can that be avoided?).  
# TODO: test configuration files that dictate exact dependencies and options,
# e.g. source (or .) <script that sets variables>

# compute flags, -t <type> is always last for now (doesn't matter)
DEDUCE_HFLAT_VARIANT = \
	srcfile=$(srcdir)/$*.hac ; \
	flags=`$(CAT) $$srcfile | $(EXTRACT_HFLAT_FLAGS_PIPE)` ; \
	type=`$(CAT) $$srcfile | $(GREP) "@hflat-type@" | $(HEAD) -n1 | \
		$(SED) -e 's/^.*-type@[ \t]*//g' -e 's/\"//g'` ; \
	if test -n "$$type" ; then \
		flags="$$flags -t $$type" ; \
	fi

OLD_PRSIM_TEST_SCRIPT = $(am__append_4) $(am__append_5)
DEFAULT_SORT_SCRIPT = $(SORT) $< > $@
CFLATPRS_DIFF_COMMAND = $(DIFF) -bu $< $$out
@VERBOSE_CHECK_FALSE@ECHO_CFLATPRS_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CFLATPRS_DIFF_COMMAND = $(ECHO) "$(CFLATPRS_DIFF_COMMAND)"
@VERBOSE_CHECK_FALSE@ECHO_CFLAT_LVS_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CFLAT_LVS_COMMAND = $(ECHO) "$$cmd > $@"
HACKT_CFLAT_LVS_SCRIPT = \
	$(DEDUCE_HFLAT_VARIANT) ; \
	cmd="$(HACKT_CFLAT_LVS_EXE) $$flags $<" ; \
	$(ECHO_CFLAT_LVS_COMMAND) ; \
	$$cmd > $@ 2>&1

@VERBOSE_CHECK_FALSE@ECHO_CFLAT_LVS_SIZE_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CFLAT_LVS_SIZE_COMMAND = $(ECHO) "$$cmd > $@"
@VERBOSE_CHECK_FALSE@ECHO_CFLATLVS_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CFLATLVS_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $< $$out"
@VERBOSE_CHECK_FALSE@ECHO_CFLATPRSSEU_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CFLATPRSSEU_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $< $$out"
SPRS_DIFF_COMMAND = $(DIFF) -bu $< $$out
@VERBOSE_CHECK_FALSE@ECHO_SPRS_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_SPRS_DIFF_COMMAND = $(ECHO) "$(SPRS_DIFF_COMMAND)"
HACKT_CFLAT_LVS_TEST_SUBJECTS = \
	$(HACKT_CFLAT_LVS_TEST_PASSES) \
	$(HACKT_CFLAT_LVS_TEST_FAILURES)

CFLAT_BUILD_CHECK_LOCAL = \
	$(HACKT_CFLAT_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CFLAT_TEST_SUBJECTS:=.prs) \
	$(HACKT_CFLAT_TEST_SUBJECTS:=.prsdiff) \
	$(HACKT_CFLAT_SEU_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CFLAT_SEU_TEST_SUBJECTS:=.prsseu) \
	$(HACKT_CFLAT_SEU_TEST_SUBJECTS:=.prsseudiff) \
	$(HACKT_CFLAT_LVS_TEST_SUBJECTS:=.haco) \
	$(HACKT_CFLAT_LVS_TEST_SUBJECTS:=.haco-c) \
	$(HACKT_CFLAT_LVS_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CFLAT_LVS_TEST_PASSES:=.lvsprs) \
	$(HACKT_CFLAT_LVS_TEST_PASSES:=.lvsprsdiff) \
	$(HACKT_CFLAT_LVS_TEST_FAILURES:=.lvsfail) \
	$(HACKT_CFLAT_LVS_TEST_FAILURES:=.lvsfaildiff)

EMPTY_CFLAT_PRS = $(EMPTY_CFLAT_PRS_TESTS:=.expect-prs)
HACKT_GRAPH_SUFFIXES = \
	.prs-dot .prs-dot-O1 \
	.prs-dot-ps .prs-neato-ps .prs-circo-ps .prs-twopi-ps .prs-fdp-ps \
	.prs-dot-fig .prs-neato-fig .prs-circo-fig .prs-twopi-fig .prs-fdp-fig \
	.prs-dot-pdf .prs-neato-pdf .prs-circo-pdf .prs-twopi-pdf .prs-fdp-pdf

HACKT_PRSIM_SUFFIXES = \
	.prsimrc .prsimrc-out .prsimrc-out-filter .prsimrc-diff \
	.prsimrcfail-out \
	.prsimrcfail-out-filter .prsimrcfail-diff \
	.prsimexpr .prsimexprdiff .prsimexpr-O1 \
	.prsimckpt .prsimckpt-dump \
	.prsimckpt-indump .prsimckpt-outdump .prsimckpt-diff \
	.prsimckpt-dupe .prsimckpt-dupe-dump \
	.prsimckpt-O1 .prsimckpt-O1-err \
	.prsimckpt-01-dump .prsimopt-diff \
	.prsimtrace .prsimtrace-O1 \
	.prsimtrace-dump .prsimtrace-O1-dump .prsimtrace-diff \
	.prsimtrace-dump-filter .prsimtrace-O1-dump-filter

HACKT_PRSIM_TEST_SUFFIXES = \
	.prsimtest .prsimfailtest \
	.hacktprsimexprtest \
	.prsimtracetest \
	.prsimckpttest \
	.prsimopttest \
	.hacktprsdottest 

HACKT_PRSIM_CLEAN_IGNORE_PATTERNS = \
	"*.prsimtest" \
	"*.prsimrc-out" \
	"*.prsimrc-out-filter" \
	"*.prsimrc-diff" \
	"*.prsimfailtest" \
	"*.prsimrcfail-out" \
	"*.prsimrcfail-out-filter" \
	"*.prsimrcfail-diff" \
	"*.prsimckpt" \
	"*.prsimckpttest" \
	"*.prsimckpt-dump" \
	"*.prsimckpt-dupe" \
	"*.prsimckpt-dupe-dump" \
	"*.prsimckpt-outdump" \
	"*.prsimckpt-indump" \
	"*.prsimckpt-diff" \
	"*.prsimopttest" \
	"*.prsimckpt-O1" \
	"*.prsimckpt-O1-err" \
	"*.prsimckpt-O1-dump" \
	"*.prsimopt-diff" \
	"*.prsimexpr-O1" \
	"*.prs-dot-O1" \
	"*.prsimtrace" \
	"*.prsimtrace-O1" \
	"*.prsimtrace-dump" \
	"*.prsimtrace-dump-filter" \
	"*.prsimtrace-O1-dump" \
	"*.prsimtrace-O1-dump-filter" \
	"*.prsimtrace-diff" \
	"*.prsimtracetest"

PRSIMRC_FILTER_AWK = $(AWK) -f $(TEST_SRCDIR)/prsimrc-filter.awk
PRSIMRC_TIME_FILTER_AWK = $(AWK) -f $(TEST_SRCDIR)/prsimrc-random-time-filter.awk
PRSIMRC_VALUE_FILTER_AWK = $(AWK) -f $(TEST_SRCDIR)/prsimrc-random-value-filter.awk
PRSIMCKPT_TEMPLATE_SCRIPT = $(TEST_SRCDIR)/prsimckpt-template.prsimrc
PRSIMCKPT_LOAD_TEMPLATE_SCRIPT = $(TEST_SRCDIR)/prsimckpt-load-template.prsimrc
EXTRACT_HACPRSIM_FLAGS_PIPE = $(GREP) "@hacprsim-flags@" | $(HEAD) -n1 | \
	$(SED) 's/^.*@hacprsim-flags@[ ]*//g'

@VERBOSE_CHECK_FALSE@ECHO_PRSIMEXPR_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_PRSIMEXPR_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $<"

# touch is needed if the redirected output is empty
# we now perform $srcdir substitution and $(HACO_FLAGS) substitution
# in the event where the input file is a hac source, as opposed to object file
# Some directories will not want trace files, so we provide a hook to disable
# automatic trace saving: PRSIMRC_AUTOTRACE_DISABLE_HOOK = autotrace=0
PRSIMRC_TEST_SCRIPT = \
	obj=`$(CAT) $< | $(EXTRACT_HACO_PIPE) | \
	  $(SED) -e 's|[$$]srcdir|$(srcdir)|g' \
	    -e 's|[$$](HACO_FLAGS)|$(HACO_FLAGS)|g'` ; \
	flags=`$(CAT) $< | $(EXTRACT_HACPRSIM_FLAGS_PIPE)` ; \
	ckpt=`$(ECHO) $@ | $(SED) 's/\.prsim.*$$/.prsimckpt/g'` ; \
	trace=`$(ECHO) $@ | $(SED) 's/\.prsim.*$$/.prsimtrace/g'` ; \
	$(RM) $$ckpt $$trace ; \
	autotrace=1 ; \
	$(PRSIMRC_AUTOTRACE_DISABLE_HOOK) \
	if test "$$autotrace" = 1 ; then traceflag="-r $$trace" ; fi ; \
	cmd="$(HACKT_PRSIM_EXE) -b -a $$ckpt $$traceflag -I$(srcdir) $$flags $$obj" ; \
	$(ECHO) "ckpt: $$cmd < $<" ; \
	$(SED) -e 's|SOURCE|$<|g' $(PRSIMCKPT_TEMPLATE_SCRIPT) | \
	  $$cmd > $@ 2>&1 ; \
	test -f $$ckpt || $(ECHO) "Warning: $$ckpt not produced." ; \
	test "$$autotrace" = 0 || \
	  test -f $$trace || $(ECHO) "Warning: $$trace not produced." ; \
	$(TOUCH) $@

# test -f $$ckpt && test -f $$trace ?

# fail test will not attempt to checkpoint or save trace files
PRSIMRC_FAIL_TEST_SCRIPT = \
	obj=`$(CAT) $< | $(EXTRACT_HACO_PIPE)` ; \
	flags=`$(CAT) $< | $(EXTRACT_HACPRSIM_FLAGS_PIPE)` ; \
	cmd="$(HACKT_PRSIM_EXE) -b -I$(srcdir) $$flags $$obj" ; \
	$(ECHO) "$$cmd < $<" ; \
	$$cmd < $< > $@ 2>&1


# as an automatic way of inferring trace file anti-dependencies...
# could also do this with checkpoints...
EXTRACT_PRSIM_TRACE_DEP_PIPE = $(GREP) "^trace " | $(CUT) -d\  -f2
EXTRACT_PRSIM_TRACE_UNDEP_PIPE = $(GREP) "^!rm" | $(CUT) -d\  -f2

# semi-hackish way to conditionally filter random timing
# HACK: if the file name has 'random' in it, then filter out timestamps
PRSIMRC_TEST_FILTER_SCRIPT = \
	$(CAT) $< | \
		$(SED) -e '/DELETE FROM HERE/d' -e '/DELETE TO HERE/,$$d' | \
		$(PRSIMRC_FILTER_AWK) > $@ ; \
	case $< in \
	  *random*) $(CAT) $@ | $(PRSIMRC_TIME_FILTER_AWK) | \
		$(PRSIMRC_VALUE_FILTER_AWK) > $@.tmp ; \
	    $(MV) $@.tmp $@ ; \
	    break ;; \
	  *) break ;; \
	esac ; \
	$(ECHO_FILTERED)

#	@$(PRSIMRC_TEST_FILTER_SCRIPT)
HACKT_PRSIMRC_TEST_DIFF = $(DIFF) -bu
@VERBOSE_CHECK_FALSE@ECHO_PRSIMRC_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_PRSIMRC_DIFF_COMMAND = $(ECHO) "$(HACKT_PRSIMRC_TEST_DIFF) $$expect $<"
@ABI_ILP32_FALSE@PRSIM_TRACE_DUMP_FILTER_SCRIPT = \
@ABI_ILP32_FALSE@	$(ECHO) "Filtering out binary trace differences in $@ ..." ; \
@ABI_ILP32_FALSE@	filtered=`$(ECHO) $@ | $(SED) 's/\.prsimrc-diff$$/.prsimrc-expect-nosize/g'` ; \
@ABI_ILP32_FALSE@	diffout=`$(ECHO) $@ | $(SED) 's/\.prsimrc-diff$$/.prsimrc-diff-nosize/g'` ; \
@ABI_ILP32_FALSE@	$(CAT) "$$expect" | $(PRSIM_TRACE_BINARY_FILTER) > "$$filtered" ; \
@ABI_ILP32_FALSE@	$(CAT) $< | $(PRSIM_TRACE_BINARY_FILTER) > $<-nosize ; \
@ABI_ILP32_FALSE@	$(HACKT_PRSIMRC_TEST_DIFF) "$$filtered" $<-nosize > "$$diffout" 2>&1 ; \
@ABI_ILP32_FALSE@	if test -s "$$diffout" ; then \
@ABI_ILP32_FALSE@	  $(ECHO) "Non-trace differences remain!" ; \
@ABI_ILP32_FALSE@	else \
@ABI_ILP32_FALSE@	  $(ECHO) "Binary trace differences resolved." ; \
@ABI_ILP32_FALSE@	  $(MV) $@ $@-orig ; \
@ABI_ILP32_FALSE@	  $(CP) "$$diffout" $@ ; \
@ABI_ILP32_FALSE@	fi


# additional heuristic checking for trivial differences
@ABI_ILP32_TRUE@PRSIM_TRACE_DUMP_FILTER_SCRIPT = :
NO_OP_SCRIPT = test -f $< && test -f $@
PRSIM_TRACE_DUMP_SCRIPT = \
	rc=$(srcdir)/`$(ECHO) $< | $(SED) 's/\.prsimtrace.*$$/.prsimrc/g'` && \
	obj=`$(CAT) "$$rc" | $(EXTRACT_HACO_PIPE)` && \
	cmd="$(HACKT_PRSIM_EXE) -b $$obj" && \
	$(ECHO) "$(ECHO) \"trace-dump $<\" | $$cmd > $@" && \
	$(ECHO) "trace-dump $<" | $$cmd > $@ 2>&1


#	rc=$(srcdir)/`$(ECHO) $@ | $(SED) 's/\.prsim.*$$/.prsimrc/g'` ; \
#	obj=`$(CAT) "$$rc" | $(EXTRACT_HACO_PIPE)`
PRSIM_CHECKPOINT_DUMP_SCRIPT = $(HACKT_PRSIM_EXE) -d $< > $@
@VERBOSE_CHECK_FALSE@ECHO_PRSIMCKPT_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_PRSIMCKPT_DIFF_COMMAND = $(ECHO) "$(DIFF) -u $$expect $<"
PRSIMOPT_TEMPLATE_SCRIPT = $(TEST_SRCDIR)/prsimopt-template.prsimrc
PRSIMOPT_FLAG = -O1
@VERBOSE_CHECK_FALSE@ECHO_PRSIMCKPT_OPT_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_PRSIMCKPT_OPT_DIFF_COMMAND = $(ECHO) "$(DIFF) -q $$unopt $<"
HACKT_PRSIMRC_TEST_SCRIPTS_BASES = \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES)


# all alloc tests and prsimrc tests are candidates for prs-dot tests
HACKT_PRS_DOT_TEST_SUBJECTS = $(HACKT_ALLOC_TEST_PASSES) \
	$(HACKT_PRSIMRC_TEST_PASSES)

# this should really only reference the root products of prsim,
# derivative files (.prsimckpt, .prsimtrace) could be omitted
HACKT_PRSIM_PRODUCTS = \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimrc-out) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimckpt) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimtrace) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES:=.prsimrcfail-out) \
	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpt) \
	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpt-outdump) \
	$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES:=.prsimckpt-O1) \
	$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES:=.prsimckpt-O1-err) \
	$(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.prsimexpr) \
	$(HACKT_PRS_DOT_TEST_SUBJECTS:=.prsimexpr-O1) \
	$(HACKT_PRS_DOT_TEST_SUBJECTS:=.prs-dot-O1)

ALL_PRSIMEXPR_DOT = $(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.prs-dot) 
ALL_PRS_DOT_PS = $(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.prs-dot-ps) 
HACKT_VPI_SUFFIXES = .v .vx .vxi .vx-out .vxi-out .vx-out-filter .vx-diff \
	.v-wrap

HACKT_VPI_TEST_SUFFIXES = .vpitest 
HACKT_VPI_CLEAN_IGNORE_PATTERNS = \
	"*.vx" \
	"*.v-wrap" \
	"*.vxi" \
	"*.vx-out" \
	"*.vxi-out" \
	"*.vx-out-filter" \
	"*.vx-diff" \
	"*.vpitest" \
	"*.csrc" \
	"*.daidir"

VPI_PRSIM_MODULE = $(top_builddir)/src/vpihacprsim.la
AUTO_WRAP_VERILOG_AWK = $(AWK) -f $(top_srcdir)/lib/verilog/wrap_verilog_modules_to_hacprsim.awk
VCS_OUTPUT_FILTER = \
	$(SED) -n '/^[$$]start of simulation/,/^[$$]finish at simulation/p' | \
	$(GREP) -v "\$$finish called from file"

# format may change slightly between versions
# initial version tested was Y-2006.06
# added grep for version C-2009-06

# where vpihacprim.la is built
VPI_LIB_PATH = $(top_builddir)/src
# where vpihacprsim.{la,so} are installed
INSTALLCHECK_VPI_LIB_PATH = $(pkglibdir)
# wait for license if none available, damn commercial tools
COMMON_VCS_FLAGS = +cli+3 -Mupdate +v2k +vcsace+diff+ok +vcs+lic+wait \
	$(am__append_6)
AM_VCS_VPI_FLAGS = +vpi \
	-use_vpiobj $(VPI_LIB_PATH)/$(LTDL_OBJDIR)/vpihacprsim.so \
	-LDFLAGS="-L$(VPI_LIB_PATH)/$(LTDL_OBJDIR)" 

AM_VCS_FLAGS = +incdir+$(srcdir) $(COMMON_VCS_FLAGS) -Mdir=$@.csrc
AM_PLI_FLAGS = 

# for install-time tests, use installed library, not the built one
INSTALLCHECK_VCS_VPI_FLAGS = +vpi \
	-use_vpiobj $(INSTALLCHECK_VPI_LIB_PATH)/vpihacprsim.so \
	-LDFLAGS="-L$(INSTALLCHECK_VPI_LIB_PATH)" 

# lazy: for now, use the .. dir instead of +incdir+$(examplesdir)/...
# because compilation is done in a temporary subdirectory
# the generated Makefiles have a variable named $(VSRC) that could be used...
INSTALLCHECK_VCS_FLAGS = +incdir+$(srcdir) $(COMMON_VCS_FLAGS) -Mdir=$$@.csrc
INSTALLCHECK_PLI_FLAGS = 
EXTRACT_VCS_FLAGS_PIPE = $(GREP) "@vcs-flags@" | \
        $(SED) 's/^.*@vcs-flags@[ ]*//g'


# setup run-time link path for build testing
VPI_TEST_ENV = \
	$(LTDL_SHLIBPATH_VAR)=$(VPI_LIB_PATH)/$(LTDL_OBJDIR)$(PATH_SEPARATOR)$$$(LTDL_SHLIBPATH_VAR)


# installcheck environment
VPI_INSTALLCHECK_ENV = \
	$(LTDL_SHLIBPATH_VAR)=$(INSTALLCHECK_VPI_LIB_PATH)$(PATH_SEPARATOR)$$$(LTDL_SHLIBPATH_VAR)

@VERBOSE_CHECK_FALSE@ECHO_VPI_DIFF_COMMAND = :
#	$(GREP) "observed" $< > $@ || $(TOUCH) $@
#	$(CP) $< $@
@VERBOSE_CHECK_TRUE@ECHO_VPI_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $<"
HACKT_VPI_TEST_SCRIPTS_BASES = \
	$(HACKT_VPI_TEST_SCRIPTS_PASSES) \
	$(HACKT_VPI_TEST_SCRIPTS_FAILURES)

VPI_SIM_EXECUTABLES = $(HACKT_VPI_TEST_SCRIPTS_PASSES:=.vx)
VPI_TARGETS = $(am__append_7)
CHPSIM_ALLOC_DUMP = $(HACKT_CHPSIM_EXE) -fno-run -fdump-graph-alloc
CHPSIM_GRAPH_DOT = $(HACKT_CHPSIM_EXE) -fno-run -fdump-dot-struct -fcluster-processes -fshow-channels
CHPSIMCKPT_TEMPLATE_SCRIPT = $(TEST_SRCDIR)/chpsimckpt-template.chpsimrc
CHPSIMCKPT_LOAD_TEMPLATE_SCRIPT = $(TEST_SRCDIR)/chpsimckpt-load-template.chpsimrc

# pipe for extracting dlopen modules and paths from chpsimrc script
# these arguments are passed to chpsim
EXTRACT_CHPSIM_MODULES_PIPE = $(GREP) "@module@" | $(SED) 's/^.*@module@//g'
EXTRACT_HACCHPSIM_FLAGS_PIPE = $(GREP) "@hacchpsim-flags@" | $(HEAD) -n1 | \
	$(SED) 's/^.*@hacchpsim-flags@[ ]*//g'

HACKT_CHPSIM_SUFFIXES = \
	.chpsimrc .chpsimrc-out \
	.chpsimrc-out-filter .chpsimrc-diff \
	.chpsimallocdump .chpsimallocdiff \
	.chpsim-event-dot .chpsim-event-fig \
	.chpsim-event-ps .chpsim-event-pdf \
	.chpsimrcfail-out .chpsimrcfail-diff \
	.chpsimckpt .chpsimckpt-outdump .chpsimckpt-indump \
	.chpsimckpt-dupe .chpsimckpt-dupe-dump \
	.chpsimckpt-diff \
	.chpsimtrace

HACKT_CHPSIM_TEST_SUFFIXES = \
	.chpsimtest .chpsimfailtest \
	.chpsimalloctest .chpsimdottest .chpsimckpttest

HACKT_CHPSIM_CLEAN_IGNORE_PATTERNS = \
	"*.chpsimallocdump" \
	"*.chpsimallocdiff" \
	"*.chpsimalloctest" \
	"*.chpsim-event-dot" \
	"*.chpsim-event-ps" \
	"*.chpsimdottest" \
	"*.chpsimrc-out" \
	"*.chpsimrc-out-filter" \
	"*.chpsimrc-out-filter-nosize" \
	"*.chpsimrc-diff" \
	"*.chpsimrc-diff-orig" \
	"*.chpsimrc-diff-nosize" \
	"*.chpsimrc-expect-nosize" \
	"*.chpsimtest" \
	"*.chpsimrcfail-out" \
	"*.chpsimrcfail-diff" \
	"*.chpsimfailtest" \
	"*.chpsimckpt" \
	"*.chpsimckpt-outdump" \
	"*.chpsimckpt-dupe" \
	"*.chpsimckpt-dupe-dump" \
	"*.chpsimckpt-indump" \
	"*.chpsimckpt-diff" \
	"*.chpsimckpttest" \
	"*.chpsimtrace"

@VERBOSE_CHECK_FALSE@ECHO_CHPSIM_ALLOC_DIFF_COMMAND = :

# .chpsim-event-{dot,fig,ps,pdf} rules in Make.test-graph
@VERBOSE_CHECK_TRUE@ECHO_CHPSIM_ALLOC_DIFF_COMMAND = $(ECHO) "$(DIFF) -bu $$""(srcdir)/$$stderr $<"

# no additional dependencies for chpsimdottest needed

# for Darwin: need some help finding shared libraries that are dependencies
# of dlopened modules.  
# search for dependent module libraries, set CHPSIM_LIB_PATH
# CHPSIM_LIB_PATH = .
# should really iterate over paths in CHPSIM_LIB_PATH in loop
CHPSIM_TEST_ENV = \
	test -z "$(CHPSIM_LIB_PATH)" || \
	  $(LTDL_SHLIBPATH_VAR)=$(CHPSIM_LIB_PATH)/$(LTDL_OBJDIR)$(PATH_SEPARATOR)$$$(LTDL_SHLIBPATH_VAR) && \
	  export $(LTDL_SHLIBPATH_VAR)

SHOW_CHPSIM_TEST_ENV = $(LTDL_SHLIBPATH_VAR)=$(CHPSIM_LIB_PATH)/$(LTDL_OBJDIR)$(PATH_SEPARATOR)$$"$(LTDL_SHLIBPATH_VAR)"

# NOTE: EXTRACT_HACO_PIPE is defined in "Make.test-prsim"
# TODO: extract additional command-line flags from the source script
#	maybe using @chpsim-flags@ as a match pattern
# We privide a hook to disable automatic tracing:
#	CHPSIMRC_AUTOTRACE_DISABLE_HOOK = autotrace=0;
CHPSIMRC_TEST_SCRIPT = \
	obj=`$(CAT) $< | $(EXTRACT_HACO_PIPE)` ; \
	mods=`$(CAT) $< | $(EXTRACT_CHPSIM_MODULES_PIPE)` ; \
	flags=`$(CAT) $< | $(EXTRACT_HACCHPSIM_FLAGS_PIPE)` ; \
	ckpt=`$(ECHO) $@ | $(SED) 's/\.chpsim.*$$/.chpsimckpt/g'` ; \
	trace=`$(ECHO) $@ | $(SED) 's/\.chpsim.*$$/.chpsimtrace/g'` ; \
	$(RM) $$ckpt $$trace ; \
	autotrace=1 ; \
	$(CHPSIMRC_AUTOTRACE_DISABLE_HOOK) \
	if test "$$autotrace" = 1 ; then traceflag="-r $$trace" ; fi ; \
	$(CHPSIM_TEST_ENV) ; \
	cmd="$(HACKT_CHPSIM_EXE) -b -I$(srcdir) -a $$ckpt $$traceflag $$flags $$mods $$obj" ; \
	$(ECHO) "ckpt: $(SHOW_CHPSIM_TEST_ENV) $$cmd < $<" ; \
	$(SED) 's|SOURCE|$<|g' $(CHPSIMCKPT_TEMPLATE_SCRIPT) | \
	  $$cmd > $@ 2>&1 && \
	test -f $$ckpt || $(ECHO) "Warning: $$ckpt not produced." ; \
	test "$$autotrace" = 0 || \
	  test -f $$trace || $(ECHO) "Warning: $$trace not produced." ; \
	$(TOUCH) $@


# the same until we add checkpointing to the pass test
CHPSIMRC_FAIL_TEST_SCRIPT = \
	obj=`$(CAT) $< | $(EXTRACT_HACO_PIPE)` ; \
	mods=`$(CAT) $< | $(EXTRACT_CHPSIM_MODULES_PIPE)` ; \
	flags=`$(CAT) $< | $(EXTRACT_HACCHPSIM_FLAGS_PIPE)` ; \
	$(CHPSIM_TEST_ENV) ; \
	cmd="$(HACKT_CHPSIM_EXE) -b -I$(srcdir) $$flags $$mods $$obj" ; \
	$(ECHO) "$(SHOW_CHPSIM_TEST_ENV) $$cmd < $<" ; \
	$$cmd < $< > $@ 2>&1


# without generating checkpoint
CHPSIMRC_NOCKPT_TEST_SCRIPT = \
	$(CHPSIMRC_FAIL_TEST_SCRIPT) && \
	$(TOUCH) $@

HACKT_CHPSIMRC_TEST_DIFF = $(DIFF) -bu
@VERBOSE_CHECK_FALSE@ECHO_CHPSIMRC_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CHPSIMRC_DIFF_COMMAND = $(ECHO) "$(HACKT_CHPSIMRC_TEST_DIFF) $$expect $<"

# one option: always apply $(CHPSIM_TRACE_BINARY_FILTER)
CHPSIMRC_TEST_FILTER_SCRIPT = \
	$(SED) -e '/DELETE FROM HERE/d' -e '/DELETE TO HERE/,$$d' $< > $@

@ABI_ILP32_FALSE@CHPSIM_TRACE_DUMP_FILTER_SCRIPT = \
@ABI_ILP32_FALSE@	$(ECHO) "Filtering out binary trace differences in $@ ..." ; \
@ABI_ILP32_FALSE@	filtered=`$(ECHO) $@ | $(SED) 's/\.chpsimrc-diff$$/.chpsimrc-expect-nosize/g'` ; \
@ABI_ILP32_FALSE@	diffout=`$(ECHO) $@ | $(SED) 's/\.chpsimrc-diff$$/.chpsimrc-diff-nosize/g'` ; \
@ABI_ILP32_FALSE@	$(CAT) "$$expect" | $(CHPSIM_TRACE_BINARY_FILTER) > "$$filtered" ; \
@ABI_ILP32_FALSE@	$(CAT) $< | $(CHPSIM_TRACE_BINARY_FILTER) > $<-nosize ; \
@ABI_ILP32_FALSE@	$(HACKT_CHPSIMRC_TEST_DIFF) "$$filtered" $<-nosize > "$$diffout" 2>&1 ; \
@ABI_ILP32_FALSE@	if test -s "$$diffout" ; then \
@ABI_ILP32_FALSE@	  $(ECHO) "Non-trace differences remain!" ; \
@ABI_ILP32_FALSE@	else \
@ABI_ILP32_FALSE@	  $(ECHO) "Binary trace differences resolved." ; \
@ABI_ILP32_FALSE@	  $(MV) $@ $@-orig ; \
@ABI_ILP32_FALSE@	  $(CP) "$$diffout" $@ ; \
@ABI_ILP32_FALSE@	fi


# additional heuristic checking for trivial differences
@ABI_ILP32_TRUE@CHPSIM_TRACE_DUMP_FILTER_SCRIPT = :

# as an automatic way of inferring trace file anti-dependencies...
# could also do this with checkpoints...
EXTRACT_CHPSIM_TRACE_DEP_PIPE = $(GREP) "^trace " | $(CUT) -d\  -f2
EXTRACT_CHPSIM_TRACE_UNDEP_PIPE = $(GREP) "^!rm" | $(CUT) -d\  -f2
@VERBOSE_CHECK_FALSE@ECHO_CHPSIMCKPT_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_CHPSIMCKPT_DIFF_COMMAND = $(ECHO) "$(DIFF) -u $$expect $<"
HACKT_CHPSIMRC_TEST_SCRIPTS_BASES = \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES)

HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_BASES = \
	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_PASSES) \
	$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_FAILURES)


# all alloc tests and prsimrc tests are candidates for prs-dot tests
HACKT_CHPSIM_DOT_TEST_SUBJECTS = $(HACKT_ALLOC_TEST_PASSES)
CHPSIM_RANDOM_BUILD_CHECK_LOCAL = $(am__append_9)
ALL_CHPSIM_ALLOC = $(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS:=.expect-chpsimalloc) \
ALL_CHPSIM_DOT = $(HACKT_CHPSIM_DOT_TEST_SUBJECTS:=.chpsim-event-dot)

ALL_CHPSIM_PS = $(HACKT_CHPSIM_DOT_TEST_SUBJECTS:=.chpsim-event-ps)
ALL_CHPSIMRC_OUT = $(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES:=.chpsimrc-out) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES:=.chpsimrcfail-out)

ALL_CHPSIM_CKPT = $(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES:=.chpsimckpt)
HACKT_GUILE_SUFFIXES = \
	.hacscm .hacscm-out .hacscmfail-out .hacscm-diff .hacscmfail-diff \
	.hacchpsimscm .hacchpsimscm-out .hacchpsimscmfail-out \
	.hacchpsimscm-diff .hacchpsimscmfail-diff

HACKT_GUILE_TEST_SUFFIXES = \
	.hacscmtest .hacscmfailtest \
	.hacchpsimscmtest .hacchpsimscmfailtest

HACKT_GUILE_CLEAN_IGNORE_PATTERNS = \
	"*.hacscm-out" \
	"*.hacscm-out-nosize" \
	"*.hacscm-diff" \
	"*.hacscm-expect-filter" \
	"*.hacscmtest" \
	"*.hacscmfail-out" \
	"*.hacscmfail-diff" \
	"*.hacscmfail-diff-orig" \
	"*.hacscmfailtest" \
	"*.hacchpsimscm-out" \
	"*.hacchpsimscm-out-nosize" \
	"*.hacchpsimscm-diff" \
	"*.hacchpsimscm-diff-nosize" \
	"*.hacchpsimscm-diff-orig" \
	"*.hacchpsimscm-expect-nosize" \
	"*.hacchpsimscmtest" \
	"*.hacchpsimscmfail-out" \
	"*.hacchpsimscmfail-diff" \
	"*.hacchpsimscmfailtest"


# second filter added to account for guile-1.6 error differences
HACSCM_OUTPUT_FILTER = \
	$(SED) -e '/module created/s/: [^ ]*[ ]/: \#\#FILE\#\# /g' \
		-e '/^Type "(backtrace)" to get more information/d'


# different versions of guile have slightly different error formats
# This is only used as a backup plan, see rule for .hacscmfail-diff.
HACSCM_EXPECT_FILTER = \
	$(SED) -e '/^In standard input:/,/^$$/d' -e '/^Backtrace:/d'


# append to this to add paths
HACKT_GUILE_LOAD_PATH = $(top_srcdir)/src/scm$(PATH_SEPARATOR)$(srcdir)

# strip spaces that result from appending the Makefile variable
# point search paths to pre-installed libraries
HACSCM_TEST_ENVIRONMENT = GUILE_LOAD_PATH=`$(ECHO) \
	$(HACKT_GUILE_LOAD_PATH) | $(SED) 's/ //g'` \
	LTDL_LIBRARY_PATH=$(PRE_INST_LDPATH) $(am__append_10)
HACKT_GUILE_ENV_EXE = \
	$(HACSCM_TEST_ENVIRONMENT) $(HACKT_GUILE_EXE)

HACSCM_TEST_SCRIPT = $(am__append_11)
HACSCM_FAIL_TEST_SCRIPT = $(HACSCM_TEST_SCRIPT)
HACSCM_DIFF = $(DIFF) -Bbu
HACSCM_DIFF_COMMAND = $(HACSCM_DIFF) $$expect $<
@VERBOSE_CHECK_FALSE@ECHO_HACSCM_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_HACSCM_DIFF_COMMAND = $(ECHO) "$(HACSCM_DIFF_COMMAND)"

# TESTS_ENVIRONMENT doesn't really apply here because these tests are run
# separately as prerequisites of the actual check loop script.
# Thus we must apply environment variables manually.
# Point the GUILE_LOAD_PATH to the home of scheme modules in the source tree.
HACCHPSIMSCM_TEST_ENVIRONMENT = $(HACSCM_TEST_ENVIRONMENT)
HACKT_CHPSIM_GUILE_ENV_EXE = \
	$(HACCHPSIMSCM_TEST_ENVIRONMENT) $(HACKT_CHPSIM_GUILE_EXE)


# TODO: add filter if needed
HACCHPSIMSCM_TEST_SCRIPT = $(am__append_12) $(am__append_13)
HACCHPSIMSCM_FAIL_TEST_SCRIPT = $(HACCHPSIMSCM_TEST_SCRIPT)
HACCHPSIMSCM_TEST_DIFF = $(DIFF) -bu
@VERBOSE_CHECK_FALSE@ECHO_HACCHPSIMSCM_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_HACCHPSIMSCM_DIFF_COMMAND = $(ECHO) "$(HACCHPSIMSCM_TEST_DIFF) -bu $$expect $<"
@ABI_ILP32_FALSE@CHPSIM_GUILE_TRACE_DUMP_FILTER_SCRIPT = \
@ABI_ILP32_FALSE@	$(ECHO) "Filtering out binary trace differences in $@ ..." ; \
@ABI_ILP32_FALSE@	filtered=`$(ECHO) $@ | $(SED) 's/\.hacchpsimscm-diff$$/.hacchpsimscm-expect-nosize/g'` ; \
@ABI_ILP32_FALSE@	diffout=`$(ECHO) $@ | $(SED) 's/\.hacchpsimscm-diff$$/.hacchpsimscm-diff-nosize/g'` ; \
@ABI_ILP32_FALSE@	$(CAT) "$$expect" | $(CHPSIM_TRACE_BINARY_FILTER) > "$$filtered" ; \
@ABI_ILP32_FALSE@	$(CAT) $< | $(CHPSIM_TRACE_BINARY_FILTER) > $<-nosize ; \
@ABI_ILP32_FALSE@	$(HACCHPSIMSCM_TEST_DIFF) "$$filtered" $<-nosize > "$$diffout" 2>&1 ; \
@ABI_ILP32_FALSE@	if test -s "$$diffout" ; then \
@ABI_ILP32_FALSE@	  $(ECHO) "Non-trace differences remain!" ; \
@ABI_ILP32_FALSE@	else \
@ABI_ILP32_FALSE@	  $(ECHO) "Binary trace differences resolved." ; \
@ABI_ILP32_FALSE@	  $(MV) $@ $@-orig ; \
@ABI_ILP32_FALSE@	  $(CP) "$$diffout" $@ ; \
@ABI_ILP32_FALSE@	fi


# additional heuristic checking for trivial differences
@ABI_ILP32_TRUE@CHPSIM_GUILE_TRACE_DUMP_FILTER_SCRIPT = :
HACKT_GUILE_TEST_SCRIPTS_BASES = \
	$(HACKT_GUILE_TEST_SCRIPTS_PASSES) \
	$(HACKT_GUILE_TEST_SCRIPTS_FAILURES)

HACKT_CHPSIM_GUILE_TEST_SCRIPTS_BASES = \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_FAILURES)

HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_BASES = \
	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_PASSES) \
	$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_FAILURES)

GUILE_RANDOM_BUILD_CHECK_LOCAL = $(am__append_14)
HACKT_GUILE_OUT = \
	$(HACKT_GUILE_TEST_SUBJECTS:=.hacscm-out) \
	$(HACKT_GUILE_TEST_SUBJECTS:=.hacscmfail-out)

HACKT_CHPSIM_GUILE_OUT = \
	$(HACKT_CHPSIM_GUILE_TEST_SUBJECTS:=.hacchpsimscm-out) \
	$(HACKT_CHPSIM_GUILE_TEST_SUBJECTS:=.hacchpsimscmfail-out)

HACKNET_SUFFIXES = .spice .spice-diff .spice-fail .spice-fail-diff
HACKNET_TEST_SUFFIXES = .hacknettest .hacknetfailtest
HACKNET_CLEAN_IGNORE_PATTERNS = \
	"*.spice" \
	"*.spice-diff" \
	"*.spice-fail" \
	"*.spice-fail-diff" \
	"*.hacknettest" \
	"*.hacknetfailtest"


# also substitute $srcdir
EXTRACT_HACKNET_FLAGS_PIPE = $(GREP) "@hacknet-flags@" | $(HEAD) -n1 | \
	$(SED) -e 's/^.*@hacknet-flags@[ ]*//g' -e 's|\$$srcdir|$(srcdir)|g'


# should really take some configure/test file for testing combinations
# of object files and netlist configuration options.
HACKNET_TEST_SCRIPT = \
	src="$(srcdir)/"`$(ECHO) $< | $(SED) 's|\.haco-a|.hac|'` && \
	hnflags=`$(CAT) $$src | $(EXTRACT_HACKNET_FLAGS_PIPE)` && \
	cmd="$(HACKNET_EXE) $$hnflags $<" && \
	$(ECHO) "$$cmd > $@" && \
	$$cmd > $@

HACKNET_FAIL_TEST_SCRIPT = $(HACKNET_TEST_SCRIPT)
HACKNET_TEST_DIFF = $(DIFF) -bu
@VERBOSE_CHECK_FALSE@ECHO_HACKNET_DIFF_COMMAND = :
@VERBOSE_CHECK_TRUE@ECHO_HACKNET_DIFF_COMMAND = $(ECHO) "$(HACKNET_TEST_DIFF) $$expect $<"
HACKNET_TEST_SCRIPTS_BASES = \
	$(HACKNET_TEST_SCRIPTS_PASSES) \
	$(HACKNET_TEST_SCRIPTS_FAILURES)

HACKNET_PRODUCTS = \
	$(HACKNET_TEST_SCRIPTS_PASSES:=.spice) \
	$(HACKNET_TEST_SCRIPTS_FAILURES:=.spice-fail)

CLEAN_BOGUS_FILES = $(BOGUS_TESTS) $(BOGUS_TARGETS)
HAC_OBJECT_TARGETS = \
	$(HAC_COMPILE_OBJECT_TARGETS) \
	$(HAC_CREATE_OBJECT_TARGETS) \
	$(HAC_ALLOC_OBJECT_TARGETS)

HACGUILE_TARGETS = \
	$(HACKT_GUILE_TEST_SCRIPTS_BASES:=.hacscm-out) \
	$(HACKT_GUILE_TEST_SCRIPTS_BASES:=.hacscmfail-out)

HACCHPSIMGUILE_TARGETS = \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_BASES:=.hacchpsimscm-out) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_BASES:=.hacchpsimscmfail-out)

ALL_OBJECT_TESTS = \
	$(HACKT_PARSE_TEST_PASSES) \
	$(HACKT_PARSE_TEST_WARNINGS) \
	$(HACKT_PRSIMRC_TEST_SUBJECTS) \
	$(HACKT_CHPSIMRC_TEST_SUBJECTS)

HAC_OBJECT_DEPS = $(ALL_OBJECT_TESTS:=.depend)
ALL_LOCAL = $(am__append_15)
GENERAL_CLEAN_IGNORE_PATTERNS = \
	"*.core" "core.*" \
	"*.test" "*.diff" \
	"*.sort" \
	"*.noindex" \
	"*-from-haco" \
	"*.*haco*" \
	"*.*-from-*-dump" \
	"*.*-from-*-diff"

ALL_CVSIGNORE = $(am__append_16)
# RECURSIVE_TARGETS =

# blatantly copied from Makefile.in, generated by automake
RECURSIVE_TARGET_SCRIPT = \
	failcom='exit 1'; \
	for f in x $$MAKEFLAGS; do \
	  case $$f in \
	    *=* | --[!k]*);; \
	    *k*) failcom='fail=yes';; \
	  esac; \
	done; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    dot_seen=yes; \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	  || eval $$failcom; \
	done; \
	if test "$$dot_seen" = "no"; then \
	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
	fi; test -z "$$fail"


# always bottom-up and reverse order
# NOTE: this script needs to be prepended with '+' to connect jobserver
CLEAN_RECURSIVE_TARGET_SCRIPT = \
	set fnord $$MAKEFLAGS; amf=$$2; \
	list='$(SUBDIRS)'; \
	rev=''; for subdir in $$list; do \
	  if test "$$subdir" = "."; then :; else \
	    rev="$$subdir $$rev"; \
	  fi; \
	done; \
	target=`echo $@ | sed s/-recursive//`; \
	for subdir in $$rev; do \
	  echo "Making $$target in $$subdir"; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"

@AUTO_CVSIGNORE_TRUE@PHONY_CVSIGNORE = clean-cvsignore-local clean-cvsignore-am cvsignore \
@AUTO_CVSIGNORE_TRUE@	clean-cvsignore cvsignore-local cvsignore-am

all: all-am

.SUFFIXES:
.SUFFIXES: .hac .depend .cast .castprs .hac-cpp .hacdepend .haco .compiledump .compiledump-filter .compilewarndiff .compilefaildiff .outdump .indump .haco-dump .outdump-filter .indump-filter .compileobjdiff .hacktcmpltest .hacktcmplwarntest .hacktcmplfailtest .hacktobjtest .hacf .hacf-filter .hacf-diff .hacf-fail .hacf-fail-filter .hacf-fail-diff .hacfo .compileflatdump .compileflatdump-filter .compileflatdump-diff .findump .findump-filter .hacfobjdiff .hacflattest .hacflatfailtest .hacfobjdifftest .compileflatdump-test .haco-c .createdump .createdump-filter .createstderr .creatediff .createfaildump .createfaildiff .haco-c-dump .haco-c-err .haco-c-from-haco .haco-c-from-haco-err .create-from-haco-dump .create-from-haco-dump-filter .create-from-haco-diff .hacktcreatetest .hacktcreatefailtest .haco-a .haco-a-dump .haco-a-dump-filter .haco-a-from-haco .haco-a-from-haco-dump .haco-a-from-haco-dump-filter .allocdump .allocfaildump .allocdump-filter .allocdiff .alloc-from-haco-diff .alloc-from-haco-dump .alloc-from-haco-dump-filter .hacktalloctest .hacktallocfromhacotest .prs .prsdiff .prs-sort .expect-prs .expect-prs-sort .prsdiff-sort .sprs .sprs-sort .sprs-diff .sprsdiff-sort .prsseu .prsseu-sort .prsseu-diff prsseudiff-sort .lvsprs .expect-lvsprs .lvsprsdiff .lvsprs-sort .expect-lvsprs-sort .lvsprsdiff-sort .lvsfail .lvsfaildiff .lvssprs .hacktcflattest .hacktcflatlvstest .hacktcflatlvsfailtest .hacktcflatseutest .hacktsprstest .prs-dot .prs-dot-O1 .prs-dot-ps .prs-neato-ps .prs-circo-ps .prs-twopi-ps .prs-fdp-ps .prs-dot-fig .prs-neato-fig .prs-circo-fig .prs-twopi-fig .prs-fdp-fig .prs-dot-pdf .prs-neato-pdf .prs-circo-pdf .prs-twopi-pdf .prs-fdp-pdf .prsimrc .prsimrc-out .prsimrc-out-filter .prsimrc-diff .prsimrcfail-out .prsimrcfail-out-filter .prsimrcfail-diff .prsimexpr .prsimexprdiff .prsimexpr-O1 .prsimckpt .prsimckpt-dump .prsimckpt-indump .prsimckpt-outdump .prsimckpt-diff .prsimckpt-dupe .prsimckpt-dupe-dump .prsimckpt-O1 .prsimckpt-O1-err .prsimckpt-01-dump .prsimopt-diff .prsimtrace .prsimtrace-O1 .prsimtrace-dump .prsimtrace-O1-dump .prsimtrace-diff .prsimtrace-dump-filter .prsimtrace-O1-dump-filter .prsimtest .prsimfailtest .hacktprsimexprtest .prsimtracetest .prsimckpttest .prsimopttest .hacktprsdottest .v .vx .vxi .vx-out .vxi-out .vx-out-filter .vx-diff .v-wrap .vpitest .chpsimrc .chpsimrc-out .chpsimrc-out-filter .chpsimrc-diff .chpsimallocdump .chpsimallocdiff .chpsim-event-dot .chpsim-event-fig .chpsim-event-ps .chpsim-event-pdf .chpsimrcfail-out .chpsimrcfail-diff .chpsimckpt .chpsimckpt-outdump .chpsimckpt-indump .chpsimckpt-dupe .chpsimckpt-dupe-dump .chpsimckpt-diff .chpsimtrace .chpsimtest .chpsimfailtest .chpsimalloctest .chpsimdottest .chpsimckpttest .hacscm .hacscm-out .hacscmfail-out .hacscm-diff .hacscmfail-diff .hacchpsimscm .hacchpsimscm-out .hacchpsimscmfail-out .hacchpsimscm-diff .hacchpsimscmfail-diff .hacscmtest .hacscmfailtest .hacchpsimscmtest .hacchpsimscmfailtest .spice .spice-diff .spice-fail .spice-fail-diff .hacknettest .hacknetfailtest .allocfaildiff .expect-prsseu .expect-prsseu-sort .expect-sprs .expect-sprs-sort .hacktallocfailtest .haco-a-from-haco-filter .haco-c-dump-filter .prsimckpt-O1-dump .prsseudiff .prsseudiff-sort .sprsdiff
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/test/Make.test-head $(top_srcdir)/Make.stddef $(top_srcdir)/test/Make.test-tail $(top_srcdir)/test/Make.test-compile $(top_srcdir)/test/Make.test-flatten $(top_srcdir)/test/Make.test-create $(top_srcdir)/test/Make.test-alloc $(top_srcdir)/test/Make.test-cflat $(top_srcdir)/test/Make.test-graph $(top_srcdir)/test/Make.test-prsim $(top_srcdir)/test/Make.test-vpi $(top_srcdir)/test/Make.test-chpsim $(top_srcdir)/test/Make.test-guile $(top_srcdir)/test/Make.test-net $(top_srcdir)/Make.global $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
		&& exit 0; \
	      exit 1;; \
	  esac; \
	done; \
	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  test/chpsim/testlib/Makefile'; \
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --gnu  test/chpsim/testlib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@case '$?' in \
	  *config.status*) \
	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
	  *) \
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
	esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

$(top_srcdir)/configure:  $(am__configure_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs

distclean-libtool:
	-rm -f libtool
uninstall-info-am:
tags: TAGS
TAGS:

ctags: CTAGS
CTAGS:


check-TESTS: $(TESTS)
	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
	srcdir=$(srcdir); export srcdir; \
	list='$(TESTS)'; \
	if test -n "$$list"; then \
	  for tst in $$list; do \
	    if test -f ./$$tst; then dir=./; \
	    elif test -f $$tst; then dir=; \
	    else dir="$(srcdir)/"; fi; \
	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
	      all=`expr $$all + 1`; \
	      case " $(XFAIL_TESTS) " in \
	      *" $$tst "*) \
		xpass=`expr $$xpass + 1`; \
		failed=`expr $$failed + 1`; \
		echo "XPASS: $$tst"; \
	      ;; \
	      *) \
		echo "PASS: $$tst"; \
	      ;; \
	      esac; \
	    elif test $$? -ne 77; then \
	      all=`expr $$all + 1`; \
	      case " $(XFAIL_TESTS) " in \
	      *" $$tst "*) \
		xfail=`expr $$xfail + 1`; \
		echo "XFAIL: $$tst"; \
	      ;; \
	      *) \
		failed=`expr $$failed + 1`; \
		echo "FAIL: $$tst"; \
	      ;; \
	      esac; \
	    else \
	      skip=`expr $$skip + 1`; \
	      echo "SKIP: $$tst"; \
	    fi; \
	  done; \
	  if test "$$failed" -eq 0; then \
	    if test "$$xfail" -eq 0; then \
	      banner="All $$all tests passed"; \
	    else \
	      banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
	    fi; \
	  else \
	    if test "$$xpass" -eq 0; then \
	      banner="$$failed of $$all tests failed"; \
	    else \
	      banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
	    fi; \
	  fi; \
	  dashes="$$banner"; \
	  skipped=""; \
	  if test "$$skip" -ne 0; then \
	    skipped="($$skip tests were not run)"; \
	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
	      dashes="$$skipped"; \
	  fi; \
	  report=""; \
	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
	    report="Please report to $(PACKAGE_BUGREPORT)"; \
	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
	      dashes="$$report"; \
	  fi; \
	  dashes=`echo "$$dashes" | sed s/./=/g`; \
	  echo "$$dashes"; \
	  echo "$$banner"; \
	  test -z "$$skipped" || echo "$$skipped"; \
	  test -z "$$report" || echo "$$report"; \
	  echo "$$dashes"; \
	  test "$$failed" -eq 0; \
	else :; fi

distdir: $(DISTFILES)
	$(mkdir_p) $(distdir)/../../.. $(distdir)/../../../test
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
	list='$(DISTFILES)'; for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
	  esac; \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkdir_p) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
	$(MAKE) $(AM_MAKEFLAGS) \
	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
	  dist-hook
check-am: all-am
	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile all-local
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:
	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)

distclean-generic:
	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-am

clean-am: clean-generic clean-libtool clean-local mostlyclean-am

distclean: distclean-am
	-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
	distclean-local

dvi: dvi-am

dvi-am:

html: html-am

info: info-am

info-am:

install-data-am:

install-exec-am:

install-info: install-info-am

install-man:

installcheck-am:

maintainer-clean: maintainer-clean-am
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-generic mostlyclean-libtool

pdf: pdf-am

pdf-am:

ps: ps-am

ps-am:

uninstall-am: uninstall-info-am

.PHONY: all all-am all-local check check-TESTS check-am clean \
	clean-generic clean-libtool clean-local dist-hook distclean \
	distclean-generic distclean-libtool distclean-local distdir \
	dvi dvi-am html html-am info info-am install install-am \
	install-data install-data-am install-exec install-exec-am \
	install-info install-info-am install-man install-strip \
	installcheck installcheck-am installdirs maintainer-clean \
	maintainer-clean-generic mostlyclean mostlyclean-generic \
	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
	uninstall-info-am

force-am:
force:

# end "Make.stddef"

$(BOGUS_SUFFIX_TARGETS):
	@$(TOUCH) $@

.hac.depend:
	@if test -x $(HACKT_COMPILE_EXE) ; then \
		$(ECHO) "Generating automatic dependencies $@ ..." && \
		$(HACKT_COMPILE_EXE) $(HACO_FLAGS) -M $@-tmp $< && \
		$(CAT) $@-tmp | $(HAC_DEPEND_FILTER) > $@ && \
		$(RM) $@-tmp ; \
	fi
#	$(HACKT_COMPILE_EXE) $(HACO_FLAGS) $< $@

# dependency tracking enabled by default
# note: echoed command is slightly 'simplified' of actual executed command
.hac.haco:
	@$(HACKT_COMPILE_TEST_DEFAULT_SCRIPT)
# NOTE: workaround Apple's cpp bugs: -MF and -MT cause cpp to hang
# NOTE: behavior with -MD is different between apple gcc-3.3 and gcc-4.0!
#	doesn't always produce $*.d... WTF
# NOTE: -MP doesn't generate phony targets with just -M [:S]
.hac-cpp.hac:
#	$(CPP_TRADITIONAL) $(HACKT_CPP_FLAGS) $< > $@
	$(CPP_TRADITIONAL) $(HACKT_CPP_FLAGS) $< | \
		$(GREP) -v "^#pragma" > $@ && \
	$(CPP_TRADITIONAL) $(HACKT_CPP_FLAGS) $(HACKT_CPP_MKDEP_FLAGS) $< | \
		$(SED) 's|^.*\.o:|$@:|' > $@depend
#	$(RM) $*.d
# does the same thing as -MF -MT

# for making dependencies without normal preprocessing output
# HACKT_CPP_MKDEPFLAGS = $(HACO_FLAGS) -MP -M -MF $@depend -MT $@
# just create an empty hacdepend and let preprocessing side-effect overwrite
.hac-cpp.hacdepend:
	@$(TOUCH) $@
#	$(CPP_TRADITIONAL) $(HACKT_CPP_FLAGS) $<

hac-cpp.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CPP_PARSE_TEST_SUBJECTS)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print "-include " $$1 ".hacdepend"; }' > $@ ; \
	$(TOUCH) $@

-include hac-cpp.autodepend

# for expect-fail tests: ignore exit status
.hac.compiledump:
	-@obj=`$(ECHO) $@ | $(SED) 's/\.compiledump$$/.haco/g'` ; \
	$(ECHO_COMPILEDUMP_COMMAND) ; \
	flags=`$(CAT) $< | $(EXTRACT_HACO_FLAGS_PIPE)` ; \
	cmd="$(HACKT_COMPILE_EXE) $(HACO_FLAGS) $$flags $< $$obj" ; \
	$(ECHO) "$$cmd" ; \
	$$cmd > $@ 2>&1

.compiledump.compiledump-filter:
	@$(CAT) $< | $(HACKT_COMPILE_ERROR_FILTER) > $@

.hac.outdump:
	@depbase=`$(ECHO) $@ | $(SED) 's/\.outdump$$//g'` ; \
	flags=`$(CAT) $< | $(EXTRACT_HACO_FLAGS_PIPE)` ; \
	$(ECHO_OUTDUMP_COMMAND) ; \
	$(HACKT_COMPILE_EXE) -d -fdump-object-header $(HACO_FLAGS) $$flags \
		$< "$$depbase".hacod > $@ 2>&1

.haco.indump:
	$(DEFAULT_OBJDUMP_RULE_ACTION)

# or just filter out all text before the persistence header
.outdump.outdump-filter:
	@$(CAT) $< | $(HACKT_OBJ_DIFF_FILTER) | $(GREP) -v "^WARNING" > $@ ; \
	$(ECHO_FILTERED)

.indump.indump-filter:
	@$(CAT) $< | $(HACKT_OBJ_DIFF_FILTER) > $@ ; \
	$(ECHO_FILTERED)

.haco.haco-dump:
	$(DEFAULT_OBJDUMP_RULE_ACTION)

.indump-filter.compileobjdiff:
	@odump=`$(ECHO) $@ | $(SED) 's/\.compileobjdiff$$/.outdump-filter/g'` ; \
	$(RM) $@ ; \
	if test -f "$$odump" ; then \
	  $(ECHO_OBJDUMP_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$odump" $< > $@ 2>&1 ; \
	  if test -s $@ ; then $(ECHO) "Object differences in $@!" ; fi ; \
	else exit 1 ; \
	fi ; \
	$(TOUCH) $@

compileobjdiff.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_OBJ_TEST_SUBJECTS)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".compileobjdiff: " $$1 ".outdump-filter"; }' > $@ ; \
	$(TOUCH) $@

-include compileobjdiff.autodepend

# should pass without any diagnostics
.haco.hacktcmpltest:
	@log=`$(ECHO) $@ | $(SED) 's/\.hacktcmpltest$$/.compiledump/g'` ; \
	{ $(ECHO) "#!$(SHELL)" ; \
	$(ECHO) "# \"$@\"" ; \
	err=0 ; \
	if test -f "$$log" ; then \
	  if test -s "$$log" ; then \
	    if $(GREP) -v "finish writing" $$log | $(GREP) -q . ; then \
	    $(ECHO) "$(ECHO) Unexpected diagnostics in $$log." ; \
	    err=1 ; \
	    fi ; \
	  fi ; \
	else $(ECHO) "$(ECHO) Missing $$log." ; \
	  err=1 ; \
	fi ; \
	if test "$$err" -eq 1 ; then \
	  $(ECHO) "exit 1" ; \
	fi ; } > $@ ; \
	$(CHMOD) +x $@

# no need to filter warnings
.compilewarndiff.hacktcmplwarntest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.haco.compilewarndiff:
	@log=`$(ECHO) $@ | $(SED) 's/\.compilewarndiff$$/.compiledump/g'` ; \
	stderr=`$(ECHO) $@ | $(SED) 's/\.compilewarndiff$$/.stderr/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  if test -f "$$log" ; then \
	    $(ECHO_COMPILEWARN_DIFF_COMMAND) ; \
	    $(DIFF) -bu "$$expect" "$$log" > $@ 2>&1 ; \
	    if test -s $@ ; then $(ECHO) "$@ is non-empty!" ; fi ; \
	  else $(ECHO) "Missing $$log." | $(TEE) $@ ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

compilewarntest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PARSE_TEST_WARNINGS)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".compilewarndiff: $$(srcdir)/" $$1 ".stderr"; }' > $@ ; \
	$(TOUCH) $@

-include compilewarntest.autodepend

.compilefaildiff.hacktcmplfailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

# additional dependencies:
# .stderr.compilefaildirr
.compiledump-filter.compilefaildiff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.compilefaildiff$$/.stderr/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_COMPILEDUMP_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  $(BISON_COMPILE_DIFF_SCRIPT) ; \
	  if test -s $@ ; then $(ECHO) "$@ is non-empty!" ; fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

compilefailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PARSE_TEST_FAILURES) $(HACKT_CPP_PARSE_TEST_FAILURES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".compilefaildiff: $$(srcdir)/" $$1 ".stderr"; }' > $@ ; \
	$(TOUCH) $@

-include compilefailtest.autodepend

# dummy test for when make variable is empty
.hacktcmpltest:
	@$(DUMMY_TEST_SCRIPT)

.hacktcmplwarntest:
	@$(DUMMY_TEST_SCRIPT)

.hacktcmplfailtest:
	@$(DUMMY_TEST_SCRIPT)

# .hac.hacktobjtest:
.compileobjdiff.hacktobjtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

# dummy test for when make variable is empty
.hacktobjtest:
	@$(DUMMY_TEST_SCRIPT)

# compilediffs is obsolete
compilediffs: force
	-$(CAT) *.diff > $@

compilewarndiffs: force
	-$(CAT) *.compilewarndiff > $@

compilefaildiffs: force
	-$(CAT) *.compilefaildiff > $@

compileobjdiffs: force
	-$(CAT) *.compileobjdiff > $@
$(HACKT_PARSE_FAIL_DUMPS): $(HACKT_COMPILE_EXE)
$(HACKT_COMPILE_OBJ_DUMPS): $(HACKT_COMPILE_EXE)

build-check-local: \
	$(HACKT_PARSE_TEST_PASSES:=.haco) \
	$(HACKT_CPP_PARSE_TEST_SUBJECTS:=.hac) \
	$(HACKT_CPP_PARSE_TEST_PASSES:=.haco) \
	$(HACKT_PARSE_TEST_WARNINGS:=.haco) \
	$(HACKT_PARSE_TEST_WARNINGS:=.compiledump) \
	$(HACKT_PARSE_TEST_WARNINGS:=.compiledump-filter) \
	$(HACKT_PARSE_TEST_WARNINGS:=.compilewarndiff) \
	$(HACKT_PARSE_TEST_FAILURES:=.compiledump) \
	$(HACKT_PARSE_TEST_FAILURES:=.compiledump-filter) \
	$(HACKT_PARSE_TEST_FAILURES:=.compilefaildiff) \
	$(HACKT_CPP_PARSE_TEST_FAILURES:=.compiledump) \
	$(HACKT_CPP_PARSE_TEST_FAILURES:=.compiledump-filter) \
	$(HACKT_CPP_PARSE_TEST_FAILURES:=.compilefaildiff) \
	$(HACKT_OBJ_TEST_SUBJECTS:=.outdump) \
	$(HACKT_OBJ_TEST_SUBJECTS:=.indump) \
	$(HACKT_OBJ_TEST_SUBJECTS:=.outdump-filter) \
	$(HACKT_OBJ_TEST_SUBJECTS:=.indump-filter) \
	$(HACKT_OBJ_TEST_SUBJECTS:=.compileobjdiff)

echo-compile-passes: force
	@$(ECHO) $(HACKT_PARSE_TEST_PASSES) $(HACKT_CPP_PARSE_TEST_PASSES)

echo-compile-warnings: force
	@$(ECHO) $(HACKT_PARSE_TEST_WARNINGS)

echo-compile-failures: force
	@$(ECHO) $(HACKT_PARSE_TEST_FAILURES) $(HACKT_CPP_PARSE_TEST_FAILURES)

echo-bison-outputs: force
	@$(ECHO) $(BISON_OUTPUTS)

echo-parse-tests: force
	@$(ECHO) $(HACKT_PARSE_TEST_SUBJECTS)

clean-compiletests:
	patternlist='$(HACKT_COMPILE_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-compiletests

.PHONY: clean-compiletests

.hac.hacf:
	@$(HACKT_FLATTEN_TEST_DEFAULT_SCRIPT)

.hacf.hacf-filter:
	@$(CAT) $< | $(HACKT_FLATTEN_ERROR_FILTER) > $@

.hacf-filter.hacf-diff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.hacf-diff$$/.hacf-expect/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_FLATTEN_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ ; \
	  if test -s $@ ; then $(ECHO) "Differences in $@!" ; fi ; \
	else exit 1 ; \
	fi ; \
	$(TOUCH) $@

.hacf-diff.hacflattest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

hacflattest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_FLATTEN_TEST_PASSES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".hacf-diff: $$(srcdir)/" $$1 ".hacf-expect"; }' > $@ ; \
	$(TOUCH) $@

-include hacflattest.autodepend

###############################################################################
# flattened files have no dependencies!
# really don't need include $(HACO_FLAGS) flags for this...
.hacf.hacfo:
	@log="$$depbase.compileflatdump" ; \
	cmd="$(HACKT_COMPILE_EXE) $< $@" ; \
	$(ECHO) "$$cmd" ; \
	$$cmd > "$$log" 2>&1

.hacfo.findump:
	$(DEFAULT_OBJDUMP_RULE_ACTION)

# additional sed filter fakes the file name as if it were the original source
.findump.findump-filter:
	@$(CAT) $< | $(HACKT_OBJ_DIFF_FILTER) | \
	$(SED) -e '/^In module/s|$*.hacf|$(srcdir)/$*.hac|' \
		-e '/^In module/s| \./| |' > $@ ; \
	$(ECHO_FILTERED)

.findump-filter.hacfobjdiff:
	@expect=`$(ECHO) $@ | $(SED) 's/\.hacfobjdiff$$/.indump-filter/g'` ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_FLATTEN_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ ; \
	  if test -s $@ ; then $(ECHO) "Differences in $@!" ; fi ; \
	else exit 1 ; \
	fi ; \
	$(TOUCH) $@

.hacfobjdiff.hacfobjdifftest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

hacfobjdifftest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_FLATTEN_PARSE_TEST_PASSES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".hacfobjdiff: " $$1 ".indump-filter"; }' > $@ ; \
	$(TOUCH) $@

-include hacfobjdifftest.autodepend

###############################################################################
# expect fail: dummy object target should fail to be produced
# really don't need include $(HACO_FLAGS) flags for this...
.hacf.compileflatdump:
	-@obj=`$(ECHO) $@ | $(SED) 's/\.compileflatdump$$/.haco/g'` ; \
	cmd="$(HACKT_COMPILE_EXE) $< $$obj" ; \
	$(ECHO) "$$cmd" ; \
	$$cmd > $@ 2>&1
# 1) trivially adjust file name as if it were non-flattened
# 2) expanded embdedded files take up larger file position
# 3) compensates for parse errors placement of import decl.

.compileflatdump.compileflatdump-filter:
	@$(CAT) $< | $(HACKT_COMPILE_ERROR_FILTER) | \
		$(COMPILEFLATDUMP_EXTRA_FILTER) > $@

.compileflatdump-filter.compileflatdump-diff:
	@expect=`$(ECHO) $@ | $(SED) 's/\.compileflatdump-diff$$/.compiledump-filter/g'` ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_FLATTEN_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ ; \
	  if test -s $@ ; then \
	    $(CAT) "$$expect" | $(COMPILEFLATDUMP_EXTRA_FILTER) > "$$expect"-tmp ; \
	    $(DIFF) -bu "$$expect"-tmp $< > $@ ; \
	    if test -s $@ ; then \
	      $(ECHO) "Differences in $@!" ; \
	    fi ; \
	  fi ; \
	else exit 1 ; \
	fi ; \
	$(TOUCH) $@

.compileflatdump-diff.compileflatdump-test:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

compileflattest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_FLATTEN_PARSE_TEST_FAILURES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".compileflatdump-diff: " $$1 ".compiledump-filter"; }' > $@ ; \
	$(TOUCH) $@

-include compileflattest.autodepend

###############################################################################
.hac.hacf-fail:
	-$(HACKT_FLATTEN_EXE) $(HACO_FLAGS) $< > $@ 2> $@-stderr ; \
	$(CAT) $@-stderr >> $@ ; \
	$(RM) $@-stderr

.hacf-fail.hacf-fail-filter:
	@$(CAT) $< | $(HACKT_FLATTEN_ERROR_FILTER) > $@

.hacf-fail-filter.hacf-fail-diff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.hacf-fail-diff$$/.hacf-expect/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_FLATTEN_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ ; \
	  if test -s $@ ; then $(ECHO) "Differences in $@!" ; fi ; \
	else exit 1 ; \
	fi ; \
	$(TOUCH) $@

.hacf-fail-diff.hacflatfailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

hacflatfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_FLATTEN_TEST_FAILURES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".hacf-fail-diff: $$(srcdir)/" $$1 ".hacf-expect"; }' > $@ ; \
	$(TOUCH) $@

-include hacflatfailtest.autodepend
###############################################################################

# dummy test for when make variable is empty
.hacflattest:
	@$(DUMMY_TEST_SCRIPT)

.hacflatfailtest:
	@$(DUMMY_TEST_SCRIPT)

.hacfobjdifftest:
	@$(DUMMY_TEST_SCRIPT)

.compileflatdump-test:
	@$(DUMMY_TEST_SCRIPT)

hacflatdiffs: force
	-$(CAT) *.hacf-diff > $@

hacflatfaildiffs: force
	-$(CAT) *.hacf-fail-diff > $@

hacfobjdiffs: force
	-$(CAT) *.hacfobjdiff > $@

compileflatdiffs: force
	-$(CAT) *.compileflatdump-diff > $@
$(HACKT_FLATTEN_DUMPS): $(HACKT_FLATTEN_EXE)
# $(HACKT_FLATTEN_PARSE_TEST_PASSES:=.hacfo): $(HACKT_COMPILE_EXE)
# $(HACKT_FLATTEN_PARSE_TEST_PASSES:=.findump): $(HACKT_OBJDUMP_EXE)
# $(HACKT_FLATTEN_PARSE_TEST_FAILURES:=.compileflatdump): $(HACKT_COMPILE_EXE)

build-check-local: \
	$(HACKT_FLATTEN_TEST_PASSES:=.hacf) \
	$(HACKT_FLATTEN_TEST_PASSES:=.hacf-filter) \
	$(HACKT_FLATTEN_TEST_PASSES:=.hacf-diff) \
	$(HACKT_FLATTEN_TEST_FAILURES:=.hacf-fail) \
	$(HACKT_FLATTEN_TEST_FAILURES:=.hacf-fail-filter) \
	$(HACKT_FLATTEN_TEST_FAILURES:=.hacf-fail-diff) \
	$(HACKT_FLATTEN_PARSE_TEST_PASSES:=.hacfo) \
	$(HACKT_FLATTEN_PARSE_TEST_PASSES:=.findump) \
	$(HACKT_FLATTEN_PARSE_TEST_PASSES:=.findump-filter) \
	$(HACKT_FLATTEN_PARSE_TEST_PASSES:=.hacfobjdiff) \
	$(HACKT_FLATTEN_PARSE_TEST_FAILURES:=.compileflatdump) \
	$(HACKT_FLATTEN_PARSE_TEST_FAILURES:=.compileflatdump-filter) \
	$(HACKT_FLATTEN_PARSE_TEST_FAILURES:=.compiledump) \
	$(HACKT_FLATTEN_PARSE_TEST_FAILURES:=.compiledump-filter) \
	$(HACKT_FLATTEN_PARSE_TEST_FAILURES:=.compileflatdump-diff)

echo-flatten-passes: force
	@$(ECHO) $(HACKT_FLATTEN_TEST_PASSES)

echo-flatten-failures: force
	@$(ECHO) $(HACKT_FLATTEN_TEST_FAILURES)

echo-flatten-tests: force
	@$(ECHO) $(HACKT_FLATTEN_TEST_SUBJECTS)

clean-flattentests:
	patternlist='$(HACKT_FLATTEN_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-flattentests

.PHONY: clean-flattentests

.haco-c.createdump:
	@$(CREATE_OBJDUMP_SCRIPT)

# or link
.createdump.haco-c-dump:
	@$(CP) $? $@

.createdump.createdump-filter:
	@$(CAT) $< | $(HACKT_OBJ_DIFF_FILTER) > $@ ; \
	$(ECHO_FILTERED)

.haco-c-dump.haco-c-dump-filter:
	@$(CAT) $< | $(HACKT_OBJ_DIFF_FILTER) > $@ ; \
	$(ECHO_FILTERED)
#	$(CAT) "$$filtered" | $(POM_SIZE_FILTER) > "$$filtered2" ; \
#	$(CAT) $<-noindex | $(POM_SIZE_FILTER) > $<-nosize ;

.createdump-filter.creatediff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.creatediff$$/.createstderr/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_CREATEDUMP_DIFF_COMMAND) ; \
	  $(HACKT_CREATE_TEST_DIFF) "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	    $(ANALYZE_DIFF_AWK) -v quiet=2 $@ > $@-anal ; \
	    if $(GREP) "OK" $@-anal ; then \
	      filtered=`$(ECHO) $@ | $(SED) 's/\.creatediff$$/.createstderr-noindex/g'` ; \
	      diffout=`$(ECHO) $@ | $(SED) 's/\.creatediff$$/.creatediff-noindex/g'` ; \
	      $(CAT) "$$expect" | $(POM_INDEX_FILTER) > $$filtered ; \
	      $(CAT) $< | $(POM_INDEX_FILTER) > $<-noindex ; \
	      $(HACKT_CREATE_TEST_DIFF) "$$filtered" $<-noindex > "$$diffout" 2>&1 ; \
	      $(ANALYZE_DIFF_AWK) -v quiet=0 "$$diffout" ; \
	    fi ; \
	    $(RM) $@-anal ; \
	    $(CREATE_HEADER_DIFF_SCRIPT_PART2) ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.creatediff.hacktcreatetest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

createtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CREATE_TEST_PASSES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".creatediff: $$(srcdir)/" $$1 ".createstderr"; print $$1 ".createdump: " $$1 ".haco-c-err" ; }' > $@ ; \
	$(TOUCH) $@

-include createtest.autodepend

.hacktcreatetest:
	@$(DUMMY_TEST_SCRIPT)

# unroll and create have been fused together
.haco.createfaildump:
	-@failobj=`$(ECHO) $@ | $(SED) 's/\.createfaildump$$/.haco-c-fail/g'` ; \
	$(ECHO) $(HACKT_CREATE_EXE) $< "$$failobj" ; \
	$(HACKT_CREATE_EXE) $< "$$failobj" > $@ 2>&1

.createfaildump.createfaildiff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.createfaildiff$$/.createstderr/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_CREATEFAIL_DIFF_COMMAND) ; \
	  $(HACKT_CREATE_TEST_DIFF) "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.createfaildiff.hacktcreatefailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

createfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CREATE_TEST_FAILURES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".createfaildiff: $$(srcdir)/" $$1 ".createstderr"; }' > $@ ; \
	$(TOUCH) $@

-include createfailtest.autodepend

.hacktcreatefailtest:
	@$(DUMMY_TEST_SCRIPT)

# unroll and create have been fused together
.haco.haco-c:
	$(HACKT_CREATE_EXE) $< $@ 2>&1 | $(TEE) $@-err
	@$(TOUCH) $@-err

.haco-c.haco-c-err:
	@:

creatediffs: force
	-$(CAT) *.creatediff > $@

createfaildiffs: force
	-$(CAT) *.createfaildiff > $@

creatediffs.noindex: force
	-$(CAT) *.creatediff-noindex > $@

creatediffs.nosize: force
	-$(CAT) *.creatediff-nosize > $@

build-check-local: $(CREATE_BUILD_CHECK_LOCAL)

echo-create-passes: force
	@$(ECHO) $(HACKT_CREATE_TEST_PASSES)

echo-create-failures: force
	@$(ECHO) $(HACKT_CREATE_TEST_FAILURES)

echo-create-tests: force
	@$(ECHO) $(HACKT_CREATE_TEST_SUBJECTS)

clean-createtests:
	patternlist='$(HACKT_CREATE_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-createtests

.PHONY: clean-createtests

# ALLOC tests
.haco-c.haco-a:
	$(HACKT_ALLOC_EXE) $< $@

.haco.haco-a-from-haco:
	$(HACKT_ALLOC_EXE) $< $@

.haco-a.haco-a-dump:
	$(DEFAULT_OBJDUMP_RULE_ACTION)

.haco-a.allocdump:
	$(DEFAULT_OBJDUMP_RULE_ACTION)

.haco-a-from-haco.haco-a-from-haco-dump:
	$(DEFAULT_OBJDUMP_RULE_ACTION)

.haco-a-dump.haco-a-dump-filter:
	$(ALLOCDUMP_FILTER_SCRIPT)

.allocdump.allocdump-filter:
	$(ALLOCDUMP_FILTER_SCRIPT)

.haco-a-from-haco-dump.haco-a-from-haco-filter:
	$(ALLOCDUMP_FILTER_SCRIPT)

.allocdump-filter.allocdiff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.allocdiff$$/.allocstderr/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_ALLOCDUMP_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then $(ECHO) "$@ is non-empty!" ; fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.allocdiff.hacktalloctest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

alloctest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_ALLOC_TEST_PASSES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".allocdiff: $$(srcdir)/" $$1 ".allocstderr"; }' > $@ ; \
	$(TOUCH) $@

-include alloctest.autodepend

.hacktalloctest:
	@$(DUMMY_TEST_SCRIPT)

.haco-c.allocfaildump:
	-@failobj=`$(ECHO) $@ | $(SED) 's/\.allocfaildump$$/.haco-a-fail/g'` ; \
	$(ECHO) $(HACKT_ALLOC_EXE) $< "$$failobj" ; \
	$(HACKT_ALLOC_EXE) $< "$$failobj" > $@ 2>&1

.allocfaildump.allocfaildiff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.allocfaildiff$$/.allocstderr/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_ALLOCFAIL_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.allocfaildiff.hacktallocfailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

allocfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_ALLOC_TEST_FAILURES)" | \
		$(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print $$1 ".allocfaildiff: $$(srcdir)/" $$1 ".allocstderr"; }' > $@ ; \
	$(TOUCH) $@

-include allocfailtest.autodepend

.haco-a-from-haco.alloc-from-haco-dump:
	$(DEFAULT_OBJDUMP_RULE_ACTION)

.alloc-from-haco-dump.alloc-from-haco-dump-filter:
	@$(CAT) $< | $(ALLOC_FILTER) > $@ ; \
	$(ECHO_FILTERED)

# unifies 3-way diff
.alloc-from-haco-dump-filter.alloc-from-haco-diff:
	@expect1=`$(ECHO) $@ | $(SED) 's/\.alloc-from-haco-diff$$/.allocdump-filter/g'` ; \
	$(RM) $@ ; \
	if test -f "$$expect1" ; then \
	  $(ECHO_ALLOCFROMHACO_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect1" $< >> $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect1." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

allocfromhaco.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_ALLOC_TEST_PASSES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".alloc-from-haco-diff: " $$1 ".allocdump-filter"; }' > $@ ; \
	$(TOUCH) $@

-include allocfromhaco.autodepend

.alloc-from-haco-diff.hacktallocfromhacotest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.hacktallocfromhacotest:
	@$(DUMMY_TEST_SCRIPT)

# this now includes 3-way differences
allocfromhacodiffs: force
	-$(CAT) *.alloc-from-haco-diff > $@

allocdiffs: force
	-$(CAT) *.allocdiff > $@

allocfaildiffs: force
	-$(CAT) *.allocfaildiff > $@

allocdiffs.noindex: force
	-$(CAT) *.allocdiff-noindex > $@

build-check-local: $(ALLOC_BUILD_CHECK_LOCAL)

# echo-alloc-build-check-local:
#	@$(ECHO) $(ALLOC_BUILD_CHECK_LOCAL)

echo-alloc-passes: force
	@$(ECHO) $(HACKT_ALLOC_TEST_PASSES)

echo-alloc-failures: force
	@$(ECHO) $(HACKT_ALLOC_TEST_FAILURES)

echo-alloc-tests: force
	@$(ECHO) $(HACKT_ALLOC_TEST_SUBJECTS)

clean-alloctests:
	patternlist='$(HACKT_ALLOC_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-alloctests

.PHONY: clean-alloctests

# the touch is only necessary if the output is empty, in which case
# we need to force a timestamp update
.haco-a.prs:
	@$(DEDUCE_HFLAT_VARIANT) ; \
	cmd="$(HACKT_CFLAT_PRSIM_EXE) $$flags $<" ; \
	$(ECHO) "$$cmd > $@" ; \
	$$cmd > $@
	@$(TOUCH) $@

.prs.prs-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-prs.expect-prs-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-prs-sort.prsdiff-sort:
	@out=`$(ECHO) $@ | $(SED) 's/\.prsdiff-sort$$/.prs-sort/g'` ; \
	if test -f "$$out" ; then \
	  $(ECHO_CFLATPRS_DIFF_COMMAND) ; \
	  $(CFLATPRS_DIFF_COMMAND) > $@ ; \
	  if test ! -s $@ ; then \
	    $(ECHO) "Only re-ordering differences found.  (OK)" ; \
	  fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.expect-prs.prsdiff:
	@out=`$(ECHO) $@ | $(SED) 's/\.prsdiff$$/.prs/g'` ; \
	$(RM) $@ ; \
	if test -f "$$out" ; then \
	  $(ECHO_CFLATPRS_DIFF_COMMAND) ; \
	  $(CFLATPRS_DIFF_COMMAND) > $@ ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	    $(MAKE) $@-sort ; \
	    $(OLD_PRSIM_TEST_SCRIPT) ; \
	  fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.prsdiff.hacktcflattest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.hacktcflattest:
	@$(DUMMY_TEST_SCRIPT)

cflatprstest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CFLAT_TEST_SUBJECTS)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsdiff: " $$1 ".prs"; print $$1 ".prsdiff-sort: " $$1 ".prs-sort"; }' > $@ ; \
	$(TOUCH) $@

-include cflatprstest.autodepend

# if the source file has a magic line @hflat-type@, then extract it
# as the type to process for cflatting.
# The hflat-type string must not contain any spaces!
.haco-a.lvsprs:
	@$(HACKT_CFLAT_LVS_SCRIPT)

.haco-a.lvsfail:
	-@$(HACKT_CFLAT_LVS_SCRIPT)

.haco-a.lvssprs:
	@$(DEDUCE_HFLAT_VARIANT) ; \
	cmd="$(HACKT_CFLAT_LVS_EXE) -fsizes $$flags $<" ; \
	$(ECHO_CFLAT_LVS_SIZE_COMMAND) ; \
	$$cmd > $@

.lvsprs.lvsprs-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-lvsprs.expect-lvsprs-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-lvsprs-sort.lvsprsdiff-sort:
	@out=`$(ECHO) $@ | $(SED) 's/\.lvsprsdiff-sort$$/.lvsprs-sort/g'` ; \
	if test -f "$$out" ; then \
	  $(ECHO_CFLATLVS_DIFF_COMMAND) ; \
	  $(DIFF) -bu $< "$$out" > $@ ; \
	  if test ! -s $@ ; then \
	    $(ECHO) "Only re-ordering differences found.  (OK)" ; \
	  fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.expect-lvsprs.lvsprsdiff:
	@out=`$(ECHO) $@ | $(SED) 's/\.lvsprsdiff$$/.lvsprs/g'` ; \
	$(RM) $@ ; \
	if test -f "$$out" ; then \
	  $(ECHO_CFLATLVS_DIFF_COMMAND) ; \
	  $(DIFF) -bu $< "$$out" > $@ ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.expect-lvsprs.lvsfaildiff:
	@out=`$(ECHO) $@ | $(SED) 's/\.lvsfaildiff$$/.lvsfail/g'` ; \
	$(RM) $@ ; \
	if test -f "$$out" ; then \
	  $(ECHO_CFLATLVS_DIFF_COMMAND) ; \
	  $(DIFF) -bu $< "$$out" > $@ ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.lvsprsdiff.hacktcflatlvstest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.lvsfaildiff.hacktcflatlvsfailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.hacktcflatlvstest:
	@$(DUMMY_TEST_SCRIPT)

.hacktcflatlvsfailtest:
	@$(DUMMY_TEST_SCRIPT)

cflatlvstest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CFLAT_LVS_TEST_PASSES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".lvsprsdiff: " $$1 ".lvsprs"; print $$1 ".lvsprsdiff-sort: " $$1 ".lvsprs-sort"; }' > $@ ; \
	$(TOUCH) $@

cflatlvsfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CFLAT_LVS_TEST_FAILURES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".lvsfaildiff: " $$1 ".lvsfail"; }' > $@ ; \
	$(TOUCH) $@

-include cflatlvstest.autodepend
-include cflatlvsfailtest.autodepend

# not bothering to extract @hflat-flags@ for these tests
.haco-a.prsseu:
	$(HACKT_CFLAT_PRSIM_SEU_EXE) $< > $@

.prsseu.prsseu-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-prsseu.expect-prsseu-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-prsseu-sort.prsseudiff-sort:
	@out=`$(ECHO) $@ | $(SED) 's/\.prsseudiff-sort$$/.prsseu-sort/g'` ; \
	if test -f "$$out" ; then \
	  $(ECHO_CFLATPRSSEU_DIFF_COMMAND) ; \
	  $(DIFF) -bu $< "$$out" > $@ ; \
	  if test ! -s $@ ; then \
	    $(ECHO) "Only re-ordering differences found.  (OK)" ; \
	  fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.expect-prsseu.prsseudiff:
	@out=`$(ECHO) $@ | $(SED) 's/\.prsseudiff$$/.prsseu/g'` ; \
	$(RM) $@ ; \
	if test -f "$$out" ; then \
	  $(ECHO_CFLATPRSSEU_DIFF_COMMAND) ; \
	  $(DIFF) -bu $< "$$out" > $@ ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.prsseudiff.hacktcflatseutest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.hacktcflatseutest:
	@$(DUMMY_TEST_SCRIPT)

cflatprsseutest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CFLAT_SEU_TEST_SUBJECTS)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsseudiff: " $$1 ".prsseu"; print $$1 ".prsseudiff-sort: " $$1 ".prsseu-sort"; }' > $@ ; \
	$(TOUCH) $@

-include cflatprsseutest.autodepend

.haco-a.sprs:
	@$(DEDUCE_HFLAT_VARIANT) ; \
	cmd="$(HACKT_CFLAT_PRSIM_EXE) -fsizes $$flags $<" ; \
	$(ECHO) "$$cmd > $@" ; \
	$$cmd > $@

.sprs.sprs-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-sprs.expect-sprs-sort:
	$(DEFAULT_SORT_SCRIPT)

.expect-sprs-sort.sprsdiff-sort:
	@out=`$(ECHO) $@ | $(SED) 's/\.sprsdiff-sort$$/.sprs-sort/g'` ; \
	if test -f "$$out" ; then \
	    $(ECHO_SPRS_DIFF_COMMAND) ; \
	    $(SPRS_DIFF_COMMAND) > $@ ; \
	    if test ! -s $@ ; then \
	      $(ECHO) "Only re-ordering differences found.  (OK)" ; \
	    fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.expect-sprs.sprsdiff:
	@out=`$(ECHO) $@ | $(SED) 's/\.sprsdiff$$/.sprs/g'` ; \
	$(RM) $@ ; \
	if test -f "$$out" ; then \
	    $(ECHO_SPRS_DIFF_COMMAND) ; \
	    $(SPRS_DIFF_COMMAND) > $@ ; \
	    if test -s $@ ; then \
	      $(ECHO) "$@ is non-empty!" ; \
	    fi ; \
	else $(ECHO) "Missing $$out." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.sprsdiff.hacktsprstest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.hacktsprstest:
	@$(DUMMY_TEST_SCRIPT)

cflatsprstest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CFLAT_SPRS_TEST_SUBJECTS)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".sprsdiff: " $$1 ".sprs"; print $$1 ".sprsdiff-sort: " $$1 ".sprs-sort"; }' > $@ ; \
	$(TOUCH) $@

-include cflatsprstest.autodepend

@HAVE_CFLAT_TRUE@.cast.castprs:
@HAVE_CFLAT_TRUE@	$(CFLAT) -prsim $< > $@
@HAVE_CFLAT_FALSE@.cast.castprs:
@HAVE_CFLAT_FALSE@	@$(ECHO) "Sorry, no cflat found in path." ; exit 1

prsdiffs: force
	-$(CAT) *.prsdiff > $@

lvsprsdiffs: force
	-$(CAT) *.lvsprsdiff > $@

lvsfaildiffs: force
	-$(CAT) *.lvsfaildiff > $@

prsseudiffs: force
	-$(CAT) *.prsseu-diff > $@

sprsdiffs: force
	-$(CAT) *.sprsdiff > $@

prsdiffs.sort: force
	-$(CAT) *.prsdiff-sort > $@

prsseudiffs.sort: force
	-$(CAT) *.prsseu-diff-sort > $@

sprsdiffs.sort: force
	-$(CAT) *.sprsdiff.sort > $@

build-check-local: $(CFLAT_BUILD_CHECK_LOCAL)

clean-empty-cflat-prs:
	-test -z "$(EMPTY_CFLAT_PRS)" || $(RM) $(EMPTY_CFLAT_PRS)

# need a bogus dependency to make it work... ?
$(EMPTY_CFLAT_PRS): Makefile
	@$(TOUCH) $@

all-local: $(EMPTY_CFLAT_PRS)

echo-empty-cflat-prs: force
	@$(ECHO) $(EMPTY_CFLAT_PRS)

echo-cflat-tests: force
	@$(ECHO) $(HACKT_CFLAT_TEST_SUBJECTS)

echo-cflat-lvs-passes: force
	@$(ECHO) $(HACKT_CFLAT_LVS_TEST_PASSES)

echo-cflat-lvs-failures: force
	@$(ECHO) $(HACKT_CFLAT_LVS_TEST_FAILURES)

echo-cflat-lvs-tests: force
	@$(ECHO) $(HACKT_CFLAT_LVS_TEST_SUBJECTS)

echo-cflat-sprs-tests: force
	@$(ECHO) $(HACKT_CFLAT_SPRS_TEST_SUBJECTS)

clean-cflattests:
	patternlist='$(HACKT_CFLAT_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-cflattests

.PHONY: clean-cflattests

# by default we produce the figures using optimized expression netlists -O1
# All thevarious graphviz filter programs accept the DOT language for input.  
@HAVE_DOT_TRUE@.prs-dot-O1.prs-dot-ps:
@HAVE_DOT_TRUE@	$(DOT) -Tps $< -o $@

@HAVE_DOT_TRUE@.prs-dot-O1.prs-dot-fig:
@HAVE_DOT_TRUE@	$(DOT) -Tfig $< -o $@

@HAVE_NEATO_TRUE@.prs-dot-O1.prs-neato-ps:
@HAVE_NEATO_TRUE@	$(NEATO) -Tps $< -o $@

@HAVE_NEATO_TRUE@.prs-dot-O1.prs-neato-fig:
@HAVE_NEATO_TRUE@	$(NEATO) -Tfig $< -o $@

@HAVE_CIRCO_TRUE@.prs-dot-O1.prs-circo-ps:
@HAVE_CIRCO_TRUE@	$(CIRCO) -Tps $< -o $@

@HAVE_CIRCO_TRUE@.prs-dot-O1.prs-circo-fig:
@HAVE_CIRCO_TRUE@	$(CIRCO) -Tfig $< -o $@

@HAVE_TWOPI_TRUE@.prs-dot-O1.prs-twopi-ps:
@HAVE_TWOPI_TRUE@	$(TWOPI) -Tps $< -o $@

@HAVE_TWOPI_TRUE@.prs-dot-O1.prs-twopi-fig:
@HAVE_TWOPI_TRUE@	$(TWOPI) -Tfig $< -o $@

@HAVE_FDP_TRUE@.prs-dot-O1.prs-fdp-ps:
@HAVE_FDP_TRUE@	$(FDP) -Tps $< -o $@

@HAVE_FDP_TRUE@.prs-dot-O1.prs-fdp-fig:
@HAVE_FDP_TRUE@	$(FDP) -Tfig $< -o $@

@HAVE_FIG2DEV_TRUE@.prs-dot-fig.prs-dot-pdf:
@HAVE_FIG2DEV_TRUE@	$(FIG2DEV) -Lpdf $< $@

@HAVE_FIG2DEV_TRUE@.prs-neato-fig.prs-neato-pdf:
@HAVE_FIG2DEV_TRUE@	$(FIG2DEV) -Lpdf $< $@

@HAVE_FIG2DEV_TRUE@.prs-circo-fig.prs-circo-pdf:
@HAVE_FIG2DEV_TRUE@	$(FIG2DEV) -Lpdf $< $@

@HAVE_FIG2DEV_TRUE@.prs-twopi-fig.prs-twopi-pdf:
@HAVE_FIG2DEV_TRUE@	$(FIG2DEV) -Lpdf $< $@

@HAVE_FIG2DEV_TRUE@.prs-fdp-fig.prs-fdp-pdf:
@HAVE_FIG2DEV_TRUE@	$(FIG2DEV) -Lpdf $< $@

.chpsim-event-dot.chpsim-event-fig:
@HAVE_DOT_TRUE@	$(DOT) -Tfig $< -o $@
@HAVE_DOT_FALSE@	@$(ECHO) "No dot found in path during configure."

.chpsim-event-fig.chpsim-event-pdf:
@HAVE_FIG2DEV_TRUE@	$(FIG2DEV) -Lpdf $< $@
@HAVE_FIG2DEV_FALSE@	@$(ECHO) "No fig2dev found in path during configure."

.chpsim-event-dot.chpsim-event-ps:
@HAVE_DOT_TRUE@	$(DOT) -Tps $< -o $@
@HAVE_DOT_FALSE@	@$(ECHO) "No dot found in path during configure."

# clean-graphs:

.haco-a.prsimexpr:
	$(HACKT_PRSIM_EXE) -fno-run -fdump-expr-alloc -fcheck-structure $< > $@

.haco-a.prs-dot:
	$(HACKT_PRSIM_EXE) -fno-run -fdump-dot-struct $< > $@

.haco-a.prsimexpr-O1:
	$(HACKT_PRSIM_EXE) -fno-run -fdump-expr-alloc -O1 $< > $@

.haco-a.prs-dot-O1:
	$(HACKT_PRSIM_EXE) -fno-run -fdump-dot-struct -O1 $< > $@

.prsimexpr-O1.hacktprsdottest:
	@$(DUMMY_TEST_SCRIPT)

# dummy test for when make variable is empty
.hacktprsdottest:
	@$(DUMMY_TEST_SCRIPT)

hacktprsdottest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PRS_DOT_TEST_SUBJECTS)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".hacktprsdottest: " $$1 ".prs-dot-O1"; }' > $@ ; \
	$(TOUCH) $@

-include hacktprsdottest.autodepend

.prsimexpr.prsimexprdiff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.prsimexprdiff$$/.expect-prsimexpr/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_PRSIMEXPR_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

prsimexprtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PRSIMEXPR_TEST_SUBJECTS)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsimexprdiff: $$(srcdir)/" $$1 ".expect-prsimexpr"; }' > $@ ; \
	$(TOUCH) $@

-include prsimexprtest.autodepend

.prsimexprdiff.hacktprsimexprtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.hacktprsimexprtest:
	@$(DUMMY_TEST_SCRIPT)

.prsimrc.prsimrc-out:
	@$(PRSIMRC_TEST_SCRIPT)

# expect failure, ignore error
.prsimrc.prsimrcfail-out:
	-@$(PRSIMRC_FAIL_TEST_SCRIPT)

# this reuses the same dependency for checkpoints
# beware of race between -O0 and -O1 tests that produce the same files!
prsimrc-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	{ list='$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES)' ; \
	exts='prsimrc-out prsimckpt-O1-err' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.prsimrc ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  deps=`$(CAT) "$$src" | $(EXTRACT_DEPS_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj $$deps" ; \
	  mktrc=`$(CAT) $$src | $(EXTRACT_PRSIM_TRACE_DEP_PIPE)` ; \
	  if test "$$mktrc" ; then \
	    rmtrc=`$(CAT) $$src | $(EXTRACT_PRSIM_TRACE_UNDEP_PIPE)` ; \
	    if test x"$$rmtrc" != x"$$mktrc" ; then \
	      $(ECHO) "$$mktrc: $$d.prsimrc-out" ; \
	      $(ECHO) "	@test -f $$""@" ; \
	      $(ECHO) "CLEANFILES += $$mktrc" ; \
	      $(ECHO) "$$mktrc: $$""(HACKT_PRSIM_EXE)" ; \
            fi ; \
	  fi ; \
	  antideps=`$(CAT) "$$src" | $(EXTRACT_ANTIDEPS_PIPE)` ; \
	  if test "$$antideps" ; then \
	    $(ECHO) "$$antideps: $$d.prsimrc-out" ; \
	    $(ECHO) "	@:" ; \
	    $(ECHO) "CLEANFILES += $$antideps" ; \
	    $(ECHO) "AUTO_IGNORE += $$antideps" ; \
	  fi ; \
	done ;} > $@ ; \
	$(TOUCH) $@

prsimrcfail-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	{ list='$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES)' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.prsimrc ; \
	  target=$$d.prsimrcfail-out ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  deps=`$(CAT) "$$src" | $(EXTRACT_DEPS_PIPE)` ; \
	  antideps=`$(CAT) "$$src" | $(EXTRACT_ANTIDEPS_PIPE)` ; \
	  $(ECHO) "$$target: $$obj $$deps" ; \
	  test -z "$$antideps" || $(ECHO) "$$antideps: $$target" ; \
	done ;} > $@ ; \
	$(TOUCH) $@

-include prsimrc-out.autodepend
-include prsimrcfail-out.autodepend

.prsimrc-out.prsimrc-out-filter:
	@$(PRSIMRC_TEST_FILTER_SCRIPT)

.prsimrcfail-out.prsimrcfail-out-filter:
	@$(PRSIMRC_FILTER_AWK) $< | $(PRSIM_TRACE_BINARY_FILTER) | \
	  $(SED) '/^parser stacks:/,$$d' > $@

.prsimrc-out-filter.prsimrc-diff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.prsimrc-diff$$/.prsimrc-expect/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_PRSIMRC_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	    $(PRSIM_TRACE_DUMP_FILTER_SCRIPT) ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.prsimrcfail-out-filter.prsimrcfail-diff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.prsimrcfail-diff$$/.prsimrc-expect/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_PRSIMRC_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.prsimrc-diff.prsimtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.prsimrcfail-diff.prsimfailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.prsimtest:
	@$(DUMMY_TEST_SCRIPT)

.prsimfailtest:
	@$(DUMMY_TEST_SCRIPT)

prsimtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsimrc-diff: $$(srcdir)/" $$1 ".prsimrc-expect"; }' > $@ ; \
	$(TOUCH) $@

prsimfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsimrcfail-diff: $$(srcdir)/" $$1 ".prsimrc-expect"; }' > $@ ; \
	$(TOUCH) $@

-include prsimtest.autodepend
-include prsimfailtest.autodepend

.prsimrc-out.prsimckpt-outdump:
	@$(SED) '/DELETE FROM HERE/,/DELETE TO HERE/d' $< > $@

# no-op: simultaneously produced target
.prsimrc-out.prsimckpt:
	@$(NO_OP_SCRIPT)

.prsimrc-out.prsimtrace:
	@$(NO_OP_SCRIPT)

.prsimtrace.prsimtrace-dump:
	@$(PRSIM_TRACE_DUMP_SCRIPT)

.prsimtrace-O1.prsimtrace-O1-dump:
	@$(PRSIM_TRACE_DUMP_SCRIPT)

.prsimtrace-dump.prsimtrace-dump-filter:
	$(PRSIM_TRACE_BINARY_FILTER) $< > $@
#	$(SED) '/Trace file contents/,/Epoch 0:/s|[0-9][0-9]*$$|##SIZE##|' $< > $@

.prsimtrace-dump-filter.prsimtrace-diff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\-diff$$/-expect/'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_PRSIMRC_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.prsimtrace-diff.prsimtracetest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

prsimtracetest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PRSIMTRACE_TEST_SUBJECTS)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsimtrace-diff: $$(srcdir)/" $$1 ".prsimtrace-expect"; }' > $@ ; \
	$(TOUCH) $@

-include prsimtracetest.autodepend

.prsimckpt.prsimckpt-dump:
	$(PRSIM_CHECKPOINT_DUMP_SCRIPT)

.prsimckpt.prsimckpt-indump:
	@rc=$(srcdir)/`$(ECHO) $< | $(SED) 's/\.prsimckpt$$/.prsimrc/g'` ; \
	obj=`$(CAT) "$$rc" | $(EXTRACT_HACO_PIPE)` ; \
	flags=`$(CAT) "$$rc" | $(EXTRACT_HACPRSIM_FLAGS_PIPE)` ; \
	ckpt=`$(ECHO) $@ | $(SED) 's/-indump$$/-dupe/g'` ; \
	cmd="$(HACKT_PRSIM_EXE) -b -I$(srcdir) $$flags $$obj" ; \
	$(ECHO) "load: $$cmd" ; \
	$(CAT) $(PRSIMCKPT_LOAD_TEMPLATE_SCRIPT) | \
	  $(SED) -e 's|LOAD|$<|g' -e 's|SAVE|'"$$ckpt"'|g' | \
	  $$cmd > $@ 2>&1

# no-op: simultaneously produced target
.prsimckpt-indump.prsimckpt-dupe:
	@$(NO_OP_SCRIPT)

.prsimckpt-dupe.prsimckpt-dupe-dump:
	$(PRSIM_CHECKPOINT_DUMP_SCRIPT)

.prsimckpt-outdump.prsimckpt-diff:
	@expect=`$(ECHO) $@ | $(SED) 's/\.prsimckpt-diff$$/.prsimckpt-indump/g'` ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_PRSIMCKPT_DIFF_COMMAND) ; \
	  $(DIFF) -u "$$expect" $< > $@ 2>&1 ; \
	  ca=`$(ECHO) $@ | $(SED) 's/-diff$$//g'` ; \
	  cb=`$(ECHO) $@ | $(SED) 's/-diff$$/-dupe/g'` ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  elif $(DIFF) -q "$$ca" "$$cb" ; then : ; \
	  else $(MAKE) "$$ca"-dump "$$cb"-dump && \
	    $(DIFF) -u "$$ca"-dump "$$cb"-dump > $@ ; \
	    $(ECHO) "$@ is non-empty! (checkpoint binaries differ)" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.prsimckpt-diff.prsimckpttest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.prsimckpttest:
	@$(DUMMY_TEST_SCRIPT)

prsimckpttest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsimckpt-diff: " $$1 ".prsimckpt-indump"; }' > $@ ; \
	$(TOUCH) $@

-include prsimckpttest.autodepend

# touch needed for empty outputs
.prsimrc.prsimckpt-O1-err:
	@obj=`$(CAT) $< | $(EXTRACT_HACO_PIPE)` ; \
	ckpt=`$(ECHO) $@ | $(SED) 's/-err$$//g'` ; \
	trace=`$(ECHO) $$ckpt | $(SED) 's/ckpt-O1$$/trace-O1/g'` ; \
	$(RM) $$ckpt $$trace ; \
	autotrace=1 ; \
	$(PRSIMRC_AUTOTRACE_DISABLE_HOOK) \
	if test "$$autotrace" = 1 ; then traceflag="-r $$trace" ; fi ; \
	flags=`$(CAT) $< | $(EXTRACT_HACPRSIM_FLAGS_PIPE)` ; \
	cmd="$(HACKT_PRSIM_EXE) -b -a $$ckpt $$traceflag -I$(srcdir) $$flags $(PRSIMOPT_FLAG) $$obj" ; \
	$(ECHO) "ckpt: $$cmd" ; \
	$$cmd < $< > $@ 2>&1 ; \
	test -f $$ckpt || $(ECHO) "Warning: $$ckpt not produced." ; \
	test "$$autotrace" = 0 || \
	  test -f $$trace || $(ECHO) "Warning: $$trace not produced." ; \
	$(TOUCH) $@

#	$(CAT) $(PRSIMOPT_TEMPLATE_SCRIPT) | $(SED) -e 's|SOURCE|$<|g' -e 's|CHECKPOINT|'"$$ckpt"'|g'

# no-op: simultaneously produced target
.prsimckpt-O1-err.prsimckpt-O1:
	@$(NO_OP_SCRIPT)

.prsimckpt-O1-err.prsimtrace-O1:
	@$(NO_OP_SCRIPT)

.prsimckpt-O1.prsimckpt-O1-dump:
	$(PRSIM_CHECKPOINT_DUMP_SCRIPT)

# also depends on .prsimckpt
# consider looking at hexdump too
.prsimckpt-O1.prsimopt-diff:
	@unopt=`$(ECHO) $< | $(SED) 's/-O1$$//g'` ; \
	$(RM) $@ ; \
	if test -f "$$unopt" ; then \
	  $(ECHO_PRSIMCKPT_OPT_DIFF_COMMAND) ; \
	  if $(DIFF) -q "$$unopt" $< ; then \
	    $(RM) $@ ; \
	  else $(MAKE) $<-dump "$$unopt"-dump && \
	    $(DIFF) -u $<-dump "$$unopt"-dump > $@ ; \
	    $(ECHO) "$@ is non-empty! (checkpoint binaries differ)" ; \
	  fi ; \
	else $(ECHO) "Missing $$unopt." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.prsimopt-diff.prsimopttest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.prsimopttest:
	@$(DUMMY_TEST_SCRIPT)

prsimopttest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".prsimopt-diff: " $$1 ".prsimckpt"; }' > $@ ; \
	$(TOUCH) $@

-include prsimopttest.autodepend

prsimrcdiffs: force
	-$(CAT) *.prsimrc-diff > $@

prsimrcfaildiffs: force
	-$(CAT) *.prsimrcfail-diff > $@

prsimtracediffs: force
	-$(CAT) *.prsimtrace-diff > $@

prsimckptdiffs: force
	-$(CAT) *.prsimckpt-diff > $@

prsimoptdiffs: force
	-$(CAT) *.prsimopt-diff > $@

prsimexprdiffs: force
	-$(CAT) *.prsimexprdiff > $@

$(HACKT_PRSIM_PRODUCTS): $(HACKT_PRSIM_EXE)

build-check-local: \
	$(HACKT_PRSIMRC_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimckpt) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimtrace) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimrc-out) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimrc-out-filter) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES:=.prsimrc-diff) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES:=.prsimrcfail-out) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES:=.prsimrcfail-out-filter) \
	$(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES:=.prsimrcfail-diff) \
	$(HACKT_PRSIMTRACE_TEST_SUBJECTS:=.prsimtrace-dump) \
	$(HACKT_PRSIMTRACE_TEST_SUBJECTS:=.prsimtrace-dump-filter) \
	$(HACKT_PRSIMTRACE_TEST_SUBJECTS:=.prsimtrace-diff) \
	$(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.prsimexpr) \
	$(HACKT_PRSIMEXPR_TEST_SUBJECTS:=.prsimexprdiff) \
	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpt) \
	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpt-outdump) \
	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpt-dupe) \
	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpt-indump) \
	$(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES:=.prsimckpt-diff) \
	$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES:=.prsimckpt) \
	$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES:=.prsimckpt-O1-err) \
	$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES:=.prsimckpt-O1) \
	$(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES:=.prsimopt-diff) \
	$(HACKT_PRS_DOT_TEST_SUBJECTS:=.prsimexpr-O1) \
	$(HACKT_PRS_DOT_TEST_SUBJECTS:=.prs-dot-O1)

all-prs-dot: $(ALL_PRSIMEXPR_DOT)

all-prs-dot-ps: $(ALL_PRS_DOT_PS)

clean-prs-dot: force
	-$(RM) $(ALL_PRSIMEXPR_DOT)

clean-prs-dot-ps: force
	-$(RM) $(ALL_PRS_DOT_PS)

echo-prsimexpr-tests: force
	@$(ECHO) $(HACKT_PRSIMEXPR_TEST_SUBJECTS)

echo-prsimrc-passes: force
	@$(ECHO) $(HACKT_PRSIMRC_TEST_SCRIPTS_PASSES)

echo-prsimrc-failures: force
	@$(ECHO) $(HACKT_PRSIMRC_TEST_SCRIPTS_FAILURES)

echo-prsimrc-tests: force
	@$(ECHO) $(HACKT_PRSIMRC_TEST_SCRIPTS_BASES)

echo-prsimtrace-tests: force
	@$(ECHO) $(HACKT_PRSIMTRACE_TEST_SUBJECTS)

echo-prsimckpt-tests: force
	@$(ECHO) $(HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES)

echo-prsimopt-tests: force
	@$(ECHO) $(HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES)

clean-prsimtests:
	patternlist='$(HACKT_PRSIM_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-prsimtests

.PHONY: clean-prsimtests all-prs-dot all-prs-ps

# create simulation executable
# '+' connects child make (vcs) to parent's jobserver
# touch b/c incremental compilation doesn't always updated timestamp
.v.vx:
@HAVE_VPI_TRUE@	+vflags=`cat $< | $(EXTRACT_VCS_FLAGS_PIPE)` && \
@HAVE_VPI_TRUE@	$(VCS_ENV) $(VCS) $(AM_VCS_FLAGS) $(AM_VCS_VPI_FLAGS) $(AM_PLI_FLAGS) \
@HAVE_VPI_TRUE@		$$vflags -o $@ $< && \
@HAVE_VPI_TRUE@	$(TOUCH) $@
@HAVE_VPI_FALSE@	@$(ECHO) "VPI not explicitly enabled during configure."

.v.v-wrap:
	{ $(ECHO) "\`include \"$<\"" ; $(ECHO) "" ; \
		$(AUTO_WRAP_VERILOG_AWK) $< ;} > $@

# post-install tests!
.v.vxi:
@HAVE_VPI_TRUE@	+$(VCS_ENV) $(VCS) $(INSTALLCHECK_VCS_FLAGS) \
@HAVE_VPI_TRUE@		$(INSTALLCHECK_VCS_VPI_FLAGS) $(INSTALLCHECK_PLI_FLAGS) -o $@ $<
@HAVE_VPI_FALSE@	@$(ECHO) "VPI not explicitly enabled during configure."

# SHOW_VPI_TEST_ENV = $(LTDL_SHLIBPATH_VAR)=$(VPI_LIB_PATH)/$(LTDL_OBJDIR)$(PATH_SEPARATOR)$$"$(LTDL_SHLIBPATH_VAR)"

.vx.vx-out:
@HAVE_VPI_TRUE@	$(VPI_TEST_ENV) ./$< > $@ 2>&1
@HAVE_VPI_FALSE@	@$(ECHO) "VCS/VPI was not explicitly configured, so skipping." > $@

.vxi.vxi-out:
	$(VPI_INSTALLCHECK_ENV) ./$< > $@ 2>&1

.vx-out.vx-out-filter:
	$(CAT) $< | $(VCS_OUTPUT_FILTER) > $@ ; \
	$(TOUCH) $@

.vx-out-filter.vx-diff:
@HAVE_VPI_TRUE@	@stderr=`$(ECHO) $@ | $(SED) 's/\.vx-diff$$/.expect-vpi/g'` ; \
@HAVE_VPI_TRUE@	expect=$(srcdir)/$$stderr ; \
@HAVE_VPI_TRUE@	$(RM) $@ ; \
@HAVE_VPI_TRUE@	if test -f "$$expect" ; then \
@HAVE_VPI_TRUE@	  $(ECHO_VPI_DIFF_COMMAND) ; \
@HAVE_VPI_TRUE@	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
@HAVE_VPI_TRUE@	  if test -s $@ ; then \
@HAVE_VPI_TRUE@	    $(ECHO) "$@ is non-empty!" ; \
@HAVE_VPI_TRUE@	  fi ; \
@HAVE_VPI_TRUE@	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
@HAVE_VPI_TRUE@	fi ; \
@HAVE_VPI_TRUE@	$(TOUCH) $@
@HAVE_VPI_FALSE@	@$(CP) $< $@

.vx-diff.vpitest:
@HAVE_VPI_TRUE@	@$(DEFAULT_DIFF_TEST_SCRIPT)
@HAVE_VPI_FALSE@	@$(SKIP_TEST_SCRIPT)

vpitest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	{ list='$(HACKT_VPI_TEST_SCRIPTS_PASSES)' ; \
	exts='vx-out' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.v ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  deps=`$(CAT) "$$src" | $(EXTRACT_DEPS_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(ECHO) -n "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj $$deps" ; \
	done ; \
	$(ECHO) "$(HACKT_VPI_TEST_SCRIPTS_BASES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".vx-diff: $$(srcdir)/" $$1 ".expect-vpi"; }'; \
	} > $@ ; \
	$(TOUCH) $@

-include vpitest.autodepend

vpidiffs: force
	-$(CAT) *.vx-diff > $@
# exeuctables depend on the plugin module
@HAVE_VPI_TRUE@$(VPI_SIM_EXECUTABLES): $(VPI_PRSIM_MODULE)

build-check-local: $(VPI_TARGETS)

echo-vpi-tests: force
	@$(ECHO) $(HACKT_VPI_TEST_SCRIPTS_BASES)

clean-vpitests:
	patternlist='$(HACKT_VPI_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-vpitests

.PHONY: clean-vpitests

.haco-a.chpsimallocdump:
	$(CHPSIM_ALLOC_DUMP) $< > $@

.haco-a.chpsim-event-dot:
	@$(ECHO) "$(CHPSIM_GRAPH_DOT) $< > $@" ; \
	if $(CHPSIM_GRAPH_DOT) $< > $@.tmp ; then $(MV) $@.tmp $@ ; \
	else $(RM) $@.tmp ; exit 1 ; \
	fi

.chpsimallocdump.chpsimallocdiff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.chpsimallocdiff$$/.expect-chpsimalloc/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_CHPSIM_ALLOC_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.chpsimallocdiff.chpsimalloctest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.chpsimalloctest:
	@$(DUMMY_TEST_SCRIPT)

chpsimalloctest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".chpsimallocdiff: $$(srcdir)/" $$1 ".expect-chpsimalloc"; }' > $@ ; \
	$(TOUCH) $@

-include chpsimalloctest.autodepend

# chpsim event graph tests
.chpsim-event-dot.chpsimdottest:
	@$(DUMMY_TEST_SCRIPT)

.chpsimdottest:
	@$(DUMMY_TEST_SCRIPT)

.chpsimrc.chpsimrc-out:
	@$(CHPSIMRC_TEST_SCRIPT)

.chpsimrc.chpsimrcfail-out:
	-@$(CHPSIMRC_FAIL_TEST_SCRIPT)
#	  $(AWK) '/BEGIN-RANDOM/,/END-RANDOM/{if($$1=="time:")print "time: \#TIME\#";else print;}' | \
#	  $(GREP) -v -e "-RANDOM" > $@

# automatically tracing expect-pass tests
.chpsimrc-out.chpsimtrace:
	@$(NO_OP_SCRIPT)

.chpsimrc-out.chpsimrc-out-filter:
	$(CHPSIMRC_TEST_FILTER_SCRIPT)

# TODO: introduce filtering scripts and differences
.chpsimrc-out-filter.chpsimrc-diff:
	@stderr=`$(ECHO) $@ |$(SED) 's/\.chpsimrc-diff$$/.chpsimrc-expect/g'`; \
	expect="$(srcdir)/$$stderr" ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_CHPSIMRC_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	    $(CHPSIM_TRACE_DUMP_FILTER_SCRIPT) ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.chpsimrcfail-out.chpsimrcfail-diff:
	@stderr=`$(ECHO) $@ |$(SED) 's/\.chpsimrcfail-diff$$/.chpsimrc-expect/g'`; \
	expect="$(srcdir)/$$stderr" ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_CHPSIMRC_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

# TODO: write rules for fail-tests

.chpsimrc-diff.chpsimtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.chpsimrcfail-diff.chpsimfailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.chpsimtest:
	@$(DUMMY_TEST_SCRIPT)

.chpsimfailtest:
	@$(DUMMY_TEST_SCRIPT)

chpsimrc-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	rlist='$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_PASSES)' ; \
	list='$(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES)'" $$rlist" ; \
	exts='chpsimrc-out' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.chpsimrc ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  deps=`$(CAT) "$$src" | $(EXTRACT_DEPS_PIPE)` ; \
	  antideps=`$(CAT) "$$src" | $(EXTRACT_ANTIDEPS_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj $$deps" ; \
	  mktrc=`$(CAT) $$src | $(EXTRACT_CHPSIM_TRACE_DEP_PIPE)` ; \
	  if test "$$mktrc" ; then \
	    rmtrc=`$(CAT) $$src | $(EXTRACT_CHPSIM_TRACE_UNDEP_PIPE)` ; \
	    if test x"$$rmtrc" != x"$$mktrc" ; then \
	      $(ECHO) "$$mktrc: $$d.chpsimrc-out" ; \
	      $(ECHO) "	@test -f $$""@" ; \
	      $(ECHO) "CLEANFILES += $$mktrc" ; \
	      $(ECHO) "$$mktrc: $$""(HACKT_CHPSIM_EXE)" ; \
            fi ; \
	  fi ; \
	  if test "$$antideps" ; then \
	    $(ECHO) "$$antideps: $$d.chpsimrc-out" ; \
	    $(ECHO) "	@:" ; \
	    $(ECHO) "CLEANFILES += $$antideps" ; \
	    $(ECHO) "AUTO_IGNORE += $$antideps" ; \
	  fi ; \
	done > $@ ; \
	$(TOUCH) $@

-include chpsimrc-out.autodepend

chpsimrcfail-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	rlist='$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_FAILURES)' ; \
	list='$(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES)'" $$rlist" ; \
	exts='chpsimrcfail-out' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.chpsimrc ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  deps=`$(CAT) "$$src" | $(EXTRACT_DEPS_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj $$deps" ; \
	done > $@ ; \
	$(TOUCH) $@

-include chpsimrcfail-out.autodepend

chpsimrctest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	{ $(ECHO) "$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_PASSES)" ; \
	  $(ECHO) "$(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES)" ;} | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".chpsimrc-diff: $$(srcdir)/" $$1 ".chpsimrc-expect"; }' > $@ ; \
	$(TOUCH) $@

-include chpsimrctest.autodepend

chpsimrcfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	{ $(ECHO) "$(HACKT_CHPSIMRC_RANDOM_TEST_SCRIPTS_FAILURES)" ; \
	  $(ECHO) "$(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES)" ;} | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".chpsimrcfail-diff: $$(srcdir)/" $$1 ".chpsimrc-expect"; }' > $@ ; \
	$(TOUCH) $@

-include chpsimrcfailtest.autodepend

# checkpoint is simultaneously generated
.chpsimrc-out.chpsimckpt:
	@$(NO_OP_SCRIPT)

.chpsimrc-out.chpsimckpt-outdump:
	@$(SED) '/DELETE FROM HERE/,/DELETE TO HERE/d' $< > $@

.chpsimckpt.chpsimckpt-indump:
	@rc=$(srcdir)/`$(ECHO) $< | $(SED) 's/\.chpsimckpt$$/.chpsimrc/g'` ; \
	obj=`$(CAT) "$$rc" | $(EXTRACT_HACO_PIPE)` ; \
	mods=`$(CAT) "$$rc" | $(EXTRACT_CHPSIM_MODULES_PIPE)` ; \
	flags=`$(CAT) "$$rc" | $(EXTRACT_HACCHPSIM_FLAGS_PIPE)` ; \
	ckpt=`$(ECHO) $@ | $(SED) 's/-indump$$/-dupe/g'` ; \
	$(CHPSIM_TEST_ENV) ; \
	cmd="$(HACKT_CHPSIM_EXE) -b -I$(srcdir) $$flags $$mods $$obj" ; \
	$(ECHO) "load: $(SHOW_CHPSIM_TEST_ENV) $$cmd" ; \
	$(CAT) $(CHPSIMCKPT_LOAD_TEMPLATE_SCRIPT) | \
	  $(SED) -e 's|LOAD|$<|g' -e 's|SAVE|'"$$ckpt"'|g' | \
	  $$cmd > $@ 2>&1

# simultaneously generated
.chpsimckpt-indump.chpsimckpt-dupe:
	@$(NO_OP_SCRIPT)

# this one needs the object file attached
# Doesn't really need TEST_ENV because no libraries are loaded.
.chpsimckpt-dupe.chpsimckpt-dupe-dump:
	@rc=$(srcdir)/`$(ECHO) $< | $(SED) 's/\.chpsimckpt-dupe$$/.chpsimrc/g'` ; \
	obj=`$(CAT) "$$rc" | $(EXTRACT_HACO_PIPE)` ; \
	flags=`$(CAT) "$$rc" | $(EXTRACT_HACCHPSIM_FLAGS_PIPE)` ; \
	$(CHPSIM_TEST_ENV) ; \
	{ $(ECHO) "load $<" ; $(ECHO) "dump-state" ;} | \
	  $(HACKT_CHPSIM_EXE) -b $$flags $< > $@

.chpsimckpt-outdump.chpsimckpt-diff:
	@expect=`$(ECHO) $@ | $(SED) 's/\.chpsimckpt-diff$$/.chpsimckpt-indump/g'` ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_CHPSIMCKPT_DIFF_COMMAND) ; \
	  $(DIFF) -u "$$expect" $< > $@ 2>&1 ; \
	  ca=`$(ECHO) $@ | $(SED) 's/-diff$$//g'` ; \
	  cb=`$(ECHO) $@ | $(SED) 's/-diff$$/-dupe/g'` ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  elif $(DIFF) -q "$$ca" "$$cb" ; then : ; \
	  else $(MAKE) "$$ca"-dump "$$cb"-dump && \
	    $(DIFF) -u "$$ca"-dump "$$cb"-dump > $@ ; \
	    $(ECHO) "$@ is non-empty! (checkpoint binaries differ)" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.chpsimckpt-diff.chpsimckpttest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.chpsimckpttest:
	@$(DUMMY_TEST_SCRIPT)

chpsimckpttest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".chpsimckpt-diff: " $$1 ".chpsimckpt-indump"; }' > $@ ; \
	$(TOUCH) $@

-include chpsimckpttest.autodepend

chpsimallocdiffs: force
	-$(CAT) *.chpsimallocdiff > $@

chpsimrcdiffs: force
	-$(CAT) *.chpsimrc-diff > $@

chpsimrcdiffs.nosize: force
	-$(CAT) *.chpsimrc-diff-nosize > $@

chpsimrcfaildiffs: force
	-$(CAT) *.chpsimrcfail-diff > $@

chpsimckptdiffs: force
	-$(CAT) *.chpsimckpt-diff > $@

build-check-local: \
	$(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS:=.chpsimallocdump) \
	$(HACKT_CHPSIM_DOT_TEST_SUBJECTS:=.chpsim-event-dot) \
	$(HACKT_CHPSIM_DOT_TEST_SUBJECTS:=.chpsimdottest) \
	$(HACKT_CHPSIMRC_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES:=.chpsimrc-out) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES:=.chpsimrc-out-filter) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES:=.chpsimrc-diff) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES:=.chpsimrcfail-out) \
	$(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES:=.chpsimrcfail-diff) \
	$(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES:=.chpsimckpt) \
	$(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES:=.chpsimckpt-outdump) \
	$(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES:=.chpsimckpt-dupe) \
	$(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES:=.chpsimckpt-indump) \
	$(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES:=.chpsimckpt-diff) \
	$(CHPSIM_RANDOM_BUILD_CHECK_LOCAL)

$(ALL_CHPSIM_ALLOC): $(HACKT_CHPSIM_EXE)
$(ALL_CHPSIM_DOT): $(HACKT_CHPSIM_EXE)
$(ALL_CHPSIMRC_OUT): $(HACKT_CHPSIM_EXE)
$(ALL_CHPSIM_CKPT): $(HACKT_CHPSIM_EXE)

all-chpsim-alloc: $(ALL_CHPSIM_ALLOC)

all-chpsim-dot: $(ALL_CHPSIM_DOT)

all-chpsim-ps: $(ALL_CHPSIM_PS)

clean-chpsim-alloc: force
	-$(RM) $(ALL_CHPSIM_ALLOC)

clean-chpsim-dot: force
	-$(RM) $(ALL_CHPSIM_DOT)

clean-chpsim-ps: force
	-$(RM) $(ALL_CHPSIM_PS)

echo-chpsimalloc-tests: force
	@$(ECHO) $(HACKT_CHPSIM_ALLOC_TEST_SUBJECTS)

echo-chpsimdot-tests: force
	@$(ECHO) $(HACKT_CHPSIM_DOT_TEST_SUBJECTS)

echo-chpsimrc-passes: force
	@$(ECHO) $(HACKT_CHPSIMRC_TEST_SCRIPTS_PASSES)

echo-chpsimrc-failures: force
	@$(ECHO) $(HACKT_CHPSIMRC_TEST_SCRIPTS_FAILURES)

echo-chpsimckpt-tests: force
	@$(ECHO) $(HACKT_CHPSIM_CKPT_TEST_SCRIPTS_BASES)

clean-chpsimtests:
	patternlist='$(HACKT_CHPSIM_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-chpsimtests

.PHONY: clean-chpsimtests all-chpsim-dot all-chpsim-ps
@HAVE_LIBGUILE_FALSE@	$(ECHO) "Not configured with libguile." > $@

.hacscm.hacscm-out:
	@$(HACSCM_TEST_SCRIPT)

.hacscm.hacscmfail-out:
	-@$(HACSCM_FAIL_TEST_SCRIPT)

# TODO: introduce filtering scripts and differences
@HAVE_LIBGUILE_TRUE@.hacscm-out.hacscm-diff:
@HAVE_LIBGUILE_TRUE@	@stderr=`$(ECHO) $@ |$(SED) 's/\.hacscm-diff$$/.hacscm-expect/g'`; \
@HAVE_LIBGUILE_TRUE@	expect="$(srcdir)/$$stderr" ; \
@HAVE_LIBGUILE_TRUE@	$(RM) $@ ; \
@HAVE_LIBGUILE_TRUE@	if test -f "$$expect" ; then \
@HAVE_LIBGUILE_TRUE@	  $(ECHO_HACSCM_DIFF_COMMAND) ; \
@HAVE_LIBGUILE_TRUE@	  $(HACSCM_DIFF_COMMAND) > $@ 2>&1 ; \
@HAVE_LIBGUILE_TRUE@	  if test -s $@ ; then \
@HAVE_LIBGUILE_TRUE@	    $(ECHO) "$@ is non-empty!" ; \
@HAVE_LIBGUILE_TRUE@	  fi ; \
@HAVE_LIBGUILE_TRUE@	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
@HAVE_LIBGUILE_TRUE@	fi ; \
@HAVE_LIBGUILE_TRUE@	$(TOUCH) $@

@HAVE_LIBGUILE_TRUE@.hacscmfail-out.hacscmfail-diff:
@HAVE_LIBGUILE_TRUE@	@stderr=`$(ECHO) $@ |$(SED) 's/\.hacscmfail-diff$$/.hacscm-expect/g'`; \
@HAVE_LIBGUILE_TRUE@	expect="$(srcdir)/$$stderr" ; \
@HAVE_LIBGUILE_TRUE@	$(RM) $@ ; \
@HAVE_LIBGUILE_TRUE@	if test -f "$$expect" ; then \
@HAVE_LIBGUILE_TRUE@	  $(ECHO_HACSCM_DIFF_COMMAND) ; \
@HAVE_LIBGUILE_TRUE@	  $(HACSCM_DIFF_COMMAND) > $@ 2>&1 ; \
@HAVE_LIBGUILE_TRUE@	  if test -s $@ ; then \
@HAVE_LIBGUILE_TRUE@	    $(ECHO) "$@ is non-empty!  Trying harder..." ; \
@HAVE_LIBGUILE_TRUE@	    $(HACSCM_EXPECT_FILTER) "$$expect" > "$$stderr"-filter ; \
@HAVE_LIBGUILE_TRUE@	    $(MV) $@ $@-orig ; \
@HAVE_LIBGUILE_TRUE@	    $(HACSCM_DIFF) "$$stderr"-filter $< > $@ 2>&1 ; \
@HAVE_LIBGUILE_TRUE@	    if test -s $@ ; then \
@HAVE_LIBGUILE_TRUE@	      $(ECHO) "$@ is still non-empty!" ; \
@HAVE_LIBGUILE_TRUE@	    else $(ECHO) "Differences resolved." ; \
@HAVE_LIBGUILE_TRUE@	    fi ; \
@HAVE_LIBGUILE_TRUE@	  fi ; \
@HAVE_LIBGUILE_TRUE@	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
@HAVE_LIBGUILE_TRUE@	fi ; \
@HAVE_LIBGUILE_TRUE@	$(TOUCH) $@
@HAVE_LIBGUILE_FALSE@.hacscm-out.hacscm-diff:
@HAVE_LIBGUILE_FALSE@	@$(TOUCH) $@

@HAVE_LIBGUILE_FALSE@.hacscmfail-out.hacscmfail-diff:
@HAVE_LIBGUILE_FALSE@	@$(TOUCH) $@

@HAVE_LIBGUILE_TRUE@.hacscm-diff.hacscmtest:
@HAVE_LIBGUILE_TRUE@	@$(DEFAULT_DIFF_TEST_SCRIPT)

@HAVE_LIBGUILE_TRUE@.hacscmfail-diff.hacscmfailtest:
@HAVE_LIBGUILE_TRUE@	@$(DEFAULT_DIFF_TEST_SCRIPT)
@HAVE_LIBGUILE_FALSE@.hacscm-diff.hacscmtest:
@HAVE_LIBGUILE_FALSE@	@$(SKIP_TEST_SCRIPT)

@HAVE_LIBGUILE_FALSE@.hacscmfail-diff.hacscmfailtest:
@HAVE_LIBGUILE_FALSE@	@$(SKIP_TEST_SCRIPT)

.hacscmtest:
	@$(DUMMY_TEST_SCRIPT)

.hacscmfailtest:
	@$(DUMMY_TEST_SCRIPT)

hacscm-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	list='$(HACKT_GUILE_TEST_SCRIPTS_PASSES)' ; \
	exts='hacscm-out' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.hacscm ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj" ; \
	done > $@ ; \
	$(TOUCH) $@

-include hacscm-out.autodepend

hacscmfail-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	list='$(HACKT_GUILE_TEST_SCRIPTS_FAILURES)' ; \
	exts='hacscmfail-out' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.hacscm ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj" ; \
	done > $@ ; \
	$(TOUCH) $@

-include hacscmfail-out.autodepend

hacscmtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_GUILE_TEST_SCRIPTS_PASSES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".hacscm-diff: $$(srcdir)/" $$1 ".hacscm-expect"; }' > $@ ; \
	$(TOUCH) $@

-include hacscmtest.autodepend

hacscmfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKT_GUILE_TEST_SCRIPTS_FAILURES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".hacscmfail-diff: $$(srcdir)/" $$1 ".hacscm-expect"; }' > $@ ; \
	$(TOUCH) $@

-include hacscmfailtest.autodepend

.hacchpsimscm.hacchpsimscm-out:
	@$(HACCHPSIMSCM_TEST_SCRIPT)

.hacchpsimscm.hacchpsimscmfail-out:
	-@$(HACCHPSIMSCM_FAIL_TEST_SCRIPT)

# TODO: introduce filtering scripts and differences
@HAVE_LIBGUILE_TRUE@.hacchpsimscm-out.hacchpsimscm-diff:
@HAVE_LIBGUILE_TRUE@	@stderr=`$(ECHO) $@ |$(SED) 's/\.hacchpsimscm-diff$$/.hacchpsimscm-expect/g'`; \
@HAVE_LIBGUILE_TRUE@	expect="$(srcdir)/$$stderr" ; \
@HAVE_LIBGUILE_TRUE@	$(RM) $@ ; \
@HAVE_LIBGUILE_TRUE@	if test -f "$$expect" ; then \
@HAVE_LIBGUILE_TRUE@	  $(ECHO_HACCHPSIMSCM_DIFF_COMMAND) ; \
@HAVE_LIBGUILE_TRUE@	  $(HACCHPSIMSCM_TEST_DIFF) "$$expect" $< > $@ 2>&1 ; \
@HAVE_LIBGUILE_TRUE@	  if test -s $@ ; then \
@HAVE_LIBGUILE_TRUE@	    $(ECHO) "$@ is non-empty!" ; \
@HAVE_LIBGUILE_TRUE@	    $(CHPSIM_GUILE_TRACE_DUMP_FILTER_SCRIPT) ; \
@HAVE_LIBGUILE_TRUE@	  fi ; \
@HAVE_LIBGUILE_TRUE@	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
@HAVE_LIBGUILE_TRUE@	fi ; \
@HAVE_LIBGUILE_TRUE@	$(TOUCH) $@

@HAVE_LIBGUILE_TRUE@.hacchpsimscmfail-out.hacchpsimscmfail-diff:
@HAVE_LIBGUILE_TRUE@	@stderr=`$(ECHO) $@ |$(SED) 's/\.hacchpsimscmfail-diff$$/.hacchpsimscm-expect/g'`; \
@HAVE_LIBGUILE_TRUE@	expect="$(srcdir)/$$stderr" ; \
@HAVE_LIBGUILE_TRUE@	$(RM) $@ ; \
@HAVE_LIBGUILE_TRUE@	if test -f "$$expect" ; then \
@HAVE_LIBGUILE_TRUE@	  $(ECHO_HACCHPSIMSCM_DIFF_COMMAND) ; \
@HAVE_LIBGUILE_TRUE@	  $(HACCHPSIMSCM_TEST_DIFF) "$$expect" $< > $@ 2>&1 ; \
@HAVE_LIBGUILE_TRUE@	  if test -s $@ ; then \
@HAVE_LIBGUILE_TRUE@	    $(ECHO) "$@ is non-empty!" ; \
@HAVE_LIBGUILE_TRUE@	  fi ; \
@HAVE_LIBGUILE_TRUE@	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
@HAVE_LIBGUILE_TRUE@	fi ; \
@HAVE_LIBGUILE_TRUE@	$(TOUCH) $@
@HAVE_LIBGUILE_FALSE@.hacchpsimscm-out.hacchpsimscm-diff:
@HAVE_LIBGUILE_FALSE@	@$(TOUCH) $@

@HAVE_LIBGUILE_FALSE@.hacchpsimscmfail-out.hacchpsimscmfail-diff:
@HAVE_LIBGUILE_FALSE@	@$(TOUCH) $@

@HAVE_LIBGUILE_TRUE@.hacchpsimscm-diff.hacchpsimscmtest:
@HAVE_LIBGUILE_TRUE@	@$(DEFAULT_DIFF_TEST_SCRIPT)

@HAVE_LIBGUILE_TRUE@.hacchpsimscmfail-diff.hacchpsimscmfailtest:
@HAVE_LIBGUILE_TRUE@	@$(DEFAULT_DIFF_TEST_SCRIPT)
@HAVE_LIBGUILE_FALSE@.hacchpsimscm-diff.hacchpsimscmtest:
@HAVE_LIBGUILE_FALSE@	@$(SKIP_TEST_SCRIPT)

@HAVE_LIBGUILE_FALSE@.hacchpsimscmfail-diff.hacchpsimscmfailtest:
@HAVE_LIBGUILE_FALSE@	@$(SKIP_TEST_SCRIPT)

.hacchpsimscmtest:
	@$(DUMMY_TEST_SCRIPT)

.hacchpsimscmfailtest:
	@$(DUMMY_TEST_SCRIPT)

# NOTE: optional extra dependence on generated tracefile from other test
hacchpsimscm-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	rlist='$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_PASSES)' ; \
	list='$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES)'" $$rlist" ; \
	exts='hacchpsimscm-out' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.hacchpsimscm ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  obj="$$obj "`$(CAT) "$$src" | $(EXTRACT_CHPSIMTRACE_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj" ; \
	done > $@ ; \
	$(TOUCH) $@

-include hacchpsimscm-out.autodepend

hacchpsimscmfail-out.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	rlist='$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_FAILURES)' ; \
	list='$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_FAILURES)'" $$rlist" ; \
	exts='hacchpsimscmfail-out' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.hacchpsimscm ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  obj="$$obj "`$(CAT) "$$src" | $(EXTRACT_CHPSIMTRACE_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj" ; \
	done > $@ ; \
	$(TOUCH) $@

-include hacchpsimscmfail-out.autodepend

hacchpsimscmtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	{ $(ECHO) "$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_PASSES)" ; \
	  $(ECHO) "$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES)" ;} | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".hacchpsimscm-diff: $$(srcdir)/" $$1 ".hacchpsimscm-expect"; }' > $@ ; \
	$(TOUCH) $@

-include hacchpsimscmtest.autodepend

hacchpsimscmfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	{ $(ECHO) "$(HACKT_CHPSIM_GUILE_RANDOM_TEST_SCRIPTS_FAILURES)" ; \
	  $(ECHO) "$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_FAILURES)" ;} | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".hacchpsimscmfail-diff: $$(srcdir)/" $$1 ".hacchpsimscm-expect"; }' > $@ ; \
	$(TOUCH) $@

-include hacchpsimscmfailtest.autodepend

hacscmdiffs: force
	-$(CAT) *.hacscm-diff > $@

hacscmfaildiffs: force
	-$(CAT) *.hacscmfail-diff > $@

hacchpsimscmdiffs: force
	-$(CAT) *.hacchpsimscm-diff > $@

hacchpsimscmfaildiffs: force
	-$(CAT) *.hacchpsimscmfail-diff > $@

build-check-local: \
	$(HACKT_GUILE_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_GUILE_TEST_SCRIPTS_PASSES:=.hacscm-out) \
	$(HACKT_GUILE_TEST_SCRIPTS_PASSES:=.hacscm-diff) \
	$(HACKT_GUILE_TEST_SCRIPTS_FAILURES:=.hacscmfail-out) \
	$(HACKT_GUILE_TEST_SCRIPTS_FAILURES:=.hacscmfail-diff) \
	$(HACKT_CHPSIM_GUILE_TEST_SUBJECTS:=.haco-a) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES:=.hacchpsimscm-out) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES:=.hacchpsimscm-diff) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_FAILURES:=.hacchpsimscmfail-out) \
	$(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_FAILURES:=.hacchpsimscmfail-diff) \
	$(GUILE_RANDOM_BUILD_CHECK_LOCAL)

# no longer a built executable, plug-in dependency in Make.test-guile
# $(HACKT_GUILE_OUT): $(HACKT_GUILE_EXE)
# $(HACKT_CHPSIM_GUILE_OUT): $(HACKT_CHPSIM_GUILE_EXE)

echo-hacscm-passes: force
	@$(ECHO) $(HACKT_GUILE_TEST_SCRIPTS_PASSES)

echo-hacscm-failures: force
	@$(ECHO) $(HACKT_GUILE_TEST_SCRIPTS_FAILURES)

echo-hacchpsimscm-passes: force
	@$(ECHO) $(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_PASSES)

echo-hacchpsimscm-failures: force
	@$(ECHO) $(HACKT_CHPSIM_GUILE_TEST_SCRIPTS_FAILURES)

clean-hacscmtests:
	patternlist='$(HACKT_GUILE_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-hacscmtests

.PHONY: clean-hacscmtests

.haco-a.spice:
	@$(HACKNET_TEST_SCRIPT)

.haco-a.spice-fail:
	-@$(HACKNET_FAIL_TEST_SCRIPT) 2>&1

# for now: use .hac -> .spice
# TODO: worry about .hacknetconf files later...
# eventually re-use single hac source with multiple configurations
# and technology files.  
# idea: map .hac to .spice using default options
# and map .hacknetconf to .spice using non-default options
# requiring specification of hac object file
# for now, use only HACKNET_TEST_SCRIPTS_PASSES/FAILURES
# later, use HACKNET_TEST_SUBJECTS for .hac -> .spice

# this reuses the same dependency for checkpoints
# beware of race between -O0 and -O1 tests that produce the same files!
hacknet.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(RM) $@ ; \
	{ list='$(HACKNET_TEST_SCRIPTS_BASES)' ; \
	exts='spice spice-fail' ; \
	test -z "$$list" || \
	for d in $$list ; do \
	  src=$(srcdir)/$$d.hac ; \
	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
	  deps=`$(CAT) "$$src" | $(EXTRACT_DEPS_PIPE)` ; \
	  for e in $$exts ; do \
	    target=$$d.$$e ; \
	    $(PRINTF) "$$target " ; \
	  done ; \
	  $(ECHO) ": $$obj $$deps" ; \
	done ;} > $@ ; \
	$(TOUCH) $@
#	{ list='$(HACKNET_TEST_SCRIPTS_BASES)' ; \
#	exts='spice spice-fail' ; \
#	test -z "$$list" || \
#	for d in $$list ; do \
#	  src=$(srcdir)/$$d.hacknetconf ; \
#	  obj=`$(CAT) "$$src" | $(EXTRACT_HACO_PIPE)` ; \
#	  deps=`$(CAT) "$$src" | $(EXTRACT_DEPS_PIPE)` ; \
#	  for e in $$exts ; do \
#	    target=$$d.$$e ; \
#	    $(PRINTF) "$$target " ; \
#	  done ; \
#	  $(ECHO) ": $$obj $$deps" ; \
#	done ;} > $@ ; \
#	$(TOUCH) $@

-include hacknet.autodepend

.spice.spice-diff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.spice-diff$$/.spice-expect/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_HACKNET_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.spice-fail.spice-fail-diff:
	@stderr=`$(ECHO) $@ | $(SED) 's/\.spice-fail-diff$$/.spice-expect/g'` ; \
	expect=$(srcdir)/$$stderr ; \
	$(RM) $@ ; \
	if test -f "$$expect" ; then \
	  $(ECHO_HACKNET_DIFF_COMMAND) ; \
	  $(DIFF) -bu "$$expect" $< > $@ 2>&1 ; \
	  if test -s $@ ; then \
	    $(ECHO) "$@ is non-empty!" ; \
	  fi ; \
	else $(ECHO) "Missing $$expect." | $(TEE) $@ ; \
	fi ; \
	$(TOUCH) $@

.spice-diff.hacknettest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.spice-fail-diff.hacknetfailtest:
	@$(DEFAULT_DIFF_TEST_SCRIPT)

.hacknettest:
	@$(DUMMY_TEST_SCRIPT)

.hacknetfailtest:
	@$(DUMMY_TEST_SCRIPT)

# for both passes and failures
hacknettest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKNET_TEST_SCRIPTS_PASSES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".spice-diff: $$(srcdir)/" $$1 ".spice-expect"; }' > $@ ; \
	$(TOUCH) $@

hacknetfailtest.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(HACKNET_TEST_SCRIPTS_FAILURES)" | \
	  $(SPACES_TO_NEWLINE) | $(SORT) -u | \
	  $(AWK) '/.+/ {print $$1 ".spice-fail-diff: $$(srcdir)/" $$1 ".spice-expect"; }' > $@ ; \
	$(TOUCH) $@

-include hacknettest.autodepend
-include hacknetfailtest.autodepend

hacknetdiffs: force
	-$(CAT) *.spice-diff > $@

hacknetfaildiffs: force
	-$(CAT) *.spice-fail-diff > $@

$(HACKNET_PRODUCTS): $(HACKNET_EXE)

build-check-local: \
	$(HACKNET_TEST_SUBJECTS:=.haco-a) \
	$(HACKNET_TEST_SCRIPTS_PASSES:=.spice) \
	$(HACKNET_TEST_SCRIPTS_PASSES:=.spice-diff) \
	$(HACKNET_TEST_SCRIPTS_FAILURES:=.spice-fail) \
	$(HACKNET_TEST_SCRIPTS_FAILURES:=.spice-fail-diff)

echo-hacknet-passes: force
	@$(ECHO) $(HACKNET_TEST_SCRIPTS_PASSES)

echo-hacknet-failures: force
	@$(ECHO) $(HACKNET_TEST_SCRIPTS_FAILURES)

echo-hacknet-tests: force
	@$(ECHO) $(HACKNET_TEST_SCRIPTS_BASES)

clean-hacknettests:
	patternlist='$(HACKNET_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

clean-local: clean-hacknettests

.PHONY: clean-hacknettests

check-summaries: check-summaries-recursive

check-summaries-am: $(CHECK_SUMMARIES)
	-@ls -l $(CHECK_SUMMARIES)

# build all tests, but don't run the resulting test scripts
build-check-local: $(TESTS)

# executable dependence: if executable is more recent, also rebuild
# if we really cared we could subdivide this by the executable that
# generated the output, e.g. haco, haccreate, hacalloc...
# depending on the hackt dispatcher should cover everything
$(HAC_COMPILE_OBJECT_TARGETS): $(HACKT_COMPILE_EXE)
$(HAC_CREATE_OBJECT_TARGETS): $(HACKT_CREATE_EXE)
$(HAC_ALLOC_OBJECT_TARGETS): $(HACKT_ALLOC_EXE)

# depend on the plug-in
@HAVE_LIBGUILE_TRUE@$(HACGUILE_TARGETS): $(top_builddir)/src/hackt-guile.la

# depend on the plug-in
@HAVE_LIBGUILE_TRUE@$(HACCHPSIMGUILE_TARGETS): $(top_builddir)/src/hackt-chpsim-guile.la
# $(HAC_OBJECT_DEPS): $(HACKT_EXE)

# source dependencies
test.autodepend: Makefile
	@$(ECHO) "Generating dependencies $@" ; \
	$(ECHO) "$(ALL_OBJECT_TESTS)" | $(SPACES_TO_NEWLINE) | $(SORT) -u | \
		$(AWK) '/.+/ {print "-include " $$1 ".depend"; }' > $@ ; \
	$(TOUCH) $@

-include test.autodepend

# echo-style Makefile debugging
echo-tests: force
	@$(ECHO) $(TESTS)

echo-hackt: force
	@$(ECHO) $(HACKT_EXE)

all-local: $(ALL_LOCAL)

# we generate all the local.cvsignore's in the test directories
@AUTO_CVSIGNORE_TRUE@local.cvsignore: $(TEST_SRCDIR)/test.cvsignore
@AUTO_CVSIGNORE_TRUE@	$(CP) $? $@

# additional dependence
@AUTO_CVSIGNORE_TRUE@$(srcdir)/.cvsignore: $(TEST_SRCDIR)/Make.test-tail

# clean tests only
clean-tests: clean-tests-recursive clean-tests-local

clean-tests-local:
	-$(RM) $(TESTS)

clean-summaries: clean-summaries-recursive clean-summaries-local

clean-summaries-local:
	$(RM) $(CHECK_SUMMARIES)

distclean-depend: distclean-depend-recursive distclean-depend-local

distclean-depend-local:
	-$(RM_PATTERN) "*.autodepend"
	-$(RM_PATTERN) "*.depend"
	-$(RM_PATTERN) "*.hacdepend"

# automatically removes $(CLEANFILES)
clean-local: clean-summaries-local
	patternlist='$(GENERAL_CLEAN_IGNORE_PATTERNS)' ; \
	for p in $$patternlist ; do \
	  pp=`$(ECHO) $$p | $(SED) 's/"//g'` ; \
	  $(RM_PATTERN) "$$pp" ; \
	done

cleaner: cleaner-recursive cleaner-am

cleaner-am: cleaner-local clean-am

distclean-local: cleaner-local distclean-depend-local

.PHONY: cleaner cleaner-am cleaner-local check-summaries check-summaries-am \
	clean-tests help-test clean-summaries clean-summaries-local \
	distclean-depend distclean-depend-local

help-local: help-test

help-test:
	@$(ECHO) "Test make targets:"
	@$(ECHO) "    cleaner: also cleans *.<ext> files (recursive)"
	@$(ECHO) "    check-summaries: summaries of test differences (recursive)"
	@$(ECHO) "	(produces: $(CHECK_SUMMARIES))"
	@$(ECHO) "    echo-*:"
	@$(ECHO) "	hackt: path to the built hackt executable"
	@$(ECHO) "	tests: lists TESTS"
	@$(ECHO) "	(-tests may be substituted with -passes, -failures)"
	@$(ECHO) "	parse-tests: lists HACKT_PARSE_TEST_SUBJECTS"
	@$(ECHO) "	flatten-tests: lists HACKT_FLATTEN_TEST_SUBJECTS"
	@$(ECHO) "	create-tests: lists HACKT_CREATE_TEST_SUBJECTS"
	@$(ECHO) "	alloc-tests: lists HACKT_ALLOC_TEST_SUBJECTS"
	@$(ECHO) "	cflat-tests: lists HACKT_CFLAT_TEST_SUBJECTS"
	@$(ECHO) "	cflat-lvs-tests: lists HACKT_CFLAT_LVS_TEST_SUBJECTS"
	@$(ECHO) "	cflat-sprs-tests: lists HACKT_CFLAT_SPRS_TEST_SUBJECTS"
	@$(ECHO) "	prsimexpr-tests: lists HACKT_PRSIMEXPR_TEST_SUBJECTS"
	@$(ECHO) "	prsimrc-tests: lists HACKT_PRSIMRC_TEST_SCRIPTS_BASES"
	@$(ECHO) "	prsimckpt-tests: lists HACKT_PRSIM_CKPT_TEST_SCRIPTS_BASES"
	@$(ECHO) "	prsimopt-tests: lists HACKT_PRSIM_OPT_TEST_SCRIPTS_BASES"
	@$(ECHO) "	compile-passes: lists TESTS that pass parsing"
	@$(ECHO) "	bison-outputs: list TESTS whose output is bison-specific"
	@$(ECHO) "	empty-cflat-prs: list of tests whose cflat-output is empty"
	@$(ECHO) "	chpsimalloc-tests: lists HACKT_CHPSIM_ALLOC_TEST_SUBJECTS"

# automatically runs autotools (and recursively in subdirectories)
reconf: force
	autoreconf

# .cvsignore for this project will always be semi-automatically generated
# .cvsignore is never needed for VPATH builds, duh!
@AUTO_CVSIGNORE_TRUE@$(srcdir)/.cvsignore: $(srcdir)/Makefile.am $(top_srcdir)/Make.global

# phony recursive target
@AUTO_CVSIGNORE_TRUE@cvsignore-recursive: $(srcdir)/.cvsignore force

@AUTO_CVSIGNORE_TRUE@cvsignore: cvsignore-recursive

@AUTO_CVSIGNORE_TRUE@cvsignore-am: $(srcdir)/.cvsignore cvsignore-local

@AUTO_CVSIGNORE_TRUE@clean-cvsignore: clean-cvsignore-recursive

@AUTO_CVSIGNORE_TRUE@clean-cvsignore-am: clean-cvsignore-local
@AUTO_CVSIGNORE_TRUE@	-$(RM) $(srcdir)/.cvsignore

# DISTCLEANFILES += $(srcdir)/.cvsignore

all-local: $(ALL_CVSIGNORE)

build-check: build-check-recursive

build-check-am: build-check-local

build-check-local:

# convenient target for building subtree of the distribution
# not a recursive target
# this also clears out the target distribution directory first
distdir-subdir:
	top_distdir="$(top_builddir)/$(PACKAGE)-$(VERSION)" ; \
	distdir="$$top_distdir/$(subdir)" ; \
	until rm -fr $$distdir ; do : ; done ; \
	$(mkdir_p) $$distdir ; \
	$(MAKE) top_distdir="$$top_distdir" distdir="$$distdir" distdir ; \
	$(ECHO) "$$distdir ready for inspection."

# This target tells make to look exclusively in the srcdir for these files
# and copy them over to the distdir.
# This is needed because the EXTRA_DIST target sometimes finds unwanted files
# in the build directory.  (e.g. auto-generated empty files)
# $distdir is assumed passed in as Makefile variable already because it 
# is a dependency of dist-hook, which is a dependency of distdir.
# NOTE: this ignores files that are not found in the srcdir!
srcdir-distfiles: force
	list='$(srcdir_EXTRA_DIST)'; \
	for file in $$list ; do \
	  test ! -f $(srcdir)/$$file || cp -p $(srcdir)/$$file $(distdir) ; \
	done
#	for file in $$list ; do \
#	  case $$file in \
#	    $(srcdir)/*) cp $$file $(distdir) ;; \
#	    *) cp $(srcdir)/$$file $(distdir) ;; \
#	  esac ; \
#	done

dist-hook: srcdir-distfiles

cleandirs:
	test -z "$(CLEANDIRS)" || $(RM) -r $(CLEANDIRS)

clean-local: cleandirs

# $distdir is assumed passed in as Makefile variable
distcleandirs:
	test -z "$(DISTCLEANDIRS)" || $(RM) -r $(DISTCLEANDIRS)

distclean-local: distcleandirs

# $distdir is assumed passed in as Makefile variable
dist-hook-autoclean:
	-cd $(distdir) && { test -z "$(DISTHOOK_CLEANFILES)" || $(RM) $(DISTHOOK_CLEANFILES) ;}

dist-hook: dist-hook-autoclean

# echo makefile debugging
echo-extra-dist: force
	@$(ECHO) $(EXTRA_DIST)

echo-srcdir-extra-dist: force
	@$(ECHO) $(srcdir_EXTRA_DIST)

# list the automatically distributed files
echo-dist-common: force
	@$(ECHO) $(DIST_COMMON)

echo-distfiles: force
	@$(ECHO) $(DISTFILES)

echo-cleanfiles: force
	@$(ECHO) $(CLEANFILES)

echo-disthook-cleanfiles: force
	@$(ECHO) $(DISTHOOK_CLEANFILES)

echo-distcleanfiles: force
	@$(ECHO) $(DISTCLEANFILES)

echo-auto-ignore: force
	@$(ECHO) $(AUTO_IGNORE)

echo-config: force
	cd $(top_builddir) && ./config.status --version

echo-srcdir: force
	@$(ECHO) $(srcdir)

echo-top-srcdir: force
	@$(ECHO) $(top_srcdir)

echo-top-builddir: force
	@$(ECHO) $(top_builddir)

echo-subdir: force
	@$(ECHO) $(subdir)

echo-subdirs: force
	@$(ECHO) $(SUBDIRS)

echo-dist-subdirs: force
	@$(ECHO) $(DIST_SUBDIRS)

echo-build: force
	@$(ECHO) $(build)

echo-host: force
	@$(ECHO) $(host)

echo-program-transform-name: force
	@$(ECHO) $(program_transform_name)

echo-prefix: force
	@$(ECHO) $(prefix)

echo-exec-prefix: force
	@$(ECHO) $(exec_prefix)

echo-programs: force
	@$(ECHO) $(PROGRAMS)

echo-scripts: force
	@$(ECHO) $(SCRIPTS)

echo-data: force
	@$(ECHO) $(DATA)

echo-texinfos: force
	@$(ECHO) $(TEXINFOS)

echo-dvis: force
	@$(ECHO) $(DVIS)

echo-pdfs: force
	@$(ECHO) $(PDFS)

echo-pss: force
	@$(ECHO) $(PSS)

echo-htmls: force
	@$(ECHO) $(htmls)

echo-package: force
	@$(ECHO) $(PACKAGE)

echo-package-bugreport: force
	@$(ECHO) $(PACKAGE_BUGREPORT)

echo-package-version: force
	@$(ECHO) $(PACKAGE_VERSION)

echo-SUFFIXES: force
	@$(ECHO) $(SUFFIXES)

echo-LEX: force
	@$(ECHO) $(LEX)

echo-YACC: force
	@$(ECHO) $(YACC)

echo-AM_CFLAGS: force
	@$(ECHO) $(AM_CFLAGS)

echo-AM_CXXFLAGS: force
	@$(ECHO) $(AM_CXXFLAGS)

echo-AM_CPPFLAGS: force
	@$(ECHO) $(AM_CPPFLAGS)

echo-AM_LDFLAGS: force
	@$(ECHO) $(AM_LDFLAGS)

echo-CFLAGS: force
	@$(ECHO) $(CFLAGS)

echo-CXXFLAGS: force
	@$(ECHO) $(CXXFLAGS)

echo-CPPFLAGS: force
	@$(ECHO) $(CPPFLAGS)

echo-LDFLAGS: force
	@$(ECHO) $(LDFLAGS)

echo-LIBS: force
	@$(ECHO) $(LIBS)

# might as well include this for non-maintainers too
# again, can't append to file with cat redirection because distclean
# sets permissions of new files as read-only
# NOTE: local.cvsignore may be normal or automatically generated
@AUTO_CVSIGNORE_TRUE@$(srcdir)/.cvsignore: local.cvsignore
@AUTO_CVSIGNORE_TRUE@	@$(ECHO) $(AUTO_IGNORE) | $(SPACES_TO_NEWLINE) > $@.temp
@AUTO_CVSIGNORE_TRUE@	-$(CAT) $< $@.temp > $@
@AUTO_CVSIGNORE_TRUE@	-$(RM) $@.temp

# -k option allows continuation past directories with failed tests
check.log: force
	@$(ECHO) "Logging results of \"make -k check\" in $@ ..."
	@$(ECHO) Tests started `$(DATE)` > $@.tmp
	-$(MAKE) -k check >> $@.tmp 2>&1
	@$(ECHO) Tests finished `$(DATE)` >> $@.tmp
	-$(MV) $@.tmp $@
# dump failures
	-$(GREP) -v "^PASS" $@ | $(GREP) -v "ignored"
	-$(GREP) "^Tests" $@
#	@$(ECHO) `$(GREP) "Abort trap" $@ | wc -l` cases crashed.
#	@$(ECHO) Total of `$(GREP) ^FAIL $@ | wc -l` failures encountered.
	$(AWK) -f $(top_srcdir)/scripts/tally_tests.awk $@
	@if $(GREP) "make.* \*\*\* " $@ ; then \
		$(ECHO) "Errors found!  see $@." ; \
		exit 1 ; \
	fi

# filters are specific to this project
# don't depend on check.log which is forced
check.log.filter:
	@test -f check.log && \
	$(CAT) check.log | $(GREP) -v "^Summarizing" | \
		$(GREP) -v "src/hackt" > $@ \
		|| $(ECHO) "\'make check.log\' first"

# assumes 'wc' in PATH
@HAVE_CVS_TRUE@cvsdiffs: force
@HAVE_CVS_TRUE@	-{ cd $(srcdir) && $(CVS) $(DIFF) -uN ;} > $@
@HAVE_CVS_TRUE@	@$(ECHO) `$(GREP) "^-" $@ | $(GREP) -v "^---" | wc -l` "lines removed" ; \
@HAVE_CVS_TRUE@	$(ECHO) `$(GREP) "^+" $@ | $(GREP) -v "^+++" | wc -l` "lines added"
@HAVE_CVS_FALSE@cvsdiffs: force
@HAVE_CVS_FALSE@	@$(ECHO) "Sorry, no 'cvs' found in path."

# general rule for recursive targets
$(MORE_RECURSIVE_TARGETS):
	+@$(RECURSIVE_TARGET_SCRIPT)

$(MORE_CLEAN_RECURSIVE_TARGETS):
	+@$(CLEAN_RECURSIVE_TARGET_SCRIPT)

# this shouldn't be parallel...
# .NOTPARALLEL: help
# .NOTPARALLEL unfortunately kills everything...
# help: help-global help-local
help: 
# ignore stderr
	-@{ $(CALLMAKE) help-global ; \
	$(CALLMAKE) help-local ;} 2> /dev/null

help-local:

# brief description of targets
help-global:
	@$(ECHO) "Global make targets:" ; \
	$(ECHO) "    help: lists some useful make targets" ; \
	$(ECHO) "    all: builds everything (recursive)" ; \
	$(ECHO) "    clean: removes make targets (recursive)" ; \
	$(ECHO) "    distclean: removes configure targets (recursive)" ; \
	$(ECHO) "    cvsdiffs: creates difference patch from CVS"
@AUTO_CVSIGNORE_TRUE@	@$(ECHO) "    cvsignore: generates $$(srcdir)/.cvsignore (recursive)" ; \
@AUTO_CVSIGNORE_TRUE@	$(ECHO) "    clean-cvsignore: cleans $$(srcdir)/.cvsignore (recursive)"
	@$(ECHO) "    check: runs tests (recursive)" ; \
	$(ECHO) "    build-check: create/run tests, without check (recursive)" ; \
	$(ECHO) "    check.log: logs make check -k" ; \
	$(ECHO) "    distdir-subdir: packages subtree of distribution" ; \
	$(ECHO) "    pdf: builds PDFs (recursive)" ; \
	$(ECHO) "    ps: builds PostScripts (recursive)" ; \
	$(ECHO) "    info: builds texinfo files (recursive)" ; \
	$(ECHO) "    html: builds HTML files (recursive)" ; \
	$(ECHO) "    echo-*:" ; \
	$(ECHO) "	config: configure invocation (config.status --version)" ; \
	$(ECHO) "	cleanfiles: list of cleaned files" ; \
	$(ECHO) "	distcleanfiles: list of distcleaned files" ; \
	$(ECHO) "	SUFFIXES: list of Makefile suffixes" ; \
	$(ECHO) "	extra-dist: list of EXTRA_DIST files" ; \
	$(ECHO) "	srcdir-extra-dist: list of source-only distrib. files" ; \
	$(ECHO) "	dist-common: list automatic DIST_COMMON files" ; \
	$(ECHO) "	distfiles: list of all DISTFILES" ; \
	$(ECHO) "	disthook-cleanfiles: list of all DISTHOOK_CLEANFILES" ; \
	$(ECHO) "	auto-ignore: list of automatic cvsignored files" ; \
	$(ECHO) "	srcdir, top-srcdir, top-builddir, subdir, " ; \
	$(ECHO) "	build, host, prefix, exec-prefix" ; \
	$(ECHO) "	subdirs, dist-subdirs" ; \
	$(ECHO) "	programs, scripts, data" ; \
	$(ECHO) "	texinfos, dvis, pdfs, pss, htmls" ; \
	$(ECHO) "	program-transform-name, package{,-version,-bugreport}" ; \
	$(ECHO) "	CFLAGS, CXXFLAGS, CPPFLAGS, LDFLAGS, AM_*FLAGS, LIBS, LEX, YACC"

# http://xkcd.com/149/
sandwich:
	@if test `whoami` = "root" ; then \
	  $(ECHO) "Okay." ; \
	else \
	  $(ECHO) "What? Make it yourself." ; \
	fi

# standard phony target for unconditional targets
force:

.PHONY: force $(PHONY_CVSIGNORE) \
	$(MORE_RECURSIVE_TARGETS) $(MORE_CLEAN_RECURSIVE_TARGETS) \
	help help-local help-global dist-hook dist-hook-autoclean \
	srcdir-distfiles build-check build-check-am build-check-local

# help: help-test
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
