Krolyxon
Commit e46b1fa

Branches

Refs →

nsxive46b1fa

Simplify config.mk

Author
Bert Münnich
Date
2017-09-08 15:56 +0200
Committer
Bert Münnich · 2017-09-08 16:03 +0200
Parent
ad9955a
Commit
e46b1fa609b96194633c58bf75df9c88ede44a90

+21 −16

2 files changed

  1. M Makefile +16 −4
  2. M config.mk +5 −12
M Makefile View
@@ -1,10 +1,22 @@
1−VERSION := git-20170906
1+VERSION := git-20170908
22
3−.PHONY: clean install uninstall
3+.PHONY: all clean install uninstall
44 .SUFFIXES:
55
66 include config.mk
77
8+CPPFLAGS += -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF)
9+DEPFLAGS := -MMD -MP
10+
11+LDLIBS := -lImlib2 -lX11 -lXft
12+
13+ifneq ($(HAVE_GIFLIB),0)
14+ LDLIBS += -lgif
15+endif
16+ifneq ($(HAVE_LIBEXIF),0)
17+ LDLIBS += -lexif
18+endif
19+
820 SRC := autoreload_$(AUTORELOAD).c commands.c image.c main.c options.c thumbs.c util.c window.c
921 DEP := $(SRC:.c=.d)
1022 OBJ := $(SRC:.c=.o)
@@ -16,13 +28,13 @@ $(OBJ): Makefile
1628 -include $(DEP)
1729
1830 %.o: %.c
19− $(CC) $(CFLAGS) $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -MMD -MP -c -o $@ $<
31+ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEPFLAGS) -c -o $@ $<
2032
2133 config.h:
2234 cp config.def.h $@
2335
2436 sxiv: $(OBJ)
25− $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
37+ $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
2638
2739 clean:
2840 rm -f $(OBJ) $(DEP) sxiv
M config.mk View
@@ -5,20 +5,13 @@ CC ?= gcc
55 CFLAGS += -std=c99 -Wall -pedantic
66 CPPFLAGS += -I/usr/include/freetype2 -D_XOPEN_SOURCE=700
77 LDFLAGS +=
8−LIBS := -lImlib2 -lX11 -lXft
98
109 # autoreload backend: inotify/nop
1110 AUTORELOAD := inotify
1211
13−# optional dependencies:
14−# giflib: gif animations
15−ifndef NO_GIFLIB
16− CPPFLAGS += -DHAVE_GIFLIB
17− LIBS += -lgif
18−endif
19−# libexif: jpeg auto-orientation, exif thumbnails
20−ifndef NO_LIBEXIF
21− CPPFLAGS += -DHAVE_LIBEXIF
22− LIBS += -lexif
23−endif
12+# enable features requiring giflib (-lgif)
13+HAVE_GIFLIB := 1
14+
15+# enable features requiring libexif (-lexif)
16+HAVE_LIBEXIF := 1
2417