Krolyxon
Commit e3b68ef

Branches

Refs →

nsxivMakefile

68 lines · 1.5 KB · Makefile

1# Requires GNU make 3.80 or later
2
3VERSION := git-20171006
4
5all: sxiv
6
7include config.mk
8
9CPPFLAGS += -I. -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF)
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
24$(OBJ): config.h Makefile
25
26%.o: %.c
27 @echo "CC $@"
28 $(CC) $(CFLAGS) $(CPPFLAGS) $(DEPFLAGS) -c -o $@ $<
29
30config.h: | config.def.h
31 @echo "GEN $@"
32 cp $| $@
33
34sxiv: $(OBJ)
35 @echo "LINK $@"
36 $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
37
38clean:
39 rm -f $(OBJ) $(DEP) sxiv
40
41install: all
42 @echo "INSTALL bin/sxiv"
43 mkdir -p $(DESTDIR)$(PREFIX)/bin
44 cp sxiv $(DESTDIR)$(PREFIX)/bin/
45 chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
46 @echo "INSTALL sxiv.1"
47 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
48 sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
49 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
50 @echo "INSTALL share/sxiv/"
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 @echo "REMOVE bin/sxiv"
57 rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
58 @echo "REMOVE sxiv.1"
59 rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
60 @echo "REMOVE share/sxiv/"
61 rm -rf $(DESTDIR)$(PREFIX)/share/sxiv
62
63.PHONY: all clean install uninstall
64.SUFFIXES:
65$(V).SILENT:
66
67-include $(DEP)
68