Krolyxon
Commit 197afce

Branches

Refs →

nsxiv197afce

introduce config.mk

this moves all the build variables intended to be modified by the user
over to `config.mk` similar to other suckless software.

also move CPPFLAGS down below for cosmetic purposes.
Author
NRK
Date
2022-04-22 03:14 +0600
Committer
N-R-K · 2022-05-30 12:07 +0000
Parent
450797c
Commit
197afce93508d0c17ec8966fb96deed80c3c0f82

+35 −35

3 files changed

  1. M Makefile +8 −33
  2. M README.md +2 −2
  3. A config.mk +25 −0
M Makefile View
@@ -1,39 +1,9 @@
11 .POSIX:
22
3−# nsxiv version
4−VERSION = 29
5−
6−# PREFIX for install
7−PREFIX = /usr/local
8−MANPREFIX = $(PREFIX)/share/man
9−EGPREFIX = $(PREFIX)/share/doc/nsxiv/examples
10−
11−# default value for optional dependencies. 1 = enabled, 0 = disabled
12−OPT_DEP_DEFAULT = 1
13−
14−# autoreload backend: 1 = inotify, 0 = none
15−HAVE_INOTIFY = $(OPT_DEP_DEFAULT)
16−
17−# optional dependencies, see README for more info
18−HAVE_LIBFONTS = $(OPT_DEP_DEFAULT)
19−HAVE_LIBGIF = $(OPT_DEP_DEFAULT)
20−HAVE_LIBEXIF = $(OPT_DEP_DEFAULT)
21−HAVE_LIBWEBP = $(OPT_DEP_DEFAULT)
22−
23−# CFLAGS, any optimization flags goes here
24−CFLAGS = -std=c99 -Wall -pedantic
25−
26−# icons that will be installed via `make icon`
27−ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png
3+include config.mk
284
295 inc_fonts_0 =
306 inc_fonts_1 = -I/usr/include/freetype2 -I$(PREFIX)/include/freetype2
31−
32−CPPFLAGS = -D_XOPEN_SOURCE=700 \
33− -DHAVE_LIBGIF=$(HAVE_LIBGIF) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) \
34− -DHAVE_LIBWEBP=$(HAVE_LIBWEBP) -DHAVE_LIBFONTS=$(HAVE_LIBFONTS) \
35− -DHAVE_INOTIFY=$(HAVE_INOTIFY) $(inc_fonts_$(HAVE_LIBFONTS))
36−
377 lib_fonts_0 =
388 lib_fonts_1 = -lXft -lfontconfig
399 lib_exif_0 =
@@ -43,6 +13,11 @@ lib_gif_1 = -lgif
4313 lib_webp_0 =
4414 lib_webp_1 = -lwebpdemux -lwebp
4515
16+CPPFLAGS = -D_XOPEN_SOURCE=700 \
17+ -DHAVE_LIBGIF=$(HAVE_LIBGIF) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) \
18+ -DHAVE_LIBWEBP=$(HAVE_LIBWEBP) -DHAVE_LIBFONTS=$(HAVE_LIBFONTS) \
19+ -DHAVE_INOTIFY=$(HAVE_INOTIFY) $(inc_fonts_$(HAVE_LIBFONTS))
20+
4621 NSXIV_LDLIBS = -lImlib2 -lX11 \
4722 $(lib_exif_$(HAVE_LIBEXIF)) $(lib_gif_$(HAVE_LIBGIF)) \
4823 $(lib_webp_$(HAVE_LIBWEBP)) $(lib_fonts_$(HAVE_LIBFONTS))
@@ -63,7 +38,7 @@ nsxiv: $(OBJS)
6338 @echo "CC $@"
6439 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
6540
66−$(OBJS): Makefile nsxiv.h config.h commands.h
41+$(OBJS): Makefile config.mk nsxiv.h config.h commands.h
6742 options.o: version.h
6843 window.o: icon/data.h
6944
@@ -71,7 +46,7 @@ config.h:
7146 @echo "GEN $@"
7247 cp config.def.h $@
7348
74−version.h: Makefile .git/index
49+version.h: config.mk .git/index
7550 @echo "GEN $@"
7651 v="$$(git describe 2>/dev/null || true)"; \
7752 echo "#define VERSION \"$${v:-$(VERSION)}\"" >$@
M README.md View
@@ -99,8 +99,8 @@ For example:
9999 $ make HAVE_LIBEXIF=0
100100
101101 will disable `libexif` support. Alternatively they can be disabled via editing
102−the `Makefile` directly. `OPT_DEP_DEFAULT=0` can be used to disable all
103−optional dependencies.
102+`config.mk`. `OPT_DEP_DEFAULT=0` can be used to disable all optional
103+dependencies.
104104
105105 Installing nsxiv:
106106
A config.mk View
@@ -0,0 +1,25 @@
1+# nsxiv version
2+VERSION = 29
3+
4+# PREFIX for install
5+PREFIX = /usr/local
6+MANPREFIX = $(PREFIX)/share/man
7+EGPREFIX = $(PREFIX)/share/doc/nsxiv/examples
8+
9+# default value for optional dependencies. 1 = enabled, 0 = disabled
10+OPT_DEP_DEFAULT = 1
11+
12+# autoreload backend: 1 = inotify, 0 = none
13+HAVE_INOTIFY = $(OPT_DEP_DEFAULT)
14+
15+# optional dependencies, see README for more info
16+HAVE_LIBFONTS = $(OPT_DEP_DEFAULT)
17+HAVE_LIBGIF = $(OPT_DEP_DEFAULT)
18+HAVE_LIBEXIF = $(OPT_DEP_DEFAULT)
19+HAVE_LIBWEBP = $(OPT_DEP_DEFAULT)
20+
21+# CFLAGS, any optimization flags goes here
22+CFLAGS = -std=c99 -Wall -pedantic
23+
24+# icons that will be installed via `make icon`
25+ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png