forked from ungleich-public/cdist
further cleanups to the man build system
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
1398cde9f0
commit
8c3782f091
1 changed files with 21 additions and 31 deletions
52
Makefile
52
Makefile
|
@ -5,23 +5,20 @@ MANDIR=$(PREFIX)/share/man
|
||||||
|
|
||||||
# Manpage and HTML
|
# Manpage and HTML
|
||||||
A2XM=a2x -f manpage --no-xmllint
|
A2XM=a2x -f manpage --no-xmllint
|
||||||
# A2XH=a2x -f xhtml --no-xmllint
|
A2XH=a2x -f xhtml --no-xmllint
|
||||||
A2XH=asciidoc -b xhtml11
|
|
||||||
|
|
||||||
# Developer only
|
# Developer webbase
|
||||||
WEBDIR=$$HOME/niconetz
|
WEBDIR=$$HOME/niconetz
|
||||||
WEBBASE=software/cdist
|
WEBBASE=software/cdist
|
||||||
WEBPAGE=$(WEBBASE).mdwn
|
WEBPAGE=$(WEBBASE).mdwn
|
||||||
|
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
MANDIR=doc/man
|
MANDIR=doc/man
|
||||||
|
|
||||||
MAN1DSTDIR=$(MANDIR)/man1
|
MAN1DSTDIR=$(MANDIR)/man1
|
||||||
MAN7DSTDIR=$(MANDIR)/man7
|
MAN7DSTDIR=$(MANDIR)/man7
|
||||||
MANHTMLDIR=$(MANDIR)/html
|
MANHTMLDIR=$(MANDIR)/html
|
||||||
MANTMPDIR=$(MANDIR)/tmp
|
MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR)
|
||||||
MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR)
|
|
||||||
|
|
||||||
MAN1SRC= \
|
MAN1SRC= \
|
||||||
$(MANDIR)/cdist-code-run.text \
|
$(MANDIR)/cdist-code-run.text \
|
||||||
|
@ -53,12 +50,17 @@ MAN7SRC=$(MANDIR)/cdist.text \
|
||||||
$(MANDIR)/cdist-stages.text \
|
$(MANDIR)/cdist-stages.text \
|
||||||
$(MANDIR)/cdist-type.text \
|
$(MANDIR)/cdist-type.text \
|
||||||
|
|
||||||
|
# Manpages from types
|
||||||
MAN7TYPESRC=$(shell ls conf/type/*/man.text)
|
MAN7TYPESRC=$(shell ls conf/type/*/man.text)
|
||||||
MAN7TYPEDST=$(shell for mansrc in $(MAN7TYPESRC:.text=.7); do dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; echo $$dst; done)
|
|
||||||
MAN1DST=$(addprefix $(MAN1DSTDIR)/,$(notdir $(MAN1SRC:.text=.1)))
|
|
||||||
MAN7DST=$(addprefix $(MAN7DSTDIR)/,$(notdir $(MAN7SRC:.text=.7)))
|
|
||||||
MANHTML=$(MAN1DST:.1=.html) $(MAN7DST:.7=.html) $(MAN7TYPEDST:.7=.html)
|
|
||||||
|
|
||||||
|
# Source files after linking them
|
||||||
|
MAN1TMPSRC=$(shell ls $(MAN1DSTDIR)/*.text)
|
||||||
|
MAN7TMPSRC=$(shell ls $(MAN7DSTDIR)/*.text)
|
||||||
|
|
||||||
|
# Destination files based on linked files, not static list
|
||||||
|
MAN1DST=$(MAN1TMPSRC:.text=.1)
|
||||||
|
MAN7DST=$(MAN7TMPSRC:.text=.7)
|
||||||
|
MANHTML=$(MAN1TMPSRC:.text=.html) $(MAN7TMPSRC:.text=.html)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# User targets
|
# User targets
|
||||||
|
@ -81,48 +83,36 @@ all:
|
||||||
# Documentation
|
# Documentation
|
||||||
#
|
#
|
||||||
|
|
||||||
# Type manpages are in no good format for asciidoc, make them look good!
|
# Create manpages
|
||||||
manlink: $(MANTMPDIR)
|
man: $(MAN1DST) $(MAN7DST)
|
||||||
for mansrc in $(MAN7TYPESRC); do \
|
manhtml: $(MANHTML)
|
||||||
dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;$(MANTMPDIR)/;')"; \
|
|
||||||
ln -sf ../../../$$mansrc $$dst; done
|
|
||||||
for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MANTMPDIR); done
|
|
||||||
for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MANTMPDIR); done
|
|
||||||
|
|
||||||
################################################################################
|
$(MANHTML): $(MANHTMLDIR)
|
||||||
|
|
||||||
man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST)
|
|
||||||
|
|
||||||
# Create output dirs
|
# Create output dirs
|
||||||
$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR):
|
$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
# Link source files
|
# Link source files
|
||||||
manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR)
|
manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MANOUTDIRS)
|
||||||
for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done
|
for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done
|
||||||
for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done
|
for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done
|
||||||
for mansrc in $(MAN7TYPESRC); do \
|
for mansrc in $(MAN7TYPESRC); do \
|
||||||
dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \
|
dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \
|
||||||
ln -sf ../../../$$mansrc $$dst; done
|
ln -sf ../../../$$mansrc $$dst; done
|
||||||
|
|
||||||
%.1 %.7: %.text manlink $(MANOUTDIRS)
|
%.1 %.7: %.text manlink
|
||||||
$(A2XM) $*.text
|
$(A2XM) $*.text
|
||||||
|
|
||||||
%.html: %.text manlink
|
%.html: %.text manlink
|
||||||
$(A2XH) -o $(MANHTMLDIR)/$(@F) $<
|
$(A2XH) $<
|
||||||
|
|
||||||
# $(MANHTML): $(MANHTMLDIR)
|
|
||||||
manhtml: $(MANHTML)
|
|
||||||
|
|
||||||
$(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh
|
$(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh
|
||||||
$(MANDIR)/cdist-reference.text.sh
|
$(MANDIR)/cdist-reference.text.sh
|
||||||
$(A2XM) $(MANDIR)/cdist-reference.text
|
|
||||||
$(A2XH) $(MANDIR)/cdist-reference.text
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9]
|
rm -rf $(MANOUTDIRS)
|
||||||
rm -f conf/type/*/man.html $(MANDIR)/cdist-reference.text
|
rm -f $(MANDIR)/cdist-reference.text
|
||||||
rm -rf $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Developer targets
|
# Developer targets
|
||||||
|
|
Loading…
Reference in a new issue