Krolyxon
Branch master

Branches

Refs →

nsxivMakefile

107 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
47version.h: config.mk .git/index
48 @echo "GEN $@"
49 v="$$(git describe 2>/dev/null || true)"; \
50 echo "#define VERSION \"$${v:-$(VERSION)}\"" >$@
51
52.git/index:
53
54dump_cppflags:
55 @echo $(nsxiv_cppflags)
56
57clean:
58 rm -f *.o nsxiv version.h
59
60install-all: install install-desktop install-icon
61
62install-desktop:
63 @echo "INSTALL nsxiv.desktop"
64 mkdir -p $(DESTDIR)$(PREFIX)/share/applications
65 cp etc/nsxiv.desktop $(DESTDIR)$(PREFIX)/share/applications
66
67install-icon:
68 @echo "INSTALL icon"
69 for f in $(ICONS); do \
70 dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \
71 mkdir -p "$$dir"; \
72 cp "icon/$$f" "$$dir/nsxiv.png"; \
73 chmod 644 "$$dir/nsxiv.png"; \
74 done
75
76uninstall-icon:
77 @echo "REMOVE icon"
78 for f in $(ICONS); do \
79 dir="$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${f%.png}/apps"; \
80 rm -f "$$dir/nsxiv.png"; \
81 done
82
83install: all
84 @echo "INSTALL bin/nsxiv"
85 mkdir -p $(DESTDIR)$(PREFIX)/bin
86 cp nsxiv $(DESTDIR)$(PREFIX)/bin/
87 chmod 755 $(DESTDIR)$(PREFIX)/bin/nsxiv
88 @echo "INSTALL nsxiv.1"
89 mkdir -p $(DESTDIR)$(MANPREFIX)/man1
90 sed "s!EGPREFIX!$(EGPREFIX)!g; s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" \
91 etc/nsxiv.1 >$(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
92 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
93 @echo "INSTALL share/nsxiv/"
94 mkdir -p $(DESTDIR)$(EGPREFIX)
95 cp etc/examples/* $(DESTDIR)$(EGPREFIX)
96 chmod 755 $(DESTDIR)$(EGPREFIX)/*
97
98uninstall: uninstall-icon
99 @echo "REMOVE bin/nsxiv"
100 rm -f $(DESTDIR)$(PREFIX)/bin/nsxiv
101 @echo "REMOVE nsxiv.1"
102 rm -f $(DESTDIR)$(MANPREFIX)/man1/nsxiv.1
103 @echo "REMOVE nsxiv.desktop"
104 rm -f $(DESTDIR)$(PREFIX)/share/applications/nsxiv.desktop
105 @echo "REMOVE share/nsxiv/"
106 rm -rf $(DESTDIR)$(EGPREFIX)
107