Skip to content

Commit

Permalink
Generate man pages with m4.
Browse files Browse the repository at this point in the history
Allows substituting current version and release date.
  • Loading branch information
davmac314 committed Jul 14, 2019
1 parent 5e4a269 commit 29cd30b
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

all:
$(MAKE) -C src all
$(MAKE) -C doc/manpages all
@echo "***"
@echo "*** Build complete; use \"make check\" to run unit tests, \"make check-igr\" for"
@echo "*** integration tests, or \"make install\" to install."
Expand All @@ -22,3 +23,4 @@ install:

clean:
$(MAKE) -C src clean
$(MAKE) -C doc/manpages clean
22 changes: 21 additions & 1 deletion doc/manpages/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
include ../../mconfig
include ../../src/version.conf

install:
all: generate

generate: dinit.8 dinitctl.8 dinit-service.5 shutdown.8

install: generate
mkdir -p "$(DESTDIR)$(MANDIR)/man8"
install -m644 dinit.8 dinitctl.8 "$(DESTDIR)$(MANDIR)/man8"
mkdir -p "$(DESTDIR)$(MANDIR)/man5"
Expand All @@ -10,3 +15,18 @@ ifeq ($(BUILD_SHUTDOWN),yes)
ln -f "$(DESTDIR)$(MANDIR)/man8/shutdown.8" "$(DESTDIR)$(MANDIR)/man8/halt.8"
ln -f "$(DESTDIR)$(MANDIR)/man8/shutdown.8" "$(DESTDIR)$(MANDIR)/man8/reboot.8"
endif

clean:
rm -f dinit.8 dinitctl.8 dinit-service.5 shutdown.8

dinit.8: dinit.8.m4
m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) dinit.8.m4 > dinit.8

dinitctl.8: dinitctl.8.m4
m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) dinitctl.8.m4 > dinitctl.8

dinit-service.5: dinit-service.5.m4
m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) dinit-service.5.m4 > dinit-service.5

shutdown.8: shutdown.8.m4
m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) shutdown.8.m4 > shutdown.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.TH DINIT-SERVICE "5" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
changequote(`@@@',`$$$')dnl
@@@.TH DINIT-SERVICE "5" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
.SH NAME
Dinit service description files
.\"
Expand Down Expand Up @@ -452,3 +453,4 @@ More examples are provided with the Dinit distribution.
.\"
.SH AUTHOR
Dinit, and this manual, were written by Davin McCall.
$$$dnl
4 changes: 3 additions & 1 deletion doc/manpages/dinit.8 → doc/manpages/dinit.8.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.TH DINIT "8" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
changequote(`@@@',`$$$')dnl
@@@.TH DINIT "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
.SH NAME
dinit \- supervise processes and manage services
.\"
Expand Down Expand Up @@ -175,3 +176,4 @@ and exit Dinit; SIGQUIT exits Dinit immediately.
.\"
.SH AUTHOR
Dinit, and this manual, were written by Davin McCall.
$$$dnl
4 changes: 3 additions & 1 deletion doc/manpages/dinitctl.8 → doc/manpages/dinitctl.8.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.TH DINITCTL "8" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
changequote(`@@@',`$$$')dnl
@@@.TH DINITCTL "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
.SH NAME
dinitctl \- control services supervised by Dinit
.\"
Expand Down Expand Up @@ -181,3 +182,4 @@ unless pinned.
.\"
.SH AUTHOR
Dinit, and this manual, were written by Davin McCall.
$$$dnl
4 changes: 3 additions & 1 deletion doc/manpages/shutdown.8 → doc/manpages/shutdown.8.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.TH SHUTDOWN "8" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
changequote(`@@@',`$$$')dnl
@@@.TH SHUTDOWN "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
.SH NAME
shutdown, halt, reboot \- system shutdown
.\"
Expand Down Expand Up @@ -58,3 +59,4 @@ system shutdown after it has rolled back services.
.\"
.SH AUTHOR
Dinit, and this manual, were written by Davin McCall.
$$$dnl
4 changes: 4 additions & 0 deletions src/version.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Included from Makefiles.
VERSION=0.5.2
MONTH=June
YEAR=2019

0 comments on commit 29cd30b

Please sign in to comment.