# # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Note: libast headers are generated by the AST build system outside OS/Net # (and then copied here) and depend on the architecture (e.g. "i386", "amd64", # "sparc", "sparcv9" etc. ...), we later merge them into one unified file # (see below) ROOTHDRDIR= $(ROOT)/usr/include/ast # Define the symbol used to distinguish between 32bit and 64bit parts of the # include file. We cannot use |_LP64| here because not every compiler (like # Studio 10/11/12) sets it by default (this doesn't harm because the AST # includes are OS- and platform-specific anyway) and we can't rely on the # system includes like because "/usr/bin/diff -D" # adds the "#ifdef " before any other content and "injecting" an # "#include " will alter the behaviour of the AST code # in unpredictable ways (e.g. the resulting code will not longer work). # Sun-Bug #6524070 ("RFE: Please set |_LP64| for 64bit platforms by default # (like gcc does)") has been filed against the Sun Studio compiler as RFE # to set |_LP64| for 64bit targets. # (INTEL_BLD is '#' for a Sparc build and SPARC_BLD is '#' for an Intel build) $(SPARC_BLD)AST64BITCPPSYMBOL = __sparcv9 $(INTEL_BLD)AST64BITCPPSYMBOL = __amd64 # We use a custom install sequence here to unify 32bit and 64bit AST includes # since we can only ship one set of includes. Therefore we use # "/usr/bin/diff -D <64bit>" (and for some exceptions a manual path) to # generate an unified version of the include files (and add a boilerplate text # which explains the interface stability status). $(ROOTHDRDIR)/%: $(HDRDIR32)/% $(HDRDIR64)/% @mkdir -p tmpastinclude ; \ typeset boilerplate="" ; \ boilerplate+="/*\n" \ boilerplate+=" * BEGIN OpenSolaris section\n" \ boilerplate+=" * This is an unstable interface; changes may be made\n" \ boilerplate+=" * without notice.\n" \ boilerplate+=" * END OpenSolaris section\n" \ boilerplate+=" */\n" ; \ if [[ "$(@F)" == "ast_limits.h" || \ "$(@F)" == "ast_dirent.h" ]] ; then \ printf "# Building (concatenation) %s\n" "$(@F)" ; \ { \ print -n "$${boilerplate}" ; \ printf '#ifndef %s\n' "$(AST64BITCPPSYMBOL)" ; \ cat "$(HDRDIR32)/$(@F)" ; \ printf '#else /* %s */\n' "$(AST64BITCPPSYMBOL)" ; \ cat "$(HDRDIR64)/$(@F)" ; \ printf '#endif /* %s */\n' "$(AST64BITCPPSYMBOL)" ; \ } >"tmpastinclude/$(@F)" ; \ else \ printf "# Building (diff) %s\n" "$(@F)"; \ { \ set +o errexit ; \ print -n "$${boilerplate}" ; \ /usr/bin/diff -D $(AST64BITCPPSYMBOL) "$(HDRDIR32)/$(@F)" "$(HDRDIR64)/$(@F)" ; true ;\ } >"tmpastinclude/$(@F)" ; \ fi $(INS) -s -m $(FILEMODE) -f $(@D) "tmpastinclude/$(@F)" # Add temporary include files to the list of files to "clobber" CLOBBERFILES += tmpastinclude/*