| 1 |
# pod2man.mk -- Makefile portion to convert *.pod files to manual pages |
| 2 |
# |
| 3 |
# Copyright information |
| 4 |
# |
| 5 |
# Copyright (C) 2010 Jari Aalto |
| 6 |
# Copyright (C) 2010-2025 Erwin Waterlander |
| 7 |
# |
| 8 |
# License |
| 9 |
# |
| 10 |
# Redistribution and use in source and binary forms, with or |
| 11 |
# without modification, are permitted provided that the |
| 12 |
# following conditions are met: |
| 13 |
# |
| 14 |
# 1. Redistributions of source code must retain the above |
| 15 |
# copyright notice, this list of conditions and the following |
| 16 |
# disclaimer. |
| 17 |
# |
| 18 |
# 2. Redistributions in binary form must reproduce the above |
| 19 |
# copyright notice, this list of conditions and the following |
| 20 |
# disclaimer in the documentation and/or other materials |
| 21 |
# provided with the distribution. |
| 22 |
# |
| 23 |
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR |
| 24 |
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 25 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 26 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OF THIS |
| 27 |
# FILE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 28 |
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 29 |
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 30 |
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 31 |
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 32 |
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 33 |
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 34 |
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 35 |
# DAMAGE. |
| 36 |
# |
| 37 |
# The license text is copy of the FreeBSD License available at |
| 38 |
# <http://www.gnu.org/copyleft/gpl.html> with following |
| 39 |
# modifications: wording "THIS SOFTWARE IS PROVIDED BY THE |
| 40 |
# FREEBSD PROJECT" was changed to "THIS SOFTWARE IS PROVIDED 'AS |
| 41 |
# IS'" and wording "IN NO EVENT SHALL THE FREEBSD PROJECT" was |
| 42 |
# changed to "IN NO EVENT SHALL THE AUTHOR(S)" |
| 43 |
# |
| 44 |
# Description |
| 45 |
# |
| 46 |
# Convert *.pod files to manual pages. |
| 47 |
|
| 48 |
ifneq (,) |
| 49 |
This makefile requires GNU Make. |
| 50 |
endif |
| 51 |
|
| 52 |
include ../../version.mk |
| 53 |
|
| 54 |
.PRECIOUS: %.pod |
| 55 |
|
| 56 |
# This variable *must* be set when calling |
| 57 |
PACKAGE ?= dos2unix |
| 58 |
|
| 59 |
# Optional variables to set |
| 60 |
MANSECT ?= 1 |
| 61 |
PODCENTER ?= $(DOS2UNIX_DATE) |
| 62 |
|
| 63 |
POD2MAN = pod2man |
| 64 |
POD2MAN_FLAGS = |
| 65 |
|
| 66 |
POFILES = $(wildcard ../../po-man/*.po) |
| 67 |
PODFILES = $(patsubst ../../po-man/%.po,../%/man1/dos2unix.pod,$(POFILES)) |
| 68 |
MAN_OBJECTS = dos2unix.1 $(patsubst %.pod,%.1,$(PODFILES)) |
| 69 |
|
| 70 |
MKDIR = mkdir |
| 71 |
|
| 72 |
all: $(MAN_OBJECTS) |
| 73 |
|
| 74 |
# Create translated pod files from dos2unix.pod. |
| 75 |
$(PODFILES) &: $(POFILES) dos2unix.pod |
| 76 |
touch ../../po-man/dos2unix-man.pot |
| 77 |
po4a --wrap-po no -k 65 --msgmerge-opt --no-wrap po4a.cfg |
| 78 |
|
| 79 |
%.1 : %.pod |
| 80 |
# make target - create manual page from a *.pod page |
| 81 |
podchecker $< |
| 82 |
$(POD2MAN) $(POD2MAN_FLAGS) \ |
| 83 |
--utf8 \ |
| 84 |
--center="$(PODCENTER)" \ |
| 85 |
--name="$(PACKAGE)" \ |
| 86 |
--section="$(MANSECT)" \ |
| 87 |
$< \ |
| 88 |
| perl -p -e 's/[Pp]erl v[0-9.]+/$(PACKAGE)/;' \ |
| 89 |
> $@ && \ |
| 90 |
rm -f pod*.tmp |
| 91 |
|
| 92 |
|
| 93 |
clean: |
| 94 |
rm -f $(MAN_OBJECTS) |
| 95 |
rm -f ../../po-man/dos2unix-man.pot |
| 96 |
rm -f $(PODFILES) |