-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.perl.mk
136 lines (128 loc) · 4.49 KB
/
build.perl.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#
# Copyright (c) 2001-2020 Julien Nadeau Carriere <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Install Perl scripts and modules.
#
PERL?=/usr/bin/perl
SCRIPTS?=
MODULES?=
DATAFILES?=
MODULES_DIR?=${DATADIR}/perl
SCRIPTS_SUBST?=
MODULES_SUBST?=
CLEANFILES?=
all: all-subdir
install: all install-perl install-subdir
deinstall: deinstall-perl deinstall-subdir
clean: clean-perl clean-subdir
cleandir: clean-perl clean-subdir cleandir-subdir
regress: regress-subdir
depend: depend-subdir
install-perl:
@if [ "${DESTDIR}" != "" ]; then \
echo "# Installing under DESTDIR=${DESTDIR}:"; \
if [ ! -e "${DESTDIR}" ]; then \
echo "${INSTALL_DESTDIR} ${DESTDIR}"; \
${SUDO} ${INSTALL_DESTDIR} ${DESTDIR}; \
fi; \
fi
@if [ "${SCRIPTS}" != "" ]; then \
if [ ! -d "${DESTDIR}${BINDIR}" ]; then \
echo "${INSTALL_PROG_DIR} ${BINDIR}"; \
${SUDO} ${INSTALL_PROG_DIR} ${DESTDIR}${BINDIR}; \
fi; \
if [ "${SCRIPTS_SUBST}" != "" ]; then \
for F in ${SCRIPTS}; do \
echo "sed -e '${SCRIPTS_SUBST}' $$F > $$F.prep"; \
sed -e '${SCRIPTS_SUBST}' $$F > $$F.prep; \
echo "${INSTALL_PROG} $$F.prep ${BINDIR}/$$F"; \
${SUDO} ${INSTALL_PROG} $$F.prep ${DESTDIR}${BINDIR}/$$F; \
rm -f $$F.prep; \
done; \
else \
for F in ${SCRIPTS}; do \
echo "${INSTALL_PROG} $$F ${BINDIR}"; \
${SUDO} ${INSTALL_PROG} $$F ${DESTDIR}${BINDIR}; \
done; \
fi; \
fi
@if [ "${MODULES}" != "" ]; then \
if [ ! -d "${DESTDIR}${MODULES_DIR}" ]; then \
echo "${INSTALL_DATA_DIR} ${MODULES_DIR}"; \
${SUDO} ${INSTALL_DATA_DIR} ${DESTDIR}${MODULES_DIR}; \
fi; \
if [ "${MODULES_SUBST}" != "" ]; then \
for F in ${MODULES}; do \
echo "sed -e '${MODULES_SUBST}' $$F > $$F.prep"; \
sed -e '${MODULES_SUBST}' $$F > $$F.prep; \
echo "${INSTALL_DATA} $$F.prep ${MODULES_DIR}/$$F"; \
${SUDO} ${INSTALL_DATA} $$F.prep ${DESTDIR}${MODULES_DIR}/$$F; \
rm -f $$F.prep; \
done; \
else \
for F in ${MODULES}; do \
echo "${INSTALL_DATA} $$F ${MODULES_DIR}"; \
${SUDO} ${INSTALL_DATA} $$F ${DESTDIR}${MODULES_DIR}; \
done; \
fi; \
fi
@export _datafiles="${DATAFILES}"; \
if [ "$$_datafiles" != "" ]; then \
if [ ! -d "${DATADIR}" ]; then \
echo "${INSTALL_DATA_DIR} ${DATADIR}"; \
${SUDO} ${INSTALL_DATA_DIR} ${DESTDIR}${DATADIR}; \
fi; \
for F in $$_datafiles; do \
echo "${INSTALL_DATA} $$F ${DATADIR}"; \
${SUDO} ${INSTALL_DATA} $$F ${DESTDIR}${DATADIR}; \
done; \
fi
deinstall-perl:
@if [ "${SCRIPTS}" != "" ]; then \
for F in ${SCRIPTS}; do \
echo "${DEINSTALL_PROG} ${BINDIR}/$$F"; \
${SUDO} ${DEINSTALL_PROG} ${DESTDIR}${BINDIR}/$$F; \
done; \
fi
@if [ "${MODULES}" != "" ]; then \
for F in ${MODULES}; do \
echo "${DEINSTALL_DATA} ${MODULES_DIR}/$$F"; \
${SUDO} ${DEINSTALL_DATA} ${DESTDIR}${MODULES_DIR}/$$F; \
done; \
fi
@if [ "${DATAFILES}" != "" ]; then \
for F in ${DATAFILES}; do \
echo "${DEINSTALL_DATA} ${DATADIR}/$$F"; \
${SUDO} ${DEINSTALL_DATA} ${DESTDIR}${DATADIR}/$$F; \
done; \
fi
clean-perl:
@if [ "${CLEANFILES}" != "" ]; then \
echo "rm -f ${CLEANFILES}"; \
rm -f ${CLEANFILES}; \
fi
.PHONY: install deinstall clean cleandir regress depend
.PHONY: install-perl deinstall-perl clean-perl
include ${TOP}/mk/build.common.mk
include ${TOP}/mk/build.subdir.mk