xref: /onnv-gate/usr/src/cmd/perl/5.8.4/contrib/Makefile (revision 0:68f95e015346)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29include ../../../Makefile.cmd
30include ../Makefile.perlcfg
31
32#
33# Extra arguments needed to fool MakeMaker into building in the distrib tree.
34# Note we fake up an extra directory for contrib scripts under distrib - the
35# modified installperl knows how to handle the contents.
36#
37PERL_MM_ARGS += INST_ARCHLIB=$(PERL_DISTRIB)/lib INST_LIB=$(PERL_DISTRIB)/lib \
38    INST_SCRIPT=$(PERL_DISTRIB)/contrib_bin \
39    INST_BIN=$(PERL_DISTRIB)/contrib_bin  PERL_SRC=$(PERL_DISTRIB)
40
41# All SMI perl libraries should be prefixed with this.
42SUN_SOLARIS = Sun/Solaris
43
44# Add any XS extensions here.
45PERL_DYNAMIC_EXT = \
46    $(SUN_SOLARIS)/Utils \
47    $(SUN_SOLARIS)/Kstat \
48    $(SUN_SOLARIS)/Project \
49    $(SUN_SOLARIS)/Task \
50    $(SUN_SOLARIS)/Exacct \
51    $(SUN_SOLARIS)/Privilege \
52    $(SUN_SOLARIS)/Ucred
53
54# Add any pure-perl extensions here.
55PERL_NONXS_EXT = \
56    $(SUN_SOLARIS)/BSM \
57    $(SUN_SOLARIS)/PerlGcc
58
59PERL_EXT = $(PERL_DYNAMIC_EXT) $(PERL_NONXS_EXT)
60PERL_EXT_MAKEFILES = $(PERL_EXT:%=%/Makefile)
61
62all: copy_contrib $(PERL_EXT_MAKEFILES) $(PERL_EXT)
63
64.PARALLEL: $(PERL_EXT_MAKEFILES) $(PERL_EXT)
65
66#
67# Note: this is a dummy install target; during 'make all' this Makefile
68# populates ../distrib/lib with the modules that it is responsible for building,
69# and the install target of ../distrib/Makefile subsequently copies the modules
70# into the proto area.
71#
72install: all
73
74#
75# copy_contrib copies the clearfiles from ../../contrib to here.
76#
77copy_contrib:   ../../contrib/copy_contrib
78	@ ../../contrib/copy_contrib ../../contrib . $(PERL_EXT)
79
80clean:
81	-@ $(PERL_MM_ENV); \
82	for ext in $(PERL_EXT); do \
83		if [ -d $$ext ]; then \
84			( \
85			cd $$ext; pwd; \
86			[ -f Makefile.old ] && mf=Makefile.old; \
87			[ -f Makefile ] && mf=Makefile; \
88			[ ! -z "$$mf" ] && $(MAKE) -f $$mf clean; \
89			) \
90		fi \
91	done
92
93clobber:
94	-@ $(PERL_MM_ENV); \
95	for ext in $(PERL_EXT); do \
96		if [ -d $$ext ]; then \
97			( \
98			cd $$ext; pwd; \
99			[ -f Makefile.old ] && mf=Makefile.old; \
100			[ -f Makefile ] && mf=Makefile; \
101			[ ! -z "$$mf" ] && $(MAKE) -f $$mf realclean; \
102			); \
103			$(RM) -r $$ext; \
104		fi \
105	done
106
107test: all
108	@ $(PERL_MM_ENV); $(PERL_LD_ENV); \
109	for ext in $(PERL_EXT); do \
110		( \
111		cd $$ext; pwd; \
112		[ -f Makefile.old ] && mf=Makefile.old; \
113		[ -f Makefile ] && mf=Makefile; \
114		[ ! -z "$$mf" ] && $(MAKE) -f $$mf test; \
115		) \
116	done
117
118# Pattern-matching rule for Makefiles.
119%/Makefile: %/Makefile.PL $(PERL_CONFIGDEP)
120	@ cd $(@D); pwd; $(RUN_MINIPERL) $(<F) $(PERL_MM_ARGS) > /dev/null
121
122# Pattern-matching rule for extensions.
123$(SUN_SOLARIS)/%: $(SUN_SOLARIS)/%/Makefile FRC
124	@ cd $@; pwd; $(PERL_MM_ENV); $(MAKE) all
125
126#
127# Additional rule to make sure changes to the ::Exacct sub-module Makefile.PL
128# files results in the parent Makefile.PL being rerun.
129#
130$(SUN_SOLARIS)/Exacct/Makefile: $(SUN_SOLARIS)/Exacct/Makefile.PL \
131    $(SUN_SOLARIS)/Exacct/Catalog/Makefile.PL \
132    $(SUN_SOLARIS)/Exacct/File/Makefile.PL \
133    $(SUN_SOLARIS)/Exacct/Object/Makefile.PL \
134    $(PERL_CONFIGDEP)
135	@ cd $(SUN_SOLARIS)/Exacct; pwd; \
136	$(RUN_MINIPERL) Makefile.PL $(PERL_MM_ARGS) > /dev/null
137
138FRC:
139