aboutsummaryrefslogtreecommitdiffhomepage
path: root/build_win.bat
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2020-01-28 23:38:52 -0600
committerCalvin Rose <calsrose@gmail.com>2020-01-28 23:38:52 -0600
commit333ae7c4f87baa0086027c164b85945f30f333ee (patch)
tree4d47aa6d27b15979b2802ae30bea04656bc96b9e /build_win.bat
parentAddress #276 (diff)
Make amalgamtion the default when building.
This way we can support fewer build configurations. Also, remove all undefined behavior due to use of memcpy with NULL pointers. GCC was exploiting this to remove NULL checks in some builds.
Diffstat (limited to 'build_win.bat')
-rw-r--r--build_win.bat53
1 files changed, 8 insertions, 45 deletions
diff --git a/build_win.bat b/build_win.bat
index aca1dbbe..e783064e 100644
--- a/build_win.bat
+++ b/build_win.bat
@@ -33,20 +33,6 @@ mkdir build\core
mkdir build\mainclient
mkdir build\boot
-@rem Build the xxd tool for generating sources
-cl /nologo /c tools/xxd.c /Fobuild\xxd.obj
-@if errorlevel 1 goto :BUILDFAIL
-link /nologo /out:build\xxd.exe build\xxd.obj
-@if errorlevel 1 goto :BUILDFAIL
-
-@rem Generate the embedded sources
-build\xxd.exe src\boot\boot.janet build\boot.gen.c janet_gen_boot
-@if errorlevel 1 goto :BUILDFAIL
-
-@rem Build the generated sources
-%JANET_COMPILE% /Fobuild\boot\boot.gen.obj build\boot.gen.c
-@if errorlevel 1 goto :BUILDFAIL
-
@rem Build the bootstrap interpreter
for %%f in (src\core\*.c) do (
%JANET_COMPILE% /DJANET_BOOTSTRAP /Fobuild\boot\%%~nf.obj %%f
@@ -58,48 +44,25 @@ for %%f in (src\boot\*.c) do (
)
%JANET_LINK% /out:build\janet_boot.exe build\boot\*.obj
@if errorlevel 1 goto :BUILDFAIL
-build\janet_boot build\core_image.c
-
-@rem Build the core image
-%JANET_COMPILE% /Fobuild\core_image.obj build\core_image.c
-@if errorlevel 1 goto :BUILDFAIL
+build\janet_boot . > build\janet.c
@rem Build the sources
-for %%f in (src\core\*.c) do (
- %JANET_COMPILE% /Fobuild\core\%%~nf.obj %%f
- @if errorlevel 1 goto :BUILDFAIL
-)
+%JANET_COMPILE% /Fobuild\janet.obj build\janet.c
+@if errorlevel 1 goto :BUILDFAIL
+%JANET_COMPILE% /Fobuild\shell.obj src\mainclient\shell.c
+@if errorlevel 1 goto :BUILDFAIL
@rem Build the resources
rc /nologo /fobuild\janet_win.res janet_win.rc
-@rem Build the main client
-for %%f in (src\mainclient\*.c) do (
- %JANET_COMPILE% /Fobuild\mainclient\%%~nf.obj %%f
- @if errorlevel 1 goto :BUILDFAIL
-)
-
@rem Link everything to main client
-%JANET_LINK% /out:janet.exe build\core\*.obj build\mainclient\*.obj build\core_image.obj build\janet_win.res
+%JANET_LINK% /out:janet.exe build\janet.obj build\shell.obj build\janet_win.res
@if errorlevel 1 goto :BUILDFAIL
@rem Build static library (libjanet.a)
-%JANET_LINK_STATIC% /out:build\libjanet.lib build\core\*.obj build\core_image.obj
+%JANET_LINK_STATIC% /out:build\libjanet.lib build\janet.obj
@if errorlevel 1 goto :BUILDFAIL
-@rem Gen amlag
-setlocal enabledelayedexpansion
-set "amalg_files="
-for %%f in (src\core\*.c) do (
- set "amalg_files=!amalg_files! %%f"
-)
-janet.exe tools\amalg.janet src\core\features.h src\core\util.h src\core\state.h src\core\gc.h src\core\vector.h src\core\fiber.h src\core\regalloc.h src\core\compile.h src\core\emit.h src\core\symcache.h %amalg_files% build\core_image.c > build\janet.c
-janet.exe tools\removecr.janet build\janet.c
-
-@rem Gen shell.c
-janet.exe tools\amalg.janet src\mainclient\line.h src\mainclient\line.c src\mainclient\main.c > build\shell.c
-janet.exe tools\removecr.janet build\shell.c
-
echo === Successfully built janet.exe for Windows ===
echo === Run 'build_win test' to run tests. ==
echo === Run 'build_win clean' to delete build artifacts. ===
@@ -141,7 +104,7 @@ janet.exe tools\gendoc.janet > dist\doc.html
janet.exe tools\removecr.janet dist\doc.html
copy build\janet.c dist\janet.c
-copy build\shell.c dist\shell.c
+copy src\mainclient\shell.c dist\shell.c
copy janet.exe dist\janet.exe
copy LICENSE dist\LICENSE
copy README.md dist\README.md