Krolyxon
Commit a1b2fd2

Branches

Refs →

nsxivMakefile

70 lines · 1.5 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 @echo "CC $<"
34 $(CC) $(CFLAGS) $(CPPFLAGS) $(DEPFLAGS) -c -o $@ $<
35
36config.h:
37 @echo "GEN $@"
38 cp $(SRCDIR)/config.def.h $@
39
40sxiv: $(OBJ)
41 @echo "LINK $@"
42 $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
43
44clean:
45 rm -f $(OBJ) $(DEP) sxiv
46
47install: all
48 @echo "INSTALL bin/sxiv"
49 mkdir -p $(DESTDIR)$(PREFIX)/bin
50 cp sxiv $(DESTDIR)$(PREFIX)/bin/
51 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
52 @echo "INSTALL sxiv.1"
53 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
54 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
55 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
56 @echo "INSTALL share/sxiv/"
57 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
58 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
59 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
60
61uninstall:
62 @echo "REMOVE bin/sxiv"
63 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
64 @echo "REMOVE sxiv.1"
65 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
66 @echo "REMOVE share/sxiv/"
67 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv
68
69$(V).SILENT:
70