Krolyxon
Commit d5b8242

Branches

Refs →

nsxivMakefile

87 lines · 2.0 KB · Makefile

1version = 24+
2
3srcdir = .
4VPATH = $(srcdir)
5
6PREFIX = /usr/local
7MANPREFIX = $(PREFIX)/share/man
8
9# autoreload backend: inotify/nop
10AUTORELOAD = inotify
11
12# enable features requiring giflib (-lgif)
13HAVE_GIFLIB = 1
14
15# enable features requiring libexif (-lexif)
16HAVE_LIBEXIF = 1
17
18cflags = -std=c99 -Wall -pedantic $(CFLAGS)
19cppflags = -I. $(CPPFLAGS) -D_XOPEN_SOURCE=700 -DHAVE_GIFLIB=$(HAVE_GIFLIB) \
20 -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) -I/usr/include/freetype2
21
22lib_exif_0 =
23lib_exif_1 = -lexif
24lib_gif_0 =
25lib_gif_1 = -lgif
26ldlibs = $(LDLIBS) -lImlib2 -lX11 -lXft -lfontconfig \
27 $(lib_exif_$(HAVE_LIBEXIF)) $(lib_gif_$(HAVE_GIFLIB))
28
29objs = autoreload_$(AUTORELOAD).o commands.o image.o main.o options.o \
30 thumbs.o util.o window.o
31
32all: sxiv
33
34.PHONY: all clean install uninstall
35.SUFFIXES:
36.SUFFIXES: .c .o
37$(V).SILENT:
38
39sxiv: $(objs)
40 @echo "LINK $@"
41 $(CC) $(LDFLAGS) -o $@ $(objs) $(ldlibs)
42
43$(objs): Makefile sxiv.h commands.lst config.h
44options.o: version.h
45window.o: icon/data.h
46
47.c.o:
48 @echo "CC $@"
49 $(CC) $(cflags) $(cppflags) -c -o $@ $<
50
51config.h:
52 @echo "GEN $@"
53 cp $(srcdir)/config.def.h $@
54
55version.h: Makefile .git/index
56 @echo "GEN $@"
57 v="$$(cd $(srcdir); git describe 2>/dev/null)"; \
58 echo "#define VERSION \"$${v:-$(version)}\"" >$@
59
60.git/index:
61
62clean:
63 rm -f *.o sxiv
64
65install: all
66 @echo "INSTALL bin/sxiv"
67 mkdir -p $(DESTDIR)$(PREFIX)/bin
68 cp sxiv $(DESTDIR)$(PREFIX)/bin/
69 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
70 @echo "INSTALL sxiv.1"
71 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
72 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(version)!g" sxiv.1 \
73 >$(DESTDIR)$(MANPREFIX)/man1/sxiv.1
74 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
75 @echo "INSTALL share/sxiv/"
76 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
77 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
78 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
79
80uninstall:
81 @echo "REMOVE bin/sxiv"
82 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
83 @echo "REMOVE sxiv.1"
84 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
85 @echo "REMOVE share/sxiv/"
86 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv
87