diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..453ed1a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs/ +cache/ +build/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..453ed1a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs/ +cache/ +build/ diff --git a/Makefile b/Makefile index ed33232..541ff31 100644 --- a/Makefile +++ b/Makefile @@ -1,43 +1,61 @@ -UNAME := $(shell uname) - -CXXFLAGS = -std=c++14 SOURCES = Test.cpp +BUILD_DIR = build +CXXFLAGS = -std=c++14 + + +UNAME := $(shell uname) + + # LINUX version ifeq ($(UNAME), Linux) -TARGETS := build/hello-linux-64 build/hello-win64.exe build/hello-macosx.bin +TARGETS := $(BUILD_DIR)/hello-linux-64 $(BUILD_DIR)/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin endif # WINDOWS version -ifeq ($(UNAME), MINGW32_NT-10.0) -TARGETS := build/hello-win64.exe +ifeq ($(UNAME), MINGW64_NT-10.0) +TARGETS := $(BUILD_DIR)/hello-win64.exe endif all: $(TARGETS) + echo "all..." + echo $(MAKE) echo $(UNAME) -build/hello-linux-64: - mkdir -p build +.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/hello-win64.exe: - mkdir -p build +$(BUILD_DIR)/hello-win64.exe: | $$(@D)/. + echo "Making..." x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe -build/hello-macosx.bin: +$(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin - mkdir -p build -tidy: - mkdir -p build +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)/ > build/tidy.xml + clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ -test: - mkdir -p build - echo "" > build/tests.xml +test: $(BUILD_DIR)/tests.xml + +$(BUILD_DIR)/tests.xml: | $$(@D)/. + echo "" > $@ publish: echo "Publish..." diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..453ed1a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs/ +cache/ +build/ diff --git a/Makefile b/Makefile index ed33232..541ff31 100644 --- a/Makefile +++ b/Makefile @@ -1,43 +1,61 @@ -UNAME := $(shell uname) - -CXXFLAGS = -std=c++14 SOURCES = Test.cpp +BUILD_DIR = build +CXXFLAGS = -std=c++14 + + +UNAME := $(shell uname) + + # LINUX version ifeq ($(UNAME), Linux) -TARGETS := build/hello-linux-64 build/hello-win64.exe build/hello-macosx.bin +TARGETS := $(BUILD_DIR)/hello-linux-64 $(BUILD_DIR)/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin endif # WINDOWS version -ifeq ($(UNAME), MINGW32_NT-10.0) -TARGETS := build/hello-win64.exe +ifeq ($(UNAME), MINGW64_NT-10.0) +TARGETS := $(BUILD_DIR)/hello-win64.exe endif all: $(TARGETS) + echo "all..." + echo $(MAKE) echo $(UNAME) -build/hello-linux-64: - mkdir -p build +.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/hello-win64.exe: - mkdir -p build +$(BUILD_DIR)/hello-win64.exe: | $$(@D)/. + echo "Making..." x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe -build/hello-macosx.bin: +$(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin - mkdir -p build -tidy: - mkdir -p build +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)/ > build/tidy.xml + clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ -test: - mkdir -p build - echo "" > build/tests.xml +test: $(BUILD_DIR)/tests.xml + +$(BUILD_DIR)/tests.xml: | $$(@D)/. + echo "" > $@ publish: echo "Publish..." diff --git a/Test.cpp b/Test.cpp index 6ed636d..b7f4902 100644 --- a/Test.cpp +++ b/Test.cpp @@ -4,3 +4,4 @@ { printf("hello\n"); } + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..453ed1a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs/ +cache/ +build/ diff --git a/Makefile b/Makefile index ed33232..541ff31 100644 --- a/Makefile +++ b/Makefile @@ -1,43 +1,61 @@ -UNAME := $(shell uname) - -CXXFLAGS = -std=c++14 SOURCES = Test.cpp +BUILD_DIR = build +CXXFLAGS = -std=c++14 + + +UNAME := $(shell uname) + + # LINUX version ifeq ($(UNAME), Linux) -TARGETS := build/hello-linux-64 build/hello-win64.exe build/hello-macosx.bin +TARGETS := $(BUILD_DIR)/hello-linux-64 $(BUILD_DIR)/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin endif # WINDOWS version -ifeq ($(UNAME), MINGW32_NT-10.0) -TARGETS := build/hello-win64.exe +ifeq ($(UNAME), MINGW64_NT-10.0) +TARGETS := $(BUILD_DIR)/hello-win64.exe endif all: $(TARGETS) + echo "all..." + echo $(MAKE) echo $(UNAME) -build/hello-linux-64: - mkdir -p build +.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/hello-win64.exe: - mkdir -p build +$(BUILD_DIR)/hello-win64.exe: | $$(@D)/. + echo "Making..." x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe -build/hello-macosx.bin: +$(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin - mkdir -p build -tidy: - mkdir -p build +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)/ > build/tidy.xml + clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ -test: - mkdir -p build - echo "" > build/tests.xml +test: $(BUILD_DIR)/tests.xml + +$(BUILD_DIR)/tests.xml: | $$(@D)/. + echo "" > $@ publish: echo "Publish..." diff --git a/Test.cpp b/Test.cpp index 6ed636d..b7f4902 100644 --- a/Test.cpp +++ b/Test.cpp @@ -4,3 +4,4 @@ { printf("hello\n"); } + diff --git a/windows-setup.sh b/windows-setup.sh new file mode 100644 index 0000000..10399ea --- /dev/null +++ b/windows-setup.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +mkdir -p cache +cd cache + +PYTHON_INSTALL=python-3.8.0.exe +if [ ! -f ${PYTHON_INSTALL} ] +then + curl https://www.python.org/ftp/python/3.8.0/${PYTHON_INSTALL} -o ${PYTHON_INSTALL} +fi +chmod u+x ${PYTHON_INSTALL} +cmd //C ${PYTHON_INSTALL} + + +CLANG_INSTALL=LLVM-9.0.0-win64.exe +if [ ! -f ${CLANG_INSTALL} ] +then + curl http://releases.llvm.org/9.0.0/${CLANG_INSTALL} -o ${CLANG_INSTALL} +fi +chmod u+x ${CLANG_INSTALL} +cmd //C ${CLANG_INSTALL} + + +MINGW_INSTALL=mingw-w64-install.exe +if [ ! -f ${MINGW_INSTALL} ] +then + curl https://nchc.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/${MINGW_INSTALL} -o ${MINGW_INSTALL} +fi +chmod u+x ${MINGW_INSTALL} +cmd //C ${MINGW_INSTALL} + + +TIDY_TO_JUNIT=clang-tidy-to-junit.py +if [ ! -f ${TIDY_TO_JUNIT} ] +then + curl https://raw.githubusercontent.com/PSPDFKit-labs/clang-tidy-to-junit/master/${TIDY_TO_JUNIT} -o ${TIDY_TO_JUNIT} +fi + +