diff options
Diffstat (limited to '')
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | Makefile | 47 | ||||
-rw-r--r-- | doc/man/alarm.1 | 59 |
3 files changed, 104 insertions, 4 deletions
@@ -1,5 +1,5 @@ alarm — Schedule an alarm for a program when starting it -Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) +Copyright © 2014, 2015 Mattias Andrée (maandree@member.fsf.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,6 +14,14 @@ DATA = /share BINDIR = $(PREFIX)$(BIN) # The resource path including prefix. DATADIR = $(PREFIX)$(DATA) +# The general documentation path including prefix. +DOCDIR = $(DATADIR)/doc +# The info manual path including prefix. +INFODIR = $(DATADIR)/info +# The man page path including prefix. +MANDIR = $(DATADIR)/man +# The man page section 1 path including prefix. +MAN1DIR = $(MANDIR)/man1 # The license base path including prefix. LICENSEDIR = $(DATADIR)/licenses @@ -43,8 +51,18 @@ WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self \ STD = c99 + +.PHONY: default +default: command + .PHONY: all -all: bin/alarm +all: command + +.PHONY: base +base: command + +.PHONY: command +command: bin/alarm bin/alarm: obj/alarm.o @mkdir -p bin @@ -55,13 +73,34 @@ obj/%.o: src/%.c $(CC) $(WARN) -std=$(STD) $(OPTIMISE) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + .PHONY: install -install: bin/alarm +install: install-base install-man + +.PHONY: install-all +install-all: install-base install-doc + +.PHONY: install-base +install-base: install-command install-license + +.PHONY: install-command +install-command: bin/alarm install -dm755 -- "$(DESTDIR)$(BINDIR)" - install -m755 bin/alarm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + install -m755 $^ -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + +.PHONY: install-license +install-license: install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" install -m644 COPYING LICENSE -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" +.PHONY: install-doc +install-doc: install-man + +install-man: doc/man/alarm.1 + install -dm755 -- "$(DESTDIR)$(MAN1DIR)" + install -m644 $< -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" + + .PHONY: uninstall uninstall: @@ -69,6 +108,8 @@ uninstall: -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + -rm -- "$(DESTDIR)$(MAN1)/$(COMMAND).1" + .PHONY: clean diff --git a/doc/man/alarm.1 b/doc/man/alarm.1 new file mode 100644 index 0000000..cc81977 --- /dev/null +++ b/doc/man/alarm.1 @@ -0,0 +1,59 @@ +.TH ALARM 1 ALARM +.SH NAME +alarm - Schedule an alarm for a program when starting it +.SH SYNOPSIS +.BR alarm +.IR DURATION +.IR COMMAND +.RI [ ARGS ...] +.SH DESCRIPTION +Schedules an +.BR alarm (3) +to best triggered after a specified +.IR DURATION . +The process than +.BR execvp (3) +into +.IR COMMAND\ ARGS . +.PP +This means that +.IR COMMAND +will be killed by +.BR SIGALRM +after a selected +.IR DURATION . +.PP +.IR DURATION +must be a non-negative integer, no larger than 18h12m15s. +Recognised patterns for +.IR DURATION +are: +.TP +* +.IR SECONDS [s] +.TP +* +.IR MINUTES m[ SECONDS s] +.TP +* +.IR HOURS h[ MINUTES m][ SECONDS s] +.SH RATIONALE +This program is useful when testing programs for a limited +duration. Especially when running in the background, or +there is a chance of it locking the computer. +.SH "SEE ALSO" +.BR alarm (3) +.SH AUTHORS +Principal author, Mattias Andrée. See the COPYING file for the full +list of authors. +.SH LICENSE +Copyright \(co 2014, 2015 Mattias Andrée +.br +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. +.br +This is free software: you are free to change and redistribute it. +.br +There is NO WARRANTY, to the extent permitted by law. +.SH BUGS +Please report bugs to https://github.com/maandree/alarm/issues or to +maandree@member.fsf.org |