From e46b1fa609b96194633c58bf75df9c88ede44a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Fri, 8 Sep 2017 15:56:55 +0200 Subject: Simplify config.mk --- Makefile | 20 ++++++++++++++++---- config.mk | 17 +++++------------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index bdc770b..f3ca3f1 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,22 @@ -VERSION := git-20170906 +VERSION := git-20170908 -.PHONY: clean install uninstall +.PHONY: all clean install uninstall .SUFFIXES: include config.mk +CPPFLAGS += -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) +DEPFLAGS := -MMD -MP + +LDLIBS := -lImlib2 -lX11 -lXft + +ifneq ($(HAVE_GIFLIB),0) + LDLIBS += -lgif +endif +ifneq ($(HAVE_LIBEXIF),0) + LDLIBS += -lexif +endif + SRC := autoreload_$(AUTORELOAD).c commands.c image.c main.c options.c thumbs.c util.c window.c DEP := $(SRC:.c=.d) OBJ := $(SRC:.c=.o) @@ -16,13 +28,13 @@ $(OBJ): Makefile -include $(DEP) %.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -MMD -MP -c -o $@ $< + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEPFLAGS) -c -o $@ $< config.h: cp config.def.h $@ sxiv: $(OBJ) - $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) + $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS) clean: rm -f $(OBJ) $(DEP) sxiv diff --git a/config.mk b/config.mk index a20e6e3..cf2f946 100644 --- a/config.mk +++ b/config.mk @@ -5,20 +5,13 @@ CC ?= gcc CFLAGS += -std=c99 -Wall -pedantic CPPFLAGS += -I/usr/include/freetype2 -D_XOPEN_SOURCE=700 LDFLAGS += -LIBS := -lImlib2 -lX11 -lXft # autoreload backend: inotify/nop AUTORELOAD := inotify -# optional dependencies: -# giflib: gif animations -ifndef NO_GIFLIB - CPPFLAGS += -DHAVE_GIFLIB - LIBS += -lgif -endif -# libexif: jpeg auto-orientation, exif thumbnails -ifndef NO_LIBEXIF - CPPFLAGS += -DHAVE_LIBEXIF - LIBS += -lexif -endif +# enable features requiring giflib (-lgif) +HAVE_GIFLIB := 1 + +# enable features requiring libexif (-lexif) +HAVE_LIBEXIF := 1 -- cgit v1.2.3