Permalink
Browse files

Checkpoint new bootstrap attempt

  • Loading branch information...
1 parent 7451754 commit 000cc772ddd7647a30338a8a520031829117291a @sorear committed Oct 29, 2011
Showing with 180 additions and 0 deletions.
  1. +14 −0 Makefile
  2. +166 −0 Newmakefile
View
@@ -51,6 +51,9 @@ boot/obj/CompilerBlob.dll: .fetch-stamp src/CompilerBlob.cs
obj/Run.Kernel.dll: $(patsubst %,lib/%,$(cskernel))
$(CSC) /target:exe /out:obj/Run.Kernel.dll /lib:obj /unsafe+ \
$(patsubst %,lib/%,$(cskernel))
+obj/Kernel.dll: $(patsubst %,lib/%,$(cskernel))
+ $(CSC) /target:exe /out:obj/Kernel.dll /lib:obj /unsafe+ \
+ $(patsubst %,lib/%,$(cskernel))
perl5: obj/Perl5Interpreter.dll obj/p5embed.so
obj/Perl5Interpreter.dll: obj/Kernel.dll lib/Perl5Interpreter.cs
@@ -79,6 +82,17 @@ clean:
@rm -f run/*.dll.so
@rm -fr *~
+# uses the current niecza to set up a build area for the next stage
+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/ Newmakefile next/
+ cp Newmakefile next/Makefile
+ 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)
+
half_reboot: all
# setup a clean build area
rm -rf stage2/ stage3/
View
@@ -0,0 +1,166 @@
+### 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
+
+# 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 Metamodel \
+ OptRxSimple NAMOutput Operator NieczaActions NieczaFrontendSTD \
+ NieczaPassSimplifier OptBeta NieczaPathSearch NieczaBackendDotnet \
+ NieczaCompiler GetOptLong
+
+all: run/Niecza.exe obj/Run.Kernel.dll obj/Run.CORE.dll
+ @git describe --tags > VERSION
+
+$(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 $*
+
+obj/Run.CORE.dll: run/Niecza.exe obj/Run.Kernel.dll lib/CORE.setting
+ $(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
+ $(RUN_CLR) boot/run/Niecza.exe -C CORE
+ $(RUN_CLR) boot/run/Niecza.exe -C JSYNC
+ touch .fetch-stamp
+
+boot/obj/CompilerBlob.dll: .fetch-stamp src/CompilerBlob.cs
+ $(CSC) /target:library /out:boot/obj/CompilerBlob.dll /r:Run.Kernel \
+ /lib:boot/obj src/CompilerBlob.cs
+obj/Run.Kernel.dll: $(patsubst %,lib/%,$(cskernel))
+ $(CSC) /target:exe /out:obj/Run.Kernel.dll /lib:obj /unsafe+ \
+ $(patsubst %,lib/%,$(cskernel))
+
+perl5: obj/Perl5Interpreter.dll obj/p5embed.so
+obj/Perl5Interpreter.dll: obj/Kernel.dll lib/Perl5Interpreter.cs
+ $(CSC) /target:library /lib:obj /out:obj/Perl5Interpreter.dll /r:Kernel.dll lib/Perl5Interpreter.cs
+
+obj/p5embed.so: lib/p5embed.c
+ cc -shared -o obj/p5embed.so lib/p5embed.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
+
+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
+
+p6eval: all
+ $(RUN_CLR) run/Niecza.exe -C CORE Test JSYNC
+
+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
+mknext: run/Niecza.exe obj/Run.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/ Makefile next/
+ cp -a run/ lib/ next/boot/
+
+half_reboot: all
+ # setup a clean build area
+ rm -rf stage2/ stage3/
+ mkdir -p stage2/obj stage2/run stage2/boot stage2/boot/obj \
+ stage3/obj stage3/run stage3/boot stage3/boot/obj
+ touch stage2/FETCH_URL stage3/FETCH_URL stage2/.fetch-stamp \
+ stage3/.fetch-stamp
+ cp -a src/ lib/ Makefile stage2/
+ cp -a src/ lib/ Makefile stage3/
+ # build a current Niecza with current Niecza
+ cp obj/Kernel.dll obj/CLRBackend.exe stage2/boot/obj
+ cp -a lib run stage2/boot
+ cd stage2 && $(RUN_CLR) boot/run/Niecza.exe -C CORE JSYNC
+ cp test.pl stage2/
+ cd stage2 && $(MAKE) test
+
+reboot: half_reboot
+ # verify that the new Niecza can build itself correctly
+ cp stage2/obj/Kernel.dll stage2/obj/CLRBackend.exe stage3/boot/obj
+ cp -a lib stage2/run stage3/boot
+ cd stage3 && $(RUN_CLR) boot/run/Niecza.exe -C CORE JSYNC
+ cp test.pl stage3/
+ cd stage3 && $(MAKE) test
+ # yay, stage2/ looks like a good new bootstrap version
+ # clean up the stuff that should NOT go into the boot
+ cd stage2 && rm -rf lib/*.cs obj/* src boot VERSION FETCH_URL \
+ Makefile test.pl
+ cp obj/Kernel.dll obj/CLRBackend.exe stage2/obj
+ cp -a LICENSE README.pod docs/ stage2/
+ cd stage2 && zip -9r ../NewNieczaBootstrap.zip *
+
+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/NieczaBackendDotnet.ser: boot/obj/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.NAMOutput.ser: boot/obj/Run.JSYNC.ser
+boot/obj/Run.NAMOutput.ser: boot/obj/Run.Metamodel.ser
+boot/obj/Run.NAMOutput.ser: boot/obj/Run.Sig.ser
+boot/obj/Run.NieczaActions.ser: boot/obj/Run.CgOp.ser
+boot/obj/Run.NieczaActions.ser: boot/obj/Run.Op.ser
+boot/obj/Run.NieczaActions.ser: boot/obj/Run.RxOp.ser
+boot/obj/Run.NieczaActions.ser: boot/obj/Run.Sig.ser
+boot/obj/Run.NieczaActions.ser: boot/obj/Run.CClass.ser
+boot/obj/Run.NieczaActions.ser: boot/obj/Run.OpHelpers.ser
+boot/obj/Run.NieczaActions.ser: boot/obj/Run.Operator.ser
+boot/obj/Run.NieczaBackendDotnet.ser: boot/obj/Run.NAMOutput.ser
+boot/obj/Run.NieczaBackendDotnet.ser: boot/obj/Run.JSYNC.ser
+boot/obj/Run.NieczaBackendDotnet.ser: boot/obj/Run.NieczaPassSimplifier.ser
+boot/obj/Run.NieczaBackendDotnet.ser: boot/obj/Run.Metamodel.ser
+boot/obj/Run.NieczaCompiler.ser: boot/obj/Run.JSYNC.ser
+boot/obj/Run.NieczaFrontendSTD.ser: boot/obj/Run.STD.ser
+boot/obj/Run.NieczaFrontendSTD.ser: boot/obj/Run.NieczaGrammar.ser
+boot/obj/Run.NieczaFrontendSTD.ser: boot/obj/Run.NieczaActions.ser
+boot/obj/Run.NieczaGrammar.ser: boot/obj/Run.STD.ser
+boot/obj/Run.Operator.ser: boot/obj/Run.Sig.ser
+boot/obj/Run.Operator.ser: boot/obj/Run.OpHelpers.ser
+boot/obj/Run.Op.ser: boot/obj/Run.CgOp.ser
+boot/obj/Run.OptBeta.ser: boot/obj/Run.CgOp.ser
+boot/obj/Run.OptRxSimple.ser: boot/obj/Run.RxOp.ser
+boot/obj/Run.RxOp.ser: boot/obj/Run.CgOp.ser
+boot/obj/Run.RxOp.ser: boot/obj/Run.CClass.ser
+boot/obj/Run.Sig.ser: boot/obj/Run.CgOp.ser

0 comments on commit 000cc77

Please sign in to comment.