Makefile revision 13039:93bdcf9c0906
1270866Simp#
2270866Simp# CDDL HEADER START
3270866Simp#
4270866Simp# The contents of this file are subject to the terms of the
5270866Simp# Common Development and Distribution License (the "License").
6270866Simp# You may not use this file except in compliance with the License.
7270866Simp#
8270866Simp# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9270866Simp# or http://www.opensolaris.org/os/licensing.
10270866Simp# See the License for the specific language governing permissions
11270866Simp# and limitations under the License.
12284090Sian#
13284090Sian# When distributing Covered Code, include this CDDL HEADER in each
14270866Simp# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15270866Simp# If applicable, add the following below this CDDL HEADER, with the
16270866Simp# fields enclosed by brackets "[]" replaced with your own identifying
17270866Simp# information: Portions Copyright [yyyy] [name of copyright owner]
18270866Simp#
19270866Simp# CDDL HEADER END
20270866Simp#
21270866Simp#
22270866Simp# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23270866Simp#
24270866Simp
25270866Simpinclude ../../Makefile.cmd
26270866Simp
27270866Simp# To turn KEEP_STATE off the following two environment variables must be unset.
28270866SimpKEEP_STATE_OFF = unset KEEP_STATE SUNPRO_DEPENDENCIES
29270866Simp
30270866Simp# Perl installs files we don't want to ship, so we install to a
31270866Simp# staging area to postprocess and install the result to $(ROOT)
32270866SimpSTAGE = $(SRC)/cmd/perl/$(PERL_VERSION)/staging
33270866Simp
34270866SimpPERL=/usr/perl5/$(PERL_VERSION)/bin/perl
35270866Simp
36270866SimpPERL_MM_ARGS = INSTALLDIRS=perl CC='$(CC)' LD='$(CC)'
37270866Simp
38270866Simp# Prefix for Solaris-specific extensions that are maintained by
39270866Simp# Sun/Oracle.
40284090SianSUN_SOLARIS = Sun/Solaris
41284090Sian
42270866Simp# Add any XS extensions here.
43270866SimpPERL_DYNAMIC_EXT = \
44270866Simp    $(SUN_SOLARIS)/Utils \
45284090Sian    $(SUN_SOLARIS)/Kstat \
46270866Simp    $(SUN_SOLARIS)/Intrs \
47270866Simp    $(SUN_SOLARIS)/Project \
48270866Simp    $(SUN_SOLARIS)/Task \
49270866Simp    $(SUN_SOLARIS)/Exacct \
50270866Simp    $(SUN_SOLARIS)/Privilege \
51270866Simp    $(SUN_SOLARIS)/Lgrp \
52284090Sian    $(SUN_SOLARIS)/Ucred
53270866Simp
54270866Simp# Add any pure-perl extensions here.
55270866SimpPERL_NONXS_EXT = \
56270866Simp    $(SUN_SOLARIS)/BSM \
57270866Simp    $(SUN_SOLARIS)/PerlGcc
58284090Sian
59270866SimpPERL_EXT = $(PERL_DYNAMIC_EXT) $(PERL_NONXS_EXT)
60270866SimpPERL_EXT_MAKEFILES = $(PERL_EXT:%=%/Makefile)
61270866Simp
62270866Simpall: copy_contrib $(PERL_EXT_MAKEFILES) $(PERL_EXT)
63270866Simp
64270866Simp.PARALLEL: $(PERL_EXT_MAKEFILES) $(PERL_EXT)
65270866Simp
66270866Simpinstall: all
67270866Simp	for ext in $(PERL_EXT); do \
68270866Simp		if [ -d $$ext ]; then \
69284090Sian			( \
70284090Sian			cd $$ext; pwd; \
71284090Sian			$(KEEP_STATE_OFF); $(MAKE) $(PERL_MM_ARGS) \
72270866Simp				DESTDIR=$(STAGE) install; \
73270866Simp			cd $(STAGE); \
74270866Simp			find . \( -name ".packlist" -o -name "perllocal.pod" \) \
75270866Simp				-exec $(RM) {} \; ; \
76270866Simp			/usr/bin/pax -rwpe ./*  ${ROOT} ; \
77270866Simp			) \
78270866Simp		else \
79270866Simp			/bin/false; \
80270866Simp		fi \
81270866Simp	done
82270866Simp
83270866Simp#
84270866Simp# copy_contrib copies the clearfiles from ../contrib to here.
85270866Simp#
86270866Simpcopy_contrib:
87270866Simp	@ $(KSH93) ../contrib/copy_contrib.sh ../contrib . $(PERL_EXT)
88270866Simp
89270866Simpclean:
90270866Simp	for ext in $(PERL_EXT); do \
91270866Simp		if [ -d $$ext ]; then \
92270866Simp			( \
93270866Simp			cd $$ext; pwd; \
94270866Simp			$(KEEP_STATE_OFF); $(MAKE) clean; \
95270866Simp			) \
96270866Simp		fi \
97270866Simp	done
98270866Simp
99270866Simp# Remove Sun/Solaris
100270866Simpclobber:
101270866Simp	@ $(RM) -r Sun
102270866Simp
103270866Simptest: all
104270866Simp	for ext in $(PERL_EXT); do \
105270866Simp		( \
106270866Simp		cd $$ext; pwd; \
107270866Simp		$(KEEP_STATE_OFF); $(MAKE) test; \
108270866Simp		) \
109270866Simp	done
110270866Simp
111270866Simp#
112270866Simp# Ensure that the extension's makefile is built before
113284090Sian# trying to build the extension
114270866Simp#
115270866Simp%/Makefile: %/Makefile.PL $(PERL_CONFIGDEP)
116270866Simp	@ cd $(@D); pwd; $(PERL) $(<F) $(PERL_MM_ARGS) 2>&1 /dev/null
117270866Simp
118270866Simp# Pattern-matching rule for extensions.
119270866Simp$(SUN_SOLARIS)/%: $(SUN_SOLARIS)/%/Makefile FRC
120270866Simp	@ cd $@; pwd; $(KEEP_STATE_OFF) ; \
121270866Simp		$(PERL_MM_ARGS) $(MAKE) DESTDIR=$(STAGE) all
122270866Simp
123270866SimpFRC:
124270866Simp