1include config.mk
2
3all: build-src build-man build-applications
4
5build-src:
6	@${MAKE} -C src
7
8build-man:
9	@${MAKE} -C man
10
11build-applications:
12	@${MAKE} -C share/applications
13
14test: all
15	@if ! uname -m | fgrep -q -e arm -e mips; then \
16		PACKAGE=${PACKAGE} prove test/feh.t test/mandoc.t; \
17	else \
18		PACKAGE=${PACKAGE} prove test/feh.t test/mandoc.t || cat test/imlib2-bug-notice; \
19	fi
20
21test-x11: all
22	test/run-interactive
23	prove test/feh-bg-i.t
24
25install: install-man install-doc install-bin install-font install-img
26install: install-icon install-examples install-applications
27
28install-man:
29	@echo installing manuals to ${man_dir}
30	@mkdir -p ${man_dir}/man1
31	@cp man/feh.1 ${man_dir}/man1
32	@chmod 644 ${man_dir}/man1/feh.1
33
34install-doc:
35	@echo installing docs to ${doc_dir}
36	@mkdir -p ${doc_dir}
37	@cp AUTHORS ChangeLog README.md TODO ${doc_dir}
38	@chmod 644 ${doc_dir}/AUTHORS ${doc_dir}/ChangeLog ${doc_dir}/README.md \
39		${doc_dir}/TODO
40
41install-bin:
42	@echo installing executables to ${bin_dir}
43	@mkdir -p ${bin_dir}
44	@cp src/feh ${bin_dir}/feh.tmp
45	@mv ${bin_dir}/feh.tmp ${bin_dir}/feh
46	@chmod 755 ${bin_dir}/feh
47
48install-font:
49	@echo installing fonts to ${font_dir}
50	@mkdir -p ${font_dir}
51	@chmod 755 ${font_dir}
52	@cp share/fonts/* ${font_dir}
53	@chmod 644 ${font_dir}/*
54
55install-img:
56	@echo installing images to ${image_dir}
57	@mkdir -p ${image_dir}
58	@chmod 755 ${image_dir}
59	@cp share/images/* ${image_dir}
60	@chmod 644 ${image_dir}/*
61
62install-icon:
63	@echo installing icon to ${48_icon_dir}
64	@mkdir -p ${48_icon_dir}
65	@cp share/images/feh.png ${48_icon_dir}
66	@chmod 644 ${48_icon_dir}/feh.png
67	@echo installing icon to ${scalable_icon_dir}
68	@mkdir -p ${scalable_icon_dir}
69	@cp share/images/feh.svg ${scalable_icon_dir}
70	@chmod 644 ${scalable_icon_dir}/feh.svg
71	@if test "${app}" = 1 && which gtk-update-icon-cache > /dev/null 2>&1; then \
72		gtk-update-icon-cache ${icon_dir}; \
73	fi
74
75install-examples:
76	@echo installing examples to ${example_dir}
77	@mkdir -p ${example_dir}
78	@cp examples/* ${example_dir}
79	@chmod 644 ${example_dir}/*
80
81install-applications:
82	@echo installing desktop file to ${desktop_dir}
83	@mkdir -p ${desktop_dir}
84	@cp share/applications/feh.desktop ${desktop_dir}
85	@chmod 644 ${desktop_dir}/feh.desktop
86
87
88uninstall:
89	rm -f ${man_dir}/man1/feh.1
90	rm -rf ${doc_dir}
91	rm -f ${bin_dir}/feh
92	rm -f ${desktop_dir}/feh.desktop
93	rm -rf ${font_dir}
94	rm -rf ${image_dir}
95	@if test -e ${48_icon_dir}/feh.png; then \
96		echo rm -f ${48_icon_dir}/feh.png; \
97		rm -f ${48_icon_dir}/feh.png; \
98	fi
99	@if test -e ${scalable_icon_dir}/feh.svg; then \
100		echo rm -f ${scalable_icon_dir}/feh.svg; \
101		rm -f ${scalable_icon_dir}/feh.svg; \
102	fi
103	@if which gtk-update-icon-cache > /dev/null 2>&1; then \
104		gtk-update-icon-cache ${icon_dir}; \
105	fi
106
107dist:
108	mkdir /tmp/feh-${VERSION}
109	git --work-tree=/tmp/feh-${VERSION} checkout -f
110	cp src/deps.mk /tmp/feh-${VERSION}/src/deps.mk
111	sed -i 's/^VERSION ?= .*$$/VERSION ?= ${VERSION}/' \
112		/tmp/feh-${VERSION}/config.mk
113	sed -i 's/^MAN_DATE ?= .*$$/MAN_DATE ?= ${MAN_DATE}/' \
114		/tmp/feh-${VERSION}/config.mk
115	tar -C /tmp -cjf ../feh-${VERSION}.tar.bz2 feh-${VERSION}
116	rm -r /tmp/feh-${VERSION}
117
118disttest: dist
119	tar -C /tmp -xjf ../feh-${VERSION}.tar.bz2
120	make -C /tmp/feh-${VERSION}
121	make -C /tmp/feh-${VERSION} test
122	make -C /tmp/feh-${VERSION} install DESTDIR=./install
123	make -C /tmp/feh-${VERSION} uninstall DESTDIR=./install
124	rm -r /tmp/feh-${VERSION}
125
126clean:
127	@${MAKE} -C src clean
128	@${MAKE} -C man clean
129	@${MAKE} -C share/applications clean
130
131.PHONY: all test test-x11 install uninstall clean install-man install-doc \
132	install-bin install-font install-img install-examples \
133	install-applications dist
134