Krolyxon
Commit 1c260e7

Branches

Refs →

nsxivMakefile

62 lines · 1.4 KB · Makefile

1VERSION := git-20161228
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.PHONY: clean install uninstall
25
26SRC := commands.c image.c main.c options.c thumbs.c util.c window.c
27DEP := $(SRC:.c=.d)
28OBJ := $(SRC:.c=.o)
29
30all: config.h sxiv
31
32$(OBJ): Makefile
33
34-include $(DEP)
35
36%.o: %.c
37 $(CC) $(CFLAGS) $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -MMD -MP -c -o $@ $<
38
39config.h:
40 cp config.def.h $@
41
42sxiv: $(OBJ)
43 $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
44
45clean:
46 rm -f $(OBJ) $(DEP) sxiv
47
48install: all
49 mkdir -p $(DESTDIR)$(PREFIX)/bin
50 cp sxiv $(DESTDIR)$(PREFIX)/bin/
51 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
52 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
53 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
54 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
55 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
56 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
57 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
58
59uninstall:
60 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
61 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
62 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv