From e3c669ae56828f5761e1b8eb0a5d0004de696064 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Sat, 23 Jan 2016 04:36:44 -0600 Subject: [PATCH] Avoid invoking dirname and git for each compiled C++ source file --- Makefile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index f87496b..7cc25ad 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,8 @@ MINGW_ENABLE_CXX11_FLAG ?= -std=c++11 include config.mk -VERSION := $(shell cat VERSION.txt | tr -d '\r\n') - -COMMON_CXXFLAGS += \ - -DWINPTY_VERSION=$(VERSION) \ +COMMON_CXXFLAGS := $(COMMON_CXXFLAGS) \ + -DWINPTY_VERSION=$(shell cat VERSION.txt | tr -d '\r\n') \ -DWINPTY_VERSION_SUFFIX=$(VERSION_SUFFIX) \ -DWINPTY_COMMIT_HASH=$(COMMIT_HASH) \ -MMD -Wall \ @@ -46,10 +44,10 @@ COMMON_CXXFLAGS += \ -DWINVER=0x0501 \ -D_WIN32_WINNT=0x0501 -UNIX_CXXFLAGS += \ +UNIX_CXXFLAGS := $(UNIX_CXXFLAGS) \ $(COMMON_CXXFLAGS) -MINGW_CXXFLAGS += \ +MINGW_CXXFLAGS := $(MINGW_CXXFLAGS) \ $(COMMON_CXXFLAGS) \ -O2 \ $(MINGW_ENABLE_CXX11_FLAG) @@ -60,14 +58,14 @@ UNIX_LDFLAGS += $(UNIX_LDFLAGS_STATIC) define def_unix_target build/$1/%.o : src/%.cc VERSION.txt @echo Compiling $$< - @mkdir -p $$$$(dirname $$@) + @mkdir -p $$(dir $$@) @$$(UNIX_CXX) $$(UNIX_CXXFLAGS) $2 -I src/include -c -o $$@ $$< endef define def_mingw_target build/$1/%.o : src/%.cc VERSION.txt @echo Compiling $$< - @mkdir -p $$$$(dirname $$@) + @mkdir -p $$(dir $$@) @$$(MINGW_CXX) $$(MINGW_CXXFLAGS) $2 -I src/include -c -o $$@ $$< endef