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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23 #
  24 
  25 include ../../Makefile.cmd
  26 
  27 # To turn KEEP_STATE off the following two environment variables must be unset.
  28 KEEP_STATE_OFF = unset KEEP_STATE SUNPRO_DEPENDENCIES
  29 
  30 # Perl installs files we don't want to ship, so we install to a
  31 # staging area to postprocess and install the result to $(ROOT)
  32 STAGE = $(SRC)/cmd/perl/$(PERL_VERSION)/staging
  33 
  34 PERL=/usr/perl5/$(PERL_VERSION)/bin/perl
  35 
  36 PERL_MM_ARGS = INSTALLDIRS=perl CC='$(CC)' LD='$(CC)'
  37 
  38 # Prefix for Solaris-specific extensions that are maintained by
  39 # Sun/Oracle.
  40 SUN_SOLARIS = Sun/Solaris
  41 
  42 # Add any XS extensions here.
  43 PERL_DYNAMIC_EXT = \
  44     $(SUN_SOLARIS)/Utils \
  45     $(SUN_SOLARIS)/Kstat \
  46     $(SUN_SOLARIS)/Intrs \
  47     $(SUN_SOLARIS)/Project \
  48     $(SUN_SOLARIS)/Task \
  49     $(SUN_SOLARIS)/Exacct \
  50     $(SUN_SOLARIS)/Privilege \
  51     $(SUN_SOLARIS)/Lgrp \
  52     $(SUN_SOLARIS)/Ucred
  53 
  54 # Add any pure-perl extensions here.
  55 PERL_NONXS_EXT = \
  56     $(SUN_SOLARIS)/BSM \
  57     $(SUN_SOLARIS)/PerlGcc \
  58     $(SUN_SOLARIS)/Pg
  59 
  60 PERL_EXT = $(PERL_DYNAMIC_EXT) $(PERL_NONXS_EXT)
  61 PERL_EXT_MAKEFILES = $(PERL_EXT:%=%/Makefile)
  62 
  63 all: copy_contrib $(PERL_EXT_MAKEFILES) $(PERL_EXT)
  64 
  65 .PARALLEL: $(PERL_EXT_MAKEFILES) $(PERL_EXT)
  66 
  67 install: all
  68         for ext in $(PERL_EXT); do \
  69                 if [ -d $$ext ]; then \
  70                         ( \
  71                         cd $$ext; pwd; \
  72                         $(KEEP_STATE_OFF); $(MAKE) $(PERL_MM_ARGS) \
  73                                 DESTDIR=$(STAGE) install; \
  74                         cd $(STAGE); \
  75                         find . \( -name ".packlist" -o -name "perllocal.pod" \) \
  76                                 -exec $(RM) {} \; ; \
  77                         /usr/bin/pax -rw -pe ./*  ${ROOT} ; \
  78                         ) \
  79                 else \
  80                         /bin/false; \
  81                 fi \
  82         done
  83 
  84 #
  85 # copy_contrib copies the clearfiles from ../contrib to here.
  86 #
  87 copy_contrib:
  88         @ $(KSH93) ../contrib/copy_contrib.sh ../contrib . $(PERL_EXT)
  89 
  90 clean:
  91         for ext in $(PERL_EXT); do \
  92                 if [ -d $$ext ]; then \
  93                         ( \
  94                         cd $$ext; pwd; \
  95                         $(KEEP_STATE_OFF); $(MAKE) clean; \
  96                         ) \
  97                 fi \
  98         done
  99 
 100 # Remove Sun/Solaris
 101 clobber:
 102         @ $(RM) -r Sun
 103 
 104 test: all
 105         for ext in $(PERL_EXT); do \
 106                 ( \
 107                 cd $$ext; pwd; \
 108                 $(KEEP_STATE_OFF); $(MAKE) test; \
 109                 ) \
 110         done
 111 
 112 #
 113 # Ensure that the extension's makefile is built before
 114 # trying to build the extension
 115 #
 116 %/Makefile: %/Makefile.PL $(PERL_CONFIGDEP)
 117         @ cd $(@D); pwd; $(PERL) $(<F) $(PERL_MM_ARGS) 2>&1 /dev/null
 118 
 119 # Pattern-matching rule for extensions.
 120 $(SUN_SOLARIS)/%: $(SUN_SOLARIS)/%/Makefile FRC
 121         @ cd $@; pwd; $(KEEP_STATE_OFF) ; \
 122                 $(PERL_MM_ARGS) $(MAKE) DESTDIR=$(STAGE) all
 123 
 124 FRC: