summaryrefslogtreecommitdiff
path: root/Makefile
blob: 099bf5ed94e2ca2d5e904b66bc86163e4075bafc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
include config.mk

all: build-src build-man build-applications

build-src:
	@${MAKE} -C src

build-man:
	@${MAKE} -C man

build-applications:
	@${MAKE} -C share/applications

test: all
	@if ! uname -m | fgrep -q -e arm -e mips; then \
		PACKAGE=${PACKAGE} prove test/feh.t test/mandoc.t; \
	else \
		PACKAGE=${PACKAGE} prove test/feh.t test/mandoc.t || cat test/imlib2-bug-notice; \
	fi

test-x11: all
	test/run-interactive
	prove test/feh-bg-i.t

install: install-man install-doc install-bin install-font install-img
install: install-icon install-examples install-applications

ifeq (${cam},1)
install: install-cam
uninstall: uninstall-cam
endif

install-cam:
	@echo installing fe-cam and gen-cam-menu
	@cp man/feh-cam.1 man/gen-cam-menu.1 ${man_dir}/man1
	@chmod 644 ${man_dir}/man1/feh-cam.1 ${man_dir}/man1/gen-cam-menu.1
	@cp cam/feh-cam cam/gen-cam-menu ${bin_dir}
	@chmod 755 ${bin_dir}/feh-cam ${bin_dir}/gen-cam-menu

uninstall-cam:
	rm -f ${man_dir}/man1/feh-cam.1
	rm -f ${man_dir}/man1/gen-cam-menu.1
	rm -f ${bin_dir}/feh-cam ${bin_dir}/gen-cam-menu

install-man:
	@echo installing manuals to ${man_dir}
	@mkdir -p ${man_dir}/man1
	@cp man/feh.1 ${man_dir}/man1
	@chmod 644 ${man_dir}/man1/feh.1

install-doc:
	@echo installing docs to ${doc_dir}
	@mkdir -p ${doc_dir}
	@cp AUTHORS ChangeLog README TODO ${doc_dir}
	@chmod 644 ${doc_dir}/AUTHORS ${doc_dir}/ChangeLog ${doc_dir}/README \
		${doc_dir}/TODO

install-bin:
	@echo installing executables to ${bin_dir}
	@mkdir -p ${bin_dir}
	@cp src/feh ${bin_dir}
	@chmod 755 ${bin_dir}/feh

install-font:
	@echo installing fonts to ${font_dir}
	@mkdir -p ${font_dir}
	@cp share/fonts/* ${font_dir}
	@chmod 644 ${font_dir}/*

install-img:
	@echo installing images to ${image_dir}
	@mkdir -p ${image_dir}
	@cp share/images/* ${image_dir}
	@chmod 644 ${image_dir}/*

install-icon:
	@echo installing icon to ${48_icon_dir}
	@mkdir -p ${48_icon_dir}
	@cp share/images/feh.png ${48_icon_dir}
	@echo installing icon to ${scalable_icon_dir}
	@mkdir -p ${scalable_icon_dir}
	@cp share/images/feh.svg ${scalable_icon_dir}
	@gtk-update-icon-cache ${icon_dir}

install-examples:
	@echo installing examples to ${example_dir}
	@mkdir -p ${example_dir}
	@cp examples/* ${example_dir}
	@chmod 644 ${example_dir}/*

install-applications:
	@echo installing desktop file to ${desktop_dir}
	@mkdir -p ${desktop_dir}
	@cp share/applications/feh.desktop ${desktop_dir}
	@chmod 644 ${desktop_dir}/feh.desktop


uninstall:
	rm -f ${man_dir}/man1/feh.1 ${man_dir}/man1/feh-cam.1
	rm -f ${man_dir}/man1/gen-cam-menu.1
	rm -rf ${doc_dir}
	rm -f ${bin_dir}/feh ${bin_dir}/feh-cam ${bin_dir}/gen-cam-menu
	rm -f ${desktop_dir}/feh.desktop
	rm -rf ${font_dir}
	rm -rf ${image_dir}

dist:
	mkdir /tmp/feh-${VERSION}
	git --work-tree=/tmp/feh-${VERSION} checkout -f
	cp src/deps.mk /tmp/feh-${VERSION}/src/deps.mk
	sed -i 's/^VERSION ?= .*$$/VERSION ?= ${VERSION}/' \
		/tmp/feh-${VERSION}/config.mk
	sed -i 's/^MAN_DATE ?= .*$$/MAN_DATE ?= ${MAN_DATE}/' \
		/tmp/feh-${VERSION}/config.mk
	tar -C /tmp -cjf ../feh-${VERSION}.tar.bz2 feh-${VERSION}
	rm -r /tmp/feh-${VERSION}

disttest: dist
	tar -C /tmp -xjf ../feh-${VERSION}.tar.bz2
	make -C /tmp/feh-${VERSION}
	make -C /tmp/feh-${VERSION} test
	make -C /tmp/feh-${VERSION} install DESTDIR=./install
	make -C /tmp/feh-${VERSION} uninstall DESTDIR=./install
	rm -r /tmp/feh-${VERSION}

clean:
	@${MAKE} -C src clean
	@${MAKE} -C man clean
	@${MAKE} -C share/applications clean

.PHONY: all test test-x11 install uninstall clean install-man install-doc \
	install-bin install-font install-img install-examples \
	install-applications dist