
# common commands
ifeq ($(shell echo ^^),^)
  	# cmd
  	delete  = $(info Deleting $1 ...) @del /q $(subst /,\,$1)
  	rdelete = $(info Deleting $1 ...) @del /s /q $(subst /,\,$1) && if exist $(subst /,\,$1) (rmdir /s /q $(subst /,\,$1))
    copy = $(info Copying $1 to $2 ...) @copy /Y $(subst /,\,$1) $(subst /,\,$2)
else
  	# sh
  	delete  = $(info Deleting $1 ...) @rm -f $1
  	rdelete = $(info Deleting $1 ...) @rm -rf $1
	copy = $(info Copying $1 to $2 ...) @cp $1 $2
endif

all: generate

generate:
	cmake -GNinja -S. -Bcmake-build-debug -DCMAKE_TOOLCHAIN_FILE="C:\Android\Sdk\ndk\21.4.7075529\build\cmake\android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-16 -DANDROID_NDK=C:\Android\Sdk\ndk\21.4.7075529 -DCMAKE_C_COMPLIER=C:/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -DCMAKE_CXX_COMPLIER=C:/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -DCMAKE_EXPORT_COMPILE_COMMANDS=1
	$(call copy,./cmake-build-debug/compile_commands.json .)


build: generate
	ninja -C cmake-build-debug

deps:
	ninja -C cmake-build-debug -t deps > deps.txt
