SOURCES = Test.cpp BUILD_DIR = build CXXFLAGS = -std=c++14 UNAME := $(shell uname) # LINUX version ifeq ($(UNAME), Linux) TARGETS := $(BUILD_DIR)/hello-linux-64 $(BUILD_DIR)/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin endif # WINDOWS version ifeq ($(UNAME), MINGW64_NT-10.0) TARGETS := $(BUILD_DIR)/hello-win64.exe endif all: $(TARGETS) echo "all..." echo $(MAKE) echo $(UNAME) .PRECIOUS: $(BUILD_DIR)/ $(BUILD_DIR)%/ $(BUILD_DIR)/: echo "dir1..." mkdir -p $@ $(BUILD_DIR)%/: echo "dir2..." mkdir -p $@ .SECONDEXPANSION: $(BUILD_DIR)/hello-linux-64: | $$(@D)/. x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 $(BUILD_DIR)/hello-win64.exe: | $$(@D)/. echo "Making..." x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin tidy: $(BUILD_DIR)/tidy.xml $(BUILD_DIR)/tidy.xml: | $$(@D)/. chmod u+x ./clang-tidy-to-junit.py clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ test: $(BUILD_DIR)/tests.xml $(BUILD_DIR)/tests.xml: | $$(@D)/. echo "" > $@ publish: echo "Publish..."