/
Makefile
126 lines (103 loc) · 4.57 KB
/
Makefile
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
### CONFIGURATION
# How to run CLR programs; can be blank for Win32
RUN_CLR=mono
CSC=gmcs /debug+
RM=rm -f
CP=cp
cskernel=Kernel.cs Builtins.cs Cursor.cs JSYNC.cs NieczaCLR.cs Utils.cs \
ObjModel.cs BigInteger.cs Printf.cs CodeGen.cs \
GeneratedTrigFunctions.cs Serialize.cs UCD.cs
# Tell make to regard the following targets as not being filenames
.PHONY: all aot test spectest clean realclean
.PHONY: help
libunits=CORE JSYNC
srcunits=CClass CgOp Op OpHelpers Sig RxOp STD NieczaGrammar OptRxSimple \
Operator NieczaActions NieczaFrontendSTD NieczaPassSimplifier \
OptBeta NieczaPathSearch NieczaBackendDotnet NieczaCompiler GetOptLong
all: run/Niecza.exe obj/Run.Kernel.dll obj/Run.CORE.dll
$(patsubst %,boot/obj/Run.%.ser,$(srcunits)): boot/obj/Run.%.ser: .fetch-stamp src/%.pm6 boot/obj/Run.CORE.ser
cd src && NIECZA_KEEP_IL=1 $(RUN_CLR) ../boot/run/Niecza.exe -C $*
# hack - put VERSION info in place so the setting build can embed it
obj/Run.CORE.dll: run/Niecza.exe obj/Run.Kernel.dll lib/CORE.setting
@git describe --tags > VERSION
$(RUN_CLR) run/Niecza.exe -C CORE
run/Niecza.exe: .fetch-stamp $(patsubst %,boot/obj/Run.%.ser,$(srcunits)) src/niecza
cd src && NIECZA_KEEP_IL=1 $(RUN_CLR) ../boot/run/Niecza.exe -c niecza
$(CP) boot/obj/Kernel.dll run/
$(CSC) /target:library /out:run/CompilerBlob.dll /r:Kernel \
/lib:run src/CompilerBlob.cs
$(RUN_CLR) run/Kernel.dll -gen-app Niecza boot/obj
.fetch-stamp: FETCH_URL
-rm -rf boot/
mkdir boot
wget --no-check-certificate -Oboot/niecza.zip $$(cat FETCH_URL)
cd boot && unzip niecza.zip
NIECZA_KEEP_IL=1 $(RUN_CLR) boot/run/Niecza.exe -C $(libunits)
$(CP) boot/run/Kernel.dll boot/obj/
touch .fetch-stamp
boot/obj/Run.CompilerBlob.dll: .fetch-stamp src/CompilerBlob.cs
$(CSC) /target:library /out:boot/obj/Run.CompilerBlob.dll /r:Run.Kernel \
/lib:boot/obj src/CompilerBlob.cs
obj/Run.Kernel.dll: $(patsubst %,lib/%,$(cskernel)) lib/unidata
$(CSC) /target:exe /out:obj/Run.Kernel.dll /lib:obj /unsafe+ \
/res:lib/unidata $(patsubst %,lib/%,$(cskernel))
obj/Kernel.dll: $(patsubst %,lib/%,$(cskernel)) lib/unidata
$(CSC) /target:exe /out:obj/Kernel.dll /lib:obj /unsafe+ \
/res:lib/unidata $(patsubst %,lib/%,$(cskernel))
perl5: obj/Perl5Interpreter.dll obj/p5embed.so
obj/Perl5Interpreter.dll: obj/Run.Kernel.dll lib/Perl5Interpreter.cs
$(CSC) /target:library /lib:obj /out:obj/Perl5Interpreter.dll /r:Run.Kernel.dll lib/Perl5Interpreter.cs
obj/p5embed.so: lib/p5embed.c
perl perl5/build_interop
aot: all
mono --aot run/*.dll obj/Run.CORE.dll run/Niecza.exe
test: all
$(RUN_CLR) run/Niecza.exe -c test.pl
prove -e "$(RUN_CLR)" obj/Run.MAIN.exe
spectest: all
@t/run_spectests
clean:
@rm -f obj/*.dll obj/*.exe obj/*.nam obj/*.so
@rm -f run/Niecza.exe
@rm -f run/*.dll
@rm -f run/*.dll.so
@rm -fr *~
# uses the current niecza to set up a build area for the next stage
mkpackage:
rm -rf package/
mkdir package/ package/run/ package/lib/ package/obj/
cp -a docs/ README.pod LICENSE package/
cp -a run/Niecza.exe run/Niecza.ser run/Kernel.dll \
run/CompilerBlob.dll package/run/
cp lib/*.pm6 lib/*.setting package/lib/
cp obj/Run.Kernel.dll package/obj/
mknext: run/Niecza.exe obj/Run.Kernel.dll obj/Kernel.dll
rm -rf next/
mkdir -p next next/boot next/obj next/run next/boot next/boot/obj/
touch next/FETCH_URL next/.fetch-stamp
cp -a src/ lib/ docs/ README.pod LICENSE Makefile test.pl next/
cp -a run/ lib/ next/boot/
cp obj/Run.Kernel.dll obj/Kernel.dll next/boot/obj/
NIECZA_KEEP_IL=1 $(RUN_CLR) next/boot/run/Niecza.exe -C $(libunits)
realclean: clean
@rm .fetch-stamp
help:
@echo ''
@echo 'You can make the following targets in this Niecza Makefile:'
@echo ''
@echo 'all the main Niecza compiler and runtime files (default)'
@echo 'aot Ahead of Time compile run/Niecza.exe and run/*.dll (increases speed)'
@echo 'test run/Niecza.exe test.pl'
@echo 'spectest t/run_spectests'
@echo 'clean remove all generated files'
@echo 'realclean clean and also require new download of bootstrap files'
@echo 'help this list of targets'
@echo ''
boot/obj/Run.NieczaBackendDotnet.ser: boot/obj/Run.CompilerBlob.dll
# grep -r '^use' src/*.pm6 | sed 's|src/\(.*\)\.pm6:use \(.*\);|boot/obj/Run.\1.ser: boot/obj/Run.\2.ser|' | grep -v MONKEY_TYPING
boot/obj/Run.NieczaActions.ser: boot/obj/Run.OpHelpers.ser
boot/obj/Run.NieczaFrontendSTD.ser: boot/obj/Run.STD.ser
boot/obj/Run.NieczaFrontendSTD.ser: boot/obj/Run.NieczaGrammar.ser
boot/obj/Run.NieczaGrammar.ser: boot/obj/Run.STD.ser
boot/obj/Run.Operator.ser: boot/obj/Run.OpHelpers.ser
boot/obj/Run.OptRxSimple.ser: boot/obj/Run.RxOp.ser