# Copyright (C) 2001-2006, The Perl Foundation.
# $Id: root.in 17061 2007-02-19 19:30:30Z jkeenan $

###############################################################################
#
# NOTE:
#
# This makefile makes use of specific .dummy targets (rather than .PHONY
# or .VIRTUAL targets) in an effort to work with various flavors of make.
#
###############################################################################

###############################################################################
#
# INSTALL CONFIGURATIONS:
#
###############################################################################

DEVEL           = @DEVEL@
VERSION         = @VERSION@$(DEVEL)
SOVERSION       = @VERSION@

# Override at least PREFIX with the install location if you're going
# to be using this outside of your build area.
BUILDPREFIX     =
PREFIX          = @prefix@
EXEC_PREFIX     = @exec_prefix@
DESTDIR         =
BIN_DIR         = @bin_dir@
LIB_DIR         = @lib_dir@
INCLUDE_DIR     = @include_dir@
DOC_DIR         = @doc_dir@


###############################################################################
#
# SOURCE CONFIGURATIONS:
#
# Set up information about directories, where the sources can be found.
#
###############################################################################

# directory for build tools
BUILD_TOOLS_DIR = tools/build

# current directory
CUR_DIR         = .

# directory for the intermediate code compiler
IMCC_DIR        = compilers/imcc

# directory for header files
INC_DIR         = @inc@

# directory for the IO subsystem
IO_DIR          = src/io

# directory with Parrot modules
LIBRARY_DIR     = runtime/parrot/library

# directory for *.ops file
OPS_DIR         = src/ops

# directory for packfile files
PF_DIR          = src/packfile

# source directory
SRC_DIR         = src

# revision control
#CONDITIONED_LINE(SVN_ENTRIES):SVN_ENTRIES=@SVN_ENTRIES@
#INVERSE_CONDITIONED_LINE(SVN_ENTRIES):SVN_ENTRIES=

###############################################################################
#
# BUILD TOOL CONFIGURATIONS:
#
# DO NOT ADD C COMPILER FLAGS HERE
# Add them in Configure.pl--look for the
# comment 'ADD C COMPILER FLAGS HERE'
#
###############################################################################

RM_F       = @rm_f@
RM_RF      = @rm_rf@
AR_CR      = @ar@ @ar_flags@
RANLIB     = @ranlib@
PERL       = @perl@
CP         = @cp@
TOUCH      = @touch@
YACC       = @yacc@
LEX        = @lex@
MKPATH     = @mkpath@
AS         = @as@
CC         = @cc@
CC_INC     = @cc_inc@
C_LIBS     = @libs@
CC_SHARED  = @cc_shared@
CFLAGS     = $(CC_INC) @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED)
LINK_DYNAMIC  = @link_dynamic@
LINK       = @link@
LINKFLAGS  = @linkflags@ @link_debug@ @ld_debug@
LD         = @ld@
LDFLAGS    = @ldflags@ @ld_debug@

LINT = lint
LINTFLAGS = \
    -b \
    -n \
    -p \
    -Ncheck=%all \
    -Nlevel=4 \
    -errchk=parentheses \
    -errhdr=%all \
    -errfmt=src \
    -errtags \
    -erroff=E_BAD_PTR_CAST \
    -erroff=E_BAD_PTR_CAST_ALIGN \
    -erroff=E_FUNC_ARG_UNUSED \
    -erroff=E_LABEL_NOT_USED \

# E_FUNC_ARG_UNUSED: Because of the interpreter getting passed around.  I need to add lint protection
# on the Interp, and then we can turn it back on.


SPLINT     = splint
# note: +distinctinternalnames with +externalnamelen at 8 characters
#       (the ANSI standard) is not going to fly for us.
SPLINTFLAGS  = -weak +showscan +showsummary +posixstrictlib -abstract \
    +aliasunique +ansireserved +ansireservedinternal +assignexpose \
    +bitwisesigned +boolcompare +booltype BOOLVAL +casebreak -castfcnptr \
    -charint +continuecomment +controlnestdepth 15 +cppnames +declundef \
    +distinctinternalnames +evalorder +fielduse +forcehints -globs \
    +imptype +includenest 8 +incondefs +incondefslib +linelen 9999 \
    +longintegral +macroassign +macroempty +macroredef +matchanyintegral \
    +nestedextern +noeffect +readonlystrings +realcompare +shadow -type

# slightly weaker, more realistic variant.
SPLINTFLAGS2 = $(SPLINTFLAGS) -ansireserved -retvalother -bitwisesigned \
    -skipposixheaders

# added to splint target to simplify experimentation,
# ex: make SPLINTOPTS='-posixstrictlib +posixlib' splint
SPLINTOPTS   =

INNO_SETUP = iscc

JIT_BUILD_TOOL = $(BUILD_TOOLS_DIR)/jit2c.pl

###############################################################################
#
# file extensions and util flags
#
###############################################################################

O               = @o@
EXE             = @exe@
SHARE_EXT       = @share_ext@
LOAD_EXT        = @load_ext@
A               = @a@
LD_SHARE_FLAGS  = @ld_share_flags@
LD_LOAD_FLAGS   = @ld_load_flags@

# generated by config/init/headers.pm
NONGEN_HEADERS  = @TEMP_nongen_headers@

###############################################################################
#
# "STICKY" GENERATED FILES:
#
# These files are created when Configure.pl runs.
#
# We don't delete these on 'clean' only on 'realclean'.
# That way, we don't have to re-Configure.pl after making
# clean.
#
###############################################################################

GEN_MAKEFILES = \
    Makefile \
#CONDITIONED_LINE(has_perldoc):    docs/Makefile \
    compilers/past/Makefile \
    compilers/past-pm/Makefile \
    compilers/pge/Makefile \
    compilers/tge/Makefile \
    compilers/bcg/Makefile \
    compilers/json/Makefile \
    editor/Makefile \
    ext/Makefile \
    languages/Makefile \
    languages/abc/Makefile \
    languages/amber/Makefile \
    languages/APL/Makefile \
    languages/bc/Makefile \
    languages/befunge/Makefile \
    languages/bf/Makefile \
    languages/c99/Makefile \
    languages/cardinal/Makefile \
    languages/cola/Makefile \
    languages/ecmascript/Makefile \
    languages/forth/Makefile \
    languages/HQ9plus/Makefile \
    languages/jako/Makefile \
    languages/lisp/Makefile \
    languages/lua/Makefile \
    languages/m4/Makefile \
    languages/miniperl/Makefile \
    languages/ook/Makefile \
    languages/parrot_compiler/Makefile \
    languages/perl6/Makefile \
    languages/pheme/Makefile \
    languages/plumhead/Makefile \
    languages/pugs/Makefile \
    languages/punie/Makefile \
    languages/regex/Makefile \
    languages/scheme/Makefile \
    languages/tap/Makefile \
    languages/tcl/Makefile \
    languages/tcl/examples/Makefile \
    languages/urm/Makefile \
    languages/WMLScript/Makefile \
    languages/Zcode/Makefile \
    src/dynpmc/Makefile \
    src/dynoplibs/Makefile

GEN_CONFIGS = \
    $(INC_DIR)/config.h \
    $(INC_DIR)/platform.h \
    $(INC_DIR)/platform_interface.h \
    $(INC_DIR)/has_header.h \
    $(INC_DIR)/feature.h \
    $(INC_DIR)/core_pmcs.h \
    $(SRC_DIR)/exec_dep.h \
    lib/Parrot/Config/Generated.pm \
    lib/Parrot/PMC.pm \
    runtime/parrot/include/config.fpmc \
    $(SRC_DIR)/platform.c \
    $(SRC_DIR)/revision.c \
#CONDITIONED_LINE(platform_asm):    $(SRC_DIR)/platform_asm.s \
    $(SRC_DIR)/core_pmcs.c \
    CFLAGS \
    $(IMCC_DIR)/CFLAGS \
    config_lib.pasm \
    $(BUILD_TOOLS_DIR)/dynpmc.pl \
    $(BUILD_TOOLS_DIR)/dynoplibs.pl \
    parrot.pc \
    $(IMCC_DIR)/imcc.y.flag \
    $(OPS_DIR)/core_ops.c \
    $(OPS_DIR)/core_ops_switch.c

# most of these are generated by config/gen/parrot_include.pm

GEN_PASM_INCLUDES = \
    runtime/parrot/include/signal.pasm \
    @TEMP_gen_pasm_includes@

STICKY_FILES = $(GEN_CONFIGS) $(GEN_MAKEFILES) myconfig $(GEN_PASM_INCLUDES)


###############################################################################
#
# "FLUID" GENERATED FILES:
#
# These files are created during the build process.
#
# We *do* delete these on 'clean'.
#
###############################################################################

GEN_OPSFILES =

GEN_HEADERS = \
    $(INC_DIR)/vtable.h \
    $(INC_DIR)/oplib/core_ops.h \
    $(INC_DIR)/oplib/ops.h \
    $(INC_DIR)/oplib/core_ops_switch.h \
    $(INC_DIR)/extend_vtable.h

GEN_SOURCES = \
    $(SRC_DIR)/core_ops.c \
    $(SRC_DIR)/fingerprint.c \
    $(SRC_DIR)/nci.c \
    $(SRC_DIR)/core_ops_switch.c \
    $(SRC_DIR)/jit_cpu.c \
    $(SRC_DIR)/parrot_config.c \
    $(SRC_DIR)/null_config.c \
    $(SRC_DIR)/install_config.c \
    $(SRC_DIR)/exec_cpu.c \
    $(SRC_DIR)/extend_vtable.c

GEN_MODULES = \
    lib/Parrot/OpLib/core.pm

GEN_LIBRARY = \
    $(LIBRARY_DIR)/CGI/QueryHash.pbc \
    $(LIBRARY_DIR)/config.pbc \
    $(LIBRARY_DIR)/Data/Dumper/Base.pbc \
    $(LIBRARY_DIR)/Data/Dumper/Default.pbc \
    $(LIBRARY_DIR)/Data/Dumper.pbc \
    $(LIBRARY_DIR)/Data/Escape.pbc \
    $(LIBRARY_DIR)/Data/Sort.pbc \
    $(LIBRARY_DIR)/Digest/MD5.pbc \
    $(LIBRARY_DIR)/dumper.pbc \
    $(LIBRARY_DIR)/Getopt/Obj.pbc \
    $(LIBRARY_DIR)/JSON.pbc \
    $(LIBRARY_DIR)/MIME/Base64.pbc \
    $(LIBRARY_DIR)/ncurses.pbc \
    $(LIBRARY_DIR)/parrotlib.pbc \
    $(LIBRARY_DIR)/pcre.pbc \
    $(LIBRARY_DIR)/Parrot/Capture_PIR.pbc \
    $(LIBRARY_DIR)/Parrot/Coroutine.pbc \
    $(LIBRARY_DIR)/Parrot/HLLCompiler.pbc \
    $(LIBRARY_DIR)/PGE/Dumper.pbc \
    $(LIBRARY_DIR)/PGE/Glob.pbc \
    $(LIBRARY_DIR)/PGE/P6Grammar.pbc \
    $(LIBRARY_DIR)/PGE/Text.pbc \
    $(LIBRARY_DIR)/PGE/Util.pbc \
    $(LIBRARY_DIR)/Stream/Base.pbc \
    $(LIBRARY_DIR)/Stream/Combiner.pbc \
    $(LIBRARY_DIR)/Stream/Coroutine.pbc \
    $(LIBRARY_DIR)/Stream/Filter.pbc \
    $(LIBRARY_DIR)/Stream/Lines.pbc \
    $(LIBRARY_DIR)/Stream/ParrotIO.pbc \
    $(LIBRARY_DIR)/Stream/Replay.pbc \
    $(LIBRARY_DIR)/Stream/Sub.pbc \
    $(LIBRARY_DIR)/Stream/Writer.pbc \
    $(LIBRARY_DIR)/String/Utils.pbc \
    $(LIBRARY_DIR)/YAML/Parser/Syck.pbc \
    $(LIBRARY_DIR)/STM.pbc \
    $(LIBRARY_DIR)/libpcre.pbc \
    $(LIBRARY_DIR)/Data/Replace.pbc \
    $(LIBRARY_DIR)/postgres.pbc

# the dependencies of $(SRC_DIR)/jit_emit.h are done explicitely
# including this file in GEN_HEADERS causes unnecessary recompile of all
FLUID_FILES = \
    $(GEN_OPSFILES) \
    $(GEN_HEADERS) \
    $(GEN_SOURCES) \
    $(GEN_MODULES) \
    $(GEN_LIBRARY) \
    $(SRC_DIR)/jit_emit.h \
    runtime/parrot/include/parrotlib.pbc


###############################################################################
#
# OTHER FILE GROUPS:
#
###############################################################################

# these are private to the IMCC subsystem
IMCC_H_FILES = \
    $(IMCC_DIR)/imc.h \
    $(IMCC_DIR)/cfg.h \
    $(IMCC_DIR)/instructions.h \
    $(IMCC_DIR)/debug.h \
    $(IMCC_DIR)/sets.h \
    $(IMCC_DIR)/unit.h \
    $(IMCC_DIR)/symreg.h \
    $(IMCC_DIR)/pbc.h \
    $(IMCC_DIR)/optimizer.h \
    $(IMCC_DIR)/parser.h \
    $(IMCC_DIR)/imcparser.h

IMCC_O_FILES = \
    $(IMCC_DIR)/imcparser$(O) \
    $(IMCC_DIR)/imclexer$(O) \
    $(IMCC_DIR)/imc$(O) \
    $(IMCC_DIR)/symreg$(O) \
    $(IMCC_DIR)/instructions$(O) \
    $(IMCC_DIR)/cfg$(O) \
    $(IMCC_DIR)/reg_alloc$(O) \
    $(IMCC_DIR)/sets$(O) \
    $(IMCC_DIR)/debug$(O) \
    $(IMCC_DIR)/optimizer$(O) \
    $(IMCC_DIR)/pbc$(O) \
    $(IMCC_DIR)/parser_util$(O) \
    $(IMCC_DIR)/pcc$(O)

# generated list of header files
GENERAL_H_FILES   = $(NONGEN_HEADERS) $(GEN_HEADERS) @TEMP_cg_h@

ALL_H_FILES       = $(GENERAL_H_FILES)

CHARSET_O_FILES   = @TEMP_charset_o@
CLASS_PMC_FILES   = @TEMP_pmc_classes_pmc@
CLASS_O_FILES     = @TEMP_pmc_classes_o@
CLASS_STR_FILES   = @TEMP_pmc_classes_str@
ENCODING_O_FILES  = @TEMP_encoding_o@


IO_O_FILES = \
    $(IO_DIR)/io$(O) \
    $(IO_DIR)/io_buf$(O) \
    $(IO_DIR)/io_layers$(O) \
    $(IO_DIR)/io_unix$(O) \
    $(IO_DIR)/io_utf8$(O) \
    $(IO_DIR)/io_mmap$(O) \
    $(IO_DIR)/io_win32$(O) \
    $(IO_DIR)/io_stdio$(O) \
    $(IO_DIR)/io_string$(O) \
    $(IO_DIR)/io_passdown$(O)

INTERP_O_FILES = \
    $(OPS_DIR)/core_ops$(O) \
    $(OPS_DIR)/core_ops_switch$(O) \
    @asmfun_o@ \
    @TEMP_cg_o@ \
    @TEMP_exec_o@ \
    @TEMP_atomic_o@ \
    $(SRC_DIR)/charset$(O) \
    $(SRC_DIR)/encoding$(O) \
    $(SRC_DIR)/exceptions$(O) \
    $(SRC_DIR)/global_setup$(O) \
    $(SRC_DIR)/interpreter$(O)  \
    $(SRC_DIR)/inter_call$(O)  \
    $(SRC_DIR)/inter_cb$(O)  \
    $(SRC_DIR)/inter_create$(O)  \
    $(SRC_DIR)/inter_misc$(O)  \
    $(SRC_DIR)/inter_run$(O)  \
    $(SRC_DIR)/register$(O) \
    $(SRC_DIR)/memory$(O) \
    $(SRC_DIR)/objects$(O) \
    $(SRC_DIR)/packfile$(O) \
    $(SRC_DIR)/stacks$(O) \
    $(SRC_DIR)/stack_common$(O) \
    $(SRC_DIR)/string$(O) \
    $(SRC_DIR)/string_primitives$(O) \
    $(SRC_DIR)/sub$(O) \
    $(SRC_DIR)/runops_cores$(O) \
    $(SRC_DIR)/trace$(O) \
    $(SRC_DIR)/pmc$(O) \
    $(SRC_DIR)/pmc_freeze$(O) \
    $(SRC_DIR)/key$(O) \
    $(SRC_DIR)/hash$(O) \
    $(SRC_DIR)/core_pmcs$(O) \
#CONDITIONED_LINE(platform_asm):    $(SRC_DIR)/platform_asm$(O) \
    $(SRC_DIR)/platform$(O) \
    @TEMP_jit_o@ \
    $(SRC_DIR)/intlist$(O) \
    $(SRC_DIR)/list$(O) \
    $(SRC_DIR)/library$(O) \
    $(SRC_DIR)/global$(O) \
    $(SRC_DIR)/embed$(O) \
    $(SRC_DIR)/warnings$(O) \
    $(SRC_DIR)/packout$(O) \
    $(SRC_DIR)/byteorder$(O) \
    $(SRC_DIR)/debug$(O) \
    $(SRC_DIR)/smallobject$(O) \
    $(SRC_DIR)/headers$(O) \
    $(SRC_DIR)/hll$(O) \
    $(SRC_DIR)/dod$(O) \
    $(SRC_DIR)/gc_ims$(O) \
    $(SRC_DIR)/gc_gms$(O) \
    $(SRC_DIR)/exit$(O) \
    $(SRC_DIR)/misc$(O) \
    $(SRC_DIR)/spf_render$(O) \
    $(SRC_DIR)/spf_vtable$(O) \
    $(SRC_DIR)/datatypes$(O) \
    $(SRC_DIR)/fingerprint$(O) \
    $(SRC_DIR)/nci$(O) \
    $(SRC_DIR)/cpu_dep$(O) \
    $(SRC_DIR)/tsq$(O) \
    $(SRC_DIR)/longopt$(O) \
    $(SRC_DIR)/events$(O) \
    $(SRC_DIR)/thread$(O) \
    $(SRC_DIR)/dynext$(O) \
    $(SRC_DIR)/utils$(O) \
    $(SRC_DIR)/vtables$(O) \
    $(SRC_DIR)/pic$(O) \
    $(SRC_DIR)/pic_jit$(O) \
    $(SRC_DIR)/mmd$(O) \
    $(SRC_DIR)/builtin$(O) \
    $(SRC_DIR)/extend$(O) \
    $(SRC_DIR)/extend_vtable$(O) \
    $(SRC_DIR)/revision$(O) \
    $(PF_DIR)/pf_items$(O) \
    $(SRC_DIR)/stm/backend$(O) \
    $(SRC_DIR)/stm/waitlist$(O) \
    @TEMP_gc_o@

O_FILES = \
    $(INTERP_O_FILES) \
    $(CHARSET_O_FILES) \
    $(IO_O_FILES) \
    $(CLASS_O_FILES) \
    $(ENCODING_O_FILES) \
    $(IMCC_O_FILES)

OPS_FILES = @ops@ $(GEN_OPSFILES)

###############################################################################
#
# BUILD TARGET CONFIGURATIONS:
#
###############################################################################

# Executables
PARROT              = $(CUR_DIR)/@test_prog@$(EXE)
MINIPARROT          = $(CUR_DIR)/miniparrot$(EXE)
DIS                 = $(CUR_DIR)/disassemble$(EXE)
PDUMP               = $(CUR_DIR)/pdump$(EXE)
PINFO               = $(CUR_DIR)/pbc_info$(EXE)
PBCMERGE            = $(CUR_DIR)/pbc_merge$(EXE)
PDB                 = $(CUR_DIR)/pdb$(EXE)

# Installable executables
INSTALLABLEPARROT   = $(CUR_DIR)/installable_parrot$(EXE)
INSTALLABLEDIS      = $(CUR_DIR)/installable_disassemble$(EXE)
INSTALLABLEPDUMP    = $(CUR_DIR)/installable_pdump$(EXE)
INSTALLABLEPINFO    = $(CUR_DIR)/installable_pbc_info$(EXE)
INSTALLABLEPBCMERGE = $(CUR_DIR)/installable_pbc_merge$(EXE)
INSTALLABLEPDB      = $(CUR_DIR)/installable_pdb$(EXE)

# Libraries
LIBPARROT_STATIC    = @blib_dir@/@libparrot_static@
#CONDITIONED_LINE(darwin):export DYLD_LIBRARY_PATH := @blib_dir@:$(DYLD_LIBRARY_PATH)
#CONDITIONED_LINE(win32):LIBPARROT_SHARED  = @libparrot_shared@
#INVERSE_CONDITIONED_LINE(win32):LIBPARROT_SHARED  = @blib_dir@/@libparrot_shared@

# This line controls whether a static or shared library is built
LIBPARROT           = @libparrot@

#CONDITIONED_LINE(has_icu):ICU_SHARED  = @icu_shared@
ALL_PARROT_LIBS     = @libparrot_ldflags@ $(ICU_SHARED) $(C_LIBS)

# dynamic extensions
DYNEXT_DIR          = runtime/parrot/dynext
LIBNCI_TEST_SO      = $(DYNEXT_DIR)/libnci_test$(LOAD_EXT)

###############################################################################
#
# MAKE CONFIGURATION:
#
###############################################################################

# This is set to  MAKE=$make if your $make command doesn't
# do it for you.
@make_set_make@
MAKE = @make_c@

# These need to be above lines that define suffix rules to be portable
# (certainly FreeBSD make doesn't grok the pir.pbc rule otherwise)

.SUFFIXES : .c .h .pmc .dump $(O) .str .pir .pbc

# Passing an empty argument in @ARGV to cc_flags.pl to indicate where extra -Is
# (etc) should go. Otherwise it will insert them after the first space, which
# makes life go horribly wrong if $(CC) contains spaces but can't have -I
# arguments (etc) injected in the middle.
# There is probably a better way to do this, but I can't work it out right now.
.c$(O) :
	@$(PERL) tools/dev/cc_flags.pl $(CUR_DIR)/CFLAGS $(CC) "" $(CFLAGS) -I$(@D) @cc_o_out@$@ -c $<

# XXX probably should detect assembler, but right now this is only used on Sparc

.s$(O) :
	@$(PERL) tools/dev/cc_flags.pl $(CUR_DIR)/CFLAGS $(CC) "" $(CFLAGS) -I$(@D) @cc_o_out@$@ -c $<

# XXX These obviously require parrot: had trouble adding parrot as a dependency
# here, though. Ignored on OS X, at least.

.pir.pbc :
	$(PARROT) -o $@ $<

.pbc$(O) :
	$(PARROT) -o $@ $<


###############################################################################
#
# USER TARGETS:
#
# These targets are supposed to be called by the user.
#
###############################################################################

all : \
    flags_dummy \
    PARROT_LIBS \
    $(PARROT) \
    runtime/parrot/include/parrotlib.pbc \
    runtime/parrot/include/config.fpmc \
    docs \
    $(LIBNCI_TEST_SO) \
    $(GEN_LIBRARY) \
    dynpmc \
    dynoplibs \
    compilers \
    $(PBCMERGE)

$(GEN_LIBRARY) : $(PARROT)

# constant string support
.c.str :
	$(PERL) $(BUILD_TOOLS_DIR)/c2str.pl $< > $@

STR_FILES = \
    $(SRC_DIR)/builtin.str \
    $(SRC_DIR)/inter_call.str \
    $(SRC_DIR)/inter_cb.str \
    $(SRC_DIR)/inter_misc.str \
    $(SRC_DIR)/global.str \
    $(SRC_DIR)/global_setup.str \
    $(SRC_DIR)/library.str \
    $(SRC_DIR)/mmd.str \
    $(SRC_DIR)/pmc.str \
    $(SRC_DIR)/objects.str \
    $(SRC_DIR)/spf_render.str \
    $(SRC_DIR)/spf_vtable.str \
    $(CLASS_STR_FILES)

$(SRC_DIR)/string_private_cstring.h : $(STR_FILES) $(BUILD_TOOLS_DIR)/c2str.pl
	$(PERL) $(BUILD_TOOLS_DIR)/c2str.pl --all

# classes PMC build utils and rules
PMC2CD = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump
PMC2CC = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --c
PMC2CV = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --vtable

.pmc.dump :
	$(PMC2CD) $<

.pmc.c :
	$(PMC2CC) $<

# not all makes might understand this, so the rules are generated
#src/pmc/pmc_%.h : src/pmc/%.c
#	$(PMC2CC) $<

vtable.dump : vtable.tbl
	$(PMC2CV)

# This is a listing of all targets, that are meant to be called by users
help :
	@echo ""
	@echo "Following targets are available for the user:"
	@echo ""
	@echo "Executables:"
	@echo "  all:               'parrot' and the documentation."
	@echo "                     This is the default."
	@echo ""
	@echo "  world:             'all' and 'parrot_utils'."
	@echo "  installable:       same as 'world', but targets for installation"
	@echo ""
	@echo "  parrot_utils:      $(PDUMP), $(DIS), $(PINFO), $(PDB) and $(PBCMERGE)"
	@echo "  $(PDUMP):             Parrot Dumper"
	@echo "  $(DIS):       Parrot Disassembler"
	@echo "  $(PINFO):          Information about Parrot Byte Code"
	@echo "  $(PDB):               Parrot Debugger"
	@echo "  $(PBCMERGE):         Merge bytecode files"
	@echo ""
	@echo "Installation:"
	@echo "  install:           Install under '$(PREFIX)' on Unix systems"
	@echo "                      WARNING: Installing Parrot may interfere with"
	@echo "                               developing Parrot on the same machine."
	@echo "                               This flaw will be fixed eventually."
	@echo "  reallyinstall:     Install under '$(PREFIX)' on Unix systems"
	@echo "               NOTE: This actually does the install.  Since"
	@echo "                     there are currently issues with the Parrot"
	@echo "                     install system, this make target is used"
	@echo "                     to go ahead with the install anyway."

	@echo ""
	@echo "Documentation:"
	@echo "  help:              Print this help message."
	@echo "  docs:              Generate documentation from POD in the sources."
	@echo "  html:              Generate HTML documentation from POD in the sources."
	@echo "  html-clean:        Remove the HTML documentation."
	@echo ""
	@echo "Testing:"
	@echo "  test:              Run the test suite."
	@echo "  fulltest:          Run test suite with various options."
	@echo "  test<core>:        Run the test suite with a specified core."
	@echo "                     Valid cores are b, C, f, g, j, r, S."
	@echo "  src_tests:         Run test in C-file."
	@echo "  perl_tests:        Test the Perl modules in the distribution."
	@echo "  codingstd_tests:   Test pdd07_codingstd."
	@echo "  testexec:          Testing the exec runcore."
	@echo "  benchmark_tests:   Run all benchmarks."
	@echo "  manitest:          Check for new and missing files."
	@echo "  doc_tests:         Check POD syntax of all files containing POD."
	@echo "  buildtools_tests:  Test build tool pmc2c.pl."
	@echo ""
	@echo "Smoke Testing:"
	@echo "  smoke:             Run the test suite and send smoke.html to "
	@echo "                     http:////smoke.parrotcode.org/"
	@echo "  smokej:            Same as smoke, but with JIT runcore"
	@echo "  smokeexec:         Same as smoke, but generate first executables"
	@echo "                     with the exec runcore"
	@echo "  smoke-clean:       clean up smoke.html"
	@echo ""
	@echo "Benchmarks:"
	@echo "  mopsbench:         Million operations"
	@echo ""
	@echo "Cleaning:"
	@echo "  clean:             Basic cleaning up."
	@echo "  archclean:         Remove any platform dependent files."
	@echo "  realclean:         Removes also files generated by 'Configure.pl'"
	@echo "  distclean:         Removes also anything built, in theory."
	@echo "  svnclobber:        *Dangerous*: remove everything not in svn."
	@echo "  reconfig:          'clean' and redo configuration."
	@echo ""
	@echo "Dynamic PMCs:"
	@echo "  dynpmc:            Proxy for default target of src/dynpmc/Makefile"
	@echo "  dynpmc-test:       Proxy for target 'test' of src/dynpmc/Makefile"
	@echo "  dynpmc-clean:      Proxy for target 'clean' of src/dynpmc/Makefile"
	@echo ""
	@echo "Dynamic oplibs:"
	@echo "  dynoplibs:         Proxy for default target of src/dynoplibs/Makefile"
	@echo "  dynoplibs-test:    Proxy for target 'test' of src/dynoplibs/Makefile"
	@echo "  dynoplibs-clean:   Proxy for target 'clean' of src/dynoplibs/Makefile"
	@echo ""
	@echo "Language implementations:"
	@echo "  compilers:         Proxy for default target of pge and tge compilers"
	@echo "  languages:         Proxy for default target of languages/Makefile"
	@echo "  languages-test:    Proxy for target 'test' of languages/Makefile"
	@echo "  languages-smoke:   Proxy for target 'test' of languages/Makefile"
	@echo "  languages-clean:   Proxy for target 'clean' of languages/Makefile"
	@echo ""
	@echo "fetch from source repository:"
	@echo "  update:            svn update."
	@echo "  status:            svn status."
	@echo "  patch:             create a patch for sending to bugs-parrot."
	@echo "  rsync:             update with rsync."
	@echo ""
	@echo "Development:"
	@echo "  lint:              code checking with lint."
	@echo "  splint:            code checking with splint."
	@echo "  splint2:           another code checking with splint."
	@echo ""
	@echo "Release:"
	@echo "  release:           create a TAR ball."
	@echo "  rpm:               create RPMs."
	@echo "  win32-inno-installer:      create MSWin32 setup."
	@echo ""
	@echo "Examples:"
	@echo "  hello:             'Hello World' as an executable."
	@echo ""

world : all parrot_utils

parrot_utils : $(PDUMP) $(DIS) $(PINFO) $(PDB) $(PBCMERGE)

installable: all $(INSTALLABLEPARROT) $(INSTALLABLEPDUMP) $(INSTALLABLEDIS) $(INSTALLABLEPINFO) $(INSTALLABLEPDB) $(INSTALLABLEPBCMERGE)

flags_dummy :
	@echo "Compiling with:"
	@$(PERL) tools/dev/cc_flags.pl $(CUR_DIR)/CFLAGS echo $(CC) $(CFLAGS) -I$(@D) @cc_o_out@ xx$(O) -c xx.c

runtime/parrot/include/parrotlib.pbc: runtime/parrot/library/parrotlib.pir $(PARROT)
	$(PARROT) -o $@ runtime/parrot/library/parrotlib.pir

runtime/parrot/include/config.fpmc : myconfig config_lib.pasm $(MINIPARROT)
	@echo Invoking Parrot to generate runtime/parrot/include/config.fpmc --cross your fingers
	$(MINIPARROT) config_lib.pasm > $@

$(PARROT) : $(IMCC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
    lib/Parrot/OpLib/core.pm $(SRC_DIR)/parrot_config$(O) \
    $(MINIPARROT)
	$(LINK) @ld_out@$@ \
    $(IMCC_DIR)/main$(O) @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(LINK_DYNAMIC) \
    $(SRC_DIR)/parrot_config$(O)
#
# TODO build the real miniparrot
#
$(MINIPARROT) : $(IMCC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
    lib/Parrot/OpLib/core.pm $(SRC_DIR)/null_config$(O)
	$(LINK) @ld_out@$@ $(IMCC_DIR)/main$(O) \
    @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(SRC_DIR)/null_config$(O)

$(INSTALLABLEPARROT) : $(IMCC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
    lib/Parrot/OpLib/core.pm $(SRC_DIR)/install_config$(O) \
    $(PARROT)
	$(LINK) @ld_out@$@ \
    $(IMCC_DIR)/main$(O) \
    $(ALL_PARROT_LIBS) $(LINKFLAGS) $(SRC_DIR)/install_config$(O)

$(SRC_DIR)/parrot_config.c :  runtime/parrot/include/config.fpmc \
    $(BUILD_TOOLS_DIR)/parrot_config_c.pl
	$(PERL) $(BUILD_TOOLS_DIR)/parrot_config_c.pl > \
    $(SRC_DIR)/parrot_config.c

$(SRC_DIR)/install_config.c :  install_config.fpmc \
    $(BUILD_TOOLS_DIR)/parrot_config_c.pl
	$(PERL) $(BUILD_TOOLS_DIR)/parrot_config_c.pl --install > \
    $(SRC_DIR)/install_config.c

$(SRC_DIR)/null_config.c : myconfig $(BUILD_TOOLS_DIR)/parrot_config_c.pl
	$(PERL) $(BUILD_TOOLS_DIR)/parrot_config_c.pl --mini > \
    $(SRC_DIR)/null_config.c

install_config.fpmc : myconfig config_lib.pasm $(PARROT)
	@echo "Invoking Parrot to generate install_config.fpmc"
	$(PARROT) config_lib.pasm --install > $@

$(SRC_DIR)/parrot_config$(O) : $(SRC_DIR)/parrot_config.c

$(SRC_DIR)/install_config$(O) : $(SRC_DIR)/install_config.c

$(SRC_DIR)/null_config.$(O) : $(SRC_DIR)/null_config.c

lib_deps_object : $(O_FILES)
	$(PERL) tools/dev/lib_deps.pl object $(O_FILES)

lib_deps_source : $(GENERAL_H_FILES)
	$(PERL) tools/dev/lib_deps.pl source all_source

lib_deps : lib_deps_object lib_deps_source

check_source : $(GENERAL_H_FILES)
	$(PERL) tools/dev/check_source_standards.pl all_source

# XXX changes don't always propagate into libparrot
# e.g. when I change debug:fataly to xfataly, nm still shows the old symbol
# and parrot builds fine (except for the unproto warning
# so always delete the lib -leo

PARROT_LIBS: \
#CONDITIONED_LINE(has_static_linking):  $(LIBPARROT_STATIC) \
#CONDITIONED_LINE(has_dynamic_linking): $(LIBPARROT_SHARED)

$(LIBPARROT_STATIC) : $(O_FILES)
	$(MKPATH) @blib_dir@
	$(AR_CR) @ar_out@$@ @ar_extra@ $(O_FILES)
	$(RANLIB) $@

$(LIBPARROT_SHARED) : $(O_FILES)
	$(MKPATH) @blib_dir@
	$(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) @ld_out@$@ @libparrot_soname@ \
    $(O_FILES) $(C_LIBS) $(ICU_SHARED)
#CONDITIONED_LINE(libparrot_shared_alias):	( cd @blib_dir@ ; ln -sf @libparrot_shared@ @libparrot_shared_alias@ )


#
# Parrot Debugger
#

$(SRC_DIR)/pdb$(O) : $(GENERAL_H_FILES)

$(PDB) : $(SRC_DIR)/pdb$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pdb$(O) \
    @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)

$(INSTALLABLEPDB) : $(SRC_DIR)/pdb$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pdb$(O) \
    $(ALL_PARROT_LIBS) $(LINKFLAGS)

#
# Parrot Disassembler
#

$(SRC_DIR)/disassemble$(O) : $(GENERAL_H_FILES)

$(DIS) : $(SRC_DIR)/disassemble$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/disassemble$(O) \
    @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)

$(INSTALLABLEDIS) : $(SRC_DIR)/disassemble$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/disassemble$(O) \
    $(ALL_PARROT_LIBS) $(LINKFLAGS)

#
# Parrot Dump
#

$(PDUMP) : $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pdump$(O) \
    $(SRC_DIR)/packdump$(O) @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)

$(INSTALLABLEPDUMP) : $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pdump$(O) \
    $(SRC_DIR)/packdump$(O) $(ALL_PARROT_LIBS) $(LINKFLAGS)


# pbc_info
$(PINFO) : $(SRC_DIR)/pbc_info$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pbc_info$(O) \
    @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)

$(INSTALLABLEPINFO) : $(SRC_DIR)/pbc_info$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pbc_info$(O) \
    $(ALL_PARROT_LIBS) $(LINKFLAGS)

#
# Parrot Bytecode File Merger
#

$(PBCMERGE) : $(SRC_DIR)/pbc_merge$(O) $(LIBPARROT) $(SRC_DIR)/parrot_config$(O)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pbc_merge$(O) \
    $(SRC_DIR)/parrot_config$(O) \
    @rpath_blib@ $(ALL_PARROT_LIBS) $(LINK_DYNAMIC) $(LINKFLAGS)

$(INSTALLABLEPBCMERGE) : $(SRC_DIR)/pbc_merge$(O) $(LIBPARROT)
	$(LINK) @ld_out@$@ \
    $(SRC_DIR)/pbc_merge$(O) \
    $(SRC_DIR)/install_config$(O) \
    $(ALL_PARROT_LIBS) $(LINKFLAGS)


###############################################################################
#
# Other Dependencies and Build Rules:
#
###############################################################################

$(IMCC_DIR)/main$(O) : $(IMCC_DIR)/main.c $(GENERAL_H_FILES) $(IMCC_H_FILES)

$(INC_DIR)/oplib/ops.h lib/Parrot/OpLib/core.pm : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2pm.pl \
    lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(OPS_DIR)/ops.num $(OPS_DIR)/ops.skip
	$(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl $(OPS_FILES)

$(SRC_DIR)/fingerprint.c : $(BUILD_TOOLS_DIR)/fingerprint_c.pl PBC_COMPAT
	$(PERL) $(BUILD_TOOLS_DIR)/fingerprint_c.pl > $(SRC_DIR)/fingerprint.c


$(SRC_DIR)/revision.c : $(SVN_ENTRIES) $(BUILD_TOOLS_DIR)/revision_c.pl
	$(PERL) -Ilib $(BUILD_TOOLS_DIR)/revision_c.pl > $(SRC_DIR)/revision.c

###############################################################################
#
# Examples (Assembly):
#
###############################################################################

examples-clean:
	$(RM_F) \
    examples/mops/mops$(O) \
    examples/mops/mops$(EXE) \
    examples/pasm/hello.pbc \
    examples/pasm/hello$(O) \
    examples/pasm/hello$(EXE)

# hello
hello: test_prep examples/pasm/hello$(EXE)
	$(CUR_DIR)/examples/pasm/hello$(EXE) "from your friendly makefile"

examples/pasm/hello.pbc: examples/pasm/hello.pasm
	$(PARROT) -o examples/pasm/hello.pbc examples/pasm/hello.pasm

examples/pasm/hello$(O): examples/pasm/hello.pbc
	$(PARROT) -o examples/pasm/hello$(O) examples/pasm/hello.pbc

examples/pasm/hello$(EXE): examples/pasm/hello$(O)
	$(MAKE) . EXEC=examples/pasm/hello exec



###############################################################################
#
# Dependencies:
#
###############################################################################

$(SRC_DIR)/global_setup$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/global_setup.str

$(SRC_DIR)/global$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/global.str

$(SRC_DIR)/pmc$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/pmc_freeze$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/hash$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/intlist$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/list$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/library$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/jit$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/jit_emit.h

$(SRC_DIR)/jit_debug$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/jit_debug_xcoff$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/jit_cpu$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/jit_emit.h

$(SRC_DIR)/exec$(O) : $(GENERAL_H_FILES) @TEMP_exec_h@ $(SRC_DIR)/jit_emit.h

$(SRC_DIR)/exec_cpu$(O) : $(GENERAL_H_FILES) @TEMP_exec_h@ $(SRC_DIR)/jit_emit.h

$(INC_DIR)/extend_vtable.h $(SRC_DIR)/extend_vtable.c $(SRC_DIR)/vtable.h : vtable.tbl $(BUILD_TOOLS_DIR)/vtable_extend.pl lib/Parrot/Vtable.pm
	$(PERL) $(BUILD_TOOLS_DIR)/vtable_extend.pl

$(SRC_DIR)/exec_start$(O) : $(GENERAL_H_FILES) @TEMP_exec_h@

$(SRC_DIR)/exec_save$(O) : $(GENERAL_H_FILES) @TEMP_exec_h@

$(SRC_DIR)/key$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/smallobject$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/headers$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/dod$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/gc_ims$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/gc_gms$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/hll$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/resources$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/platform$(O) : $(GENERAL_H_FILES)

#CONDITIONED_LINE(platform_asm):$(SRC_DIR)/platform_asm$(O) : $(GENERAL_H_FILES)
#CONDITIONED_LINE(platform_asm):
$(SRC_DIR)/core_pmcs$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/trace$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/debug$(O) : $(GENERAL_H_FILES) $(INC_DIR)/debug.h

$(SRC_DIR)/sub$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/string$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/string_private_cstring.h

$(SRC_DIR)/string_primitives$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/longopt$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/dynext$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/exceptions$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/events$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/thread$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/extend$(O) : $(GENERAL_H_FILES) $(INC_DIR)/extend.h

$(SRC_DIR)/interpreter$(O) : $(SRC_DIR)/interpreter.c $(GENERAL_H_FILES)

$(SRC_DIR)/inter_call$(O) : $(SRC_DIR)/inter_call.c $(GENERAL_H_FILES) \
    $(SRC_DIR)/inter_call.str

$(SRC_DIR)/inter_cb$(O) : $(SRC_DIR)/inter_cb.c $(GENERAL_H_FILES) \
    $(SRC_DIR)/inter_cb.str

$(SRC_DIR)/inter_misc$(O) : $(SRC_DIR)/inter_misc.c $(GENERAL_H_FILES) \
    $(SRC_DIR)/inter_misc.str

$(SRC_DIR)/inter_create$(O) : $(SRC_DIR)/inter_create.c $(GENERAL_H_FILES)

$(SRC_DIR)/inter_run$(O) : $(SRC_DIR)/inter_run.c $(GENERAL_H_FILES)

$(IO_DIR)/io$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_buf$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_layers$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_unix$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_utf8$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_mmap$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_win32$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_stdio$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_string$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(IO_DIR)/io_passdown$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h

$(SRC_DIR)/memory$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/pic$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/pic_jit$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/mmd$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/mmd.str

$(SRC_DIR)/builtin$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/builtin.str

$(SRC_DIR)/objects$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/objects.str

$(SRC_DIR)/packfile$(O) : $(GENERAL_H_FILES)

$(PF_DIR)/pf_items$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/packout$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/parrot$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/register$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/runops_cores$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/stacks$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/stack_common$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/tsq$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/embed$(O) : $(GENERAL_H_FILES) $(INC_DIR)/debug.h

$(SRC_DIR)/dataypes$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/dataypes.c

$(SRC_DIR)/exit$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exit.c

$(SRC_DIR)/nci$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci.c

$(SRC_DIR)/vtables$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/vtables.c

$(SRC_DIR)/cpu_dep$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/nci.c : $(SRC_DIR)/call_list.txt $(BUILD_TOOLS_DIR)/nativecall.pl
	$(PERL) $(BUILD_TOOLS_DIR)/nativecall.pl $(SRC_DIR)/call_list.txt

$(SRC_DIR)/warnings$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/misc$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/utils$(O) : $(GENERAL_H_FILES)

$(SRC_DIR)/spf_render$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/spf_render.str

$(SRC_DIR)/spf_vtable$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/spf_vtable.str

$(SRC_DIR)/encoding$(O) : $(SRC_DIR)/encoding.c $(GENERAL_H_FILES)

$(SRC_DIR)/charset$(O) : $(SRC_DIR)/charset.c $(GENERAL_H_FILES)

$(SRC_DIR)/pbc_merge$(O) : $(SRC_DIR)/pbc_merge.c $(GENERAL_H_FILES)

$(OPS_DIR)/core_ops$(O) : $(GENERAL_H_FILES) $(OPS_DIR)/core_ops.c

# core_ops depends upon config.h so that it gets updated along with
# updates to config.h's version numbers

# .h files are built along with .c
$(INC_DIR)/oplib/core_ops.h: $(OPS_DIR)/core_ops.c

$(OPS_DIR)/core_ops.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/C.pm
	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core

$(OPS_DIR)/core_ops_switch$(O) : $(GENERAL_H_FILES) $(OPS_DIR)/core_ops_switch.c

$(INC_DIR)/oplib/core_ops_switch.h : $(OPS_DIR)/core_ops_switch.c

$(OPS_DIR)/core_ops_switch.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CSwitch.pm lib/Parrot/OpTrans/CPrederef.pm
	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core

@TEMP_cg_c@

@TEMP_gc_c@

@TEMP_pmc_build@

@TEMP_charset_build@

@TEMP_encoding_build@

# $(STICKY_FILES) : Configure.pl
#	$(PERL) Configure.pl

$(INC_DIR)/vtable.h : vtable.tbl $(BUILD_TOOLS_DIR)/vtable_h.pl lib/Parrot/Vtable.pm
	$(PERL) $(BUILD_TOOLS_DIR)/vtable_h.pl

$(SRC_DIR)/jit_emit.h : $(SRC_DIR)/jit/@jitcpuarch@/jit_emit.h
	$(CP) $(SRC_DIR)/jit/@jitcpuarch@/jit_emit.h $(SRC_DIR)/jit_emit.h
$(SRC_DIR)/exec_dep.h : $(SRC_DIR)/jit/@jitcpuarch@/exec_dep.h
	$(CP) $(SRC_DIR)/jit/@jitcpuarch@/exec_dep.h $(SRC_DIR)/exec_dep.h
$(SRC_DIR)/jit_cpu.c : lib/Parrot/OpLib/core.pm $(SRC_DIR)/jit_emit.h \
    $(SRC_DIR)/jit/@jitcpuarch@/core.jit $(JIT_BUILD_TOOL)
	$(PERL) $(JIT_BUILD_TOOL) @jitcpuarch@ $(SRC_DIR)/jit_cpu.c
$(SRC_DIR)/exec_cpu.c : lib/Parrot/OpLib/core.pm $(SRC_DIR)/jit_emit.h \
    $(SRC_DIR)/jit/@jitcpuarch@/core.jit @TEMP_exec_h@ $(SRC_DIR)/exec_dep.h $(JIT_BUILD_TOOL)
	$(PERL) $(JIT_BUILD_TOOL) @jitcpuarch@ $(SRC_DIR)/exec_cpu.c

# imcc file dependencies
#
# The .flag files are needed because we are keeping some derived files in SVN,
# which does not keep accurate timestamps on the files, relative to each other.
# Note that YACC or LEX may be null commands, so we must `touch` all the
# target files, instead of just the .flag files.

$(IMCC_DIR)/imcc.y.flag $(IMCC_DIR)/imcparser.c $(IMCC_DIR)/imcparser.h : $(IMCC_DIR)/imcc.y
	$(YACC) $(IMCC_DIR)/imcc.y -d -o $(IMCC_DIR)/imcparser.c
	$(TOUCH) $(IMCC_DIR)/imcc.y.flag $(IMCC_DIR)/imcparser.c $(IMCC_DIR)/imcparser.h

$(IMCC_DIR)/imcc.l.flag $(IMCC_DIR)/imclexer.c : $(IMCC_DIR)/imcc.l
	$(LEX) -o$(IMCC_DIR)/imclexer.c $(IMCC_DIR)/imcc.l
	$(TOUCH) $(IMCC_DIR)/imcc.l.flag $(IMCC_DIR)/imclexer.c

$(IMCC_O_FILES) : $(IMCC_H_FILES) $(ALL_H_FILES)

###############################################################################
#
# Documentation targets:
#
###############################################################################

#CONDITIONED_LINE(has_perldoc):docs : docs.dummy
#INVERSE_CONDITIONED_LINE(has_perldoc):docs : docs.stub

#CONDITIONED_LINE(has_perldoc):html : html.dummy
#INVERSE_CONDITIONED_LINE(has_perldoc):html : html.stub

html.stub:
	@echo "Perldoc is required, but not detected."

docs.stub:
	@echo "Perldoc is required, but not detected."

docs.dummy :
	$(MAKE) docs

docs-clean :
	$(MAKE) docs clean

html.dummy :
	$(MAKE) docs html

html-clean :
	$(MAKE) docs html-clean

###############################################################################
#
# dynamic PMC targets:
#
###############################################################################

dynpmc : dynpmc.dummy

# XXX this dependancy is too broad, and should be narrowed down
dynpmc.dummy : $(PARROT)
	$(MAKE) src/dynpmc

dynpmc-test :
	$(MAKE) src/dynpmc test

dynpmc-clean :
	$(MAKE) src/dynpmc clean

###############################################################################
#
# dynamic oplibs targets:
#
###############################################################################

dynoplibs : dynoplibs.dummy

# XXX this dependancy is too broad, and should be narrowed down
dynoplibs.dummy : $(PARROT)
	$(MAKE) src/dynoplibs

dynoplibs-test :
	$(MAKE) src/dynoplibs test

dynoplibs-clean :
	$(MAKE) src/dynoplibs clean

###############################################################################
#
# language implementation targets:
#
###############################################################################

compilers : compilers.dummy

compilers.dummy : $(PARROT)
	$(MAKE) compilers/past
	$(MAKE) compilers/pge
	$(MAKE) compilers/tge
	$(MAKE) compilers/past-pm
	$(MAKE) compilers/json

languages : languages.dummy

languages.dummy :
	$(MAKE) languages

languages-test :
	$(MAKE) languages test

languages-smoke :
	$(MAKE) languages smoke

languages-clean :
	$(MAKE) languages clean

###############################################################################
#
# compiler implementation targets:
#
###############################################################################

compilers-clean :
	$(MAKE) compilers/past clean
	$(MAKE) compilers/past-pm clean
	$(MAKE) compilers/pge clean
	$(MAKE) compilers/tge clean
	$(MAKE) compilers/json clean

###############################################################################
#
# editors targets:
#
###############################################################################

editor-clean :
	$(MAKE) editor clean

###############################################################################
#
# Testing Targets:
#
###############################################################################

# The --running-make-test argument is currently used by long-running tests
# to disable GC_DEBUG.
EXTRA_TEST_ARGS    = --gc-debug --running-make-test
DISTRO_TEST_FILES = \
    t/distro/*.t
BENCHMARK_TEST_FILES = \
    t/benchmark/*.t
DOC_TEST_FILES = \
    t/doc/*.t
PERL_TEST_FILES = \
    t/perl/*.t
CODINGSTD_TEST_FILES = \
    t/codingstd/*.t
RUN_TEST_FILES = \
    t/run/*.t
RUNCORE_TEST_FILES = \
    t/compilers/imcc/*/*.t \
    t/op/*.t \
    t/pmc/*.t \
    t/native_pbc/*.t \
    t/dynpmc/*.t \
    t/dynoplibs/*.t \
    t/compilers/json/*.t \
    t/compilers/past/*.t \
    t/compilers/pge/*.t \
    t/compilers/pge/p5regexp/*.t \
    t/compilers/pge/p6rules/*.t \
    t/compilers/tge/*.t \
    t/library/*.t \
    t/examples/*.t
SRC_TEST_FILES = \
    t/src/*.t
TOOLS_TEST_FILES = \
    t/tools/*.t
PMC2CUTILS_DIR = t/tools/pmc2cutils
OPS2PMUTILS_DIR = t/tools/ops2pmutils
BUILDTOOLS_TEST_FILES = \
        $(PMC2CUTILS_DIR)/00-qualify.t \
        $(PMC2CUTILS_DIR)/01-pmc2cutils.t \
        $(PMC2CUTILS_DIR)/02-find_file.t \
        $(PMC2CUTILS_DIR)/03-dump_vtable.t \
        $(PMC2CUTILS_DIR)/04-dump_pmc.t \
        $(PMC2CUTILS_DIR)/05-gen_c.t \
        $(PMC2CUTILS_DIR)/06-print_tree.t \
        $(PMC2CUTILS_DIR)/07-open_file.t \
        $(OPS2PMUTILS_DIR)/00-qualify.t \
        $(OPS2PMUTILS_DIR)/01-ops2pmutils.t \
        $(OPS2PMUTILS_DIR)/02-usage.t \
        $(OPS2PMUTILS_DIR)/03-new.t \
        $(OPS2PMUTILS_DIR)/04-prepare_ops.t \
        $(OPS2PMUTILS_DIR)/05-renum_op_map_file.t \
        $(OPS2PMUTILS_DIR)/06-load_op_map_files.t \
        $(OPS2PMUTILS_DIR)/07-no_ops_skip.t \
        $(OPS2PMUTILS_DIR)/08-sort_ops.t \
        $(OPS2PMUTILS_DIR)/09-prepare_real_ops.t \
        $(OPS2PMUTILS_DIR)/10-print_module.t \
        $(OPS2PMUTILS_DIR)/11-print_h.t

# Common prep for all test targets.
# We probably need a complete build before running the tests.
test_prep : all

# Run test cases with a single call of t/harness. Users have to look at only
# one report. The default set of tests to run is contained in t/harness,
# make any edits there.
# Normal core
test : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS)

# automake compatibility
check : test

# Test various run cores and other stuff
# 'testC', 'testg' and 'testj' are tested only
# when the needed runcores are available
fulltest : \
    testb \
#CONDITIONED_LINE(cg_flag): testC \
    testf \
#CONDITIONED_LINE(cg_flag): testg \
#CONDITIONED_LINE(jitcapable): testj \
    testr \
    testS \
    src_tests \
    perl_tests \
    codingstd_tests \
    benchmark_tests \
    doc_tests \
    distro_tests

# bounds checking, slow core
testb : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -b $(RUNCORE_TEST_FILES)

# CGP core
testC : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -C $(RUNCORE_TEST_FILES)

# fast core
testf : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -f $(RUNCORE_TEST_FILES)

# Computed goto
testg : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -g $(RUNCORE_TEST_FILES)

# JIT core
testj : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -j $(RUNCORE_TEST_FILES)

# normal core, write and run Parrot Byte Code
testr : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -r $(RUNCORE_TEST_FILES)

# switched core
testS : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -S $(RUNCORE_TEST_FILES)

# Computed goto jitted core
testCj : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -Cj $(RUNCORE_TEST_FILES)

# switched jitted core
testSj : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) -Sj $(RUNCORE_TEST_FILES)

# test the EXEC stuff
testexec: test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(PARROT_ARGS) --run-exec $(RUNCORE_TEST_FILES)

# Test that need to be compiled by the C-compiler
src_tests :
	$(PERL) t/harness $(SRC_TEST_FILES)

# Command line and varous environments
run_tests :
	$(PERL) t/harness $(RUN_TEST_FILES)


# Test the Perl5 Modules in the Parrot distribution
perl_tests :
	$(PERL) t/harness $(PERL_TEST_FILES)

# Test pdd07_codingstd
codingstd_tests :
	$(PERL) t/harness $(CODINGSTD_TEST_FILES)

buildtools_tests :
	$(PERL) t/harness $(BUILDTOOLS_TEST_FILES)

# obsolete
testbench :
	@echo "Please use the target benchmark_tests."

# benchmark tests
benchmark_tests : test_prep
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(BENCHMARK_TEST_FILES)

# doc tests
doc_tests :
	$(PERL) t/harness $(EXTRA_TEST_ARGS) $(DOC_TEST_FILES)

# Running a benchmark
mopsbench : test_prep
	$(PARROT) $(PARROT_ARGS) examples/benchmarks/mops_intval.pasm

# distro tests
distro_tests : test_prep
	$(PERL) t/harness $(DISTRO_TEST_FILES)

# configure tests
configure_tests :
	$(PERL) t/harness t/configure/*.t


###############################################################################
#
# Cleaning Targets:
#
###############################################################################

clean : \
    test-clean \
    prog-clean \
    dynext-clean \
    languages-clean \
#CONDITIONED_LINE(has_perldoc): docs-clean \
#CONDITIONED_LINE(has_perldoc): html-clean \
    dynpmc-clean \
    dynoplibs-clean \
    examples-clean \
    imcc-clean \
    compilers-clean \
    smoke-clean \
    editor-clean
	@TEMP_cg_r@
	$(RM_F) chartypes "*.s" "*~" $(FLUID_FILES)

prog-clean :
	$(RM_F) \
    $(O_FILES) \
    $(PARROT) \
    $(MINIPARROT) \
    $(LIBPARROT) \
    $(INSTALLABLEPARROT) \
    $(INSTALLABLEDIS) \
    $(INSTALLABLEPDUMP) \
    $(INSTALLABLEPINFO) \
    $(INSTALLABLEPBCMERGE) \
    $(INSTALLABLEPDB) \
    $(IMCC_DIR)/main$(O) \
    $(PDUMP) $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) \
    $(SRC_DIR)/pbc_info$(O) $(PINFO) \
    $(PDB) $(SRC_DIR)/pdb$(O) \
    $(PBCMERGE) $(SRC_DIR)/pbc_merge$(O) \
    $(DIS) $(SRC_DIR)/disassemble$(O) \
    $(SRC_DIR)/null_config$(O) \
    $(SRC_DIR)/parrot_config$(O) \
    $(SRC_DIR)/install_config$(O) \
    $(SRC_DIR)/exec_start$(O) \
    $(SRC_DIR)/nci_test$(O) \
    $(LIBNCI_TEST_SO) \
    install_config.fpmc
	$(PERL) $(BUILD_TOOLS_DIR)/c2str.pl --init
	$(RM_F) \
    $(SRC_DIR)/string_private_cstring.h \
    "$(SRC_DIR)/*.str" "src/pmc/*.str" \
    "src/pmc/*.c" "src/pmc/*.h" "src/pmc/*.dump" \
    vtable.dump "*.def" "*.lib" "*.exp"

archclean: dynoplibs-clean dynpmc-clean dynext-clean
	$(RM_F) \
    $(O_FILES) \
    $(GEN_CONFIGS) \
    $(GEN_MAKEFILES) \
    $(PARROT) \
    $(MINIPARROT) \
    $(INSTALLABLEPARROT) \
    $(INSTALLABLEDIS) \
    $(INSTALLABLEPDUMP) \
    $(INSTALLABLEPINFO) \
    $(INSTALLABLEPBCMERGE) \
    $(INSTALLABLEPDB) \
    $(IMCC_DIR)/main$(O) \
    $(PDUMP) $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) \
    $(SRC_DIR)/pbc_info$(O) $(PINFO) \
    $(PDB) $(SRC_DIR)/pdb$(O) \
    $(PBCMERGE) $(SRC_DIR)/pbc_merge$(O) \
    $(DIS) $(SRC_DIR)/disassemble$(O) \
    $(SRC_DIR)/null_config$(O) \
    $(SRC_DIR)/parrot_config$(O) \
    $(SRC_DIR)/install_config$(O) \
    $(SRC_DIR)/asmfun.s \
    $(SRC_DIR)/jit_emit.h \
    $(SRC_DIR)/jit_cpu.c \
    $(SRC_DIR)/exec_cpu.c \
    $(SRC_DIR)/exec_start$(O) \
    install_config.fpmc \
    $(SRC_DIR)/nci_test$(O) \
    $(LIBNCI_TEST_SO) \
    $(LIBPARROT_STATIC) \
    $(LIBPARROT_SHARED)

dynext-clean :
# shared libs (LOAD_EXT, SHARE_EXT)
# win32 import library (.lib - shared object is deleted by LIBNCI_TEST_SO above)
# win32 program data base - contains debugging info (.pdb)
# win32 incremental link status files (.ilk)
# win32 exported functions and data items (.exp)
# win32 export definition files (.def)
	$(RM_F) \
   "$(DYNEXT_DIR)/*$(LOAD_EXT)" \
    "$(DYNEXT_DIR)/*$(SHARE_EXT)" \
    "$(DYNEXT_DIR)/*.lib" \
    "*.pdb" "$(DYNEXT_DIR)/*.pdb" \
    "*.ilk" "$(DYNEXT_DIR)/*.ilk" \
    "$(DYNEXT_DIR)/*.exp" \
    "*.def"

# Remove files generated by the test suite
# XXX Is there a danger of too long command lines in the $(RM_F) commands, or it there an automatic xargs?
test-clean :
	$(RM_F) \
    "t/compilers/*/*.out" \
    "t/compilers/*/*.pasm" \
    "t/compilers/*/*.pbc" \
    "t/compilers/*/*_pbcexe*" \
    "t/compilers/*/*.pir" \
    "t/compilers/*/*.stabs.s"
	$(RM_F) \
    "t/compilers/*/*/*.out" \
    "t/compilers/*/*/*.pasm" \
    "t/compilers/*/*/*.pbc" \
    "t/compilers/*/*/*_pbcexe*" \
    "t/compilers/*/*/*.pir" \
    "t/compilers/*/*/*.stabs.s"
	$(RM_F) \
    "t/examples/*.pbc" \
    "t/examples/*_pbcexe*" \
    "t/examples/*.past"
	$(RM_F) \
    "t/*/*.o" \
    "t/*/*.out" \
    "t/*/*.pasm" \
    "t/*/*_pbcexe*" \
    "t/*/*.pir" \
    "t/*/*.stabs.s"
	$(RM_F) \
    "t/library/*.pbc" \
    "t/op/*.pbc" \
    "t/pmc/*.pbc" \
    "t/stress/*.pbc" \
    "t/tools/*.pbc"
	$(RM_F) \
    "t/src/*.c"

imcc-clean:
	$(RM_F) \
    $(IMCC_DIR)/core \
    "$(IMCC_DIR)/*.o" \
    $(IMCC_DIR)/imcparser.output

realclean : clean
	$(RM_RF) \
    $(STICKY_FILES) \
    blib

distclean : realclean

# Require .svn to exist first
# Otherwise it'll remove every last file
svnclobber : .svn
	$(PERL) -MFile::Find -e 'find(sub{unlink $$_ if -f and not $$File::Find::name =~ m[/\.svn/] and not -e ".svn/text-base/$$_.svn-base";},".")'

reconfig : clean
	$(PERL) Configure.pl --reconfig

manitest :
	$(PERL) tools/dev/manicheck.pl

###############################################################################
#
# SVN Targets:
#
###############################################################################

update :
	svn -q update

# Is this still working ?
rsync :
	rsync -av cvs.perl.org::parrot-HEAD $(CUR_DIR)

status :
	svn -q status

patch :
	svn diff


lint : $(PARROT)
	rm -f *.ln
	$(LINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" $(LINTFLAGS) src/*.c

splint : $(PARROT)
	$(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS) $(SPLINTOPTS) `echo $(O_FILES) | sed @PQ@s/\.o/\.c/g@PQ@`
	$(SPLINT) $(CC_INC) $(SPLINTFLAGS) $(SPLINTOPTS) $(IMCC_DIR)/main.c

splint2 : $(PARROT)
	$(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS2) $(SPLINTOPTS) `echo $(O_FILES) | sed @PQ@s/\.o/\.c/g@PQ@`
	$(SPLINT) $(CC_INC) $(SPLINTFLAGS2) $(SPLINTOPTS) $(IMCC_DIR)/main.c


###############################################################################
#
# installation
#
###############################################################################

install:
	@echo "WARNING:"
	@echo "  Installing Parrot may interfere with developing Parrot"
	@echo "  on the same machine.  This is a temporary flaw in the"
	@echo "  Parrot build system."
	@echo "  To use the make install target, type: make reallyinstall"
	$(PERL) -e "exit(1)"

reallyinstall: installable
	$(PERL) tools/dev/install_files.pl \
    --buildprefix=$(BUILDPREFIX) \
    --prefix=$(PREFIX) \
    --exec-prefix=$(EXEC_PREFIX) \
    --bindir=$(BIN_DIR) \
    --libdir=$(LIB_DIR) \
    --includedir=$(INCLUDE_DIR) \
    --destdir=$(DESTDIR) \
    --docdir=$(DOC_DIR) \
    MANIFEST MANIFEST.generated

###############################################################################
#
# release targets (probably unix only)
#
###############################################################################

release : MANIFEST MANIFEST.generated
	[ -d parrot-$(VERSION) ] || ln -s $(CUR_DIR) parrot-$(VERSION)
	@$(RM_F) MANIFEST.real
	mv MANIFEST MANIFEST.real
	grep -v DEVELOPING MANIFEST.real > MANIFEST
	perl -lane 'print"parrot-$(VERSION)/$$F[0]"unless!length||/#/' MANIFEST | \
	  tar -zcv -T - -f parrot-$(VERSION).tar.gz
	mv MANIFEST.real MANIFEST
	rm parrot-$(VERSION)

rpms : release
	sudo cp parrot-$(VERSION).tar.gz /usr/src/*/SOURCES
	sudo cp parrot.spec /usr/src/*/SPECS
	cd /usr/src/*/SPECS @make_and@ sudo rpm -ba parrot.spec

win32-inno-installer : world installable
	$(PERL) tools/dev/mk_inno.pl --version=$(VERSION) --prefix=$(PREFIX) --icudir=@icu_dir@
	$(INNO_SETUP) parrot.iss

###############################################################################
#
# miniparrot targets:
#
###############################################################################

#miniparrot-prebuild : $(GEN_CONFIGS) $(FLUID_FILES)
#	@tools/dev/rebuild_miniparrot.pl --action=clean
#	@tools/dev/rebuild_miniparrot.pl --action=prebuild_classes $(CLASS_O_FILES)
#	@tools/dev/rebuild_miniparrot.pl --action=copy_src $(GEN_CONFIGS) $(FLUID_FILES) $(ALL_H_FILES)
#	@tools/dev/rebuild_miniparrot.pl --action=copy_src pmc/*.h $(IMCC_DIR)/main.c $(INC_DIR)/debug.h
#	@tools/dev/rebuild_miniparrot.pl --action=copy_src_from_obj $(O_FILES)
#	@tools/dev/rebuild_miniparrot.pl --action=write_buildscripts --executable=parrot $(O_FILES) $(IMCC_DIR)/main$(O)
#
#miniparrot-update :
#	tools/dev/rebuild_miniparrot.pl

###############################################################################
#
# exec:
#
###############################################################################

exec : $(SRC_DIR)/exec_start$(O) $(SRC_DIR)/parrot_config$(O) $(LIBPARROT)
	$(LINK) @ld_out@$(EXEC)$(EXE) $(EXEC)$(O) $(SRC_DIR)/exec_start$(O) $(SRC_DIR)/parrot_config$(O) @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)

###### OS depend targets ##########

# for use by t/pmc/nci.t
$(LIBNCI_TEST_SO): $(SRC_DIR)/nci_test$(O)
	$(LD) $(LD_LOAD_FLAGS) @ncilib_link_extra@ $(LDFLAGS) \
    @ld_out@$@ $(SRC_DIR)/nci_test$(O) $(C_LIBS)

# vim ctags
# this needs exuberant-ctags

tags: tags.dummy
	$(RM_F) tags
	ctags \
		--links=no --totals \
		-R --exclude=blib --exclude=.svn  \
		--languages=c,perl --langmap=c:+.h,c,l,y:+.pmc \
		$(CUR_DIR)
	$(PERL) $(BUILD_TOOLS_DIR)/addopstags.pl $(OPS_DIR)/*.ops

tags.dummy:

HEADERIZER_O_FILES = \
    $(INTERP_O_FILES) \
    $(CHARSET_O_FILES) \
    $(IO_O_FILES) \
    $(CLASS_O_FILES) \
    $(ENCODING_O_FILES)

headerizer:
	$(PERL) $(BUILD_TOOLS_DIR)/headerize.pl $(HEADERIZER_O_FILES)

###############################################################################
#
# smoke:
#
###############################################################################

smoke : all
	$(PERL) t/harness --html $(EXTRA_TEST_ARGS) $(PARROT_ARGS)
	$(PERL) tools/util/smokeserv-client.pl smoke.html

smokej : all
	$(PERL) t/harness --html $(EXTRA_TEST_ARGS) -j $(PARROT_ARGS)
	$(PERL) tools/util/smokeserv-client.pl smoke.html

smokeexec: all
	$(PERL) t/harness --html $(EXTRA_TEST_ARGS) $(PARROT_ARGS) --run-exec $(RUNCORE_TEST_FILES)
	$(PERL) tools/util/smokeserv-client.pl smoke.html

smoke-clean :
	$(RM_F) smoke.html

#
# Local variables:
# mode: makefile
# End:
#

