]> git.notmuchmail.org Git - notmuch/blobdiff - Makefile.local
Makefile: Avoid complaining about .first-build-message not existing
[notmuch] / Makefile.local
index aefbb9e811ff38d66ca96e6f9af33f76792ed248..f497b6cb5225d7e568f1c69d915c3f423ec347a2 100644 (file)
 # repository), we let git append identification of the actual commit.
 PACKAGE=notmuch
 
+IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi)
+
 VERSION:=$(shell cat version)
 ifneq ($(MAKECMDGOALS),release)
 ifneq ($(MAKECMDGOALS),release-message)
-VERSION:=$(shell if git describe > /dev/null 2>&1; then git describe --match '[0-9.]*'; else cat version; fi)
+ifeq ($(IS_GIT),yes)
+VERSION:=$(shell git describe --match '[0-9.]*')
+endif
 endif
 endif
 
@@ -28,15 +32,17 @@ GPG_FILE=$(SHA1_FILE).asc
 FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
 FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
+FINAL_NOTMUCH_LINKER = CC
 ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
 FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS)
+FINAL_NOTMUCH_LINKER = CXX
 endif
 FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
 
 .PHONY: all
 all: notmuch notmuch-shared notmuch.1.gz
 ifeq ($(MAKECMDGOALS),)
-ifeq ($(shell cat .first-build-message),)
+ifeq ($(shell cat .first-build-message 2>/dev/null),)
        @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
        @echo ""
        @echo "Compilation of notmuch is now complete. You can install notmuch with:"
@@ -126,6 +132,7 @@ release-message:
 
 .PHONY: verify-no-dirty-code
 verify-no-dirty-code: verify-version
+ifeq ($(IS_GIT),yes)
        @printf "Checking that source tree is clean..."
 ifneq ($(shell git ls-files -m),)
        @echo "No"
@@ -139,6 +146,7 @@ ifneq ($(shell git ls-files -m),)
 else
        @echo "Good"
 endif
+endif
 
 .PHONY: verify-version
 verify-version:
@@ -229,7 +237,7 @@ notmuch: $(notmuch_client_modules) lib/libnotmuch.a
        $(call quiet,CXX $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@
 
 notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)
-       $(call quiet,CXX $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
+       $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
 
 notmuch.1.gz: notmuch.1
        gzip --stdout $^ > $@