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
|
||||
A2XM=a2x -f manpage --no-xmllint
|
||||
# A2XH=a2x -f xhtml --no-xmllint
|
||||
A2XH=asciidoc -b xhtml11
|
||||
A2XH=a2x -f xhtml --no-xmllint
|
||||
|
||||
# Developer only
|
||||
# Developer webbase
|
||||
WEBDIR=$$HOME/niconetz
|
||||
WEBBASE=software/cdist
|
||||
WEBPAGE=$(WEBBASE).mdwn
|
||||
|
||||
|
||||
# Documentation
|
||||
MANDIR=doc/man
|
||||
|
||||
MAN1DSTDIR=$(MANDIR)/man1
|
||||
MAN7DSTDIR=$(MANDIR)/man7
|
||||
MANHTMLDIR=$(MANDIR)/html
|
||||
MANTMPDIR=$(MANDIR)/tmp
|
||||
MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR)
|
||||
MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR)
|
||||
|
||||
MAN1SRC= \
|
||||
$(MANDIR)/cdist-code-run.text \
|
||||
|
@ -53,12 +50,17 @@ MAN7SRC=$(MANDIR)/cdist.text \
|
|||
$(MANDIR)/cdist-stages.text \
|
||||
$(MANDIR)/cdist-type.text \
|
||||
|
||||
# Manpages from types
|
||||
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
|
||||
|
@ -81,48 +83,36 @@ all:
|
|||
# Documentation
|
||||
#
|
||||
|
||||
# Type manpages are in no good format for asciidoc, make them look good!
|
||||
manlink: $(MANTMPDIR)
|
||||
for mansrc in $(MAN7TYPESRC); do \
|
||||
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
|
||||
# Create manpages
|
||||
man: $(MAN1DST) $(MAN7DST)
|
||||
manhtml: $(MANHTML)
|
||||
|
||||
################################################################################
|
||||
|
||||
man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST)
|
||||
$(MANHTML): $(MANHTMLDIR)
|
||||
|
||||
# Create output dirs
|
||||
$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR):
|
||||
mkdir -p $@
|
||||
|
||||
# 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 $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done
|
||||
for mansrc in $(MAN7TYPESRC); do \
|
||||
dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \
|
||||
ln -sf ../../../$$mansrc $$dst; done
|
||||
|
||||
%.1 %.7: %.text manlink $(MANOUTDIRS)
|
||||
%.1 %.7: %.text manlink
|
||||
$(A2XM) $*.text
|
||||
|
||||
%.html: %.text manlink
|
||||
$(A2XH) -o $(MANHTMLDIR)/$(@F) $<
|
||||
|
||||
# $(MANHTML): $(MANHTMLDIR)
|
||||
manhtml: $(MANHTML)
|
||||
$(A2XH) $<
|
||||
|
||||
$(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh
|
||||
$(MANDIR)/cdist-reference.text.sh
|
||||
$(A2XM) $(MANDIR)/cdist-reference.text
|
||||
$(A2XH) $(MANDIR)/cdist-reference.text
|
||||
|
||||
clean:
|
||||
rm -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9]
|
||||
rm -f conf/type/*/man.html $(MANDIR)/cdist-reference.text
|
||||
rm -rf $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR)
|
||||
rm -rf $(MANOUTDIRS)
|
||||
rm -f $(MANDIR)/cdist-reference.text
|
||||
|
||||
################################################################################
|
||||
# Developer targets
|
||||
|
|
Loading…
Reference in a new issue