[project @ 2001-06-11 13:31:49 by dsyme]
[ghc-hetmet.git] / ghc / compiler / ilxGen / tests / build.mk
1 # 1. To make standard library:
2 #
3 # e.g. from lib/std directory:
4 #       $(MAKE) way=ilx-Onot-mono std.ilx-Onot.mono.dll std.ilx-Onot.mono.vlb
5 #       $(MAKE) way=ilx-O-mono  std.ilx-O.mono.dll std.ilx-O.mono.vlb
6 #       $(MAKE) way=ilx-Onot-generic std.ilx-Onot.generic.dll
7 #
8 # 2. To make tests:
9 #
10 # e.g. from ilxGen/tests directory:
11 #
12 #  $ make -n way=ilx-Onot-mono test1.ilx-Onot.mono.retail.run 
13 #
14 #  $ make -n way=ilx-Onot-mono test1-nostdlib.ilx-Onot.mono.retail.run HC_OPTS="-fno-implicit-prelude -fglasgow-exts"
15 #
16
17
18 # Add all the ILX ways so dependencies get made correctly.
19 # (n.b. Actually we only need to add "ilx-Onot" and "ilx-O" for the 
20 #       GHC --> ILX dependencies, as these are the portions of the ILX
21 #       ways that are relevant in terms of GHC options,
22 #       but we list some of the others anyway.  Also note that
23 #       there are no dependencies required for the ILX --> IL or
24 #       IL --> CLR phases as these operate on the "standalone"
25 #       ILX and IL files).
26 #
27 GhcLibWays+= ilx-Onot-mono ilx-Onot ilx-O ilx-O-mono
28 GhcWithIlx=YES
29
30 ILXized=YES
31
32 # These are common to all the ILX ways
33 GHC_ILX_OPTS=-filx  -fruntime-types -DILX -DNO_BIG_TUPLES
34
35
36 # Each set of args below defines one ILX way.
37 ALL_WAYS+=ilx-Onot-generic
38 WAY_ilx-Onot-generic_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
39 WAY_ilx-Onot-generic_HC_OPTS=-buildtag ilx-Onot  $(GHC_ILX_OPTS) -Onot 
40 WAY_ilx-Onot-generic_ILX2IL_OPTS=--generic 
41 WAY_ilx-Onot-generic_ILX=YES
42
43 ALL_WAYS+=ilx-Onot-fullgeneric-verifiable
44 WAY_ilx-Onot-fullgeneric-verifiable_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
45 WAY_ilx-Onot-fullgeneric-verifiable_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot 
46 WAY_ilx-Onot-fullgeneric-verifiable_ILX2IL_OPTS=--fullgeneric  --verifiable
47 WAY_ilx-Onot-fullgeneric-verifiable_ILX=YES
48
49 ALL_WAYS+=ilx-Onot-repgeneric-verifiable
50 WAY_ilx-Onot-repgeneric-verifiable_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
51 WAY_ilx-Onot-repgeneric-verifiable_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot 
52 WAY_ilx-Onot-repgeneric-verifiable_ILX2IL_OPTS=--repgeneric  --verifiable
53 WAY_ilx-Onot-repgeneric-verifiable_ILX=YES
54
55 ALL_WAYS+=ilx-O-generic
56 WAY_ilx-O-generic_NAME=ILX with Haskell Optimizer On to run on Generic CLR
57 WAY_ilx-O-generic_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O 
58 WAY_ilx-O-generic_ILX2IL_OPTS=--generic 
59 WAY_ilx-O-generic_ILX=YES
60
61 ALL_WAYS+=ilx-Onot-mono
62 WAY_ilx-Onot-mono_NAME=ILX with Haskell Optimizer Off to run on V1 CLR
63 WAY_ilx-Onot-mono_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot 
64 WAY_ilx-Onot-mono_ILX2IL_OPTS=--mono 
65 WAY_ilx-Onot-mono_ILX=YES
66
67 ALL_WAYS+=ilx-Onot-mono-verifiable
68 WAY_ilx-Onot-mono-verifiable_NAME=ILX with Haskell Optimizer Off to run on V1 CLR, verifiable code (CURRENTLY WILL NOT RUN BECAUSE OF LACK OF HIGHER KINDED TYPE PARAMETERS BUT IS USEFUL TO FIND BUGS USING THE VERIFIER)
69 WAY_ilx-Onot-mono-verifiable_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot 
70 WAY_ilx-Onot-mono-verifiable_ILX2IL_OPTS=--mono  --verifiable
71 WAY_ilx-Onot-mono-verifiable_ILX=YES
72
73 ALL_WAYS+=ilx-O-mono
74 WAY_ilx-O-mono_NAME=ILX with Haskell Optimizer On to run on V1 CLR
75 WAY_ilx-O-mono_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O 
76 WAY_ilx-O-mono_ILX2IL_OPTS=--mono 
77 WAY_ilx-O-mono_ILX=YES
78
79 ALL_WAYS+=ilx-Onot-generic-traced
80 WAY_ilx-Onot-generic-traced_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
81 WAY_ilx-Onot-generic-traced_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot 
82 WAY_ilx-Onot-generic-traced_ILX2IL_OPTS=--generic  --traced
83 WAY_ilx-Onot-generic-traced_ILX=YES
84
85 ALL_WAYS+=ilx-O-generic-traced
86 WAY_ilx-O-generic-traced_NAME=ILX with Haskell Optimizer On to run on Generic CLR
87 WAY_ilx-O-generic-traced_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O 
88 WAY_ilx-O-generic-traced_ILX2IL_OPTS=--generic  --traced
89 WAY_ilx-O-generic-traced_ILX=YES
90
91 ALL_WAYS+=ilx-Onot-mono-traced
92 WAY_ilx-Onot-mono-traced_NAME=ILX with Haskell Optimizer Off to run on V1 CLR
93 WAY_ilx-Onot-mono-traced_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot 
94 WAY_ilx-Onot-mono-traced_ILX2IL_OPTS=--mono  --traced
95 WAY_ilx-Onot-mono-traced_ILX=YES
96
97 ALL_WAYS+=ilx-O-mono-traced
98 WAY_ilx-O-mono-traced_NAME=ILX with Haskell Optimizer On to run on V1 CLR
99 WAY_ilx-O-mono-traced_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O 
100 WAY_ilx-O-mono-traced_ILX2IL_OPTS=--mono  --traced
101 WAY_ilx-O-mono-traced_ILX=YES
102
103 # Put a "." after the Haskell portion of the way.  Way names can't contain
104 # dots for some reason elsewhere in the Make system.  But we need to be able
105 # to split out the Haskell portion of the way from the ILX portion (e.g. --generic)
106 # and the runtime portion (e.g. --retail).
107 ilx_way=$(subst ilx-Onot-,ilx-Onot.,$(subst ilx-O-,ilx-O.,$(way)))
108 ilx2il_suffix=$(subst ilx-Onot.,.,$(subst ilx-O.,.,$(ilx_way)))
109 hs2ilx_suffix=$(subst $(ilx2il_suffix),,$(ilx_way))
110 HS_ILX=$(subst $(way),$(hs2ilx_suffix),$(HS_OBJS))
111 HS_IL=$(subst $(hs2ilx_suffix)_o,$(ilx_way).il,$(HS_ILX))
112 HS_MODS=$(subst $(ilx_way).il,$(ilx_way).dll,$(HS_IL))
113
114 debug: 
115         @echo ilx_way=$(ilx_way)
116         @echo ""
117         @echo HS_OBJS=$(HS_OBJS)
118         @echo ""
119         @echo HS_ILX=$(HS_ILX)
120         @echo ""
121         @echo HS_IL=$(HS_IL)
122         @echo ""
123         @echo HS_MODS=$(HS_MODS)
124         @echo ""
125         @echo ilx2il_suffix=$(ilx2il_suffix)
126         @echo ""
127         @echo hs2ilx_suffix=$(hs2ilx_suffix)
128
129 ILX2IL=//c/devel/fcom/src/bin/ilx2il.exe
130 ILVALID=//c/devel/fcom/src/bin/ilvalid.exe
131 ILVERIFY=//c/devel/fcom/src/bin/ilverify.exe
132
133 # We have new rules because only the Haskell-->ILX contribution to the whole "way"
134 # forms the "way" for the purposes of these rules
135 %.$(hs2ilx_suffix)_o : %.lhs     
136         $(HC_PRE_OPTS)
137         $(HC) $(HC_OPTS) -osuf $(hs2ilx_suffix)_o -hisuf $(hs2ilx_suffix)_hi -c $< -o $*.$(hs2ilx_suffix)_o
138         $(HC_POST_OPTS)
139
140 %.$(hs2ilx_suffix)_o : %.hs      
141         $(HC_PRE_OPTS)
142         $(HC) $(HC_OPTS) -osuf $(hs2ilx_suffix)_o -hisuf $(hs2ilx_suffix)_hi -c $< -o $*.$(hs2ilx_suffix)_o
143         $(HC_POST_OPTS)
144
145 %.$(hs2ilx_suffix)_hi : %.$(hs2ilx_suffix)_o
146         @if [ ! -f $@ ] ; then \
147             echo Panic! $< exists, but $@ does not. \
148             exit 1; \
149         else exit 0 ; \
150         fi                                                      
151
152 .PRECIOUS:  %.$(hs2ilx_suffix)_o %.$(hs2ilx_suffix)_hi %.$(ilx_way).il %.$(ilx_way).dll 
153
154 %.$(ilx_way).il : %.$(hs2ilx_suffix)_o  %.$(hs2ilx_suffix)_hi  $(ILX2IL)
155         $(ILX2IL) --suffix  $(ilx2il_suffix) $(WAY_$(way)_ILX2IL_OPTS) -o $@ $*.$(hs2ilx_suffix)_o
156
157 %.$(ilx_way).dll : %.$(ilx_way).il       
158         echo "call devcorb2gen free" > tmp.bat
159         echo "ilasm /DEBUG /QUIET /DLL /OUT=$@ $<" >> tmp.bat
160         cmd /c tmp.bat
161
162 %.$(ilx_way).mvl : %.$(ilx_way).il $(HS_IL)  
163         ((ILVALID_HOME=c:\\devel\\fcom\\src\\ ILVALID_MSCORLIB=mscorlib.vlb $(ILVALID) c:\\devel\\fcom\\src\\bin\\msilxlib$(ilx2il_suffix).vlb  $(addprefix --other-il-module ,$(filter-out $*.$(ilx_way).il,$(HS_IL))) $<) 2>&1) | tee $@
164
165 %.$(ilx_way).mvr : %.$(ilx_way).il $(HS_IL) 
166         ((ILVALID_HOME=c:\\devel\\fcom\\src\\ ILVALID_MSCORLIB=mscorlib.vlb $(ILVERIFY) c:\\devel\\fcom\\src\\bin\\msilxlib$(ilx2il_suffix).vlb  $(addprefix --other-il-module ,$(filter-out $<,$(HS_IL))) $<) 2>&1) | tee $@
167
168 .PRECIOUS: %.$(ilx_way).il %.$(ilx_way).ilx  %.$(ilx_way).exe  %.$(ilx_way).dll