Skip to content

Commit

Permalink
Makefile: improve, some kind of refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sighook committed Dec 28, 2023
1 parent db28e68 commit 7a0a443
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,38 @@ all: help
help:

pod:
@: 1. concatenate pods into handbook pod
@: 2. btw, remove vimline
perl -0pe 's/\R?$$/\n\n/' src/*.pod | sed '/^# vim: .*/d' > ${POD}

man: pod
# remove section numbering from =head[1234] and L</"...">
# remove "=ff" pdf extension
sed -r -e 's/^(=head[12])\s+([0-9\.]+)\s+(.*)/\1 \3/' \
-e 's/^(=head[34])\s+B<([0-9\.]+)\s+(.*)>/\1 B<\3>/' \
-e 's/L<\/"([0-9\.]+)\s+(.*)">/L<\/"\2\">/' \
-e 's/^=ff$$//' \
${POD} > MAN.${POD}
# check generated pod for syntax errors
@: prepare temporary pod file for future manual page:
@: 1. remove section numbering from '=head[1-4]' and 'L</"...">'
@: 2. remove '=ff' pdf extension
sed -e 's/^(=head[12])\s+([0-9\.]+)\s+(.*)/\1 \3/' \
-e 's/^(=head[34])\s+B<([0-9\.]+)\s+(.*)>/\1 B<\3>/' \
-e 's/L<\/"([0-9\.]+)\s+(.*)">/L<\/"\2\">/' \
-e 's/^=ff$$//' \
-r ${POD} > MAN.${POD}
@: 3. check generated pod for syntax errors
podchecker MAN.${POD}
# prepare man page
@: 4. prepare manual page
pod2man -r "${NAME} ${VERSION}" -c "${DESCRIPTION}" \
-n handbook -s 7 MAN.${POD} > ${MAN}

txt: pod
pod2text ${POD} > ${TXT}

pdf: pod
# remove man and html formatting
perl -0pe 's/^=begin man[\r\n].*?^=end man[\r\n]//gms; \
s/^=begin html[\r\n].*?^=end html[\r\n]//gms; \
s/\bPer Lidén\b/Per Liden/gms;' \
${POD} > PDF.${POD}
# check generated pod for syntax errors (skip =ff extension)
@: 1. remove manual page and html formatting sections
@: 2. replace utf8 sentence to fix pdf rendering
perl -0pe 's/^=begin (man|html)[\r\n].*?^=end \1[\r\n]//gms; \
s/\bPer Lidén\b/Per Liden/gms;' ${POD} > PDF.${POD}
@: 3. check generated pod file for syntax errors
@: 4. btw, skip '=ff' pdf extension while checking
sed '/^=ff$$/d' PDF.${POD} | podchecker -
# prepare pdf
pod2pdf --footer-text "${NAME} ${VERSION}" --outlines \
@: 5. prepare pdf
pod2pdf --footer-text "${NAME} ${VERSION}" --outlines \
--title "${DESCRIPTION}" PDF.${POD} > ${PDF}

install-man: man
Expand Down

0 comments on commit 7a0a443

Please sign in to comment.