Makefile revision 1341:6d7c4f090a72
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 2005 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28include ../../../Makefile.cmd
29include ../Makefile.perlcfg
30
31#
32# Extra arguments needed to fool MakeMaker into building in the distrib tree.
33# Note we fake up an extra directory for contrib scripts under distrib - the
34# modified installperl knows how to handle the contents.
35#
36PERL_MM_ARGS += INST_ARCHLIB=$(PERL_DISTRIB)/lib INST_LIB=$(PERL_DISTRIB)/lib \
37    INST_SCRIPT=$(PERL_DISTRIB)/contrib_bin \
38    INST_BIN=$(PERL_DISTRIB)/contrib_bin  PERL_SRC=$(PERL_DISTRIB)
39
40# All SMI perl libraries should be prefixed with this.
41SUN_SOLARIS = Sun/Solaris
42
43# Add any XS extensions here.
44PERL_DYNAMIC_EXT = \
45    $(SUN_SOLARIS)/Utils \
46    $(SUN_SOLARIS)/Intrs \
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