Krolyxon
Commit c027122

Branches

Refs →

nsxivMakefile

66 lines · 1.5 KB · Makefile

1VERSION := git-20170517
2
3PREFIX := /usr/local
4MANPREFIX := $(PREFIX)/share/man
5
6CC ?= gcc
7CFLAGS += -std=c99 -Wall -pedantic
8CPPFLAGS += -I/usr/include/freetype2 -D_XOPEN_SOURCE=700
9LDFLAGS +=
10LIBS := -lImlib2 -lX11 -lXft
11
12# optional dependencies:
13# giflib: gif animations
14ifndef NO_GIFLIB
15 CPPFLAGS += -DHAVE_GIFLIB
16 LIBS += -lgif
17endif
18# libexif: jpeg auto-orientation, exif thumbnails
19ifndef NO_LIBEXIF
20 CPPFLAGS += -DHAVE_LIBEXIF
21 LIBS += -lexif
22endif
23
24# select autoreload backend
25# overwritten with `make AUTORELOAD=nop`
26AUTORELOAD := inotify
27
28.PHONY: clean install uninstall
29
30SRC := autoreload_$(AUTORELOAD).c commands.c image.c main.c options.c thumbs.c util.c window.c
31DEP := $(SRC:.c=.d)
32OBJ := $(SRC:.c=.o)
33
34all: config.h sxiv
35
36$(OBJ): Makefile
37
38-include $(DEP)
39
40%.o: %.c
41 $(CC) $(CFLAGS) $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -MMD -MP -c -o $@ $<
42
43config.h:
44 cp config.def.h $@
45
46sxiv: $(OBJ)
47 $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
48
49clean:
50 rm -f $(OBJ) $(DEP) sxiv
51
52install: all
53 mkdir -p $(DESTDIR)$(PREFIX)/bin
54 cp sxiv $(DESTDIR)$(PREFIX)/bin/
55 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
56 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
57 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
58 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
59 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
60 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
61 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
62
63uninstall:
64 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
65 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
66 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv