view Makefile @ 14:1612f50b1bf6

did: exclude test output
author Sam <sam@basx.dev>
date Wed, 28 Dec 2022 11:44:08 +0700
parents a571db114152
children dde536a70483
line wrap: on
line source

SOURCES := $(shell find src -name '*.nim')
COMPILE_OPTIONS := --path:src --mm:orc --experimental:strictEffects --threads:on --app:gui
DEBUG_OPTIONS := --debugger:native --checks:on --assertions:on
RELEASE_OPTIONS := -d:release --checks:off --assertions:off
WINDOWS_DEBUG_OPTIONS := --cc:vcc --passC:'/MDd' --passL:'ucrtd.lib' 
WINDOWS_RELEASE_OPTIONS := --cc:vcc --passC:'/MD' --passL:'ucrt.lib' 

make_dirs: 
	mkdir -p build/debug/linux
	mkdir -p build/release/linux
	mkdir -p build/debug/windows
	mkdir -p build/release/windows

# build hello_triangle
build/debug/linux/hello_triangle: ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} -o:$@ examples/hello_triangle.nim
build/release/linux/hello_triangle: ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} -o:$@ examples/hello_triangle.nim
build/debug/windows/hello_triangle.exe:  ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} ${WINDOWS_DEBUG_OPTIONS} -o:$@ examples/hello_triangle.nim
build/release/windows/hello_triangle.exe: ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} ${WINDOWS_RELEASE_OPTIONS} -o:$@ examples/hello_triangle.nim

build_all_linux: build/debug/linux/hello_triangle build/release/linux/hello_triangle
build_all_windows: build/debug/windows/hello_triangle.exe build/release/windows/hello_triangle.exe
build_all: build_all_linux build_all_windows

# build maths (for testing)
build/debug/linux/maths: ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} -o:$@ examples/maths.nim
build/release/linux/maths: ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} -o:$@ examples/maths.nim
build/debug/windows/maths.exe:  ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${DEBUG_OPTIONS} ${WINDOWS_DEBUG_OPTIONS} -o:$@ examples/maths.nim
build/release/windows/maths.exe: ${SOURCES} make_dirs
	nim c ${COMPILE_OPTIONS} ${RELEASE_OPTIONS} ${WINDOWS_RELEASE_OPTIONS} -o:$@ examples/maths.nim

clean:
	rm -rf build

tests:
	testament p tests/

# publish
publish_linux_debug: build/debug/linux/hello_triangle
	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/
publish_linux_release: build/release/linux/hello_triangle
	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/
publish_windows_debug: build/debug/linux/hello_triangle
	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/
publish_windows_release: build/release/linux/hello_triangle
	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/

publish_all: publish_linux_debug publish_linux_release publish_windows_debug publish_windows_release


# download thirdparty-libraries

thirdparty/lib/glslang/linux_debug:
	mkdir -p $@
	wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Debug.zip
	unzip glslang-master-linux-Debug.zip
thirdparty/lib/glslang/linux_release:
	mkdir -p $@
	wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip
	unzip glslang-master-linux-Release.zip
thirdparty/lib/glslang/windows_debug:
	mkdir -p $@
	wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Debug.zip
	unzip glslang-master-windows-x64-Debug.zip
thirdparty/lib/glslang/windows_release:
	mkdir -p $@
	wget --directory-prefix=$@ https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip
	unzip glslang-master-windows-x64-Release.zip

thirdparty/lib/spirv-tools/linux_debug:
	mkdir -p $@
	wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-gcc-debug/continuous/1899/20221216-081758/install.tgz
	tar -xf $@/install.tgz
thirdparty/lib/spirv-tools/linux_release:
	mkdir -p $@
	wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-gcc-release/continuous/1889/20221216-081754/install.tgz
	tar -xf $@/install.tgz
thirdparty/lib/spirv-tools/windows_debug:
	mkdir -p $@
	wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-debug/continuous/1599/20221216-081803/install.zip
	unzip $@/install.zip
thirdparty/lib/spirv-tools/windows_release:
	mkdir -p $@
	wget --directory-prefix=$@ https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-release/continuous/1885/20221216-081805/install.zip
	unzip $@/install.zip