From a46006f527db5743c3cb43e541857705a05884cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Fri, 8 Sep 2017 16:20:03 +0200 Subject: 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. --- Makefile | 6 ++++-- config.mk | 2 ++ 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 -- cgit v1.2.3