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