#
# 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
# 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 (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
#
#
# Common macros
#
PRE_POUND = pre\#
POUND_SIGN = $(PRE_POUND:pre\%=%)
DIRMODE = 755
FILEMODE = 0444
# Installation directories
MFS_DIR = /lib/svc/manifest
VP_DIR = /usr/share/vpanels
RAD_JAVA_DIR = /usr/lib/rad/java
VP_LOCALE = $(VP_DIR)/locale
PROTO_APPS = $(ROOT)/usr/share/applications
PROTO_APPS_PO = $(ROOT)/usr/share/applications/po
PROTO_AUTOSTART = $(ROOT)/usr/share/gnome/autostart
PROTO_BIN = $(ROOT)/usr/bin
PROTO_DOC = $(ROOT)/usr/share/lib/java/javadoc
PROTO_ETC_SEC = $(ROOT)/etc/security
PROTO_ETC_UATTR.D = $(ROOT)/etc/user_attr.d
PROTO_ETC_VPANELS = $(ROOT)/etc/vpanels
PROTO_INCLUDE = $(ROOT)/usr/include
PROTO_LIB = $(ROOT)/usr/lib
PROTO_RAD = $(PROTO_LIB)/rad
PROTO_RAD_JAVA = $(PROTO_RAD)/java
PROTO_MAN = $(ROOT)/usr/share/man
PROTO_MDB = $(ROOT)/usr/lib/mdb/proc
PROTO_MFS_NETWORK = $(ROOT)$(MFS_DIR)/network
PROTO_MFS_SYSTEM = $(ROOT)$(MFS_DIR)/system
PROTO_MTD = $(ROOT)/lib/svc/method
PROTO_PYTHON = $(ROOT)/usr/lib/python2.6/vendor-packages
PROTO_SCHEMA = $(ROOT)/etc/gconf/schemas
PROTO_VP_DIR = $(ROOT)$(VP_DIR)
PROTO_VP_LOCALE = $(ROOT)$(VP_LOCALE)
PROTO_HELP_AUTHS = $(PROTO_LIB)/help/auths/locale/C
PROTO_HELP_PROFS = $(PROTO_LIB)/help/profiles/locale/C
PROJ_CORE = $(SRC)/core/build/$(MACH32)
# Files generated during build removed during "make clean/clobber"
CLEAN_FILES =
CLOBBER_FILES = $(CLEAN_FILES)
# Remove the CDDL from a target file
RMCDDL = $(PERL) -ni -e '\
if (!$$cddl) {\
print unless ($$cddl = /CDDL HEADER START/);\
} elsif (/CDDL HEADER END/) {\
$$cddl = 0;\
}' $@
# Install macros
INS.dir = $(INS) -s -d -m $(DIRMODE) $@
INS.file = \
$(INS) -s -d -m $(DIRMODE) $(@D); \
$(RM) -- $@; \
$(INS) -s -m $(FILEMODE) -f $(@D) $<
INS.pyfile = $(INS.file); $(RMCDDL); $(TOUCH) -r $< $@
#Install and rename a file
INS.rename = \
$(INS.file); \
$(MV) $(@D)/$(<F) $@
# Tools and dependencies used at build time
ISA:sh = uname -p
CHMOD = /usr/bin/chmod
CP = /usr/bin/cp
EGREP = /usr/bin/egrep
ENV = /usr/bin/env
FIND = /usr/bin/find
GREP = /usr/bin/grep
GTAR = /usr/sfw/bin/gtar
HEAD = /usr/bin/head
INS = /usr/sbin/install
LN = /usr/bin/ln
LS = /usr/bin/ls
MKDIR = /usr/bin/mkdir
MV = /usr/bin/mv
PERL = /usr/bin/perl
PKG = /usr/bin/pkg
PKGMERGE = /usr/bin/pkgmerge
PKGMOGRIFY = /usr/bin/pkgmogrify
PKGREPO = /usr/bin/pkgrepo
PKGSEND = /usr/bin/pkgsend
PWDCMD = /usr/bin/pwd
SED = /usr/bin/sed
SORT = /usr/bin/sort
TAR = /usr/bin/tar
WGET = /usr/bin/wget
XARGS = /usr/bin/xargs
PYTHON = /usr/bin/python
TOUCH = /usr/bin/touch
TRUE = /usr/bin/true
INTLTOOL_EXTRACT = /usr/bin/intltool-extract
INTLTOOL_UPDATE = /usr/bin/intltool-update
INTLTOOL_MERGE = /usr/bin/intltool-merge
# Set here explicitly to avoid compiling with newer class version
JDK_HOME = /usr/jdk/instances/jdk1.8.0
JAVA_HOME = $(JDK_HOME)
JAVAC = $(JDK_HOME)/bin/javac
JAR = $(JDK_HOME)/bin/jar
JAVADOC = $(JDK_HOME)/bin/javadoc
JAVAH = $(JDK_HOME)/bin/javah
JAVA = $(JAVA_HOME)/bin/java
# Consumers must depend on java (or java/adr)
RADADRGEN = $(ENV) \
RADADR_SCHEMA=/usr/share/lib/xml/rng/radadr.rng.1 \
RADADR_XSLDIR=/usr/share/lib/xml/style \
# Lint
LINTFLAGS = -s -errtags=yes -errsecurity=core -errwarn=%all
# Mapfiles
MAPFILES_i386 = /usr/lib/ld/map.noexdata
MAPFILES_sparc =
MAPFILES = $(MAPFILES_$(ISA)) /usr/lib/ld/map.pagealign
MAPOPTS = $(MAPFILES:%=-M%)
# Libraries
LIBNAME = $(LIBRARY:lib%.a=%)
DYNLIB = $(LIBRARY:.a=.so$(VERS))
SOLIB = $(LIBRARY:.a=.so)
LLINK = 32
LINTLIB = llib-l$(LIBNAME).ln
LINTSRC = $(LINTLIB:%.ln=%)
LINTOUT = lint.out
LINTSRCS = $(SRCS)
LIBDIR64_i386=amd64
LIBDIR64_sparc=sparcv9
LIBDIR64=$(LIBDIR64_$(ISA))
ROOTHDRDIR = $(PROTO_INCLUDE)
ROOTHDRS = $(HDRS:%=$(ROOTHDRDIR)/%)
ROOTLIBBASE = $(PROTO_LIB)
ROOTLINTDIR = $(ROOTLIBBASE)
ROOTLINT = $(LINTSRC:%=$(ROOTLINTDIR)/%)
ROOTLIBDIR32 = $(ROOTLIBBASE)
ROOTLIBDIR64 = $(ROOTLIBBASE)/$(LIBDIR64)
ROOTLIBDIR = $(ROOTLIBDIR$(LLINK))
ROOTLIBS = $(LIBS:%=$(ROOTLIBDIR)/%)
ROOTLIBLINK32 = $(ROOTLIBBASE)/32
ROOTLIBLINK64 = $(ROOTLIBBASE)/64
ROOTLIBTGT32 = .
ROOTLIBTGT64 = $(LIBDIR64)
# Default to all subdirectories with a Makefile
SUBDIRS_CMD = $(LS) -1 */Makefile 2>/dev/null | $(SED) 's@/Makefile$$@@'
SUBDIRS = $(SUBDIRS_CMD:sh)
# Use CLASS_PATH instead of CLASS_PATH to avoid picking up environment
CLASS_PATH_ARRAY = $(DEPENDENCY_JARS)
CLASS_PATH_CMD = echo "$(CLASS_PATH_ARRAY)" | $(SED) 's/[ ][ ]*/:/g'
CLASS_PATH = $(CLASS_PATH_CMD:sh)
.SUFFIXES: .py .pyc
$(RM) $@
$(PYTHON) -mpy_compile $<
@[ $(<)c = $@ ] || $(MV) $(<)c $@