summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2017-09-08 16:20:03 +0200
committerBert Münnich <ber.t@posteo.de>2017-09-08 16:20:05 +0200
commita46006f527db5743c3cb43e541857705a05884cf (patch)
tree52b2e5806eeaba260df336c35abc2087890997eb
parente46b1fa609b96194633c58bf75df9c88ede44a90 (diff)
downloadnsxiv-a46006f527db5743c3cb43e541857705a05884cf.tar.zst
Support out-of-source builds
Fixes issue #167. Long after closing this issue (kind of wontfix) we have switched to GNU make and can thus use its features like VPATH.
-rw-r--r--Makefile6
-rw-r--r--config.mk2
2 files changed, 6 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f3ca3f1..f7654da 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,9 @@ VERSION := git-20170908
include config.mk
-CPPFLAGS += -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF)
+VPATH := $(SRCDIR)
+
+CPPFLAGS += -I. -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF)
DEPFLAGS := -MMD -MP
LDLIBS := -lImlib2 -lX11 -lXft
@@ -31,7 +33,7 @@ $(OBJ): Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEPFLAGS) -c -o $@ $<
config.h:
- cp config.def.h $@
+ cp $(SRCDIR)/config.def.h $@
sxiv: $(OBJ)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
diff --git a/config.mk b/config.mk
index cf2f946..3aa3cf2 100644
--- a/config.mk
+++ b/config.mk
@@ -1,3 +1,5 @@
+SRCDIR := .
+
PREFIX := /usr/local
MANPREFIX := $(PREFIX)/share/man