diff options
29 files changed, 949 insertions, 241 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a29679 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# .gitignore for illumos checkouts. +# Note: this does not try to ignore all files in a fully built workspace. +# Rather, you are expected to "make clobber" before running "git status". +.make.state* +/proto +/usr/src/TAGS +/usr/src/cscope.* + diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 66c96ab..0000000 --- a/.hgignore +++ /dev/null @@ -1,5 +0,0 @@ -# -syntax: glob -proto/* -*/.make.state -*~ diff --git a/Install-foo b/Install-foo deleted file mode 100644 index 99efd7e..0000000 --- a/Install-foo +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/ksh -x -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2011 Nexenta Systems, Inc. All rights reserved. -# - -cpu=`uname -p` - -# Where is destination? -if [ "$1" ] ; then - DEST=$1 -fi - -# Where is PROTO? (arg? env? proto?) -if [ "$2" ] ; then - PROTO=$2 -elif [ "$ROOT" ] ; then - PROTO=$ROOT -elif [ -d ./proto ] ; then - PROTO=`pwd`/proto/root_$cpu -else - echo "PROTO env?" - exit 1 -fi - -case $cpu in -i386) - ARCH64=amd64 - ;; -sparc) - ARCH64=sparcv9 - ;; -*) echo "Huh?" ; exit 1;; -esac - -# Stop on error, and make noise -set -ex - -# Stop the service -# svcadm disable svc:/... - -# Unload old FOO -modinfo |grep ' foo ' |while read i junk -do - modunload -i $i -done - -# Copy in the new binaries -while read f -do - cmp -s $PROTO/$f $DEST/$f || { - echo "update $DEST/$f" - if [ -f $PROTO/$f ] ; then - if [ -f $DEST/$f.orig ] ; then - rm -f $DEST/$f || : - else - mv $DEST/$f $DEST/$f.orig || : - fi - fi - cp $PROTO/$f $DEST/$f - } -done <<EOF -kernel/drv/foo.conf -kernel/drv/foo -kernel/drv/amd64/foo -usr/lib/libfoo.so.1 -usr/bin/foo -EOF - -if [ -z "$DEST" ] -then - - modload -p drv/foo - add_drv -m '* 0666 root sys" foo - devfsadm -i foo - - # Reimport the manifest - # svccfg import /lib/svc/manifest/... - # svcadm restart manifest-import - - # Refresh, Restart the service - # svcadm enable svc:/... - -fi @@ -10,9 +10,17 @@ As provided, this skeleton builds one driver, one library, and one command, all named "foo". These are intentionally trivial objects, just to demonstrate how it builds. +The developer script quickbuild builds everything here. +If you copy quickbuild into a full illumos workspace +after integrating what you prototype in this skeleton, +then quickbuild will do a "partial build" for you. +(Quickly build just these components.) + This does not do any package building (no IPS, no SysV). -Instead, this uses the script Install-foo as an example of -how one might do a developer-style "quick" install. +The quickbuild script can create a tarball that you can +copy to a test machine and unpack there as a quick way +to "install". + Here is a list of all the places you might want to copy to add another driver, library, or command: @@ -33,4 +41,8 @@ to add another driver, library, or command: cmd/foo - Install-foo + man/man1/foo.1 + man/man3x/libfoo.3x + man/man7/foo.7 + + quickbuild diff --git a/myenv.sh b/myenv.sh new file mode 100644 index 0000000..3b1844b --- /dev/null +++ b/myenv.sh @@ -0,0 +1,183 @@ +# +# 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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org> +# Copyright 2013 Nexenta Systems, Inc. All rights reserved. +# + +# Configuration variables for the runtime environment of the nightly +# build script and other tools for construction and packaging of releases. +# This script is sourced by 'nightly' and 'bldenv' to set up the environment +# for the build. This example is suitable for building an OpenSolaris +# workspace, which will contain the resulting archives. It is based +# off the onnv release. It sets NIGHTLY_OPTIONS to make nightly do: +# do DEBUG (only!) build (-D -F) +# do not bringover from the parent (-n) +# runs 'make check' (-C) +# runs lint in usr/src (-l plus the LINTDIRS variable) +# sends mail on completion (-m and the MAILTO variable) +# creates packages for PIT/RE (-p) +# checks for changes in ELF runpaths (-r) +# build and use this workspace's tools in $SRC/tools (-t) +# +export NIGHTLY_OPTIONS='-DCFlnpr' + +# CODEMGR_WS - where is your workspace (or what should nightly name it) +export CODEMGR_WS=`git rev-parse --show-toplevel` + +# This is a variable for the rest of the script - GATE doesn't matter to +# nightly itself. +GATE=`basename ${CODEMGR_WS}` + +# Maximum number of dmake jobs. The recommended number is 2 + NCPUS, +# where NCPUS is the number of logical CPUs on your build system. +export DMAKE_MAX_JOBS=4 + +# PARENT_WS is used to determine the parent of this workspace. This is +# for the options that deal with the parent workspace (such as where the +# proto area will go). +# export PARENT_WS= + +# CLONE_WS is the workspace nightly should do a bringover from. +# export CLONE_WS= + +# The bringover, if any, is done as STAFFER. +# Set STAFFER to your own login as gatekeeper or developer +# The point is to use group "staff" and avoid referencing the parent +# workspace as root. +# Some scripts optionally send mail messages to MAILTO. +# +export STAFFER="$LOGNAME" +export MAILTO="$STAFFER" + +# If you wish the mail messages to be From: an arbitrary address, export +# MAILFROM. +#export MAILFROM="user@example.com" + +# The project (see project(4)) under which to run this build. If not +# specified, the build is simply run in a new task in the current project. +export BUILD_PROJECT= + +# You should not need to change the next four lines +export LOCKNAME="$(basename "$CODEMGR_WS")_nightly.lock" +export ATLOG="$CODEMGR_WS/log" +export LOGFILE="$ATLOG/nightly.log" +export MACH="$(uname -p)" + +# +# The following two macros are the closed/crypto binaries. Once +# Illumos has totally freed itself, we can remove these references. +# +# Location of encumbered binaries. +# This assumes you keep a local copy around +export ON_CLOSED_BINS=/ws/on-closed-bins/onnv147/closed +# Location of signed cryptographic binaries. +# export ON_CRYPTO_BINS="$CLONE_WS/on-crypto.$MACH.tar.bz2" + +# +# REF_PROTO_LIST - for comparing the list of stuff in your proto area +# with. Generally this should be left alone, since you want to see differences +# from your parent (the gate). +# +export REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH}" + +export ROOT="$CODEMGR_WS/proto/root_${MACH}" +export SRC="$CODEMGR_WS/usr/src" +export MULTI_PROTO="no" + +# +# Build environment variables, including version info for mcs, motd, +# motd, uname and boot messages. Mostly you shouldn't change this except +# when a release name changes, etc. +# +# With modern SCM systems like git, one typically wants the +# change set ID (hash) in the version sring. +GIT_REV=`git rev-parse --short=10 HEAD` +export VERSION="${GATE}:${GIT_REV}" +export ONNV_BUILDNUM=152 + +# +# the RELEASE and RELEASE_DATE variables are set in Makefile.master; +# there might be special reasons to override them here. +# +# export RELEASE='5.11' +# export RELEASE_DATE='October 2007' + +# proto area in parent for optionally depositing a copy of headers and +# libraries corresponding to the protolibs target +# not applicable given the NIGHTLY_OPTIONS +# +export PARENT_ROOT="$PARENT_WS/proto/root_$MACH" +export PARENT_TOOLS_ROOT="$PARENT_WS/public/tools/root_$MACH-nd" + +# Package creation variables. You probably shouldn't change these, +# either. +# +# PKGARCHIVE determines where the repository will be created. +# +# PKGPUBLISHER_REDIST controls the publisher setting for the repository. +# +export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly" +# export PKGPUBLISHER_REDIST='on-redist' + +# Package manifest format version. +export PKGFMT_OUTPUT='v1' + +# we want make to do as much as it can, just in case there's more than +# one problem. +# export MAKEFLAGS='k' + +# Magic variable to prevent the devpro compilers/teamware from sending +# mail back to devpro on every use. +export UT_NO_USAGE_TRACKING='1' + +# Build tools - don't change these unless you know what you're doing. These +# variables allows you to get the compilers and onbld files locally or +# through cachefs. Set BUILD_TOOLS to pull everything from one location. +# Alternately, you can set ONBLD_TOOLS to where you keep the contents of +# SUNWonbld and SPRO_ROOT to where you keep the compilers. SPRO_VROOT +# exists to make it easier to test new versions of the compiler. +#export BUILD_TOOLS=/ws/onnv-tools +export ONBLD_TOOLS=/opt/onbld +#export SPRO_ROOT=/opt/onspro +#export SPRO_VROOT="$SPRO_ROOT" + +# path to onbld tool binaries +ONBLD_BIN="${ONBLD_TOOLS}/bin" + +# This goes along with lint - it is a series of the form "A [y|n]" which +# means "go to directory A and run 'make lint'" Then mail me (y) the +# difference in the lint output. 'y' should only be used if the area you're +# linting is actually lint clean or you'll get lots of mail. +# You shouldn't need to change this though. +#export LINTDIRS="$SRC y" + +# Set this flag to 'n' to disable the automatic validation of the dmake +# version in use. The default is to check it. +#CHECK_DMAKE=y + +# Set this flag to 'n' to disable the use of 'checkpaths'. The default, +# if the 'N' option is not specified, is to run this test. +#CHECK_PATHS=y + +# POST_NIGHTLY can be any command to be run at the end of nightly. See +# nightly(1) for interactions between environment variables and this command. +#POST_NIGHTLY= diff --git a/quickbuild b/quickbuild new file mode 100755 index 0000000..1c4638e --- /dev/null +++ b/quickbuild @@ -0,0 +1,201 @@ +#!/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2014 Nexenta Systems, Inc. All rights reserved. +# + +# Use distributed make (dmake) by default. +make=${MAKE:-dmake} + +# Do this if you want to use dbx or gdb +# export SOURCEDEBUG=yes + +[ -n "$SRC" ] || { + echo "SRC not set. Run 'ws' or 'bldenv' first." + exit 1 +} + +cpu=`uname -p` +case $cpu in +i386) + x=intel + mdb_arch="ia32 amd64" + arch64=amd64 + ;; +sparc) + x=sparc + mdb_arch=v9 + arch64=sparcv9 + ;; +*) echo "Huh?" ; exit 1;; +esac + +################################################################ + +build_tools() { + test -f $SRC/tools/proto/root_i386-nd/opt/onbld/bin/genoffsets || + (cd $SRC/tools && $make install) + (cd $SRC/common/mapfiles/common; $make install) +} + +clobber_tools() { + (cd $SRC/tools && $make clobber) + (cd $SRC/common/mapfiles/common; $make clobber) +} + +################################################################ + +do_hdrs() { + +case $1 in +clean|clobber) + (cd $SRC/uts && $make -k clobber_h) + (cd $SRC/head && $make clobber) + ;; +install) + (cd $SRC && $make sgs) + ;; +*) + ;; +esac + +# Need some library headers too... +(cd $SRC/lib/libfoo && $make $targ) + +} + +################################################################ + +do_kern() { + case $1 in + lint) targ=modlintlib ;; + *) targ=$1 ;; + esac + ( unset SOURCEDEBUG ; + (cd $SRC/uts/$x/foo && $make $targ) + ) +} + +################################################################ + +do_libs() { + + (cd $SRC/lib && $make $1) + +} + +################################################################ + +do_cmds() { + + (cd $SRC/cmd && $make $1) + +} + +################################################################ + +do_mans() { + + (cd $SRC/man && $make $1) +} + + +################################################################ +# This builds $SRC/TAGS (and cscope.files) in a helpful order. + +do_tags() { + (cd $SRC ; + find uts/common/sys -name '*.[ch]' -print |sort + find lib/libfoo -name '*.[ch]' -print |sort + find cmd/foo -name '*.[ch]' -print |sort + ) > $SRC/cscope.files + + (cd $SRC ; + exctags -e -L - < cscope.files + cscope -b ) +} + +################################################################ +# This creates a tarfile one can use to update a test machine. + +do_tar() { + git_rev=`git rev-parse --short=8 HEAD` + files=" +kernel/drv/foo.conf +kernel/drv/$arch64/foo +kernel/drv/foo +usr/lib/libfoo.so.1 +usr/lib/libfoo.so +usr/bin/foo +" + + (cd $ROOT && tar cfj ../../on-skel-${git_rev}.tar.bz2 $files) +} + +################################################################ + +if [ "$1" = "" ]; then + set '?' # force usage +fi + +set -x + +for arg +do + case "$arg" in + install) + build_tools + set -e + do_hdrs $arg + do_kern $arg + do_libs $arg + do_cmds $arg + do_mans $arg + ;; + lint) + do_kern $arg + do_libs $arg + do_cmds $arg + ;; + check) + do_libs $arg + do_cmds $arg + do_mans $arg + ;; + clean) + # intentionally skip: lib1, hdrs, tools + do_mans $arg + do_cmds $arg + do_libs $arg + do_kern $arg + ;; + clobber) + do_mans $arg + do_cmds $arg + do_libs $arg + do_kern $arg + do_hdrs $arg + clobber_tools + ;; + tags) + do_tags + ;; + tar) + do_tar + ;; + *) + echo "Usage: $0 {install|lint|check|clean|clobber|tags|tar}"; + exit 1; + ;; + esac +done diff --git a/usr/src/Makefile b/usr/src/Makefile index 37cd8b6..7e72d12 100644 --- a/usr/src/Makefile +++ b/usr/src/Makefile @@ -34,7 +34,7 @@ include Makefile.master # it defines TARGETDIRS and ROOTDIRS. include Targetdirs -COMMON_SUBDIRS= uts lib cmd +COMMON_SUBDIRS= uts lib cmd man sparc_SUBDIRS= i386_SUBDIRS= @@ -47,6 +47,8 @@ HDRSUBDIRS= uts head lib cmd # CHKHDRSUBDIRS= head uts lib +# And man page formats +CHKMANSUBDIRS = man # The check target also causes smf(5) service manifests to be validated. CHKMFSTSUBDIRS= cmd @@ -116,7 +118,7 @@ sgs: rootdirs .WAIT sysheaders userheaders .WAIT \ setup: bldtools sgs bldtools: -# @cd tools; pwd; $(MAKE) install + @cd tools; pwd; $(MAKE) install # rootdirs: $(ROOTDIRS) @@ -154,7 +156,7 @@ all_xmod_sparc install_xmod_sparc: FRC all_xmod_i386 install_xmod_i386: FRC @cd uts/i86; pwd; $(MAKE) TARGET=$(TARGET) svvs -check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) +check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) $(CHKMANSUBDIRS) # # Cross-reference customization: skip all of the subdirectories that diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index dad0b73..ee9ee2a 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -21,33 +21,30 @@ # # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# Copyright (c) 2012 by Delphix. All rights reserved. +# Copyright 2014 Garrett D'Amore <garrett@damore.org> +# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. # + # # Makefile.master, global definitions for system source # ROOT= /proto # -# RELEASE_BUILD should be cleared for final release builds. -# NOT_RELEASE_BUILD is exactly what the name implies. +# Adjunct root, containing an additional proto area to be used for headers +# and libraries. # -# INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls -# identification strings. Enabling RELEASE_BUILD automatically enables -# INTERNAL_RELEASE_BUILD. +ADJUNCT_PROTO= + # -# EXPORT_RELEASE_BUILD controls whether binaries are built in a form that -# can be released for export under a binary license. It is orthogonal to -# the other *RELEASE_BUILD settings. ("#" means do an export release -# build, "" means do a normal build.) +# Adjunct for building things that run on the build machine. # -# CLOSED_BUILD controls whether we try to build files under -# usr/closed. ("" means to build closed code, "#" means don't try to -# build it.) Skipping the closed code implies doing an export release -# build. +NATIVE_ADJUNCT= /usr + # -# STRIP_COMMENTS toggles comment section striping. Generally the same setting -# as INTERNAL_RELEASE_BUILD. +# RELEASE_BUILD should be cleared for final release builds. +# NOT_RELEASE_BUILD is exactly what the name implies. # # __GNUC toggles the building of ON components using gcc and related tools. # Normally set to `#', set it to `' to do gcc build. @@ -68,19 +65,10 @@ PRE_POUND= pre\# POUND_SIGN= $(PRE_POUND:pre\%=%) NOT_RELEASE_BUILD= -INTERNAL_RELEASE_BUILD= $(POUND_SIGN) RELEASE_BUILD= $(POUND_SIGN) $(RELEASE_BUILD)NOT_RELEASE_BUILD= $(POUND_SIGN) -$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD= PATCH_BUILD= $(POUND_SIGN) -# If CLOSED_IS_PRESENT is not set, assume the closed tree is present. -CLOSED_BUILD_1= $(CLOSED_IS_PRESENT:yes=) -CLOSED_BUILD= $(CLOSED_BUILD_1:no=$(POUND_SIGN)) - -EXPORT_RELEASE_BUILD= $(POUND_SIGN) -$(CLOSED_BUILD)EXPORT_RELEASE_BUILD= - # SPARC_BLD is '#' for an Intel build. # INTEL_BLD is '#' for a Sparc build. SPARC_BLD_1= $(MACH:i386=$(POUND_SIGN)) @@ -88,31 +76,25 @@ SPARC_BLD= $(SPARC_BLD_1:sparc=) INTEL_BLD_1= $(MACH:sparc=$(POUND_SIGN)) INTEL_BLD= $(INTEL_BLD_1:i386=) -STRIP_COMMENTS= $(INTERNAL_RELEASE_BUILD) - -# Are we building tonic closedbins? Unless you have used the -# -O flag to nightly or bldenv, leave the definition of TONICBUILD -# as $(POUND_SIGN). +# The variables below control the compilers used during the build. +# There are a number of permutations. +# +# __GNUC and __SUNC control (and indicate) the primary compiler. Whichever +# one is not POUND_SIGN is the primary, with the other as the shadow. They +# may also be used to control entirely compiler-specific Makefile assignments. +# __GNUC and GCC are the default. +# +# __GNUC64 indicates that the 64bit build should use the GNU C compiler. +# There is no Sun C analogue. +# +# The following version-specific options are operative regardless of which +# compiler is primary, and control the versions of the given compilers to be +# used. They also allow compiler-version specific Makefile fragments. # -# IF YOU CHANGE CLOSEDROOT, you MUST change install.bin -# to match the new definition. -TONICBUILD= $(POUND_SIGN) -$(TONICBUILD)CLOSEDROOT= $(ROOT)-closed - - -# set __GNUC= in the environment to build 32-bit with the gcc compiler. -# The default is to use the Sun Studio compiler for all processor types. -__GNUC= $(POUND_SIGN) - -# set __GNUC64= in the environment to build 64-bit with the gcc compiler. -# Inherit the __GNUC value by default, and if that is set to $(POUND_SIGN) -# then this means use the Sun Studio compiler. -__GNUC64= $(__GNUC) -# set __SSNEXT= in the enviroment to build with the 'next' release of -# the Sun Studio compiler. This will cause command line options specific -# to the 'next' version of the Sun Studio compiler to be used. -__SSNEXT= $(POUND_SIGN) +__SUNC= $(POUND_SIGN) +$(__SUNC)__GNUC= $(POUND_SIGN) +__GNUC64= $(__GNUC) # CLOSED is the root of the tree that contains source which isn't released # as open source @@ -131,6 +113,12 @@ SFWINCDIR= $(SFW_ROOT)/include SFWLIBDIR= $(SFW_ROOT)/lib SFWLIBDIR64= $(SFW_ROOT)/lib/$(MACH64) +GCC_ROOT= /opt/gcc/4.4.4 +GCCLIBDIR= $(GCC_ROOT)/lib +GCCLIBDIR64= $(GCC_ROOT)/lib/$(MACH64) + +DOCBOOK_XSL_ROOT= /usr/share/sgml/docbook/xsl-stylesheets + RPCGEN= /usr/bin/rpcgen STABS= $(ONBLD_TOOLS)/bin/$(MACH)/stabs ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract @@ -170,6 +158,7 @@ JAR= $(JAVA_ROOT)/bin/jar CTFCONVERT= $(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert CTFMERGE= $(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge CTFSTABS= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs +CTFSTRIP= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip NDRGEN= $(ONBLD_TOOLS)/bin/$(MACH)/ndrgen GENOFFSETS= $(ONBLD_TOOLS)/bin/genoffsets CTFCVTPTBL= $(ONBLD_TOOLS)/bin/ctfcvtptbl @@ -177,18 +166,23 @@ CTFFINDMOD= $(ONBLD_TOOLS)/bin/ctffindmod XREF= $(ONBLD_TOOLS)/bin/xref FIND= /usr/bin/find PERL= /usr/bin/perl -PYTHON_24= /usr/bin/python2.4 +PERL_VERSION= 5.10.0 +PERL_PKGVERS= -510 +PERL_ARCH = i86pc-solaris-64int +$(SPARC_BLD)PERL_ARCH = sun4-solaris-64int PYTHON_26= /usr/bin/python2.6 -PYTHON= $(PYTHON_24) +PYTHON= $(PYTHON_26) SORT= /usr/bin/sort TOUCH= /usr/bin/touch WC= /usr/bin/wc XARGS= /usr/bin/xargs ELFEDIT= /usr/bin/elfedit ELFSIGN= /usr/bin/elfsign -DTRACE= /usr/sbin/dtrace +DTRACE= /usr/sbin/dtrace -xnolibs UNIQ= /usr/bin/uniq TAR= /usr/bin/tar +ASTBINDIR= /usr/ast/bin +MSGCC= $(ASTBINDIR)/msgcc FILEMODE= 644 DIRMODE= 755 @@ -231,12 +225,6 @@ MANIFEST_CHECK= \ SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \ $(SRC)/cmd/svc/svccfg/svccfg-native validate $< -# -# IMPORTANT:: If you change any of INS.file, INS.dir, INS.rename, -# INS.link or INS.symlink here, then you must also change the -# corresponding override definitions in $CLOSED/Makefile.tonic. -# If you do not do this, then the closedbins build for the OpenSolaris -# community will break. PS, the gatekeepers will be upset too. INS.file= $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $< INS.dir= $(INS) -s -d -m $(DIRMODE) $@ # installs and renames at once @@ -313,6 +301,19 @@ CCSTATICSYM= -Wc,-Qassembler-ounrefsym=0 # # generate 32-bit addresses in the v9 kernel. Saves memory. CCABS32= -Wc,-xcode=abs32 +# +# generate v9 code which tolerates callers using the v7 ABI, for the sake of +# system calls. +CC32BITCALLERS= -_gcc=-massume-32bit-callers + +# GCC, especially, is increasingly beginning to auto-inline functions and +# sadly does so separately not under the general -fno-inline-functions +# Additionally, we wish to prevent optimisations which cause GCC to clone +# functions -- in particular, these may cause unhelpful symbols to be +# emitted instead of function names +CCNOAUTOINLINE= -_gcc=-fno-inline-small-functions \ + -_gcc=-fno-inline-functions-called-once \ + -_gcc=-fno-ipa-cp # One optimization the compiler might perform is to turn this: # #pragma weak foo @@ -324,7 +325,7 @@ CCABS32= -Wc,-xcode=abs32 # Since we do some of this (foo might be referenced in common kernel code # but provided only for some cpu modules or platforms), we disable this # optimization. -# +# sparc_CCUNBOUND = -Wd,-xsafe=unboundsym i386_CCUNBOUND = CCUNBOUND = $($(MACH)_CCUNBOUND) @@ -352,8 +353,11 @@ amd64_AS_XARCH= -xarch=amd64 -P -Ui386 -U__i386 # sparc_STAND_FLAGS= -_gcc=-ffreestanding sparcv9_STAND_FLAGS= -_gcc=-ffreestanding -i386_STAND_FLAGS= -_gcc=-ffreestanding -amd64_STAND_FLAGS= -xmodel=kernel +# Disabling MMX also disables 3DNow, disabling SSE also disables all later +# additions to SSE (SSE2, AVX ,etc.) +NO_SIMD= -_gcc=-mno-mmx -_gcc=-mno-sse +i386_STAND_FLAGS= -_gcc=-ffreestanding $(NO_SIMD) +amd64_STAND_FLAGS= -xmodel=kernel $(NO_SIMD) SAVEARGS= -Wu,-save_args amd64_STAND_FLAGS += $(SAVEARGS) @@ -368,7 +372,7 @@ ILDOFF= -xildoff XDEPEND= -xdepend XFFLAG= -xF=%all XESS= -xs -XSTRCONST= -xstrconst +XSTRCONST= -xstrconst # # turn warnings into errors (C) @@ -376,6 +380,20 @@ CERRWARN = -errtags=yes -errwarn=%all CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT CERRWARN += -erroff=E_STATEMENT_NOT_REACHED +CERRWARN += -_gcc=-Wno-missing-braces +CERRWARN += -_gcc=-Wno-sign-compare +CERRWARN += -_gcc=-Wno-unknown-pragmas +CERRWARN += -_gcc=-Wno-unused-parameter +CERRWARN += -_gcc=-Wno-missing-field-initializers + +# Unfortunately, this option can misfire very easily and unfixably. +CERRWARN += -_gcc=-Wno-array-bounds + +# DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in +# -nd builds +$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused +$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body + # # turn warnings into errors (C++) CCERRWARN= -xwe @@ -420,10 +438,6 @@ CNOGLOBAL= -W0,-noglobal # In the same spirit, this will also remove the date from the N_OPT stab. CGLOBALSTATIC= -W0,-xglobalstatic -# Normally, gcc uses indirect DWARF strings to save space. However, -# this causes relocations that ctfconvert cannot handle. Disable this. -CDWARFSTR= -_gcc=-fno-dwarf2-indirect-strings - # Sometimes we want all symbols and types in debugging information even # if they aren't used. CALLSYMS= -W0,-xdbggen=no%usedonly @@ -440,7 +454,16 @@ DEBUGFORMAT= -xdebugformat=stabs # CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR) CTF_FLAGS_i386 = -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR) -CTF_FLAGS = $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT) + +CTF_FLAGS_sparcv9 = $(CTF_FLAGS_sparc) +CTF_FLAGS_amd64 = $(CTF_FLAGS_i386) + +# Sun Studio produces broken userland code when saving arguments. +$(__GNUC)CTF_FLAGS_amd64 += $(SAVEARGS) + +CTF_FLAGS_32 = $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT) +CTF_FLAGS_64 = $(CTF_FLAGS_$(MACH64)) $(DEBUGFORMAT) +CTF_FLAGS = $(CTF_FLAGS_32) # # Flags used with genoffsets @@ -487,25 +510,54 @@ amd64_XREGSFLAG = XREGSFLAG = $($(MACH)_XREGSFLAG) XREGSFLAG64 = $($(MACH64)_XREGSFLAG) +# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and +# avoids stripping it. +SOURCEDEBUG = $(POUND_SIGN) +SRCDBGBLD = $(SOURCEDEBUG:yes=) + +# +# These variables are intended ONLY for use by developers to safely pass extra +# flags to the compilers without unintentionally overriding Makefile-set +# flags. They should NEVER be set to any value in a Makefile. +# +# They come last in the associated FLAGS variable such that they can +# explicitly override things if necessary, there are gaps in this, but it's +# the best we can manage. +# +CUSERFLAGS = +CUSERFLAGS64 = $(CUSERFLAGS) +CCUSERFLAGS = +CCUSERFLAGS64 = $(CCUSERFLAGS) + +CSOURCEDEBUGFLAGS = +CCSOURCEDEBUGFLAGS = +$(SRCDBGBLD)CSOURCEDEBUGFLAGS = -g -xs +$(SRCDBGBLD)CCSOURCEDEBUGFLAGS = -g -xs + CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \ $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \ - $(CGLOBALSTATIC) + $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \ + $(CUSERFLAGS) CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \ $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \ - $(CGLOBALSTATIC) + $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \ + $(CUSERFLAGS64) # # Flags that are used to build parts of the code that are subsequently # run on the build machine (also known as the NATIVE_BUILD). # NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \ $(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \ - $(IROPTFLAG) $(CGLOBALSTATIC) + $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \ + $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS) DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging. DTS_ERRNO=-D_TS_ERRNO CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \ - $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) -CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) + $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \ + $(ADJUNCT_PROTO:%=-I%/usr/include) +CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \ + $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include CPPFLAGS= $(CPPFLAGS.master) AS_CPPFLAGS= $(CPPFLAGS.master) JAVAFLAGS= -deprecation @@ -517,7 +569,7 @@ JAVAFLAGS= -deprecation MSGROOT= $(ROOT)/catalog MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN) MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE) -DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) +DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po) CLOBBERFILES += $(POFILE) $(POFILES) @@ -561,13 +613,15 @@ amd64_CCOPTFLAG= -O CCOPTFLAG= $($(MACH)_CCOPTFLAG) CCOPTFLAG64= $($(MACH64)_CCOPTFLAG) -CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) -CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) +CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \ + $(CCUSERFLAGS) +CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \ + $(CCUSERFLAGS64) # # # -ELFWRAP_FLAGS = +ELFWRAP_FLAGS = ELFWRAP_FLAGS64 = -64 # @@ -606,17 +660,25 @@ MAPFILE.NGB = $(MAPFILE.NGB_$(MACH)) # MAPFILE.INT = mapfile-intf -# -# LDLIBS32 can be set in the environment to override the following assignment. -# LDLIBS64 can be set to override the assignment made in Makefile.master.64. +# +# LDLIBS32 and LDLIBS64 can be set in the environment to override the following +# assignments. +# # These environment settings make sure that no libraries are searched outside # of the local workspace proto area: # LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib # LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64 # LDLIBS32 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3) +LDLIBS32 += $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib) LDLIBS.cmd = $(LDLIBS32) LDLIBS.lib = $(LDLIBS32) + +LDLIBS64 = $(ENVLDLIBS1:%=%/$(MACH64)) \ + $(ENVLDLIBS2:%=%/$(MACH64)) \ + $(ENVLDLIBS3:%=%/$(MACH64)) +LDLIBS64 += $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64)) + # # Define compilation macros. # @@ -638,7 +700,9 @@ COMPILE.java= $(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH) # Link time macros # CCNEEDED = -lC -$(__GNUC)CCNEEDED = -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s +CCEXTNEEDED = -lCrun -lCstd +$(__GNUC)CCNEEDED = -L$(GCCLIBDIR) -lstdc++ -lgcc_s +$(__GNUC)CCEXTNEEDED = $(CCNEEDED) LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) LINK64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS) @@ -728,7 +792,6 @@ sparcv9_AS= /usr/ccs/bin/as -xregsym=no sparcv9_LD= /usr/ccs/bin/ld sparcv9_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint -# We compile 32-bit objects with cc by default i386_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc $(__GNUC)i386_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc i386_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC @@ -739,7 +802,6 @@ $(__GNUC)i386_AS= $(ONBLD_TOOLS)/bin/$(MACH)/aw i386_LD= /usr/ccs/bin/ld i386_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint -# We compile 64-bit objects with gcc amd64_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc $(__GNUC64)amd64_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc amd64_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC @@ -773,8 +835,7 @@ REAL_CC= $(CW_CC_CMD:sh) REAL_CCC= $(CW_CCC_CMD:sh) # Pass -Y flag to cpp (method of which is release-dependent) -#CCYFLAG= -Y I, -CCYFLAG= -I +CCYFLAG= -Y I, BDIRECT= -Bdirect BDYNAMIC= -Bdynamic @@ -842,8 +903,9 @@ AS_BIGPICFLAGS= $(C_BIGPICFLAGS) CTFCVTFLAGS= -i -L VERSION # -# Override to pass module-specific flags to ctfmerge. Currently used -# only by krtld to turn on fuzzy matching. +# Override to pass module-specific flags to ctfmerge. Currently used only by +# krtld to turn on fuzzy matching, and source-level debugging to inhibit +# stripping. # CTFMRGFLAGS= @@ -852,23 +914,6 @@ CTFCONVERT_O = $(CTFCONVERT) $(CTFCVTFLAGS) $@ ELFSIGN_O= $(TRUE) ELFSIGN_CRYPTO= $(ELFSIGN_O) ELFSIGN_OBJECT= $(ELFSIGN_O) -$(EXPORT_RELEASE_BUILD)ELFSIGN_O = $(ELFSIGN) -$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME = SUNWosnetCF -$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY = \ - $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME) -$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT= \ - $(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME) -$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME = SUNWosnetSE -$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY = \ - $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME) -$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT= \ - $(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME) -$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO= $(ELFSIGN_O) sign \ - $(ELFSIGN_FORMAT_OPTION) \ - -k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@ -$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT= $(ELFSIGN_O) sign \ - $(ELFSIGN_FORMAT_OPTION) \ - -k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@ # Rules (normally from make.rules) and macros which are used for post # processing files. Normally, these do stripping of the comment section @@ -922,14 +967,13 @@ PATCH_DATE= $(RELEASE_DATE) RELEASE_CM= "@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)" DEV_CM= "@($(POUND_SIGN))SunOS Internal Development: non-nightly build" -PROCESS_COMMENT= @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM) -$(STRIP_COMMENTS)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM) +PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM) $(RELEASE_BUILD)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -STRIP_STABS= : -$(RELEASE_BUILD)STRIP_STABS= $(STRIP) -x $@ +STRIP_STABS= $(STRIP) -x $@ +$(SRCDBGBLD)STRIP_STABS= : -POST_PROCESS_O= $(PROCESS_COMMENT) $@ +POST_PROCESS_O= POST_PROCESS_A= POST_PROCESS_SO= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \ $(ELFSIGN_OBJECT) @@ -1080,7 +1124,7 @@ CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) .y.i: $(YACC) -d $< $(CPPFORPO) y.tab.c > $@ - $(RM) y.tab.c + $(RM) y.tab.c .l.i: $(LEX) $< @@ -1095,7 +1139,7 @@ CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) $(YACC) -d $< $(CPPFORPO) y.tab.c > $<.i $(BUILD.po) - $(RM) y.tab.c + $(RM) y.tab.c .l.po: $(LEX) $< @@ -1118,13 +1162,6 @@ CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) $(MANIFEST_CHECK) # -# Rules to process ONC+ Source partial files -# -%_onc_plus: % - @$(ECHO) "extracting code from $< ... " - sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $< > $@ - -# # Include rules to render automated sccs get rules "safe". -# +# include $(SRC)/Makefile.noget diff --git a/usr/src/Makefile.master.64 b/usr/src/Makefile.master.64 index c629264..4974b1d 100644 --- a/usr/src/Makefile.master.64 +++ b/usr/src/Makefile.master.64 @@ -20,7 +20,7 @@ # # # Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2011 Nexenta Systems, Inc. All rights reserved. +# Copyright 2014 Garrett D'Amore <garrett@damore.org> # # rebind basic build macros to 64-bit versions @@ -38,6 +38,8 @@ LINK.c= $(LINK64.c) LINK.cc= $(LINK64.cc) LINT.c= $(LINT64.c) +CTF_FLAGS= $(CTF_FLAGS_64) + OFFSETS_CREATE= $(OFFSETS_CREATE64) # @@ -48,6 +50,7 @@ LDLIBS1= $(ENVLDLIBS1:%=%/$(MACH64)) LDLIBS2= $(ENVLDLIBS2:%=%/$(MACH64)) LDLIBS3= $(ENVLDLIBS3:%=%/$(MACH64)) LDLIBS64 = $(LDLIBS1) $(LDLIBS2) $(LDLIBS3) + # # Moved these up to the top level here, so they can be overridden # @@ -55,9 +58,10 @@ LDLIBS.cmd = $(LDLIBS64) LDLIBS.lib = $(LDLIBS64) # -# Override Makefile.master's settings of SFWLIBDIR +# Override Makefile.master's settings of SFWLIBDIR and GCCLIBDIR # SFWLIBDIR= $(SFWLIBDIR64) +GCCLIBDIR= $(GCCLIBDIR64) # # Override Makefile.master's settings of CC, CCC, AS and LINT @@ -81,8 +85,8 @@ BUILD.SO= $(CC) $(CFLAGS) -o $@ $(GSHARED) $(DYNFLAGS) \ MAPFILECLASS= -64 CCNEEDED = -lCrun -$(__GNUC64)CCNEEDED = -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ \ - -lgcc_s_$(MACH64) +$(__GNUC64)CCNEEDED = -L$(GCCLIBDIR) -lstdc++ +$(__GNUC64)CCNEEDED += -lgcc_s BUILDCCC.SO= $(CCC) $(CCFLAGS) -o $@ $(GSHARED) $(DYNFLAGS) \ $(PICS) $(EXTPICS) $(LDLIBS) $(CCNEEDED) diff --git a/usr/src/Makefile.msg.targ b/usr/src/Makefile.msg.targ index d2fd03b..1075e50 100644 --- a/usr/src/Makefile.msg.targ +++ b/usr/src/Makefile.msg.targ @@ -22,8 +22,6 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2011 Nexenta Systems, Inc. All rights reserved. -# # Makefile.msg.targ # diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs index 937df6a..9c3c780 100644 --- a/usr/src/Targetdirs +++ b/usr/src/Targetdirs @@ -252,7 +252,9 @@ DIRS= \ /usr/share/lib/xml \ /usr/share/lib/xml/dtd \ /usr/share/man \ - /usr/share/man/man1m \ + /usr/share/man/man1 \ + /usr/share/man/man3x \ + /usr/share/man/man7 \ /usr/share/src \ /usr/snadm \ /usr/snadm/lib \ diff --git a/usr/src/cmd/foo/foo.c b/usr/src/cmd/foo/foo.c index 70e9d3c..f85af88 100644 --- a/usr/src/cmd/foo/foo.c +++ b/usr/src/cmd/foo/foo.c @@ -14,7 +14,7 @@ */ #include <stdio.h> -#include <foo.h> +#include <libfoo/foo.h> #include <libintl.h> int diff --git a/usr/src/common/mapfiles/common/Makefile b/usr/src/common/mapfiles/common/Makefile index cf4342e..5f32884 100644 --- a/usr/src/common/mapfiles/common/Makefile +++ b/usr/src/common/mapfiles/common/Makefile @@ -51,3 +51,5 @@ $(DIRS): $(ROOTDIR)/%: % $(INS.file) + +clean clobber: diff --git a/usr/src/lib/libfoo/Makefile b/usr/src/lib/libfoo/Makefile index 20201a9..d803339 100644 --- a/usr/src/lib/libfoo/Makefile +++ b/usr/src/lib/libfoo/Makefile @@ -39,9 +39,7 @@ lint := TARGET= lint HDRS= foo.h HDRDIR = common -ROOTHDRDIR= $(ROOT)/usr/include -ROOTHDRS= $(HDRS:%=$(ROOTHDRDIR)/%) -CHECKHDRS= $(HDRS:%.h=%.check) +ROOTHDRDIR= $(ROOT)/usr/include/libfoo POFILE = libfoo.po MSGFILES = `$(GREP) -l gettext common/*.[ch]` @@ -53,6 +51,11 @@ all clean clobber lint: $(SUBDIRS) install_h: $(ROOTHDRS) +# need to make libfoo dir +$(ROOTHDRS) : $(ROOTHDRDIR) +$(ROOTHDRDIR) : + $(INS.dir) $@ + check: $(CHECKHDRS) _msg: $(MSGDOMAINPOFILE) diff --git a/usr/src/lib/libfoo/common/foo.h b/usr/src/lib/libfoo/common/foo.h index 66e07b7..f88b468 100644 --- a/usr/src/lib/libfoo/common/foo.h +++ b/usr/src/lib/libfoo/common/foo.h @@ -22,5 +22,10 @@ extern "C" { #endif int foo_getcnt(uint32_t *); +const char *foo_message(uint32_t); + +#ifdef __cplusplus +} +#endif #endif /* _FOO_H */ diff --git a/usr/src/lib/libfoo/common/getcnt.c b/usr/src/lib/libfoo/common/getcnt.c index 138db05..c97ac28 100644 --- a/usr/src/lib/libfoo/common/getcnt.c +++ b/usr/src/lib/libfoo/common/getcnt.c @@ -13,7 +13,6 @@ foo_getcnt(uint32_t *cntp) { const char *devnm = "/dev/foo"; int fd, rc; - uint32_t cnt; fd = open(devnm, O_RDONLY, 0); if (fd == -1) @@ -28,7 +27,7 @@ foo_getcnt(uint32_t *cntp) } const char * -foo_message() +foo_message(int cnt) { const char *msg; diff --git a/usr/src/man/Makefile b/usr/src/man/Makefile new file mode 100644 index 0000000..8705b8c --- /dev/null +++ b/usr/src/man/Makefile @@ -0,0 +1,33 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2011, Richard Lowe +# + +SUBDIRS= man1 \ + man3x \ + man7 + +.PARALLEL: $(SUBDIRS) + +all := TARGET = all +clean := TARGET = clean +clobber := TARGET = clobber +install := TARGET = install +check := TARGET = check + +all check clean clobber install: $(SUBDIRS) + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +FRC: diff --git a/usr/src/man/Makefile.man b/usr/src/man/Makefile.man new file mode 100644 index 0000000..1b26bf0 --- /dev/null +++ b/usr/src/man/Makefile.man @@ -0,0 +1,62 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2011, Richard Lowe +# Copyright 2014 Nexenta Systems, Inc. All rights reserved. +# + +MANDOC= $(ONBLD_TOOLS)/bin/${MACH}/mandoc +ROOTMAN= $(ROOT)/usr/share/man +ROOTHASMAN= $(ROOT)/usr/has/man +FILEMODE= 0444 + +# The manual section being built, client Makefiles must set this to, for e.g. +# "3perl", with case matching that of the section name as installed. +# +# MANSECT= + +MANCHECKS= $(MANFILES:%=%.check) +ROOTMANFILES= $(MANFILES:%=$(ROOTMAN)/man$(MANSECT)/%) +ROOTMANLINKS= $(MANLINKS:%=$(ROOTMAN)/man$(MANSECT)/%) + +$(ROOTMAN)/man$(MANSECT)/% $(ROOTHASMAN)/man$(MANSECT)/%: % + $(INS.file) + +# +# Note that new mandoc adds some checks for lots of extra whitespace. +# We don't want to check our legacy pages for that. There are thousands +# and thousands of them in our man pages. Please still check them +# manually when editing (git pbchk will do so for you.) +# +$(MANCHECKS): + @$(EGREP) -q "^.TH" $(@:%.check=%) || \ + ( $(ECHO) "checking $(@:%.check=%)"; \ + $(MANDOC) -Tlint $(@:%.check=%) ) + +$(MANLINKS): + $(RM) $@; $(SYMLINK) $(LINKSRC) $@ + +$(ROOTMANLINKS): $(MANLINKS) + $(RM) $@; $(CP) -RP $(@F) $(@D) + +all: + +check: $(MANCHECKS) + +clean: + +clobber: + $(RM) $(MANLINKS) + +.PARALLEL: + +FRC: diff --git a/usr/src/man/man1/Makefile b/usr/src/man/man1/Makefile new file mode 100644 index 0000000..f0fbf24 --- /dev/null +++ b/usr/src/man/man1/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2011, Richard Lowe +# + +include $(SRC)/Makefile.master + +MANSECT= 1 + +MANFILES= foo.1 + +MANLINKS= + +.KEEP_STATE: + +include $(SRC)/man/Makefile.man + +install: $(ROOTMANFILES) $(ROOTMANLINKS) diff --git a/usr/src/man/man1/foo.1 b/usr/src/man/man1/foo.1 new file mode 100644 index 0000000..3a0023e --- /dev/null +++ b/usr/src/man/man1/foo.1 @@ -0,0 +1,36 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Nexenta Systems, Inc. +.\" +.Dd "Apr 7, 2015" +.Dt FOO 1 +.Os +.Sh NAME +.Nm foo +.Nd example command +.Sh SYNOPSIS +.Nm foo +.Op Fl v +.Sh DESCRIPTION +The +.Nm +command is a dummy example for the on-skeleton repository. +It does nothing interesting, other than demonstrate a +command and a library. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl v +Verbose mode. +.El +.Sh SEE ALSO +.Xr foo 3x , +.Xr foo 7 diff --git a/usr/src/man/man3x/Makefile b/usr/src/man/man3x/Makefile new file mode 100644 index 0000000..f48fc91 --- /dev/null +++ b/usr/src/man/man3x/Makefile @@ -0,0 +1,32 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2011, Richard Lowe +# + +include $(SRC)/Makefile.master + +MANSECT= 3x + +MANFILES= foo.3x + +MANLINKS= foo_getcnt.3x foo_message.3x libfoo.3x + +foo_getcnt.3x := LINKSRC = foo.3x +foo_message.3x := LINKSRC = foo.3x +libfoo.3x := LINKSRC = foo.3x + +.KEEP_STATE: + +include $(SRC)/man/Makefile.man + +install: $(ROOTMANFILES) $(ROOTMANLINKS) diff --git a/usr/src/man/man3x/foo.3x b/usr/src/man/man3x/foo.3x new file mode 100644 index 0000000..c0f8717 --- /dev/null +++ b/usr/src/man/man3x/foo.3x @@ -0,0 +1,53 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Nexenta Systems, Inc. +.\" +.Dd "Apr 7, 2015" +.Dt FOO 3X +.Os +.Sh NAME +.Nm foo_getcnt , +.Nm foo_message , +.Nm libfoo +.Nd get counter stored in /dev/foo +.Sh SYNOPSIS +.In libfoo/foo.h +.Ft int +.Fo foo_getcnt +.Fa int * +.Fc +.Ft int +.Fo foo_message +.Fa void +.Fc +.Sh DESCRIPTION +The +.Fn foo_getcnt +function gets a counter from the +.Sy /dev/foo +device. +The +.Fn foo_message +function returns a message. +.Sh RETURN VALUES +Upon successful completion, +.Fn foo_message +returns +.Sy 0 . +Otherwise, it returns an +.Sy errno +value. +.Sh ERRORS +No errors are defined. +.Sh SEE ALSO +.Xr foo 1 , +.Xr foo 7 diff --git a/usr/src/man/man7/Makefile b/usr/src/man/man7/Makefile new file mode 100644 index 0000000..6ba1f78 --- /dev/null +++ b/usr/src/man/man7/Makefile @@ -0,0 +1,28 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2011, Richard Lowe +# + +include $(SRC)/Makefile.master + +MANSECT= 7 + +MANFILES= foo.7 + +MANLINKS= + +.KEEP_STATE: + +include $(SRC)/man/Makefile.man + +install: $(ROOTMANFILES) $(ROOTMANLINKS) diff --git a/usr/src/man/man7/foo.7 b/usr/src/man/man7/foo.7 new file mode 100644 index 0000000..660c34e --- /dev/null +++ b/usr/src/man/man7/foo.7 @@ -0,0 +1,31 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2015 Nexenta Systems, Inc. +.\" +.Dd "Apr 7, 2015" +.Dt FOO 7 +.Os +.Sh NAME +.Nm foo +.Nd example "foo" driver +.Sh SYNOPSIS +.In sys/foo.h +.Sh DESCRIPTION +The +.Fn foo +driver is a simple example that just implements one +.Xr ioctl 2 +function: +.Sy FOO_IOC_GETCNT . +.Sh SEE ALSO +.Xr foo 1 , +.Xr libfoo 3x diff --git a/usr/src/tools/Makefile b/usr/src/tools/Makefile new file mode 100644 index 0000000..55a3a8a --- /dev/null +++ b/usr/src/tools/Makefile @@ -0,0 +1,33 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# + +# +# Don't want to copy the tools into this skeleton, +# so just make a link to /opt/onbld +# + +include ../Makefile.master + +all install: proto/root_$(MACH)-nd/opt + +proto/root_$(MACH)-nd/opt : + -/usr/bin/mkdir -p proto/root_$(MACH)-nd + /usr/bin/rm -f $@ + /usr/bin/ln -s /opt $@ + +clobber: + /usr/bin/rm -rf proto + +clean: diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files index e5b1505..502a97f 100644 --- a/usr/src/uts/common/Makefile.files +++ b/usr/src/uts/common/Makefile.files @@ -99,14 +99,11 @@ FOO_OBJS += foo.o LINT_DEFS += -Dunix # -# This duality can be removed when the native and target compilers -# are the same (or at least recognize the same command line syntax!) -# It is a bug in the current compilation system that the assember -# can't process the -Y I, flag. +# This only builds native drivers, so no CCYFLAG # -NATIVE_INC_PATH += $(INC_PATH) $(CCYFLAG)$(UTSBASE)/common +NATIVE_INC_PATH += $(INC_PATH) -I$(UTSBASE)/common AS_INC_PATH += $(INC_PATH) -I$(UTSBASE)/common -INCLUDE_PATH += $(INC_PATH) $(CCYFLAG)$(UTSBASE)/common +INCLUDE_PATH += $(INC_PATH) -I$(UTSBASE)/common # nulldriver module diff --git a/usr/src/uts/common/sys/foo.h b/usr/src/uts/common/sys/foo.h index 841e2ce..c1db064 100644 --- a/usr/src/uts/common/sys/foo.h +++ b/usr/src/uts/common/sys/foo.h @@ -1,3 +1,17 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + */ #define FOO_IOC_GETCNT 1 typedef uint32_t foocnt_t; diff --git a/usr/src/uts/intel/foo/Makefile b/usr/src/uts/intel/foo/Makefile index fa39aca..0d0946a 100644 --- a/usr/src/uts/intel/foo/Makefile +++ b/usr/src/uts/intel/foo/Makefile @@ -69,6 +69,8 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +CERRWARN += -_gcc=-Wno-unused-parameter + # # Driver depends on MAC # diff --git a/usr/src/uts/sparc/foo/Makefile b/usr/src/uts/sparc/foo/Makefile index 4e6d906..f24f608 100644 --- a/usr/src/uts/sparc/foo/Makefile +++ b/usr/src/uts/sparc/foo/Makefile @@ -67,6 +67,8 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +CERRWARN += -_gcc=-Wno-unused-parameter + # # Driver depends on MAC # |