Krolyxon
Commit a46006f

Branches

Refs →

nsxivMakefile

58 lines · 1.3 KB · Makefile

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