Krolyxon
Commit ee908ca

Branches

Refs →

nsxivMakefile

69 lines · 1.5 KB · Makefile

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