@echo on
@dir . > nul
REM override variables either here or from the shell
set source_dir=%source_dir%
set sysroot=%sysroot%
if not exist bin mkdir bin
if not exist lib mkdir lib
if not exist src mkdir src
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist.lo %source_dir%/src/dalist.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_EXPORT -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist_debug.lo %source_dir%/src/dalist_debug.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_EXPORT -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist_entry_point.lo %source_dir%/src/dalist_entry_point.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_EXPORT -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist_memfn.lo %source_dir%/src/dalist_memfn.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_EXPORT -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist.o %source_dir%/src/dalist.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_STATIC -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist_debug.o %source_dir%/src/dalist_debug.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_STATIC -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist_entry_point.o %source_dir%/src/dalist_entry_point.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_STATIC -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
cl /nologo -c /Fo:src/dalist_memfn.o %source_dir%/src/dalist_memfn.c /Zi /Od -D_MIDIPIX_FREESTANDING -D__NT64 -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__ /X /GS- -I%source_dir%/src/internal -I%source_dir%/include -Ibuild -DDALIST_TAG_VER_MAJOR=0 -DDALIST_TAG_VER_MINOR=0 -DDALIST_TAG_VER_PATCH=0 /Wall /WX /Wall -DDALIST_STATIC -I%sysroot%/include
@if %errorlevel% neq 0 exit /b %errorlevel%
@echo.
@echo clbuild: successfully built: shared-objs static-objs app-objs.
@echo.
lib /out:lib/libdalist.a src/dalist.o src/dalist_debug.o src/dalist_entry_point.o src/dalist_memfn.o /nologo
@if %errorlevel% neq 0 exit /b %errorlevel%
@echo.
@echo clbuild: successfully created: static archive.
@echo.
link /dll /nologo /out:lib/libdalist.so src/dalist.lo src/dalist_debug.lo src/dalist_entry_point.lo src/dalist_memfn.lo /libpath:lib /subsystem:windows /nodefaultlib /entry:dalist_entry_point
@if %errorlevel% neq 0 exit /b %errorlevel%
@echo.
@echo clbuild: successfully linked: shared library.
@echo.
@echo.
@echo yay.
@echo.