Makefile revision 13124:8f28cf08bb11
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23#
24
25include ../../Makefile.cmd
26
27# To turn KEEP_STATE off the following two environment variables must be unset.
28KEEP_STATE_OFF = unset KEEP_STATE SUNPRO_DEPENDENCIES
29
30# Perl installs files we don't want to ship, so we install to a
31# staging area to postprocess and install the result to $(ROOT)
32STAGE = $(SRC)/cmd/perl/$(PERL_VERSION)/staging
33
34PERL=/usr/perl5/$(PERL_VERSION)/bin/perl
35
36PERL_MM_ARGS = INSTALLDIRS=perl CC='$(CC)' LD='$(CC)'
37
38# Prefix for Solaris-specific extensions that are maintained by
39# Sun/Oracle.
40SUN_SOLARIS = Sun/Solaris
41
42# Add any XS extensions here.
43PERL_DYNAMIC_EXT = \
44    $(SUN_SOLARIS)/Utils \
45    $(SUN_SOLARIS)/Kstat \
46    $(SUN_SOLARIS)/Intrs \
47    $(SUN_SOLARIS)/Project \
48    $(SUN_SOLARIS)/Task \
49    $(SUN_SOLARIS)/Exacct \
50    $(SUN_SOLARIS)/Privilege \
51    $(SUN_SOLARIS)/Lgrp \
52    $(SUN_SOLARIS)/Ucred
53
54# Add any pure-perl extensions here.
55PERL_NONXS_EXT = \
56    $(SUN_SOLARIS)/BSM \
57    $(SUN_SOLARIS)/PerlGcc \
58    $(SUN_SOLARIS)/Pg
59
60PERL_EXT = $(PERL_DYNAMIC_EXT) $(PERL_NONXS_EXT)
61PERL_EXT_MAKEFILES = $(PERL_EXT:%=%/Makefile)
62
63all: copy_contrib $(PERL_EXT_MAKEFILES) $(PERL_EXT)
64
65.PARALLEL: $(PERL_EXT_MAKEFILES) $(PERL_EXT)
66
67install: all
68	for ext in $(PERL_EXT); do \
69		if [ -d $$ext ]; then \
70			( \
71			cd $$ext; pwd; \
72			$(KEEP_STATE_OFF); $(MAKE) $(PERL_MM_ARGS) \
73				DESTDIR=$(STAGE) install; \
74			cd $(STAGE); \
75			find . \( -name ".packlist" -o -name "perllocal.pod" \) \
76				-exec $(RM) {} \; ; \
77			/usr/bin/pax -rwpe ./*  ${ROOT} ; \
78			) \
79		else \
80			/bin/false; \
81		fi \
82	done
83
84#
85# copy_contrib copies the clearfiles from ../contrib to here.
86#
87copy_contrib:
88	@ $(KSH93) ../contrib/copy_contrib.sh ../contrib . $(PERL_EXT)
89
90clean:
91	for ext in $(PERL_EXT); do \
92		if [ -d $$ext ]; then \
93			( \
94			cd $$ext; pwd; \
95			$(KEEP_STATE_OFF); $(MAKE) clean; \
96			) \
97		fi \
98	done
99
100# Remove Sun/Solaris
101clobber:
102	@ $(RM) -r Sun
103
104test: all
105	for ext in $(PERL_EXT); do \
106		( \
107		cd $$ext; pwd; \
108		$(KEEP_STATE_OFF); $(MAKE) test; \
109		) \
110	done
111
112#
113# Ensure that the extension's makefile is built before
114# trying to build the extension
115#
116%/Makefile: %/Makefile.PL $(PERL_CONFIGDEP)
117	@ cd $(@D); pwd; $(PERL) $(<F) $(PERL_MM_ARGS) 2>&1 /dev/null
118
119# Pattern-matching rule for extensions.
120$(SUN_SOLARIS)/%: $(SUN_SOLARIS)/%/Makefile FRC
121	@ cd $@; pwd; $(KEEP_STATE_OFF) ; \
122		$(PERL_MM_ARGS) $(MAKE) DESTDIR=$(STAGE) all
123
124FRC:
125