diff --git a/Makefile b/Makefile index 64a0348..adc8266 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,7 @@ default : all PREFIX := /usr/local UNIX_ADAPTER_EXE := console.exe MINGW_ENABLE_CXX11_FLAG := -std=c++11 +USE_PCH := 1 COMMON_CXXFLAGS := UNIX_CXXFLAGS := @@ -64,6 +65,23 @@ MINGW_CXXFLAGS += \ MINGW_LDFLAGS += -static -static-libgcc -static-libstdc++ UNIX_LDFLAGS += $(UNIX_LDFLAGS_STATIC) +ifeq "$(USE_PCH)" "1" +MINGW_CXXFLAGS += -include build/mingw/PrecompiledHeader.h +PCH_DEP := build/mingw/PrecompiledHeader.h.gch +else +PCH_DEP := +endif + +build/mingw/PrecompiledHeader.h : src/shared/PrecompiledHeader.h | $$(@D)/.mkdir + $(info Copying $< to $@) + @cp $< $@ + +build/mingw/PrecompiledHeader.h.gch : build/mingw/PrecompiledHeader.h | $$(@D)/.mkdir + $(info Compiling $<) + @$(MINGW_CXX) $(MINGW_CXXFLAGS) -c -o $@ $< + +-include build/mingw/PrecompiledHeader.h.d + define def_unix_target build/$1/%.o : src/%.cc VERSION.txt | $$$$(@D)/.mkdir $$(info Compiling $$<) @@ -71,7 +89,7 @@ build/$1/%.o : src/%.cc VERSION.txt | $$$$(@D)/.mkdir endef define def_mingw_target -build/$1/%.o : src/%.cc VERSION.txt | $$$$(@D)/.mkdir +build/$1/%.o : src/%.cc VERSION.txt $$(PCH_DEP) | $$$$(@D)/.mkdir $$(info Compiling $$<) @$$(MINGW_CXX) $$(MINGW_CXXFLAGS) $2 -I src/include -c -o $$@ $$< endef diff --git a/ship/ship.py b/ship/ship.py index 521d99d..783cbab 100755 --- a/ship/ship.py +++ b/ship/ship.py @@ -97,7 +97,7 @@ def buildTarget(target): os.environ["PATH"] = target["path"] + ";" + oldPath subprocess.check_call(["sh.exe", "configure"]) subprocess.check_call(["make.exe", "clean"]) - buildArgs = ["make.exe", "all", "tests"] + buildArgs = ["make.exe", "USE_PCH=0", "all", "tests"] if target.get("allow_parallel_make", True): buildArgs += ["-j8"] subprocess.check_call(buildArgs) diff --git a/src/shared/PrecompiledHeader.h b/src/shared/PrecompiledHeader.h new file mode 100755 index 0000000..82e5b05 --- /dev/null +++ b/src/shared/PrecompiledHeader.h @@ -0,0 +1,40 @@ +// Copyright (c) 2016 Ryan Prichard +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +#ifndef WINPTY_PRECOMPILED_HEADER_H +#define WINPTY_PRECOMPILED_HEADER_H + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#endif // WINPTY_PRECOMPILED_HEADER_H