usr/src/cmd/erlang/Makefile.sfw
author Jon Tibble <meths@btinternet.com>
Fri, 10 Feb 2012 16:19:42 +0000
branchoi_151a
changeset 114 b6d40d0a7b17
parent 0 b34509ac961f
child 74 fd34810c2c84
permissions -rw-r--r--
Added tag oi_151a_prestable1 for changeset b1282e88c680

# 
#  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 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)Makefile.sfw	1.5	09/06/04 SMI"
#

include ../Makefile.cmd

VER =		$(COMPONENT_NAME:sh)_src_$(COMPONENT_VERSION:sh)
TARBALL =	$(VER).tar.gz
PATCHES:sh =	echo Patches/*.patch

VER64 = 	$(VER)-64
PATCHES_64:sh =	echo Patches/*.patch64

# configure(1) options
# (use default --prefix in Makefile.master)
CONFIGURE_OPTIONS +=	--enable-smp-support
CONFIGURE_OPTIONS +=	--enable-threads
CONFIGURE_OPTIONS +=	--enable-hipe
CONFIGURE_OPTIONS +=	--with-ssl
CONFIGURE_OPTIONS +=	--enable-dynamic-ssl-lib

CONFIGURE_OPTIONS64 =	$(CONFIGURE_OPTIONS)
CONFIGURE_OPTIONS64 +=	--bindir=/usr/bin/$(MACH64)
CONFIGURE_OPTIONS64 +=	--libdir=/usr/lib/$(MACH64)

# Environment variables
TARGET_ENV +=	MAKE="$(GMAKE)"
TARGET_ENV +=	CC="$(GCC)"
TARGET_ENV +=	CPPFLAGS="$(CPPFLAGS) -I $(ROOT)/usr/include/gd2 -L$(ROOT)/lib"
TARGET_ENV +=	CXX="$(GXX)"
TARGET_ENV +=	MAKEFLAGS=""
TARGET_ENV +=	MFLAGS=""
TARGET_ENV +=	INSTALL="/usr/ucb/install -c"
TARGET_ENV +=	HOME="/tmp"

TARGET_ENV64 =	$(TARGET_ENV)	
TARGET_ENV64 +=	CFLAGS="-m64"
TARGET_ENV64 += CPPFLAGS="$(CPPFLAGS) -I $(ROOT)/usr/include/gd2 -L$(ROOT)/lib/64"
TARGET_ENV64 +=	LDFLAGS="-m64"

all32:=		TARGET = all
install32:=	TARGET = install
install32:=	TARGET_ENV += INSTALL_PREFIX="$(ROOT)"

all64:=		TARGET = all
install64:=	TARGET = install
install64:=	TARGET_ENV64 += INSTALL_PREFIX="$(ROOT)"

all: all32 all64

all32: $(VER)/config.status
	for pkg in $(COMPONENT_PACKAGES:sh); do \
		$(SRC)/tools/protofix --pkg $$pkg --write; \
	done
	(cd $(VER); env $(TARGET_ENV) $(GMAKE) $(TARGET))

$(VER)/config.status: $(VER)/configure
	(cd $(VER); env $(TARGET_ENV) ./configure $(CONFIGURE_OPTIONS))

$(VER)/configure: $(VER)/.patched
	$(TOUCH) $@

all64: $(VER64)/config.status
	(cd $(VER64); env $(TARGET_ENV64) $(GMAKE) $(TARGET))

$(VER64)/config.status: $(VER64)/configure
	(cd $(VER64); env $(TARGET_ENV64) ./configure $(CONFIGURE_OPTIONS64))

$(VER64)/configure: $(VER64)/.patched
	$(TOUCH) $@

install: install32 install64 doc
	# apply file attributes to files in proto area
	for pkg in $(COMPONENT_PACKAGES:sh); do \
		$(SRC)/tools/protofix --pkg $$pkg --perm; \
	done

install32: all32
	(cd $(VER); env $(TARGET_ENV) $(GMAKE) $(TARGET))
	# Post-install fixup. We use INSTALL_PREFIX to install Erlang
	# in proto area for packaging. Unfortunately, however, some 
	# files are generated in installation phase and they use
	# INSTALL_PREFIX as part of final ROOTDIR. The following code
	# fixes this.
	(cd $(ROOT); $(PERL) -pi -e "s|$(ROOT)||g" \
		usr/bin/erl \
		usr/lib/erlang/bin/erl \
		usr/lib/erlang/bin/start \
		usr/lib/erlang/erts-5.6.1/bin/erl \
		usr/lib/erlang/erts-5.6.1/bin/start \
		usr/lib/erlang/releases/RELEASES)
	# Fix symbol links in proto area to avoid nightly warning
	# messages about inconsistencies between pkgdefs and proto area
	(cd $(ROOT)/usr/bin; \
		for f in erl erlc escript run_erl to_erl typer dialyzer epmd; \
		do \
			rm -f $${f}; \
			ln -s ../lib/erlang/bin/$${f} $${f}; \
		done)
	(cd $(ROOT)/usr/lib/erlang/bin; rm -f epmd; \
		ln -s ../erts-5.6.1/bin/epmd epmd)

install64: all64
	(cd $(VER64); env $(TARGET_ENV64) $(GMAKE) $(TARGET))
	# Post-install fixup, see above comments.
	(cd $(ROOT); $(PERL) -pi -e "s|$(ROOT)||g" \
		usr/bin/$(MACH64)/erl \
		usr/lib/$(MACH64)/erlang/bin/erl \
		usr/lib/$(MACH64)/erlang/bin/start \
		usr/lib/$(MACH64)/erlang/erts-5.6.1/bin/erl \
		usr/lib/$(MACH64)/erlang/erts-5.6.1/bin/start \
		usr/lib/$(MACH64)/erlang/releases/RELEASES)
	(cd $(ROOT)/usr/bin/$(MACH64); \
		for f in erl erlc escript run_erl to_erl typer dialyzer epmd; \
		do \
			rm -f $${f}; \
			ln -s ../../lib/$(MACH64)/erlang/bin/$${f} $${f}; \
		done)
	(cd $(ROOT)/usr/lib/$(MACH64)/erlang/bin; rm -f epmd; \
		ln -s ../erts-5.6.1/bin/epmd epmd)

doc: 
	$(SH) ./install-doc

clean:
	-rm -rf $(VER) $(VER64)

include ../Makefile.targ

FRC: