summaryrefslogtreecommitdiff
path: root/compiler/ilxGen/tests/Makefile
blob: 423839c9e8b57ef352c3e93d8ab59cff6bffd41c (plain)
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

TOP = ../../..
include $(TOP)/mk/boilerplate.mk

WAYS=$(GhcLibWays)

#-----------------------------------------------------------------------------
# 	Setting the standard variables
#

HC = $(GHC_INPLACE)
SRC_HC_OPTS+=-cpp -fglasgow-exts

#-----------------------------------------------------------------------------
# 
CORENV_DEBUG=
CORENV_RETAIL=
LOCALRUN=./
ifeq ($(HOSTNAME),MSRC-HILDA)
CORENV_DEBUG="call devcorb2gen.bat checked"
CORENV_RETAIL="call devcorb2gen.bat free"
LOCALRUN=.\\
endif    

ghc:
	$(MAKE) -C ../.. 

ilx:
	$(MAKE) -C $(ILX2IL_HOME) ilxdefault

prel: ilx
	$(MAKE) -C ../../../lib/std std.$(ilx_way).dll std.$(ilx_way).vlb

#========================================================================
# 1. From Haskell to ILX and then to IL - see build.mk 

#------------------------------------------------------------------------
# 2. From IL to .EXE

%.$(ilx_way).exe : %.$(ilx_way).il ../Entry.$(ilx_way).il 
	cat $*.$(ilx_way).il ../Entry.$(ilx_way).il > $@.tmp
#	echo "call devcorb2gen free" > tmp.bat
	echo "ilasm /DEBUG /QUIET /OUT=$@ $@.tmp" >> tmp.bat
	cmd /c tmp.bat

../Entry.$(hs2ilx_suffix)_o: ../Entry.ilx
	sed -e "s|ilx std|ilx std.$(hs2ilx_suffix)|g" ../Entry.ilx > $@.tmp
	mv $@.tmp $@


%.$(ilx_way).mvl:  %.$(ilx_way).il
	(ILVALID_HOME=c:\\devel\\fcom\\src\\ ILVALID_MSCORLIB=mscorlib.vlb $(ILVALID) c:\\devel\\fcom\\src\\bin\\msilxlib$(ilx2il_suffix).vlb $(TOP)/lib/std/std.$(ilx_way).vlb $<) 2>&1


#------------------------------------------------------------------------
# From .HS to .EXE without using ILX
# Used to run performance comparisons against native code GHC

%.Onot.exe: %.hs
	$(GHC_INPLACE) -Onot -o $@ $<

%.O.exe: %.hs
	$(GHC_INPLACE) -O -o $@ $<

WIN_TOP_ABS = $(subst /,\,$(FPTOOLS_TOP_ABS))
WIN_ILX2IL_HOME = $(subst /,\,$(ILX2IL_HOME))

app.config:
	echo "<configuration>" > $@
	echo "<runtime>" >> $@
	echo "<assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">" >> $@
	echo "<probing privatePath=\"$(WIN_TOP_ABS)\\ghc\\lib\\std;$(WIN_ILX2IL_HOME)\\bin\"/>" >> $@
	echo "</assemblyBinding>" >> $@
	echo "</runtime>" >> $@
	echo "</configuration>" >> $@

%.run: %.exe app.config
	time -p $<

#------------------------------------------------------------------------
# Running:

HSstd_cbits.dll: $(DLL_PEN)/HSstd_cbits.dll
	cp $< $@

%.cordbg.run: HSstd_cbits.dll %.exe
	cp app.config $@.config
#	echo "call devcorb2gen fastchecked" > $@.bat
	echo "$(LOCALRUN)$(subst /,\\,$*).exe 2>&1" >> $@.bat
	time -p cmd /c $(subst /,\\,$@).bat
	rm $@.bat

%.debug.run: HSstd_cbits.dll %.exe
	cp app.config $@.config
#	echo "call devcorb2gen fastchecked" > $@.bat
	echo "$(LOCALRUN)$(subst /,\\,$*).exe 2>&1" >> $@.bat
	time -p cmd /c $(subst /,\\,$@).bat
	rm $@.bat

%.retail.run: HSstd_cbits.dll %.exe
	cp app.config $@.config
#	echo "call devcorb2gen free" > $@.bat
	echo "$(LOCALRUN)$(subst /,\\,$*).exe 2>&1" >> $@.bat
	time -p cmd /c $(subst /,\\,$@).bat
	rm $@.bat


%.run: %.exe
	time -p $<


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

%.mvl: %.nolib.il
	ILVALID_HOME=$(ILX2IL_HOME) $(ILVALID) $*.nolib.il

ci:
	(cd $(ILX2IL_HOME); $(CVS) ci -m "")
	(cd ../..; cvs ci -m "")
	(cd ../../../lib/std; $(CVS) ci -m "")

upd:
	(cd $(ILX2IL_HOME); $(CVS) up)
	(cd ../..; $(CVS) up)
	(cd ../../../lib/std; $(CVS) up)


.PHONY: %.run

include $(TOP)/mk/target.mk