Krolyxon
Commit 824b2cb

Branches

Refs →

nsxivMakefile

111 lines · 2.7 KB · Makefile

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