aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 99f6e4af7a0aea98fe6c61c9410513f5a8327a3b (plain) (blame)
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
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.  This file is offered as-is,
# without any warranty.

PREFIX = /usr
DATA = /share
BIN = /bin
LIBEXEC = /libexec
PKGNAME = mongoclock
COMMAND = mongoclock
LICENSES = $(PREFIX)$(DATA)


all: mongoclock.install doc

doc: info

info: mongoclock.info.gz

%.info.gz: info/%.texinfo
	makeinfo "$<"
	gzip -9 -f "$*.info"

mongoclock.install: mongoclock
	cp "$<" "$@"
	sed -i 's:$$0.py:$(PREFIX)$(LIBEXEC)/$(COMMAND).py:g' "$@"

install: install-cmd install-license install-info

install-cmd:
	install -dm755 "$(DESTDIR)$(PREFIX)$(BIN)"
	install -dm755 "$(DESTDIR)$(PREFIX)$(LIBEXEC)"
	install -m755 mongoclock.install "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
	install -m755 mongoclock.py "$(DESTDIR)$(PREFIX)$(LIBEXEC)/$(COMMAND).py"

install-license:
	install -dm755 "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
	install -m644 COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)"

install-info: mongoclock.info.gz
	install -dm755 "$(DESTDIR)$(PREFIX)$(DATA)/info"
	install -m644 mongoclock.info.gz "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"

uninstall:
	-rm -- "$(DESTDIR)$(PREFIX)$(BIN)/$(COMMAND)"
	-rm -- "$(DESTDIR)$(PREFIX)$(LIBEXEC)/$(COMMAND).py"
	-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/COPYING"
	-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/LICENSE"
	-rmdir -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
	-rm -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"

.PHONY: clean
clean:
	-rm -f mongoclock.info.gz mongoclock.install