Permalink
Newer
Older
100644 135 lines (110 sloc) 4.84 KB
1
### CONFIGURATION
2
3
# How to run CLR programs; can be blank for Win32
4
RUN_CLR=mono
5
CSC=gmcs /debug+
6
RM=rm -f
7
CP=cp
8
WGET_O=wget --no-check-certificate -O
9
#WGET_O=curl -L -o
11
cskernel=Kernel.cs Builtins.cs Cursor.cs JSYNC.cs NieczaCLR.cs Utils.cs \
12
ObjModel.cs BigInteger.cs Printf.cs CodeGen.cs \
13
GeneratedTrigFunctions.cs Serialize.cs UCD.cs
15
# Tell make to regard the following targets as not being filenames
16
.PHONY: all aot test spectest clean realclean
17
.PHONY: help
18
20
srcunits=CClass CgOp Op OpHelpers Sig RxOp STD NieczaGrammar OptRxSimple \
21
Operator NieczaActions NieczaFrontendSTD NieczaPassSimplifier \
22
OptBeta NieczaPathSearch NieczaBackendDotnet NieczaCompiler GetOptLong
24
all: run/Niecza.exe run/Run.Kernel.dll obj/Run.CORE.dll
26
$(patsubst %,boot/obj/Run.%.ser,$(srcunits)): boot/obj/Run.%.ser: .fetch-stamp src/%.pm6 boot/obj/Run.CORE.ser
27
cd src && NIECZA_KEEP_IL=1 $(RUN_CLR) ../boot/run/Niecza.exe --obj-dir ../boot/obj -C $*
29
# hack - put VERSION info in place so the setting build can embed it
30
obj/Run.CORE.dll: run/Niecza.exe obj/Run.Kernel.dll lib/CORE.setting
31
@git describe --tags > VERSION
32
$(RUN_CLR) run/Niecza.exe --obj-dir obj -C CORE
34
run/Niecza.exe: .fetch-stamp $(patsubst %,boot/obj/Run.%.ser,$(srcunits)) src/niecza
35
cd src && NIECZA_KEEP_IL=1 $(RUN_CLR) ../boot/run/Niecza.exe --obj-dir ../boot/obj -c niecza
36
$(CP) boot/obj/Kernel.dll run/
37
$(CSC) /target:library /out:run/CompilerBlob.dll /r:Kernel \
38
/lib:run src/CompilerBlob.cs
39
$(RUN_CLR) run/Kernel.dll -gen-app Niecza boot/obj
40
41
.fetch-stamp: FETCH_URL
42
-rm -rf boot/
43
mkdir boot
44
$(WGET_O) boot/niecza.zip $$(cat FETCH_URL)
45
cd boot && unzip niecza.zip
46
NIECZA_KEEP_IL=1 $(RUN_CLR) boot/run/Niecza.exe --obj-dir=boot/obj -C $(libunits)
47
$(CP) boot/run/Kernel.dll boot/obj/
48
touch .fetch-stamp
49
boot/obj/Run.CORE.ser: .fetch-stamp
51
boot/obj/Run.CompilerBlob.dll: .fetch-stamp src/CompilerBlob.cs
52
$(CSC) /target:library /out:boot/obj/Run.CompilerBlob.dll /r:Run.Kernel \
Sep 17, 2011
53
/lib:boot/obj src/CompilerBlob.cs
54
run/Run.Kernel.dll: $(patsubst %,lib/%,$(cskernel)) lib/unidata
55
$(CSC) /target:exe /out:run/Run.Kernel.dll /lib:obj /unsafe+ \
56
/res:lib/unidata $(patsubst %,lib/%,$(cskernel))
57
obj/Kernel.dll: $(patsubst %,lib/%,$(cskernel)) lib/unidata
58
$(CSC) /target:exe /out:obj/Kernel.dll /lib:obj /unsafe+ \
59
/res:lib/unidata $(patsubst %,lib/%,$(cskernel))
60
obj/Run.Kernel.dll: run/Run.Kernel.dll
61
$(CP) $< $@
62
63
.PHONY: Niecza_pm
64
perl5: obj/Perl5Interpreter.dll obj/p5embed.so Niecza_pm
65
Niecza_pm:
66
cd perl5/Niecza;perl Build.PL;perl Build
67
68
obj/Perl5Interpreter.dll: obj/Run.Kernel.dll lib/Perl5Interpreter.cs
69
$(CSC) /target:library /lib:obj /out:obj/Perl5Interpreter.dll /r:Run.Kernel.dll lib/Perl5Interpreter.cs
76
mono --aot run/*.dll obj/Run.CORE.dll run/Niecza.exe
78
test: all
79
$(RUN_CLR) run/Niecza.exe --obj-dir obj -c test.pl
80
prove -e "$(RUN_CLR)" obj/Run.MAIN.exe
82
spectest: all
83
@t/run_spectests
84
85
clean:
86
@rm -f obj/*.dll obj/*.exe obj/*.nam obj/*.so
87
@rm -f run/Niecza.exe
88
@rm -f run/*.dll
89
@rm -f run/*.dll.so
90
@rm -fr *~
91
92
# uses the current niecza to set up a build area for the next stage
93
mkpackage:
94
rm -rf package/
95
mkdir package/ package/run/ package/lib/
96
cp -a docs README.pod LICENSE package/
97
cp -a run/Niecza.exe run/Niecza.ser run/Kernel.dll \
98
run/CompilerBlob.dll run/Run.Kernel.dll package/run/
99
cp lib/*.pm6 lib/*.setting package/lib/
100
101
mknext: run/Niecza.exe obj/Run.Kernel.dll obj/Kernel.dll
102
rm -rf next/
103
mkdir -p next next/boot next/obj next/run next/boot next/boot/obj/
104
touch next/FETCH_URL next/.fetch-stamp
105
cp -a src lib docs README.pod LICENSE Makefile test.pl next/
106
cp -a run lib next/boot/
107
cp obj/Run.Kernel.dll obj/Kernel.dll next/boot/obj/
108
NIECZA_KEEP_IL=1 $(RUN_CLR) next/boot/run/Niecza.exe --obj-dir next/boot/obj -C $(libunits)
110
realclean: clean
111
@rm .fetch-stamp
112
113
help:
114
@echo ''
115
@echo 'You can make the following targets in this Niecza Makefile:'
116
@echo ''
117
@echo 'all the main Niecza compiler and runtime files (default)'
118
@echo 'aot Ahead of Time compile run/Niecza.exe and run/*.dll (increases speed)'
119
@echo 'test run/Niecza.exe test.pl'
120
@echo 'spectest t/run_spectests'
121
@echo 'clean remove all generated files'
122
@echo 'realclean clean and also require new download of bootstrap files'
123
@echo 'help this list of targets'
124
@echo ''
125
126
boot/obj/Run.NieczaBackendDotnet.ser: boot/obj/Run.CompilerBlob.dll
127
128
# grep -r '^use' src/*.pm6 | sed 's|src/\(.*\)\.pm6:use \(.*\);|boot/obj/Run.\1.ser: boot/obj/Run.\2.ser|' | grep -v MONKEY_TYPING
129
boot/obj/Run.NieczaActions.ser: boot/obj/Run.OpHelpers.ser
130
boot/obj/Run.NieczaFrontendSTD.ser: boot/obj/Run.STD.ser
131
boot/obj/Run.NieczaFrontendSTD.ser: boot/obj/Run.NieczaGrammar.ser
132
boot/obj/Run.NieczaGrammar.ser: boot/obj/Run.STD.ser
133
boot/obj/Run.Operator.ser: boot/obj/Run.OpHelpers.ser
134
boot/obj/Run.OptRxSimple.ser: boot/obj/Run.RxOp.ser