Krolyxon
Commit a67665a

Branches

Refs →

nsxivMakefile

108 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
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
58clean:
59 rm -f *.o nsxiv version.h
60
61install-all: install install-desktop install-icon
62
63install-desktop:
64 @echo "INSTALL nsxiv.desktop"
65 mkdir -p $(DESTDIR)$(PREFIX)/share/applications
66 cp nsxiv.desktop $(DESTDIR)$(PREFIX)/share/applications
67
68install-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
77uninstall-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
84install: 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" nsxiv.1 \
92 >$(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 examples/* $(DESTDIR)$(EGPREFIX)
97 chmod 755 $(DESTDIR)$(EGPREFIX)/*
98
99uninstall: 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