Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 165 lines (120 sloc) 4.588 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
# Makefile for Winxed

#-----------------------------------------------------------------------
# Modify this section to meet your operating system conventions and
# compiler used.

CXX = g++
CFLAGS = -g -Wall
OBJEXT = .o
EXEEXT =

#-----------------------------------------------------------------------

DRIVER = winxedrun

#-----------------------------------------------------------------------

default: stage0 driver winxedst1.pbc winxedst2.pbc

all: default

pbc: $(DRIVER).pbc

help:
@echo "Targets:"
@echo " default - Build the stage 0, the driver and stage 1 and 2 .pbc"
@echo " stage0 - Build the stage 0 compiler"
@echo " stage1 - Build the driver and the stage 1 native executable"
@echo " stage2 - Build the driver and the stage 2 native executable"
@echo " all - Build all"
@echo " driver - Build the compiler driver - native executable"
@echo " pbc - Build the compiler driver - parrot binary"
@echo " test - Run the stage 0 tests"
@echo " testv - Run the stage 0 tests with -v option"
@echo " test1 - Run the stage 1 tests"
@echo " test2 - Run the stage 2 tests"
@echo " help - This message"

#-----------------------------------------------------------------------

#-------------------------------
# Compiler stage 0
#-------------------------------

stage0: winxedst0$(EXEEXT)

winxedst0$(EXEEXT): winxedst0$(OBJEXT) token$(OBJEXT) errors$(OBJEXT) emit$(OBJEXT)
$(CXX) -o winxedst0 winxedst0$(OBJEXT) token$(OBJEXT) errors$(OBJEXT) emit$(OBJEXT)

winxedst0$(OBJEXT): winxedst0.cpp emit.h token.h errors.h
$(CXX) $(CFLAGS) -c winxedst0.cpp

token$(OBJEXT): token.cpp token.h errors.h
$(CXX) $(CFLAGS) -c token.cpp

errors$(OBJEXT): errors.cpp errors.h token.h
$(CXX) $(CFLAGS) -c errors.cpp

emit$(OBJEXT): emit.cpp emit.h token.h
$(CXX) $(CFLAGS) -c emit.cpp

#-------------------------------
# Compiler stage 1
#-------------------------------

winxedst1.pbc: winxedst1.pir
parrot -o winxedst1.pbc winxedst1.pir

winxedst1.pir: winxedst0$(EXEEXT) winxedst1.winxed
./winxedst0 -o winxedst1.pir winxedst1.winxed

#-------------------------------
# Compiler stage 2
#-------------------------------

winxedst2.pbc: winxedst2.pir
parrot -o winxedst2.pbc winxedst2.pir

winxedst2.pir: winxedst1.winxed winxedst1.pbc $(DRIVER).pbc
parrot $(DRIVER).pbc --stage=1 -c -o winxedst2.pir winxedst1.winxed

#-------------------------------
# Driver
#-------------------------------

driver: winxed$(EXEEXT)

winxed$(EXEEXT): $(DRIVER).pbc
pbc_to_exe --output=winxed$(EXEEXT) $(DRIVER).pbc

$(DRIVER).pbc: $(DRIVER).pir
parrot -o $(DRIVER).pbc $(DRIVER).pir

$(DRIVER).pir: winxed.winxed winxedst0$(EXEEXT)
./winxedst0$(EXEEXT) -o $(DRIVER).pir winxed.winxed

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Install
# Testing, handle with care
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# Preinstall: generate pir files

preinstall: \
    setup.pir \
    pir/winxed_compiler.pir \
    pir/winxed_installed.pir

# Installed compiler is stage 1 built with stage 2
pir/winxed_compiler.pir: winxedst2.pbc $(DRIVER).pbc
parrot $(DRIVER).pbc -c -o pir/winxed_compiler.pir winxedst1.winxed

# Installed driver
pir/winxed_installed.pir: winxed_installed.winxed winxedst2.pbc $(DRIVER).pbc
parrot $(DRIVER).pbc -c -o pir/winxed_installed.pir winxed_installed.winxed

# setup.pir for use from plumage
setup.pir: setup.winxed winxedst2.pbc $(DRIVER).pbc
parrot $(DRIVER).pbc -c -o setup.pir setup.winxed

# Install

install: preinstall
parrot setup.pir
parrot setup.pir install

#-----------------------------------------------------------------------

# Useful for some tests
%.pir: %.winxed winxed
./winxedst0$(EXEEXT) $<


test: $(DRIVER).pbc
parrot $(DRIVER).pbc --stage=0 t/harness --stage=0 -r t/basic t/*.t

testv: $(DRIVER).pbc
parrot $(DRIVER).pbc t/harness -rv t/basic t/*.t

test1: $(DRIVER).pbc winxedst1.pbc
parrot $(DRIVER).pbc --stage=1 t/harness --stage=1 -r t/basic t/advanced t/*.t

test2: $(DRIVER).pbc winxedst2.pbc
parrot $(DRIVER).pbc --stage=2 t/harness --stage=2 -r t/basic t/advanced t/*.t

clean:
rm -f winxedst2$(EXEEXT)
rm -f winxedst2$(OBJEXT)
rm -f winxedst2.c
rm -f winxedst1$(EXEEXT)
rm -f winxedst1$(OBJEXT)
rm -f winxedst1.c
rm -f winxedst0$(EXEEXT)
rm -f winxedst2.pbc
rm -f winxedst1.pbc
rm -f winxedst2.pir
rm -f winxedst1.pir
rm -f winxed$(EXEEXT)
rm -f winxed$(OBJEXT)
rm -f winxed.c
rm -f $(DRIVER).pbc
rm -f $(DRIVER).pir
rm -f *$(OBJEXT)

# Makefile end
Something went wrong with that request. Please try again.