Krolyxon
Commit d69f39e

Branches

Refs →

nsxivMakefile

59 lines · 1.4 KB · Makefile

1VERSION := git-20160810
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
14 CPPFLAGS += -DHAVE_GIFLIB
15 LIBS += -lgif
16# libexif: jpeg auto-orientation, exif thumbnails
17 CPPFLAGS += -DHAVE_LIBEXIF
18 LIBS += -lexif
19
20
21.PHONY: clean install uninstall
22
23SRC := commands.c image.c main.c options.c thumbs.c util.c window.c
24DEP := $(SRC:.c=.d)
25OBJ := $(SRC:.c=.o)
26
27all: config.h sxiv
28
29$(OBJ): Makefile
30
31-include $(DEP)
32
33%.o: %.c
34 $(CC) $(CFLAGS) $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -MMD -MP -c -o $@ $<
35
36config.h:
37 cp config.def.h $@
38
39sxiv: $(OBJ)
40 $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
41
42clean:
43 rm -f $(OBJ) $(DEP) sxiv
44
45install: all
46 mkdir -p $(DESTDIR)$(PREFIX)/bin
47 cp sxiv $(DESTDIR)$(PREFIX)/bin/
48 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
49 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
50 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
51 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
52 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
53 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
54 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
55
56uninstall:
57 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
58 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
59 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv