Home | History | Annotate | Download | only in erlang
      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 # ident	"@(#)Makefile.sfw	1.5	09/06/04 SMI"
     27 #
     28 
     29 include ../Makefile.cmd
     30 
     31 VER =		$(COMPONENT_NAME:sh)_src_$(COMPONENT_VERSION:sh)
     32 TARBALL =	$(VER).tar.gz
     33 PATCHES:sh =	echo Patches/*.patch
     34 
     35 VER64 = 	$(VER)-64
     36 PATCHES_64:sh =	echo Patches/*.patch64
     37 
     38 # configure(1) options
     39 # (use default --prefix in Makefile.master)
     40 CONFIGURE_OPTIONS +=	--enable-smp-support
     41 CONFIGURE_OPTIONS +=	--enable-threads
     42 CONFIGURE_OPTIONS +=	--enable-hipe
     43 CONFIGURE_OPTIONS +=	--with-ssl
     44 CONFIGURE_OPTIONS +=	--enable-dynamic-ssl-lib
     45 
     46 CONFIGURE_OPTIONS64 =	$(CONFIGURE_OPTIONS)
     47 CONFIGURE_OPTIONS64 +=	--bindir=/usr/bin/$(MACH64)
     48 CONFIGURE_OPTIONS64 +=	--libdir=/usr/lib/$(MACH64)
     49 
     50 # Environment variables
     51 TARGET_ENV +=	MAKE="$(GMAKE)"
     52 TARGET_ENV +=	CC="$(GCC)"
     53 TARGET_ENV +=	CPPFLAGS="$(CPPFLAGS) -I $(ROOT)/usr/include/gd2 -L$(ROOT)/lib"
     54 TARGET_ENV +=	CXX="$(GXX)"
     55 TARGET_ENV +=	MAKEFLAGS=""
     56 TARGET_ENV +=	MFLAGS=""
     57 TARGET_ENV +=	INSTALL="/usr/ucb/install -c"
     58 TARGET_ENV +=	HOME="/tmp"
     59 
     60 TARGET_ENV64 =	$(TARGET_ENV)	
     61 TARGET_ENV64 +=	CFLAGS="-m64"
     62 TARGET_ENV64 += CPPFLAGS="$(CPPFLAGS) -I $(ROOT)/usr/include/gd2 -L$(ROOT)/lib/64"
     63 TARGET_ENV64 +=	LDFLAGS="-m64"
     64 
     65 all32:=		TARGET = all
     66 install32:=	TARGET = install
     67 install32:=	TARGET_ENV += INSTALL_PREFIX="$(ROOT)"
     68 
     69 all64:=		TARGET = all
     70 install64:=	TARGET = install
     71 install64:=	TARGET_ENV64 += INSTALL_PREFIX="$(ROOT)"
     72 
     73 all: all32 all64
     74 
     75 all32: $(VER)/config.status
     76 	for pkg in $(COMPONENT_PACKAGES:sh); do \
     77 		$(SRC)/tools/protofix --pkg $$pkg --write; \
     78 	done
     79 	(cd $(VER); env $(TARGET_ENV) $(GMAKE) $(TARGET))
     80 
     81 $(VER)/config.status: $(VER)/configure
     82 	(cd $(VER); env $(TARGET_ENV) ./configure $(CONFIGURE_OPTIONS))
     83 
     84 $(VER)/configure: $(VER)/.patched
     85 	$(TOUCH) $@
     86 
     87 all64: $(VER64)/config.status
     88 	(cd $(VER64); env $(TARGET_ENV64) $(GMAKE) $(TARGET))
     89 
     90 $(VER64)/config.status: $(VER64)/configure
     91 	(cd $(VER64); env $(TARGET_ENV64) ./configure $(CONFIGURE_OPTIONS64))
     92 
     93 $(VER64)/configure: $(VER64)/.patched
     94 	$(TOUCH) $@
     95 
     96 install: install32 install64 doc
     97 	# apply file attributes to files in proto area
     98 	for pkg in $(COMPONENT_PACKAGES:sh); do \
     99 		$(SRC)/tools/protofix --pkg $$pkg --perm; \
    100 	done
    101 
    102 install32: all32
    103 	(cd $(VER); env $(TARGET_ENV) $(GMAKE) $(TARGET))
    104 	# Post-install fixup. We use INSTALL_PREFIX to install Erlang
    105 	# in proto area for packaging. Unfortunately, however, some 
    106 	# files are generated in installation phase and they use
    107 	# INSTALL_PREFIX as part of final ROOTDIR. The following code
    108 	# fixes this.
    109 	(cd $(ROOT); $(PERL) -pi -e "s|$(ROOT)||g" \
    110 		usr/bin/erl \
    111 		usr/lib/erlang/bin/erl \
    112 		usr/lib/erlang/bin/start \
    113 		usr/lib/erlang/erts-5.6.1/bin/erl \
    114 		usr/lib/erlang/erts-5.6.1/bin/start \
    115 		usr/lib/erlang/releases/RELEASES)
    116 	# Fix symbol links in proto area to avoid nightly warning
    117 	# messages about inconsistencies between pkgdefs and proto area
    118 	(cd $(ROOT)/usr/bin; \
    119 		for f in erl erlc escript run_erl to_erl typer dialyzer epmd; \
    120 		do \
    121 			rm -f $${f}; \
    122 			ln -s ../lib/erlang/bin/$${f} $${f}; \
    123 		done)
    124 	(cd $(ROOT)/usr/lib/erlang/bin; rm -f epmd; \
    125 		ln -s ../erts-5.6.1/bin/epmd epmd)
    126 
    127 install64: all64
    128 	(cd $(VER64); env $(TARGET_ENV64) $(GMAKE) $(TARGET))
    129 	# Post-install fixup, see above comments.
    130 	(cd $(ROOT); $(PERL) -pi -e "s|$(ROOT)||g" \
    131 		usr/bin/$(MACH64)/erl \
    132 		usr/lib/$(MACH64)/erlang/bin/erl \
    133 		usr/lib/$(MACH64)/erlang/bin/start \
    134 		usr/lib/$(MACH64)/erlang/erts-5.6.1/bin/erl \
    135 		usr/lib/$(MACH64)/erlang/erts-5.6.1/bin/start \
    136 		usr/lib/$(MACH64)/erlang/releases/RELEASES)
    137 	(cd $(ROOT)/usr/bin/$(MACH64); \
    138 		for f in erl erlc escript run_erl to_erl typer dialyzer epmd; \
    139 		do \
    140 			rm -f $${f}; \
    141 			ln -s ../../lib/$(MACH64)/erlang/bin/$${f} $${f}; \
    142 		done)
    143 	(cd $(ROOT)/usr/lib/$(MACH64)/erlang/bin; rm -f epmd; \
    144 		ln -s ../erts-5.6.1/bin/epmd epmd)
    145 
    146 doc: 
    147 	$(SH) ./install-doc
    148 
    149 clean:
    150 	-rm -rf $(VER) $(VER64)
    151 
    152 include ../Makefile.targ
    153 
    154 FRC:
    155