Permalink
Newer
Older
100644 163 lines (139 sloc) 5.99 KB
1
### CONFIGURATION
2
3
# How to run CLR programs; can be blank for Win32
4
RUN_CLR=mono
6
RM=rm -f
7
CP=cp
8
9
cskernel=Kernel.cs Builtins.cs Cursor.cs JSYNC.cs NieczaCLR.cs Utils.cs \
10
ObjModel.cs BigInteger.cs Printf.cs GeneratedTrigFunctions.cs
11
csbackend=CLRBackend.cs
12
13
# Tell make to regard the following targets as not being filenames
14
.PHONY: all aot test spectest clean realclean
15
.PHONY: help
16
18
srcunits=CClass CgOp Op OpHelpers Sig RxOp STD NieczaGrammar Metamodel \
19
OptRxSimple NAMOutput Operator NieczaActions NieczaFrontendSTD \
20
NieczaPassSimplifier OptBeta NieczaPathSearch NieczaBackendNAM \
21
NieczaBackendDotnet NieczaBackendClisp NieczaBackendHoopl \
22
NieczaCompiler GetOptLong
24
all: run/Niecza.exe obj/Kernel.dll obj/CORE.nam obj/CLRBackend.exe
25
@git describe --tags > VERSION
27
$(patsubst %,boot/obj/%.nam,$(srcunits)): boot/obj/%.nam: .fetch-stamp src/%.pm6 boot/obj/CORE.nam
28
cd src && $(RUN_CLR) ../boot/run/Niecza.exe -Bnam -C $*
29
$(RUN_CLR) boot/obj/CLRBackend.exe boot/obj $*.nam $*.dll 0
30
31
obj/CORE.nam: run/Niecza.exe obj/CLRBackend.exe lib/CORE.setting
32
$(RUN_CLR) run/Niecza.exe -C CORE
33
34
run/Niecza.exe: .fetch-stamp $(patsubst %,boot/obj/%.nam,$(srcunits)) src/niecza
35
cd src && $(RUN_CLR) ../boot/run/Niecza.exe -c -Bnam niecza
36
$(RUN_CLR) boot/obj/CLRBackend.exe boot/obj MAIN.nam MAIN.exe 1
37
$(CP) $(patsubst %,boot/obj/%.dll,Kernel CompilerBlob $(libunits) $(srcunits)) run/
38
$(CP) boot/obj/MAIN.exe run/Niecza.exe
39
40
.fetch-stamp: FETCH_URL
41
-rm -rf boot/
42
mkdir boot
43
wget --no-check-certificate -Oboot/niecza.zip $$(cat FETCH_URL)
44
cd boot && unzip niecza.zip
45
$(RUN_CLR) boot/run/Niecza.exe -C CORE
46
$(RUN_CLR) boot/run/Niecza.exe -C JSYNC
47
touch .fetch-stamp
48
49
boot/obj/CompilerBlob.dll: .fetch-stamp src/CompilerBlob.cs
50
$(CSC) /target:library /out:boot/obj/CompilerBlob.dll /r:Kernel \
Sep 17, 2011
51
/lib:boot/obj src/CompilerBlob.cs
52
obj/Kernel.dll: $(patsubst %,lib/%,$(cskernel))
53
$(CSC) /target:library /out:obj/Kernel.dll /lib:obj /unsafe+ \
54
$(patsubst %,lib/%,$(cskernel))
55
obj/CLRBackend.exe: $(patsubst %,lib/%,$(csbackend)) obj/Kernel.dll
56
$(CSC) /target:exe /lib:obj /out:obj/CLRBackend.exe /r:Kernel.dll \
57
$(patsubst %,lib/%,$(csbackend))
58
59
perl5: obj/Perl5Interpreter.dll obj/p5embed.so
60
obj/Perl5Interpreter.dll: obj/Kernel.dll lib/Perl5Interpreter.cs
61
gmcs /target:library /lib:obj /out:obj/Perl5Interpreter.dll /r:Kernel.dll lib/Perl5Interpreter.cs
63
obj/p5embed.so: lib/p5embed.c
64
cc -shared -Wl,-soname,p5embed.so -o obj/p5embed.so lib/p5embed.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
65
67
mono --aot run/*.dll run/Niecza.exe
68
69
test: all
70
$(RUN_CLR) run/Niecza.exe -c test.pl
71
prove -e "$(RUN_CLR)" obj/MAIN.exe
73
spectest: all
74
@t/run_spectests
75
76
p6eval: all
77
$(RUN_CLR) run/Niecza.exe -C CORE Test JSYNC
80
@rm -f obj/*.dll obj/*.exe obj/*.nam obj/*.so
81
@rm -f run/Niecza.exe
82
@rm -f run/*.dll
83
@rm -f run/*.dll.so
84
@rm -fr *~
85
87
# setup a clean build area
88
rm -rf stage2/ stage3/
89
mkdir -p stage2/obj stage2/run stage2/boot stage2/boot/obj \
90
stage3/obj stage3/run stage3/boot stage3/boot/obj
91
touch stage2/FETCH_URL stage3/FETCH_URL stage2/.fetch-stamp \
92
stage3/.fetch-stamp
93
cp -a src/ lib/ Makefile stage2/
94
cp -a src/ lib/ Makefile stage3/
95
# build a current Niecza with current Niecza
96
cp obj/Kernel.dll obj/CLRBackend.exe stage2/boot/obj
97
cp -a lib run stage2/boot
98
cd stage2 && $(RUN_CLR) boot/run/Niecza.exe -C CORE JSYNC
99
cp test.pl stage2/
100
cd stage2 && $(MAKE) test
101
102
reboot: half_reboot
103
# verify that the new Niecza can build itself correctly
104
cp stage2/obj/Kernel.dll stage2/obj/CLRBackend.exe stage3/boot/obj
105
cp -a lib stage2/run stage3/boot
106
cd stage3 && $(RUN_CLR) boot/run/Niecza.exe -C CORE JSYNC
107
cp test.pl stage3/
108
cd stage3 && $(MAKE) test
109
# yay, stage2/ looks like a good new bootstrap version
110
# clean up the stuff that should NOT go into the boot
111
cd stage2 && rm -rf lib/*.cs obj/* src boot VERSION FETCH_URL \
112
Makefile test.pl
113
cp obj/Kernel.dll obj/CLRBackend.exe stage2/obj
114
cp -a LICENSE README.pod docs/ stage2/
115
cd stage2 && zip -9r ../NewNieczaBootstrap.zip *
116
117
realclean: clean
118
@rm .fetch-stamp
119
120
help:
121
@echo ''
122
@echo 'You can make the following targets in this Niecza Makefile:'
123
@echo ''
124
@echo 'all the main Niecza compiler and runtime files (default)'
125
@echo 'aot Ahead of Time compile run/Niecza.exe and run/*.dll (increases speed)'
126
@echo 'test run/Niecza.exe test.pl'
127
@echo 'spectest t/run_spectests'
128
@echo 'clean remove all generated files'
129
@echo 'realclean clean and also require new download of bootstrap files'
130
@echo 'help this list of targets'
131
@echo ''
132
133
boot/obj/NieczaBackendDotnet.nam: boot/obj/CompilerBlob.dll
134
135
# grep -r '^use' src/*.pm6 | sed 's|src/\(.*\)\.pm6:use \(.*\);|boot/obj/\1.nam: boot/obj/\2.nam|' | grep -v MONKEY_TYPING
136
boot/obj/NAMOutput.nam: boot/obj/JSYNC.nam
137
boot/obj/NAMOutput.nam: boot/obj/Metamodel.nam
138
boot/obj/NAMOutput.nam: boot/obj/Sig.nam
139
boot/obj/NieczaActions.nam: boot/obj/Op.nam
140
boot/obj/NieczaActions.nam: boot/obj/RxOp.nam
141
boot/obj/NieczaActions.nam: boot/obj/Sig.nam
142
boot/obj/NieczaActions.nam: boot/obj/CClass.nam
143
boot/obj/NieczaActions.nam: boot/obj/OpHelpers.nam
144
boot/obj/NieczaActions.nam: boot/obj/Operator.nam
145
boot/obj/NieczaBackendClisp.nam: boot/obj/NieczaBackendNAM.nam
146
boot/obj/NieczaBackendDotnet.nam: boot/obj/NieczaBackendNAM.nam
147
boot/obj/NieczaBackendDotnet.nam: boot/obj/NAMOutput.nam
148
boot/obj/NieczaBackendHoopl.nam: boot/obj/NieczaBackendNAM.nam
149
boot/obj/NieczaBackendNAM.nam: boot/obj/NAMOutput.nam
150
boot/obj/NieczaCompiler.nam: boot/obj/JSYNC.nam
151
boot/obj/NieczaFrontendSTD.nam: boot/obj/STD.nam
152
boot/obj/NieczaFrontendSTD.nam: boot/obj/NieczaGrammar.nam
153
boot/obj/NieczaFrontendSTD.nam: boot/obj/NieczaActions.nam
154
boot/obj/NieczaGrammar.nam: boot/obj/STD.nam
155
boot/obj/Operator.nam: boot/obj/Sig.nam
156
boot/obj/Operator.nam: boot/obj/OpHelpers.nam
157
boot/obj/Op.nam: boot/obj/CgOp.nam
158
boot/obj/OptBeta.nam: boot/obj/CgOp.nam
159
boot/obj/OptRxSimple.nam: boot/obj/RxOp.nam
160
boot/obj/RxOp.nam: boot/obj/CgOp.nam
161
boot/obj/RxOp.nam: boot/obj/CClass.nam
162
boot/obj/Sig.nam: boot/obj/CgOp.nam