From 9bf50beab0b1337bf4088bdf7307a7c6f1c52b69 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 16 May 2017 10:20:30 +0200 Subject: [PATCH 1/3] Makefile: Add a hint that cmake can be used directly Signed-off-by: Uli Schlachter --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 6cfeaa67..93b1bf0b 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ $(BUILDLN): test -e $(BUILDLN) || ln -s -f ${builddir} $(BUILDLN) cmake ${builddir}/CMakeCache.txt: + $(ECHO) "Creating build directory and running cmake in it. You can also run CMake directly, if you want." + $(ECHO) mkdir -p ${builddir} $(ECHO) "Running cmake…" cd ${builddir} && cmake $(CMAKE_ARGS) "$(@D)" .. From 82b51c27156372eeee3938e138d4a809fe3093c7 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 16 May 2017 10:30:24 +0200 Subject: [PATCH 2/3] Makefile: Stop creating .build-* directories, use build directly Signed-off-by: Uli Schlachter --- Makefile | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 93b1bf0b..6dee69b5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -builddir=.build-$(shell hostname)-$(shell gcc -dumpmachine)-$(shell gcc -dumpversion) - ifeq (,$(VERBOSE)) MAKEFLAGS:=$(MAKEFLAGS)s ECHO=echo @@ -8,42 +6,38 @@ else endif TARGETS=awesome -BUILDLN=build +BUILDDIR=build -all: $(TARGETS) $(BUILDLN) ; +all: $(TARGETS) ; $(TARGETS): cmake-build - ln -s -f ${builddir}/$@ $@ + ln -s -f $(BUILDDIR)/$@ $@ -$(BUILDLN): - test -e $(BUILDLN) || ln -s -f ${builddir} $(BUILDLN) - -cmake ${builddir}/CMakeCache.txt: +cmake $(BUILDDIR)/CMakeCache.txt: $(ECHO) "Creating build directory and running cmake in it. You can also run CMake directly, if you want." $(ECHO) - mkdir -p ${builddir} + mkdir -p $(BUILDDIR) $(ECHO) "Running cmake…" - cd ${builddir} && cmake $(CMAKE_ARGS) "$(@D)" .. + cd $(BUILDDIR) && cmake $(CMAKE_ARGS) "$(@D)" .. -cmake-build: ${builddir}/CMakeCache.txt +cmake-build: $(BUILDDIR)/CMakeCache.txt $(ECHO) "Building…" - $(MAKE) -C ${builddir} + $(MAKE) -C $(BUILDDIR) tags: git ls-files | xargs ctags install: $(ECHO) "Installing…" - $(MAKE) -C ${builddir} install + $(MAKE) -C $(BUILDDIR) install distclean: $(ECHO) -n "Cleaning up build directory…" - $(RM) -r ${builddir} $(BUILDLN) $(TARGETS) + $(RM) -r $(BUILDDIR) $(TARGETS) $(ECHO) " done" %: cmake $(ECHO) "Running make $@…" - $(MAKE) -C ${builddir} $@ - $(and $(filter clean,$@),$(RM) $(BUILDLN) $(TARGETS)) + $(MAKE) -C $(BUILDDIR) $@ -.PHONY: cmake-build cmake install distclean $(BUILDLN) tags +.PHONY: cmake-build cmake install distclean tags From 5f92eda6bf456115d3ecb48000667b6e0511a42b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 16 May 2017 10:31:15 +0200 Subject: [PATCH 3/3] Makefile: Run cmake less often Previously, running make in the build/ directory depended on the "cmake" target which was running the cmake command. This target was phony, meaning that it was always considered to be out of date and needed to be re-generated. Change this so that instead things depend on the CMakeCache.txt file. If that file is already there, we do not re-run cmake. Signed-off-by: Uli Schlachter --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6dee69b5..514a285c 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ all: $(TARGETS) ; $(TARGETS): cmake-build ln -s -f $(BUILDDIR)/$@ $@ -cmake $(BUILDDIR)/CMakeCache.txt: +$(BUILDDIR)/CMakeCache.txt: $(ECHO) "Creating build directory and running cmake in it. You can also run CMake directly, if you want." $(ECHO) mkdir -p $(BUILDDIR) @@ -36,8 +36,8 @@ distclean: $(RM) -r $(BUILDDIR) $(TARGETS) $(ECHO) " done" -%: cmake +%: $(BUILDDIR)/CMakeCache.txt $(ECHO) "Running make $@…" $(MAKE) -C $(BUILDDIR) $@ -.PHONY: cmake-build cmake install distclean tags +.PHONY: cmake-build install distclean tags