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 2009 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26 27# 28# The perl5 installation for Solaris differs from that generated by the 29# Perl Configure procedure. The configuration appropriate for the current 30# build is automatically generated from pre-existing configuration files 31# for the build platform. 32# 33 34PROG = perl 35 36# 37# Some of the Makefile.master and Makefile.cmd flags are overridden by 38# ../Makefile.perlcfg which is in turn generated from config.sh by 39# ../extract_config.sh - check there first before overriding anything in this 40# Makefile. 41# 42include ../../../Makefile.cmd 43include ../Makefile.perlcfg 44 45# DynaLoader is a special extension as it has to be built statically. 46DYNALOADER=lib/auto/DynaLoader/DynaLoader.a 47 48# Uuencoded files that need to have SCCS keyword expansion prevented, see below. 49UUENCODED_FILES = \ 50 ext/Storable/t/downgrade.t \ 51 lib/CGI/eg/dna_small_gif.uu \ 52 lib/CGI/eg/wilogo_gif.uu 53 54# Because autosplit generates a lot of files, we create a dummy timestamp file 55# so that dependency checking can be performed. 56AUTOSPLIT = lib/auto/.tstamp 57 58CLEANFILES = miniperlmain.o perlmain.o opmini.o perlmain.c writemain cflags \ 59 ext.libs 60 61CLOBBERFILES = $(MINIPERL) $(PROG) $(PERL_CONFIGDEP) libperl.so lib/re.pm \ 62 lib/lib.pm lib/ExtUtils/Miniperl.pm t/perl 63clobber := CLOBBERFILES += CLEANFILES 64 65# Add in the perl-specific flags (including largefile flags). 66CPPFLAGS += $(PERL_COREFLAGS) $(PERL_LFFLAGS) 67 68# Add in the libraries perl needs to be linked against. 69LDLIBS += $(PERL_LDLIBS) 70 71# Compiler replacement rules 72SED_UN_CC = -e "s!'$(CC) -_gcc=-w!'cc!" 73SED_UN_CC_E = -e "s!'$(REAL_CC)!'cc!" 74 75all := TARGET = all 76install := TARGET = install 77clobber := TARGET = clobber 78clean := TARGET = clean 79test := TARGET = test 80 81all: get_no_keywords perl extensions utilities 82 83# 84# Some of the files in the perl distribution are uuencoded, or contain uuencoded 85# data. Some of the sequences of uuencoded data look like SCCS keywords, i.e. 86# "%<letter>%", so it is necessary to prevent the keywords from being expanded. 87# The SCCS 'y' flag can be added to the SCCS files to prevent keyword expansion 88# when the file is retrieved. However due to bugs in SCCS and wx we can't 89# always be sure that these flags are propagated correctly. 90# 91 92get_no_keywords: FRC 93 @ ../get_no_keywords $(UUENCODED_FILES) 94 95# 96# Expand template files that depend on config.sh. 97# 98 99$(PERL_CONFIG_H): config_h.SH config.sh 100 $(CHMOD) 0555 config_h.SH 101 ./config_h.SH 102 103perlmain.c: writemain $(PERL_CONFIG_H) 104 ./writemain $(DYNALOADER) > perlmain.c 105 106writemain: writemain.SH $(PERL_CONFIG_H) 107 $(CHMOD) 0555 writemain.SH 108 ./writemain.SH 109 110# 111# Build the libperl.so and libperl.so.1 shared objects using Makefile.lib, 112# which uses the correct library build environment. 113# 114 115libperl.so: $(PERL_CONFIG_H) FRC 116 @ $(ECHO) "Building libperl.so"; $(MAKE) -f Makefile.lib $(TARGET) 117 118# 119# Build miniperl, the bootstrap perl executable, and check it executes OK. 120# 121$(MINIPERL): miniperlmain.o opmini.o libperl.so 122 $(LINK.c) -o $@ miniperlmain.o opmini.o \ 123 -R \$$ORIGIN -L. -lperl $(LDLIBS) 124 @ $(RUN_MINIPERL) -w -Ilib -MExporter -e 'exit(0);' || \ 125 { $(ECHO) "error building miniperl"; $(RM) $(MINIPERL); exit 2; } 126 127miniperlmain.o: miniperlmain.c $(PERL_CONFIG_H) 128 129# 130# opmini.o is a version of op.o compiled with -DPERL_EXTERNAL_GLOB. Perl has 131# an internal implementation of glob, but it isn't available at this point. 132# 133opmini.o: op.c $(PERL_CONFIG_H) 134 $(COMPILE.c) -o $@ op.c -DPERL_EXTERNAL_GLOB 135 $(POST_PROCESS_O) 136 137.PARALLEL: miniperlmain.o opmini.o libperl.so 138 139# 140# Prepare for building perl modules by: 141# * Building miniperl. 142# * Copying re.pm from ext/re into lib. 143# * Creating lib.pm from lib_pm.PL. 144# * Creating Config.pm from config.sh. 145# * Autosplitting any ./lib modules that require it. 146# * Creating a fake cflags file. ExtUtils::MM_Unix (used to build extensions) 147# checks to see if there is a non-zero sized file called 'cflags' in this 148# directory, so we fool it by creating one. 149# 150 151preplibrary: $(MINIPERL) $(PERL_CONFIG_PM) lib/lib.pm \ 152 lib/ExtUtils/Miniperl.pm cflags $(AUTOSPLIT) 153 154$(PERL_CONFIG_PM): configpm $(PERL_CONFIG_H) myconfig.SH $(MINIPERL) lib/re.pm 155 $(RUN_MINIPERL) configpm $@ 156 157lib/re.pm : ext/re/re.pm 158 $(CP) -f ext/re/re.pm $@ 159 160lib/lib.pm: lib/lib_pm.PL $(PERL_CONFIGDEP) $(MINIPERL) 161 $(RUN_MINIPERL) lib/lib_pm.PL 162 163lib/ExtUtils/Miniperl.pm: $(PERL_CONFIGDEP) $(MINIPERL) \ 164 miniperlmain.c minimod.pl 165 $(RUN_MINIPERL) minimod.pl > minimod.tmp 166 $(MV) minimod.tmp $@ 167 168# Note: cflags needs to be non-zero sized, so $(TOUCH) won't do. 169cflags: 170 $(ECHO) > cflags 171 172.PARALLEL: $(PERL_CONFIGDEP) lib/re.pm lib/lib.pm lib/ExtUtils/Miniperl.pm \ 173 cflags $(AUTOSPLIT) 174 175# Because autosplit generates a lot of files, we create a dummy timestamp file 176$(AUTOSPLIT): $(PERL_CONFIGDEP) 177 @ $(MKDIR) -p lib/auto 178 $(RUN_MINIPERL) -Ilib -MAutoSplit -e 'autosplit_lib_modules(@ARGV)' \ 179 `find lib -name SCCS -prune -o -name '*.pm' -print` 180 @ $(TOUCH) $(AUTOSPLIT) 181 182# 183# Make DynaLoader. DynaLoader is statically linked into the perl executable 184# because it is used to load in all the other dynamically loaded modules. 185# Note: VERSION is used by ON as a environment variable and by perl module 186# makefiles as a make macro, so we need to unset it before building any modules. 187# 188 189ext/DynaLoader/Makefile: ext/DynaLoader/Makefile.PL $(PERL_CONFIGDEP) cflags 190 @ cd ext/DynaLoader; pwd; $(PERL_MM_ENV); \ 191 $(RUN_MINIPERL) Makefile.PL INSTALLDIRS=perl \ 192 LIBPERL_A=libperl.so $(PERL_MM_ARGS) 193 194$(DYNALOADER): ext/DynaLoader/Makefile $(PERL_CONFIGDEP) cflags FRC 195 @ cd ext/DynaLoader; pwd; $(PERL_MM_ENV); \ 196 $(MAKE) LINKTYPE=static CCCDLFLAGS= 197 198# 199# Create the perl executable. 200# 201 202perl: libperl.so $(DYNALOADER) $(PERL_STATIC_TGT) perlmain.o 203 $(LINK.c) $(ZIGNORE) -R$(PERL_REAL_CORE_DIR) \ 204 -o $@ perlmain.o $(DYNALOADER) -L. -lperl $(LDLIBS) 205 $(POST_PROCESS) 206 207perlmain.o: perlmain.c $(PERL_CONFIG_H) 208 $(COMPILE.c) -o $@ $< 209 $(POST_PROCESS_O) 210 211.PARALLEL: perlmain.o 212 213# 214# Build all the extensions. The rules for this are in the generated 215# ext/Makefile file. 216# 217 218extensions: preplibrary FRC 219 @ cd ext; pwd; $(MAKE) $(TARGET) 220 221# 222# Build utilities and pod pages. 223# 224 225utilities: perl FRC 226 @ cd x2p; pwd; $(MAKE) $(TARGET) 227 @ cd pod; pwd; $(MAKE) $(TARGET) 228 @ cd utils; pwd; $(MAKE) $(TARGET) 229 230# 231# Install targets. The bin, lib and pod symlinks are created here. The man 232# link is created by the SUNWpl5m package. In order to prevent a symlink cycle 233# we need to remove libperl.so before we start, so it will always be reinstalled 234# on each 'make install'. We also overwrite the Config.pm we used to build our 235# modules with one sanitized of the /ws/on*-tools dependency. As a result, 236# Config.pm will also be overwritten on each 'make install'. Note also that 237# perl, pstruct and psed are all hard links, so they too are reinstalled on each 238# 'make install'. 239# 240install_files: 241 $(RM) $(PERL_CORE_DIR)/libperl.so 242 @ $(PERL_LD_ENV); $(PERL_LIB_ENV); \ 243 $(PERL_DISTRIB)/perl ./installperl -destdir=$(ROOT) 244 @ $(MAKE) -f Makefile.lib install_lib 245 246 umask 022; $(MKDIR) -p $(PERL_VENDOR_DIR) 247 248 $(RM) $(PERL_ROOT_STEM)/bin 249 $(LN) -s ./$(PERL_VERSION)/bin $(PERL_ROOT_STEM)/bin 250 $(RM) $(PERL_ROOT_STEM)/pod 251 $(LN) -s ./$(PERL_VERSION)/lib/pod $(PERL_ROOT_STEM)/pod 252 253 $(RM) $(ROOTPROG) 254 $(LN) -s ../perl5/$(PERL_VERSION)/bin/perl $(ROOTPROG) 255 256 $(RM) $(PERL_ARCHLIB_DIR)/Config.pm 257 $(SED) $(SED_UN_CC) $(SED_UN_CC_E) $(PERL_CONFIG_PM) \ 258 > $(PERL_ARCHLIB_DIR)/Config.pm 259 $(CHMOD) 444 $(PERL_ARCHLIB_DIR)/Config.pm 260 261install: all .WAIT install_files 262 263# 264# Perl test suite target. 265# Note: the perl test suite breaks under parallel make. Bah. 266# 267 268# @ (PERL_MM_ENV); $(PERL_LD_ENV); 269test: all 270 $(PERL_LD_ENV); \ 271 PATH=/usr/ccs/bin:$$PATH; export PATH; \ 272 MAKE=/usr/ccs/bin/make; export MAKE; \ 273 PERL_CORE=1; export PERL_CORE; \ 274 cd t; pwd; \ 275 $(CP) ../perl .; \ 276 $(CHMOD) 755 TEST; \ 277 if tty -s; then \ 278 ./TEST < /dev/tty; \ 279 else \ 280 ./TEST < /dev/null; \ 281 fi 282 283# 284# Cleaning targets. 285# 286 287clean_pod: 288 @ cd pod; pwd; $(MAKE) clean 289 290clean_utilities: 291 @ cd utils; pwd; $(MAKE) clean 292 293clean_x2p: 294 @ cd x2p; pwd; $(MAKE) clean 295 296clean_extensions: 297 -@ unset VERSION; \ 298 cd ext; pwd; \ 299 ( \ 300 cd DynaLoader; \ 301 [ -f Makefile.old ] && mf=Makefile.old; \ 302 [ -f Makefile ] && mf=Makefile; \ 303 [ ! -z "$$mf" ] && $(MAKE) -f $$mf clean; \ 304 ); \ 305 $(MAKE) clean 306 307clean_lib: 308 $(MAKE) -f Makefile.lib clean 309 310clean: clean_pod clean_utilities clean_x2p clean_extensions clean_lib 311 $(RM) $(CLEANFILES) 312 313# 314# Clobber targets 315# 316 317clobber_extensions: 318 -@ unset VERSION; \ 319 cd ext; pwd; \ 320 $(RM) -r Sys/Syslog/lib; \ 321 ( \ 322 cd DynaLoader; \ 323 [ -f Makefile.old ] && mf=Makefile.old; \ 324 [ -f Makefile ] && mf=Makefile; \ 325 [ ! -z "$$mf" ] && $(MAKE) -f $$mf realclean; \ 326 ); \ 327 $(MAKE) clobber 328 329clobber_lib: 330 $(MAKE) -f Makefile.lib $(TARGET) 331 $(RM) -r lib/auto lib/Config.pod 332 $(RM) `find ./lib -name .exists` 333 334clobber_pod: 335 @ cd pod; pwd; $(MAKE) $(TARGET) 336 337clobber_utilities: 338 @ cd utils; pwd; $(MAKE) $(TARGET) 339 340clobber_x2p: 341 @ cd x2p; pwd; $(MAKE) $(TARGET) 342 343clobber_contrib_bin: 344 @ $(RM) -r contrib_bin 345 346clobber: clobber_extensions clobber_lib clobber_pod clobber_utilities \ 347 clobber_x2p clobber_contrib_bin 348 349include ../../../Makefile.targ 350 351FRC: 352