Krolyxon
Commit 6216bf6

Branches

Refs →

nsxivMakefile

48 lines · 1.2 KB · Makefile

1VERSION := git-20141201
2
3PREFIX := /usr/local
4MANPREFIX := $(PREFIX)/share/man
5
6CC ?= gcc
7CFLAGS += -std=c99 -Wall -pedantic
8CPPFLAGS += -I$(PREFIX)/include -D_XOPEN_SOURCE=500 -DHAVE_LIBEXIF -DHAVE_GIFLIB
9LDFLAGS += -L$(PREFIX)/lib
10LIBS := -lX11 -lImlib2 -lexif -lgif
11
12SRC := commands.c image.c main.c options.c thumbs.c util.c window.c
13DEP := $(SRC:.c=.d)
14OBJ := $(SRC:.c=.o)
15
16all: config.h sxiv
17
18$(OBJ): Makefile
19
20-include $(DEP)
21
22%.o: %.c
23 $(CC) $(CFLAGS) $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -MMD -MP -c -o $@ $<
24
25config.h:
26 cp config.def.h $@
27
28sxiv: $(OBJ)
29 $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
30
31clean:
32 rm -f $(OBJ) $(DEP) sxiv
33
34install: all
35 mkdir -p $(DESTDIR)$(PREFIX)/bin
36 cp sxiv $(DESTDIR)$(PREFIX)/bin/
37 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
38 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
39 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
40 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
41 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
42 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
43 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
44
45uninstall:
46 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
47 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
48 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv