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#
23# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24#
25
26include ../../../Makefile.cmd
27include ../Makefile.perlcfg
28
29#
30# Extra arguments needed to fool MakeMaker into building in the distrib tree.
31# Note we fake up an extra directory for contrib scripts under distrib - the
32# modified installperl knows how to handle the contents.
33#
34PERL_MM_ARGS += INST_ARCHLIB=$(PERL_DISTRIB)/lib INST_LIB=$(PERL_DISTRIB)/lib \
35    INST_SCRIPT=$(PERL_DISTRIB)/contrib_bin \
36    INST_BIN=$(PERL_DISTRIB)/contrib_bin  PERL_SRC=$(PERL_DISTRIB)
37
38# All SMI perl libraries should be prefixed with this.
39SUN_SOLARIS = Sun/Solaris
40
41# Add any XS extensions here.
42PERL_DYNAMIC_EXT = \
43    $(SUN_SOLARIS)/Utils \
44    $(SUN_SOLARIS)/Intrs \
45    $(SUN_SOLARIS)/Kstat \
46    $(SUN_SOLARIS)/Project \
47    $(SUN_SOLARIS)/Task \
48    $(SUN_SOLARIS)/Exacct \
49    $(SUN_SOLARIS)/Privilege \
50    $(SUN_SOLARIS)/Lgrp \
51    $(SUN_SOLARIS)/Ucred
52
53# Add any pure-perl extensions here.
54PERL_NONXS_EXT = \
55    $(SUN_SOLARIS)/BSM \
56    $(SUN_SOLARIS)/PerlGcc \
57    $(SUN_SOLARIS)/Pg
58
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