summaryrefslogtreecommitdiff
blob: 77b41608c275817a0c6c6dd3f058a042d96a502a (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
all: lockfile-create

lockfile-create: lockfile-progs.o
	${CC} -o $@ ${CFLAGS} ${LDFLAGS} $^ -llockfile

install: all
	install -d $(DESTDIR)/usr/bin

	install --mode=755 lockfile-create $(DESTDIR)/usr/bin/lockfile-create
	ln -s lockfile-create $(DESTDIR)/usr/bin/lockfile-remove
	ln -s lockfile-create $(DESTDIR)/usr/bin/lockfile-touch
	ln -s lockfile-create $(DESTDIR)/usr/bin/lockfile-check

	install --mode=755 lockfile-create $(DESTDIR)/usr/bin/mail-lock
	ln -s mail-lock $(DESTDIR)/usr/bin/mail-unlock
	ln -s mail-unlock $(DESTDIR)/usr/bin/mail-touchlock

	install -d $(DESTDIR)/usr/share/man/man1

	install --mode=644 lockfile-progs.1 $(DESTDIR)/usr/share/man/man1
	ln -s lockfile-progs.1 $(DESTDIR)/usr/share/man/man1/lockfile-create.1
	ln -s lockfile-progs.1 $(DESTDIR)/usr/share/man/man1/lockfile-remove.1
	ln -s lockfile-progs.1 $(DESTDIR)/usr/share/man/man1/lockfile-touch.1
	ln -s lockfile-progs.1 $(DESTDIR)/usr/share/man/man1/lockfile-check.1

	ln -s lockfile-progs.1 $(DESTDIR)/usr/share/man/man1/mail-lock.1
	ln -s lockfile-progs.1 $(DESTDIR)/usr/share/man/man1/mail-unlock.1
	ln -s lockfile-progs.1 $(DESTDIR)/usr/share/man/man1/mail-touchlock.1

test: all
	lockfile-create testfile
	lockfile-check testfile
	lockfile-touch --oneshot testfile
	lockfile-check testfile
	lockfile-remove testfile
	! test -e testfile
	! lockfile-check testfile

	lockfile-create --lock-name test.lock
	lockfile-check --lock-name test.lock
	! lockfile-check test.lock
	! test -e test.lock.lock
	lockfile-touch --oneshot --lock-name test.lock
	lockfile-check --lock-name test.lock
	! lockfile-check test.lock
	lockfile-remove --lock-name test.lock
	! test -e test.lock
	! lockfile-check --lock-name test.lock
	! lockfile-check test.lock

.PHONY: install test