extract_config.sh revision 4020:5fbe2f47bce2
1#!/bin/ksh -p 2 3# 4# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 5# Use is subject to license terms. 6# 7# ident "%Z%%M% %I% %E% SMI" 8# 9 10# 11# This script extracts values from the passed config.sh file and prints them to 12# stdout in a form that is suitable for including in a Makefile. This removes 13# the requirement to manually keep the various Makefile macros in step with the 14# contents of config.sh. 15# 16 17if [ -z "$1" -o ! -r "$1" ]; then 18 printf 'No config.sh file specified\n' >&2 19 exit 1 20fi 21typeset -r config=$1 22typeset -r perlsrc=cmd/perl/5.8.4 23 24# Pull in config.sh. 25set -e 26. $config 27set +e 28 29printf '# This file was automatically generated from %s by %s\n\n' \ 30 $config $(basename $0) 31 32# 33# ON Makefile flag macro adjustments. Perl needs to build/ship with a 34# consistent set of flags, and needs to build with the selected compilers. 35# 36printf 'C99MODE = $(C99_ENABLE)\n' 37printf 'COPTFLAG = %s\n' "$optimize" 38printf 'SPACEFLAG =\n' 39printf 'ILDOFF =\n' 40printf 'CERRWARN =\n' 41printf 'G_SHARED = %s\n' "$lddlflags" 42printf 'sparc_C_PICFLAGS = %s\n' "$cccdlflags" 43printf 'i386_C_PICFLAGS = %s\n' "$cccdlflags" 44printf 'C_PICFLAGS = %s\n' "$cccdlflags" 45printf 'DYNFLAGS += $(ZIGNORE)\n' 46printf 'CFLAGS += -_gcc=-w\n' 47 48# Global stuff. 49printf 'PERL_VERSION = %s\n' $version 50printf 'PERL_DISTRIB = $(SRC)/%s/distrib\n' $perlsrc 51printf 'PERL_CONTRIB = $(SRC)/%s/contrib\n' $perlsrc 52printf 'PERL_UTILS = $(SRC)/%s/utils\n' $perlsrc 53printf 'MINIPERL = $(PERL_DISTRIB)/miniperl\n' 54printf 'PERL_CONFIG_PM = $(PERL_DISTRIB)/lib/Config.pm\n' 55printf 'PERL_CONFIG_H = $(PERL_DISTRIB)/config.h\n' 56printf 'PERL_CONFIGDEP = $(PERL_CONFIG_H) $(PERL_CONFIG_PM)\n' 57 58# Directory locations. 59printf 'PERL_REAL_ROOT_STEM = %s\n' ${prefix%/$version} 60printf 'PERL_REAL_ROOT_DIR = %s\n' $prefix 61printf 'PERL_REAL_BIN_DIR = %s\n' $binexp 62printf 'PERL_REAL_ARCHLIB_DIR = %s\n' $archlibexp 63printf 'PERL_REAL_CORE_DIR = %s/CORE\n' $archlibexp 64printf 'PERL_REAL_SITE_DIR = %s\n' $sitearchexp 65printf 'PERL_REAL_VENDOR_DIR = %s\n' $vendorarchexp 66printf 'PERL_REAL_POD_DIR = %s/pod\n' $privlibexp 67 68# Directory locations relative to the current build $ROOT. 69printf 'PERL_ROOT_STEM = $(ROOT)%s\n' ${prefix%/$version} 70printf 'PERL_ROOT_DIR = $(ROOT)%s\n' $prefix 71printf 'PERL_BIN_DIR = $(ROOT)%s\n' $binexp 72printf 'PERL_ARCHLIB_DIR = $(ROOT)%s\n' $archlibexp 73printf 'PERL_CORE_DIR = $(ROOT)%s/CORE\n' $archlibexp 74printf 'PERL_SITE_DIR = $(ROOT)%s\n' $sitearchexp 75printf 'PERL_VENDOR_DIR = $(ROOT)%s\n' $vendorarchexp 76printf 'PERL_POD_DIR = $(ROOT)%s/pod\n' $privlibexp 77 78# Compilation environment flags. 79printf 'KEEP_STATE_OFF = unset KEEP_STATE SUNPRO_DEPENDENCIES || true\n' 80printf 'PERL_COREFLAGS = -DPERL_CORE\n' 81printf 'PERL_LFFLAGS = %s\n' "$ccflags_uselargefiles" 82printf 'PERL_LDLIBS = %s\n' "$perllibs" 83printf 'PERL_LD_ENV = LD_LIBRARY_PATH=$(PERL_DISTRIB); export LD_LIBRARY_PATH\n' 84printf 'PERL_LIB_ENV = PERL5LIB=$(PERL_UTILS)/lib:$(PERL_DISTRIB)/lib; ' 85printf 'export PERL5LIB\n' 86printf 'PERL_MM_ENV = $(KEEP_STATE_OFF); unset VERSION; $(PERL_LIB_ENV)\n' 87printf "PERL_MM_ARGS = PERL_CORE=1 DEFINE='\$(DTEXTDOM)'\n" 88 89# Make sure we always run miniperl with the correct environment. 90printf 'RUN_MINIPERL = $(PERL_LD_ENV); $(PERL_LIB_ENV); $(MINIPERL)\n' 91