
UNAME := $(shell uname)

CXXFLAGS = -std=c++14

SOURCES = Test.cpp

# LINUX version
ifeq ($(UNAME), Linux)
TARGETS := build/hello-linux-64 build/hello-win64.exe build/hello-macosx.bin
endif

# WINDOWS version
ifeq ($(UNAME), MINGW32_NT-10.0)
TARGETS := build/hello-win64.exe
endif

all: $(TARGETS)
	@echo $(UNAME)

build/hello-linux-64:
	@mkdir -p build
	@x86_64-linux-gnu-g++      Test.cpp -o build/hello-linux-64

build/hello-win64.exe:
	@mkdir -p build
	@x86_64-w64-mingw32-g++    Test.cpp -o build/hello-win64.exe

build/hello-macosx.bin:
	@x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin
	@mkdir -p build

tidy:
	@mkdir -p build
	@chmod u+x ./clang-tidy-to-junit.py
	@clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > build/tidy.xml

test:
	@mkdir -p build
	@echo '<?xml version="1.0" encoding="UTF-8" ?>' > build/tests.xml
	@echo '<testsuites id="1" name="Clang-Tidy" tests="1" errors="0" failures="0" time="0">' >> build/tests.xml
	@echo '</testsuites>' >> build/tests.xml

publish:
	@echo "Publish..."


