Makefile
changeset 1003 a4d17d6bc179
equal deleted inserted replaced
1002:1b8deb2ba4a3 1003:a4d17d6bc179
       
     1 # Makefile for X Consolidation
       
     2 #
       
     3 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
       
     4 #
       
     5 # Permission is hereby granted, free of charge, to any person obtaining a
       
     6 # copy of this software and associated documentation files (the "Software"),
       
     7 # to deal in the Software without restriction, including without limitation
       
     8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
       
     9 # and/or sell copies of the Software, and to permit persons to whom the
       
    10 # Software is furnished to do so, subject to the following conditions:
       
    11 #
       
    12 # The above copyright notice and this permission notice (including the next
       
    13 # paragraph) shall be included in all copies or substantial portions of the
       
    14 # Software.
       
    15 #
       
    16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       
    17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       
    18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
       
    19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
       
    20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
       
    22 # DEALINGS IN THE SOFTWARE.
       
    23 #
       
    24 #
       
    25 ###############################################################################
       
    26 #
       
    27 
       
    28 PWD:sh=pwd
       
    29 TOP=$(PWD)
       
    30 
       
    31 OS_SUBDIRS_common = open-src pkg
       
    32 OS_SUBDIRS_sparc = $(OS_SUBDIRS_common)
       
    33 OS_SUBDIRS_i386 = $(OS_SUBDIRS_common)
       
    34 
       
    35 all: setup install check
       
    36 
       
    37 setup: open-src/common/Makefile.options
       
    38 
       
    39 # Choose options for branding, download sites, etc.
       
    40 # Makefile.options is created as a link to a file containing the desired
       
    41 # options, chosen by the first of these found in open-src/common:
       
    42 #	1) Makefile.options.$(X_BUILD_OPTIONS)
       
    43 #	2) Makefile.options.<last two components of `domainname`, lowercased>
       
    44 #	3) Makefile.options.opensolaris
       
    45 MK_OPTS = open-src/common/Makefile.options
       
    46 
       
    47 $(MK_OPTS):
       
    48 	@ if [[ -n "${X_BUILD_OPTIONS}" ]] ; then \
       
    49 	    X_BUILD_OPTIONS="${X_BUILD_OPTIONS}" ; \
       
    50 	    if [[ ! -f "$(MK_OPTS).$${X_BUILD_OPTIONS}" ]] ; then \
       
    51 		print -u2 "Invalid X_BUILD_OPTIONS: " \
       
    52 			"$(MK_OPTS).$${X_BUILD_OPTIONS} not found" ; \
       
    53 		exit 1 ; \
       
    54 	    fi \
       
    55 	else \
       
    56 	    X_BUILD_OPTIONS="$$(domainname | \
       
    57 		awk -F. '{if (NF > 1) {printf "%s.%s", $$(NF-1), $$NF}}')" ; \
       
    58 	    typeset -l X_BUILD_OPTIONS ; \
       
    59 	    if [[ ! -f "$(MK_OPTS).$${X_BUILD_OPTIONS}" ]] ; then \
       
    60 		X_BUILD_OPTIONS='opensolaris' ; \
       
    61 	    fi \
       
    62 	fi ; \
       
    63 	print "Choosing build options from $(MK_OPTS).$${X_BUILD_OPTIONS}" ; \
       
    64 	rm -f $@ ; \
       
    65 	ln -s "Makefile.options.$${X_BUILD_OPTIONS}" $@
       
    66 
       
    67 # install & check are run in each subdir via Makefile.subdirs 
       
    68 
       
    69 ### Include common definitions
       
    70 DIRNAME=""
       
    71 include $(TOP)/open-src/common/Makefile.subdirs