Krolyxon
Commit e46b1fa

Branches

Refs →

nsxivMakefile

56 lines · 1.3 KB · Makefile

1VERSION := git-20170908
2
3.PHONY: all clean install uninstall
4.SUFFIXES:
5
6include config.mk
7
8CPPFLAGS += -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF)
9DEPFLAGS := -MMD -MP
10
11LDLIBS := -lImlib2 -lX11 -lXft
12
13ifneq ($(HAVE_GIFLIB),0)
14 LDLIBS += -lgif
15endif
16ifneq ($(HAVE_LIBEXIF),0)
17 LDLIBS += -lexif
18endif
19
20SRC := autoreload_$(AUTORELOAD).c commands.c image.c main.c options.c thumbs.c util.c window.c
21DEP := $(SRC:.c=.d)
22OBJ := $(SRC:.c=.o)
23
24all: config.h sxiv
25
26$(OBJ): Makefile
27
28-include $(DEP)
29
30%.o: %.c
31 $(CC) $(CFLAGS) $(CPPFLAGS) $(DEPFLAGS) -c -o $@ $<
32
33config.h:
34 cp config.def.h $@
35
36sxiv: $(OBJ)
37 $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
38
39clean:
40 rm -f $(OBJ) $(DEP) sxiv
41
42install: all
43 mkdir -p $(DESTDIR)$(PREFIX)/bin
44 cp sxiv $(DESTDIR)$(PREFIX)/bin/
45 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
46 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
47 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
48 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
49 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
50 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
51 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
52
53uninstall:
54 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
55 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
56 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv