Krolyxon
Commit 171633d

Branches

Refs →

nsxivMakefile

67 lines · 1.5 KB · Makefile

1VERSION := git-20171006
2
3all: sxiv
4
5include config.mk
6
7CPPFLAGS += -I. -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF)
8DEPFLAGS := -MMD -MP
9
10LDLIBS := -lImlib2 -lX11 -lXft
11
12ifneq ($(HAVE_GIFLIB),0)
13 LDLIBS += -lgif
14endif
15ifneq ($(HAVE_LIBEXIF),0)
16 LDLIBS += -lexif
17endif
18
19SRC := autoreload_$(AUTORELOAD).c commands.c image.c main.c options.c thumbs.c util.c window.c
20DEP := $(SRC:.c=.d)
21OBJ := $(SRC:.c=.o)
22
23$(OBJ): config.h Makefile
24
25%.o: %.c
26 @echo "CC $@"
27 $(CC) $(CFLAGS) $(CPPFLAGS) $(DEPFLAGS) -c -o $@ $<
28
29config.h: | config.def.h
30 @echo "GEN $@"
31 cp $| $@
32
33sxiv: $(OBJ)
34 @echo "LINK $@"
35 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
36
37clean:
38 rm -f $(OBJ) $(DEP) sxiv
39
40install: all
41 @echo "INSTALL bin/sxiv"
42 mkdir -p $(DESTDIR)$(PREFIX)/bin
43 cp sxiv $(DESTDIR)$(PREFIX)/bin/
44 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
45 @echo "INSTALL sxiv.1"
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 @echo "INSTALL share/sxiv/"
50 mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
51 cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
52 chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
53
54uninstall:
55 @echo "REMOVE bin/sxiv"
56 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
57 @echo "REMOVE sxiv.1"
58 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
59 @echo "REMOVE share/sxiv/"
60 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv
61
62.PHONY: all clean install uninstall
63.SUFFIXES:
64$(V).SILENT:
65
66-include $(DEP)
67