view Makefile @ 25:8f290112718a

fix: build from scratch not working, remove temp shader files from compilation
author Sam <sam@basx.dev>
date Wed, 11 Jan 2023 11:43:22 +0700
parents 71bbe11d8de8
children 8cb2d96ac28e
line wrap: on
line source

SOURCES := $(shell find src -name '*.nim')

# compilation requirements
examples/glslangValidator: thirdparty/bin/linux/glslangValidator
	cp $< examples
examples/glslangValidator.exe: thirdparty/bin/windows/glslangValidator.exe
	cp $< examples

# build hello_triangle
build/debug/linux/hello_triangle: ${SOURCES} examples/glslangValidator
	nim build_linux_debug -o:$@ examples/hello_triangle.nim
build/release/linux/hello_triangle: ${SOURCES} examples/glslangValidator
	nim build_linux_release -o:$@ examples/hello_triangle.nim
build/debug/windows/hello_triangle.exe: ${SOURCES} examples/glslangValidator.exe
	nim build_windows_debug -o:$@ examples/hello_triangle.nim
build/release/windows/hello_triangle.exe: ${SOURCES} examples/glslangValidator.exe
	nim build_windows_release -o:$@ examples/hello_triangle.nim

build_all_linux_hello_triangle: build/debug/linux/hello_triangle build/release/linux/hello_triangle
build_all_windows_hello_triangle: build/debug/windows/hello_triangle.exe build/release/windows/hello_triangle.exe
build_all_hello_triangle: build_all_linux_hello_triangle build_all_windows_hello_triangle

# build alotof_triangles
build/debug/linux/alotof_triangles: ${SOURCES} examples/glslangValidator
	nim build_linux_debug -o:$@ examples/alotof_triangles.nim
build/release/linux/alotof_triangles: ${SOURCES} examples/glslangValidator
	nim build_linux_release -o:$@ examples/alotof_triangles.nim
build/debug/windows/alotof_triangles.exe: ${SOURCES} examples/glslangValidator.exe
	nim build_windows_debug -o:$@ examples/alotof_triangles.nim
build/release/windows/alotof_triangles.exe: ${SOURCES} examples/glslangValidator.exe
	nim build_windows_release -o:$@ examples/alotof_triangles.nim

build_all_linux_alotof_triangles: build/debug/linux/alotof_triangles build/release/linux/alotof_triangles
build_all_windows_alotof_triangles: build/debug/windows/alotof_triangles.exe build/release/windows/alotof_triangles.exe
build_all_alotof_triangles: build_all_linux_alotof_triangles build_all_windows_alotof_triangles

# clean
clean:
	rm -rf build
	rm -rf thirdparty

.PHONY: tests

# tests
tests:
	testament p tests/

# publish
publish_linux_debug_hello_triangle: build/debug/linux/hello_triangle
	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/
publish_linux_release_hello_triangle: build/release/linux/hello_triangle
	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/
publish_windows_debug_hello_triangle: build/debug/linux/hello_triangle.exe
	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/
publish_windows_release_hello_triangle: build/release/linux/hello_triangle.exe
	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/
publish_all_linux_hello_triangle: publish_linux_debug_hello_triangle publish_linux_release_hello_triangle
publish_all_windows_hello_triangle: publish_windows_debug_hello_triangle publish_windows_release_hello_triangle
publish_all_alotof_hello_triangle: publish_all_linux_hello_triangle publish_all_windows_hello_triangle

publish_linux_debug_alotof_triangles: build/debug/linux/alotof_triangles
	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/debug/
publish_linux_release_alotof_triangles: build/release/linux/alotof_triangles
	scp $< basx.dev:/var/www/public.basx.dev/joni/linux/release/
publish_windows_debug_alotof_triangles: build/debug/linux/alotof_triangles.exe
	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/debug/
publish_windows_release_alotof_triangles: build/release/linux/alotof_triangles.exe
	scp $< basx.dev:/var/www/public.basx.dev/joni/windows/release/
publish_all_linux_alotof_triangles: publish_linux_debug_alotof_triangles publish_linux_release_alotof_triangles
publish_all_windows_alotof_triangles: publish_windows_debug_alotof_triangles publish_windows_release_alotof_triangles
publish_all_alotof_triangles: publish_all_linux_alotof_triangles publish_all_windows_alotof_triangles


# download thirdparty-libraries

thirdparty/bin/linux/glslangValidator:
	mkdir -p $$( dirname $@ )
	cd $$( dirname $@ ) && wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip
	cd $$( dirname $@ ) && unzip *.zip
	cd $$( dirname $@ ) && mv bin/* .
	cd $$( dirname $@ ) && rm -rf *.zip bin lib include
thirdparty/bin/windows/glslangValidator.exe:
	mkdir -p $$( dirname $@ )
	cd $$( dirname $@ ) && wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip
	cd $$( dirname $@ ) && unzip *.zip
	cd $$( dirname $@ ) && mv bin/* .
	cd $$( dirname $@ ) && rm -rf *.zip bin lib include