Krolyxon
Commit d9e60cb

Branches

Refs →

nsxivMakefile

88 lines · 2.0 KB · Makefile

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