#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
#
#
# The perl5 installation for Solaris differs from that generated by the
# Perl Configure procedure. The configuration appropriate for the current
# build is automatically generated from pre-existing configuration files
# for the build platform.
#
PROG = perl
#
# Some of the Makefile.master and Makefile.cmd flags are overridden by
# ../Makefile.perlcfg which is in turn generated from config.sh by
# ../extract_config.sh - check there first before overriding anything in this
# Makefile.
#
include ../../../Makefile.cmd
include ../Makefile.perlcfg
# DynaLoader is a special extension as it has to be built statically.
DYNALOADER=lib/auto/DynaLoader/DynaLoader.a
# Uuencoded files that need to have SCCS keyword expansion prevented, see below.
UUENCODED_FILES = \
ext/Storable/t/downgrade.t
# Because autosplit generates a lot of files, we create a dummy timestamp file
# so that dependency checking can be performed.
AUTOSPLIT = lib/auto/.tstamp
CLEANFILES = miniperlmain.o perlmain.o opmini.o perlmain.c writemain cflags \
ext.libs
CLOBBERFILES = $(MINIPERL) $(PROG) $(PERL_CONFIGDEP) libperl.so lib/re.pm \
lib/lib.pm lib/ExtUtils/Miniperl.pm t/perl
clobber := CLOBBERFILES += CLEANFILES
# Add in the perl-specific flags (including largefile flags).
CPPFLAGS += $(PERL_COREFLAGS) $(PERL_LFFLAGS)
# Add in the libraries perl needs to be linked against.
LDLIBS += $(PERL_LDLIBS)
# Compiler replacement rules
SED_UN_CC = -e "s!'$(CC) -_gcc=-w!'cc!"
SED_UN_CC_E = -e "s!'$(REAL_CC)!'cc!"
all := TARGET = all
install := TARGET = install
clobber := TARGET = clobber
clean := TARGET = clean
test := TARGET = test
all: get_no_keywords perl extensions utilities
#
# Some of the files in the perl distribution are uuencoded, or contain uuencoded
# data. Some of the sequences of uuencoded data look like SCCS keywords, i.e.
# "%<letter>%", so it is necessary to prevent the keywords from being expanded.
# The SCCS 'y' flag can be added to the SCCS files to prevent keyword expansion
# when the file is retrieved. However due to bugs in SCCS and wx we can't
# always be sure that these flags are propagated correctly.
#
get_no_keywords: FRC
@ ../get_no_keywords $(UUENCODED_FILES)
#
# Expand template files that depend on config.sh.
#
$(PERL_CONFIG_H): config_h.SH config.sh
$(CHMOD) 0555 config_h.SH
./config_h.SH
perlmain.c: writemain $(PERL_CONFIG_H)
./writemain $(DYNALOADER) > perlmain.c
writemain: writemain.SH $(PERL_CONFIG_H)
$(CHMOD) 0555 writemain.SH
./writemain.SH
#
# Build the libperl.so and libperl.so.1 shared objects using Makefile.lib,
# which uses the correct library build environment.
#
libperl.so: $(PERL_CONFIG_H) FRC
@ $(ECHO) "Building libperl.so"; $(MAKE) -f Makefile.lib $(TARGET)
#
# Build miniperl, the bootstrap perl executable, and check it executes OK.
#
$(MINIPERL): miniperlmain.o opmini.o libperl.so
$(LINK.c) $(ZIGNORE) -o $@ miniperlmain.o opmini.o \
-R \$$ORIGIN -L. -lperl $(LDLIBS)
@ $(RUN_MINIPERL) -w -Ilib -MExporter -e 'exit(0);' || \
{ $(ECHO) "error building miniperl"; $(RM) $(MINIPERL); exit 2; }
miniperlmain.o: miniperlmain.c $(PERL_CONFIG_H)
#
# opmini.o is a version of op.o compiled with -DPERL_EXTERNAL_GLOB. Perl has
# an internal implementation of glob, but it isn't available at this point.
#
opmini.o: op.c $(PERL_CONFIG_H)
$(COMPILE.c) -o $@ op.c -DPERL_EXTERNAL_GLOB
$(POST_PROCESS_O)
.PARALLEL: miniperlmain.o opmini.o libperl.so
#
# Prepare for building perl modules by:
# * Building miniperl.
# * Copying re.pm from ext/re into lib.
# * Creating lib.pm from lib_pm.PL.
# * Creating Config.pm from config.sh.
# * Autosplitting any ./lib modules that require it.
# * Creating a fake cflags file. ExtUtils::MM_Unix (used to build extensions)
# checks to see if there is a non-zero sized file called 'cflags' in this
# directory, so we fool it by creating one.
#
preplibrary: $(MINIPERL) $(PERL_CONFIG_PM) lib/lib.pm \
lib/ExtUtils/Miniperl.pm cflags $(AUTOSPLIT)
$(PERL_CONFIG_PM): configpm $(PERL_CONFIG_H) myconfig.SH $(MINIPERL) lib/re.pm
$(RUN_MINIPERL) configpm $@
lib/re.pm : ext/re/re.pm
$(CP) -f ext/re/re.pm $@
lib/lib.pm: lib/lib_pm.PL $(PERL_CONFIGDEP) $(MINIPERL)
$(RUN_MINIPERL) lib/lib_pm.PL
lib/ExtUtils/Miniperl.pm: $(PERL_CONFIGDEP) $(MINIPERL) \
miniperlmain.c minimod.pl
$(RUN_MINIPERL) minimod.pl > minimod.tmp
$(MV) minimod.tmp $@
# Note: cflags needs to be non-zero sized, so $(TOUCH) won't do.
cflags:
$(ECHO) > cflags
.PARALLEL: $(PERL_CONFIGDEP) lib/re.pm lib/lib.pm lib/ExtUtils/Miniperl.pm \
cflags $(AUTOSPLIT)
# Because autosplit generates a lot of files, we create a dummy timestamp file
$(AUTOSPLIT): $(PERL_CONFIGDEP)
@ $(MKDIR) -p lib/auto
$(RUN_MINIPERL) -Ilib -MAutoSplit -e 'autosplit_lib_modules(@ARGV)' \
`find lib -name SCCS -prune -o -name '*.pm' -print`
@ $(TOUCH) $(AUTOSPLIT)
#
# Make DynaLoader. DynaLoader is statically linked into the perl executable
# because it is used to load in all the other dynamically loaded modules.
# Note: VERSION is used by ON as a environment variable and by perl module
# makefiles as a make macro, so we need to unset it before building any modules.
#
ext/DynaLoader/Makefile: ext/DynaLoader/Makefile.PL $(PERL_CONFIGDEP) cflags
@ cd ext/DynaLoader; pwd; $(PERL_MM_ENV); \
$(RUN_MINIPERL) Makefile.PL INSTALLDIRS=perl \
LIBPERL_A=libperl.so $(PERL_MM_ARGS)
$(DYNALOADER): ext/DynaLoader/Makefile $(PERL_CONFIGDEP) cflags FRC
@ cd ext/DynaLoader; pwd; $(PERL_MM_ENV); \
$(MAKE) LINKTYPE=static CCCDLFLAGS=
#
# Create the perl executable.
#
perl: libperl.so $(DYNALOADER) $(PERL_STATIC_TGT) perlmain.o
$(LINK.c) $(ZIGNORE) -R$(PERL_REAL_CORE_DIR) \
-o $@ perlmain.o $(DYNALOADER) -L. -lperl $(LDLIBS)
$(POST_PROCESS)
perlmain.o: perlmain.c $(PERL_CONFIG_H)
$(COMPILE.c) -o $@ $<
$(POST_PROCESS_O)
.PARALLEL: perlmain.o
#
# Build all the extensions. The rules for this are in the generated
# ext/Makefile file.
#
extensions: preplibrary FRC
@ cd ext; pwd; $(MAKE) $(TARGET)
#
# Build utilities and pod pages.
#
utilities: perl FRC
@ cd x2p; pwd; $(MAKE) $(TARGET)
@ cd pod; pwd; $(MAKE) $(TARGET)
@ cd utils; pwd; $(MAKE) $(TARGET)
#
# Install targets. The bin, lib and pod symlinks are created here. The man
# link is created by the SUNWpl5m package. In order to prevent a symlink cycle
# we need to remove libperl.so before we start, so it will always be reinstalled
# on each 'make install'. We also overwrite the Config.pm we used to build our
# modules with one sanitized of the /ws/on*-tools dependency. As a result,
# Config.pm will also be overwritten on each 'make install'. Note also that
# perl, pstruct and psed are all hard links, so they too are reinstalled on each
# 'make install'.
#
install_files:
$(RM) $(PERL_CORE_DIR)/libperl.so
@ $(PERL_LD_ENV); $(PERL_LIB_ENV); \
$(PERL_DISTRIB)/perl ./installperl -destdir=$(ROOT)
@ $(MAKE) -f Makefile.lib install_lib
umask 022; $(MKDIR) -p $(PERL_VENDOR_DIR)
$(RM) $(PERL_ARCHLIB_DIR)/Config.pm
$(SED) $(SED_UN_CC) $(SED_UN_CC_E) $(PERL_CONFIG_PM) \
> $(PERL_ARCHLIB_DIR)/Config.pm
$(CHMOD) 444 $(PERL_ARCHLIB_DIR)/Config.pm
install: all .WAIT install_files
#
# Perl test suite target.
# Note: the perl test suite breaks under parallel make. Bah.
#
# @ (PERL_MM_ENV); $(PERL_LD_ENV);
test: all
$(PERL_LD_ENV); \
PATH=$$PATH; export PATH; \
MAKE=/usr/bin/make; export MAKE; \
PERL_CORE=1; export PERL_CORE; \
cd t; pwd; \
$(CP) ../perl .; \
$(CHMOD) 755 TEST; \
if tty -s; then \
./TEST < /dev/tty; \
else \
./TEST < /dev/null; \
fi
#
# Cleaning targets.
#
clean_pod:
@ cd pod; pwd; $(MAKE) clean
clean_utilities:
@ cd utils; pwd; $(MAKE) clean
clean_x2p:
@ cd x2p; pwd; $(MAKE) clean
clean_extensions:
-@ unset VERSION; \
cd ext; pwd; \
( \
cd DynaLoader; \
[ -f Makefile.old ] && mf=Makefile.old; \
[ -f Makefile ] && mf=Makefile; \
[ ! -z "$$mf" ] && $(MAKE) -f $$mf clean; \
); \
$(MAKE) clean
clean_lib:
$(MAKE) -f Makefile.lib clean
clean: clean_pod clean_utilities clean_x2p clean_extensions clean_lib
$(RM) $(CLEANFILES)
#
# Clobber targets
#
clobber_extensions:
-@ unset VERSION; \
cd ext; pwd; \
$(RM) -r Sys/Syslog/lib; \
( \
cd DynaLoader; \
[ -f Makefile.old ] && mf=Makefile.old; \
[ -f Makefile ] && mf=Makefile; \
[ ! -z "$$mf" ] && $(MAKE) -f $$mf realclean; \
); \
$(MAKE) clobber
clobber_lib:
$(MAKE) -f Makefile.lib $(TARGET)
$(RM) -r lib/auto lib/Config.pod
$(RM) `find ./lib -name .exists`
clobber_pod:
@ cd pod; pwd; $(MAKE) $(TARGET)
clobber_utilities:
@ cd utils; pwd; $(MAKE) $(TARGET)
clobber_x2p:
@ cd x2p; pwd; $(MAKE) $(TARGET)
clobber_contrib_bin:
@ $(RM) -r contrib_bin
clobber: clobber_extensions clobber_lib clobber_pod clobber_utilities \
clobber_x2p clobber_contrib_bin
include ../../../Makefile.targ
FRC: