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