summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xcompile5
-rw-r--r--compile.bat29
2 files changed, 18 insertions, 16 deletions
diff --git a/compile b/compile
index ce45ced..e5852d2 100755
--- a/compile
+++ b/compile
@@ -18,7 +18,8 @@ mkdir -p .build/include
: "${HOSTCC:=clang}"
warnings="-Wall -pedantic -Wno-parentheses -Wno-missing-braces \
--Wno-gnu-zero-variadic-macro-arguments"
+-Wno-gnu-zero-variadic-macro-arguments -Werror=implicit-function-declaration \
+-Werror=vla"
dbg=0
if [ "$dbg" = 1 ]; then
@@ -38,7 +39,7 @@ cc() {
if [ "$_mn" = " -DMODULE_NAME=con_" ]; then _mn=" -DMODULE_NAME=con"
elif [ "$_mn" = "-DMODULE_NAME=sst" ]; then _mn=; fi
# note: using typeof and bool from C23 - see detailed comment in compile.bat
- $CC -m32 -c -flto -fpic -fno-ident $cflags $warnings -I.build/include \
+ $CC -c -flto -fpic -fno-ident $cflags $warnings -I.build/include \
-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64$_mn \
-Dtypeof=__typeof -include stdbool.h -o ".build/${_bn%%.c}.o" "src/$1"
}
diff --git a/compile.bat b/compile.bat
index d8cb46c..98fedbd 100644
--- a/compile.bat
+++ b/compile.bat
@@ -10,11 +10,12 @@ if not exist .build\ (
)
if not exist .build\include\ md .build\include
-if "%CC%"=="" set CC=clang --target=i686-pc-windows-msvc -fuse-ld=lld
-if "%HOSTCC%"=="" set HOSTCC=clang -fuse-ld=lld
+if "%CC%"=="" set CC=clang --target=i686-pc-windows-msvc
+if "%HOSTCC%"=="" set HOSTCC=clang
set warnings=-Wall -pedantic -Wno-parentheses -Wno-missing-braces ^
--Wno-gnu-zero-variadic-macro-arguments
+-Wno-gnu-zero-variadic-macro-arguments -Werror=implicit-function-declaration ^
+-Werror=vla
set dbg=0
:: XXX: -Og would be nice but apparently a bunch of stuff still gets inlined
@@ -42,7 +43,7 @@ set objs=%objs% .build/%basename%.o
:: year to get anything done. typeof=__typeof prevents pedantic warnings caused
:: by typeof still technically being an extension, and stdbool gives us
:: predefined bool/true/false before compilers start doing that by default
-%CC% -m32 -c -flto -mno-stack-arg-probe %cflags% %warnings% -I.build/include ^
+%CC% -c -flto -mno-stack-arg-probe %cflags% %warnings% -I.build/include ^
-D_CRT_SECURE_NO_WARNINGS -D_DLL -DWIN32_LEAN_AND_MEAN -DNOMINMAX%dmodname% ^
-Dtypeof=__typeof -include stdbool.h -o .build/%basename%.o %1 || exit /b
goto :eof
@@ -92,18 +93,18 @@ if "%dbg%"=="1" set src=%src% src/dbg.c
if "%dbg%"=="1" set src=%src% src/udis86.c
if "%dbg%"=="0" set src=%src% src/wincrt.c
-%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h -ladvapi32 ^
+%HOSTCC% -fuse-ld=lld -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h -ladvapi32 ^
-o .build/codegen.exe src/build/codegen.c src/build/cmeta.c || exit /b
-%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h ^
+%HOSTCC% -fuse-ld=lld -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h ^
-o .build/mkgamedata.exe src/build/mkgamedata.c src/kv.c || exit /b
-%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h -ladvapi32 ^
+%HOSTCC% -fuse-ld=lld -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h -ladvapi32 ^
-o .build/mkentprops.exe src/build/mkentprops.c src/kv.c || exit /b
.build\codegen.exe%src% || exit /b
.build\mkgamedata.exe gamedata/engine.kv gamedata/gamelib.kv gamedata/inputsystem.kv gamedata/matchmaking.kv || exit /b
.build\mkentprops.exe gamedata/entprops.kv || exit /b
llvm-rc /FO .build\dll.res src\dll.rc || exit /b
-%CC% -shared -O0 -w -o .build/tier0.dll src/stubs/tier0.c
-%CC% -shared -O0 -w -o .build/vstdlib.dll src/stubs/vstdlib.c
+%CC% -fuse-ld=lld -shared -O0 -w -o .build/tier0.dll src/stubs/tier0.c
+%CC% -fuse-ld=lld -shared -O0 -w -o .build/vstdlib.dll src/stubs/vstdlib.c
for %%b in (%src%) do ( call :cc %%b || exit /b )
:: we need different library names for debugging because Microsoft...
:: actually, it's different anyway because we don't use vcruntime for releases
@@ -113,20 +114,20 @@ if "%dbg%"=="1" (
) else (
set clibs=-lucrt
)
-%CC% -shared -flto %ldflags% -Wl,/IMPLIB:.build/sst.lib,/Brepro,/nodefaultlib ^
+%CC% -fuse-ld=lld -shared -flto %ldflags% -Wl,/IMPLIB:.build/sst.lib,/Brepro,/nodefaultlib ^
-L.build %clibs% -lkernel32 -luser32 -ladvapi32 -lshlwapi -ld3d9 -ldsound ^
-ltier0 -lvstdlib -lntdll -o sst.dll%objs% .build/dll.res || exit /b
:: get rid of another useless file (can we just not create this???)
del .build\sst.lib
-%HOSTCC% -O2 -g -include test/test.h -o .build/bitbuf.test.exe test/bitbuf.test.c || exit /b
+%HOSTCC% -fuse-ld=lld -O2 -g -include test/test.h -o .build/bitbuf.test.exe test/bitbuf.test.c || exit /b
.build\bitbuf.test.exe || exit /b
:: special case: test must be 32-bit
-%HOSTCC% -m32 -O2 -g -ladvapi32 -include test/test.h -o .build/hook.test.exe test/hook.test.c || exit /b
+%HOSTCC% -fuse-ld=lld -m32 -O2 -g -ladvapi32 -include test/test.h -o .build/hook.test.exe test/hook.test.c || exit /b
.build\hook.test.exe || exit /b
-%HOSTCC% -O2 -g -include test/test.h -o .build/kv.test.exe test/kv.test.c || exit /b
+%HOSTCC% -fuse-ld=lld -O2 -g -include test/test.h -o .build/kv.test.exe test/kv.test.c || exit /b
.build\kv.test.exe || exit /b
-%HOSTCC% -O2 -g -include test/test.h -o .build/x86.test.exe test/x86.test.c || exit /b
+%HOSTCC% -fuse-ld=lld -O2 -g -include test/test.h -o .build/x86.test.exe test/x86.test.c || exit /b
.build\x86.test.exe || exit /b
endlocal