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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-05-16 10:31:15 +02:00
parent 82b51c2715
commit 5f92eda6bf
1 changed files with 3 additions and 3 deletions

View File

@ -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