# $Id: /mirror/trunk/config/gen/makefiles/pirc.in 35450 2009-01-11T16:06:27.204688Z fperrad  $

.SUFFIXES : .c @o@

# Setup some commands
PERL          = @perl@
RM_F          = @rm_f@
PARROT        = ../../parrot@exe@
TOOL_DIR      = ../..
CC            = @cc@
CP            = @cp@
BUILD         = $(PERL) @build_dir@/tools/build/dynpmc.pl
O             = @o@
EXE           = @exe@
BUILD_DIR     = @build_dir@
RECONFIGURE   = $(PERL) @build_dir@/tools/dev/reconfigure.pl

LIBPARROT     = @libparrot@

CC_INC        = -I../../include
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@

SOURCES       = \
  src/main.c \
  src/pirparser.c \
  src/pirlexer.c \
  src/pircompunit.c \
  src/pircompiler.c \
  src/pirsymbol.c \
  src/piremit.c \
  src/hdocprep.c \
  src/pirmacro.c \
  src/pirregalloc.c \
  src/bcgen.c \
  src/pirerr.c \
  src/pircapi.c \
  src/pirop.c

OBJS          = \
  src/main$(O) \
  src/pirparser$(O) \
  src/pirlexer$(O) \
  src/pircompunit$(O) \
  src/pircompiler$(O) \
  src/pirsymbol$(O) \
  src/piremit$(O) \
  src/hdocprep$(O) \
  src/pirmacro$(O) \
  src/pirregalloc$(O) \
  src/bcgen$(O) \
  src/pirpcc$(O) \
  src/pirerr$(O) \
  src/pircapi$(O) \
  src/pirop$(O)

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


# the default target
all: pirc$(EXE)


pirc$(EXE): $(OBJS)
	$(LINK) @ld_out@$@ \
	    $(OBJS) \
	    @rpath_blib@ @libparrot_ldflags@ $(C_LIBS) $(LINKFLAGS) $(LINK_DYNAMIC)

src/pirparser$(O): src/pirparser.c src/pirparser.h
src/pirlexer$(O): src/pirlexer.c src/pirlexer.h
src/pircompunit$(O): src/pircompunit.c src/pircompunit.h
src/pircompiler$(O): src/pircompiler.c src/pircompiler.h
src/pirsymbol$(O): src/pirsymbol.c src/pirsymbol.h
src/piremit$(O): src/piremit.c src/piremit.h
src/hdocprep$(O): src/hdocprep.c src/hdocprep.l
src/pirmacro$(O): src/pirmacro.c src/pirmacro.h
src/pirregalloc$(O): src/pirregalloc.c src/pirregalloc.h
src/bcgen$(O): src/bcgen.c src/bcgen.h
src/pirpcc$(O): src/pirpcc.c src/pirpcc.h
src/pirerr$(O): src/pirerr.c src/pirerr.h
src/pircapi$(O): src/pircapi.c src/pircapi.h
src/pirop$(O): src/pirop.c src/pirop.h

test: all
	podchecker $(SOURCES) README.pod
	perl t/harness

# regenerate the Makefile
Makefile: $(BUILD_DIR)/config/gen/makefiles/pirc.in
	cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::makefiles --target=compilers/pirc/Makefile


clean:
	$(RM_F) *$(O)
	$(RM_F) $(OBJS)
	$(RM_F) pirc$(EXE)

realclean: clean
	$(RM_F) \
	    Makefile \
	    doc/*.html

distclean: realclean
