Debian Codegraph @

Makefile

raw ◀ ▶
1 Debian patch touch this file
1 .POSIX:
2
3 include config.mk
4
5 inc_fonts_0 =
6 inc_fonts_1 = -I/usr/include/freetype2 -I$(PREFIX)/include/freetype2
7 lib_fonts_0 =
8 lib_fonts_1 = -lXft -lfontconfig
9 lib_exif_0 =
10 lib_exif_1 = -lexif
11
12 nsxiv_cppflags = -D_XOPEN_SOURCE=700 \
13 -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) -DHAVE_LIBFONTS=$(HAVE_LIBFONTS) \
14 -DHAVE_INOTIFY=$(HAVE_INOTIFY) $(inc_fonts_$(HAVE_LIBFONTS)) \
15 $(CPPFLAGS)
16
17 nsxiv_ldlibs = -lImlib2 -lX11 \
18 $(lib_exif_$(HAVE_LIBEXIF)) $(lib_fonts_$(HAVE_LIBFONTS)) \
19 $(LDLIBS)
20
21 objs = autoreload.o commands.o image.o main.o options.o \
22 thumbs.o util.o window.o
23
24 .SUFFIXES:
25 .SUFFIXES: .c .o
26
27 all: nsxiv
28
29 nsxiv: $(objs)
30 @echo "LINK $@"
31 $(CC) $(LDFLAGS) -o $@ $(objs) $(nsxiv_ldlibs)
32
33 .c.o:
34 @echo "CC $@"
35 $(CC) $(CFLAGS) $(nsxiv_cppflags) -c -o $@ $<
36
37 $(objs): Makefile config.mk nsxiv.h config.h commands.h
38 options.o: version.h optparse.h
39 window.o: icon/data.h utf8.h
40
41 config.h:
42 @echo "GEN $@"
43 cp config.def.h $@
44
•45 version.h: config.mk $(wildcard .git/index)
46 @v="$$(git describe 2>/dev/null || true)"; \
47 payload=$$(printf '#define VERSION "%s"' "$${v:-$(VERSION)}"); \
48 if ! printf '%s\n' "$$payload" | cmp -s - "$@" 2>/dev/null; then \
49 echo "GEN $@"; \
50 printf '%s\n' "$$payload" >"$@"; \
51 fi
52
53 .git/index:
54
55 dump_cppflags:
56 @echo $(nsxiv_cppflags)
57
58 clean:
59 rm -f *.o nsxiv version.h
60
61 install-all: install install-desktop install-icon
62
63 install-desktop:
64 @echo "INSTALL nsxiv.desktop"
65 mkdir -p $(DESTDIR)$(PREFIX)/share/applications
66 cp etc/nsxiv.desktop $(DESTDIR)$(PREFIX)/share/applications
67
68 install-icon:
69 @echo "INSTALL icon"
70 for f in $(ICONS); do \
71 dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \
72 mkdir -p "$$dir"; \
73 cp "icon/$$f" "$$dir/nsxiv.png"; \
74 chmod 644 "$$dir/nsxiv.png"; \
75 done
76
77 uninstall-icon:
78 @echo "REMOVE icon"
79 for f in $(ICONS); do \
80 dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \
81 rm -f "$$dir/nsxiv.png"; \
82 done
83
84 install: all
85 @echo "INSTALL bin/nsxiv"
86 mkdir -p $(DESTDIR)$(PREFIX)/bin
87 cp nsxiv $(DESTDIR)$(PREFIX)/bin/
88 chmod 755 $(DESTDIR)$(PREFIX)/bin/nsxiv
89 @echo "INSTALL nsxiv.1"
90 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
91 sed "s!EGPREFIX!$(EGPREFIX)!g; s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" \
92 etc/nsxiv.1 >$(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
93 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
94 @echo "INSTALL share/nsxiv/"
95 mkdir -p $(DESTDIR)$(EGPREFIX)
96 cp etc/examples/* $(DESTDIR)$(EGPREFIX)
97 chmod 755 $(DESTDIR)$(EGPREFIX)/*
98
99 uninstall: uninstall-icon
100 @echo "REMOVE bin/nsxiv"
101 rm -f $(DESTDIR)$(PREFIX)/bin/nsxiv
102 @echo "REMOVE nsxiv.1"
103 rm -f $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
104 @echo "REMOVE nsxiv.desktop"
105 rm -f $(DESTDIR)$(PREFIX)/share/applications/nsxiv.desktop
106 @echo "REMOVE share/nsxiv/"
107 rm -rf $(DESTDIR)$(EGPREFIX)
108