Makefile revision 1167:9608ad751c4d
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 2005 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)/Intrs \
48    $(SUN_SOLARIS)/Project \
49    $(SUN_SOLARIS)/Task \
50    $(SUN_SOLARIS)/Exacct \
51    $(SUN_SOLARIS)/Privilege \
52    $(SUN_SOLARIS)/Ucred
53
54CLOSED_PERL_EXT += $(SUN_SOLARIS)/Kstat
55
56# Add any pure-perl extensions here.
57PERL_NONXS_EXT = \
58    $(SUN_SOLARIS)/BSM \
59    $(SUN_SOLARIS)/PerlGcc
60
61PERL_EXT = $(PERL_DYNAMIC_EXT) $(PERL_NONXS_EXT)
62PERL_EXT_MAKEFILES = $(PERL_EXT:%=%/Makefile)
63
64ALL_EXT = $(PERL_EXT)
65ALL_EXT_MAKEFILES = $(PERL_EXT_MAKEFILES)
66
67$(CLOSED_BUILD)ALL_EXT += $(CLOSED_PERL_EXT)
68$(CLOSED_BUILD)ALL_EXT_MAKEFILES += $(CLOSED_PERL_EXT:%=%/Makefile)
69
70all: copy_contrib $(ALL_EXT_MAKEFILES) $(ALL_EXT)
71
72.PARALLEL: $(ALL_EXT_MAKEFILES) $(ALL_EXT)
73
74#
75# Note: this is a dummy install target; during 'make all' this Makefile
76# populates ../distrib/lib with the modules that it is responsible for building,
77# and the install target of ../distrib/Makefile subsequently copies the modules
78# into the proto area.
79#
80install: all
81
82#
83# copy_contrib copies the clearfiles from ../../contrib to here.
84#
85copy_contrib:   ../../contrib/copy_contrib
86	@ ../../contrib/copy_contrib ../../contrib . $(PERL_EXT)
87	@ if [ -d $(CLOSED)/cmd/perl/contrib -a \
88	    -n "$(CLOSED_PERL_EXT)" ]; then \
89		../../contrib/copy_contrib $(CLOSED)/cmd/perl/contrib \
90		    . $(CLOSED_PERL_EXT); \
91	fi
92
93clean:
94	-@ $(PERL_MM_ENV); \
95	for ext in $(ALL_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 clean; \
102			) \
103		fi \
104	done
105
106clobber:
107	-@ $(PERL_MM_ENV); \
108	for ext in $(ALL_EXT); do \
109		if [ -d $$ext ]; then \
110			( \
111			cd $$ext; pwd; \
112			[ -f Makefile.old ] && mf=Makefile.old; \
113			[ -f Makefile ] && mf=Makefile; \
114			[ ! -z "$$mf" ] && $(MAKE) -f $$mf realclean; \
115			); \
116			$(RM) -r $$ext; \
117		fi \
118	done
119
120test: all
121	@ $(PERL_MM_ENV); $(PERL_LD_ENV); \
122	for ext in $(ALL_EXT); do \
123		( \
124		cd $$ext; pwd; \
125		[ -f Makefile.old ] && mf=Makefile.old; \
126		[ -f Makefile ] && mf=Makefile; \
127		[ ! -z "$$mf" ] && $(MAKE) -f $$mf test; \
128		) \
129	done
130
131# Pattern-matching rule for Makefiles.
132%/Makefile: %/Makefile.PL $(PERL_CONFIGDEP)
133	@ cd $(@D); pwd; $(RUN_MINIPERL) $(<F) $(PERL_MM_ARGS) > /dev/null
134
135# Pattern-matching rule for extensions.
136$(SUN_SOLARIS)/%: $(SUN_SOLARIS)/%/Makefile FRC
137	@ cd $@; pwd; $(PERL_MM_ENV); $(MAKE) all
138
139#
140# Additional rule to make sure changes to the ::Exacct sub-module Makefile.PL
141# files results in the parent Makefile.PL being rerun.
142#
143$(SUN_SOLARIS)/Exacct/Makefile: $(SUN_SOLARIS)/Exacct/Makefile.PL \
144    $(SUN_SOLARIS)/Exacct/Catalog/Makefile.PL \
145    $(SUN_SOLARIS)/Exacct/File/Makefile.PL \
146    $(SUN_SOLARIS)/Exacct/Object/Makefile.PL \
147    $(PERL_CONFIGDEP)
148	@ cd $(SUN_SOLARIS)/Exacct; pwd; \
149	$(RUN_MINIPERL) Makefile.PL $(PERL_MM_ARGS) > /dev/null
150
151FRC:
152