cc := "x86_64-w64-mingw32-clang++"
flags := "-Wall -Wextra -std=c++17"

@clean:
  rm -rf build

@makedir-build: clean
  mkdir -p build

@build-lib-shared: makedir-build
  {{cc}} {{flags}} -D BUILD_SHARED --shared -Wl,--out-implib,build/rsa.lib library/rsa.cpp -o build/rsa.dll

@build-app-shared: build-lib-shared
  {{cc}} {{flags}} application/main.cpp -L build -l rsa -o build/main.exe

@build-lib-static: makedir-build
  {{cc}} {{flags}} -c -D BUILD_SHARED library/rsa.cpp -o build/rsa.o
  ar rcs build/rsa.lib build/rsa.o

@build-app-static: build-lib-static
  {{cc}} {{flags}} -D BUILD_STATIC application/main.cpp -L build -l rsa -o build/main.exe

@run:
  wine cmd /c build/main.exe

run-shared: build-app-shared run

run-static: build-app-static run
