[ksh93-integration-discuss] final ksh93 integration code review

Roland Mainz roland.mainz at nrubsig.org
Sat Jul 7 21:50:49 PDT 2007


Roland Mainz wrote:
> Peter Memishian wrote:
> > [ Resolved issues removed. ]
> >
> >  > >  > http://cr.grommit.com/~chin/ksh93-webrev-jun29/jun29-makefiles/
> >  > >
> >  > > I've completed my review of the Makefiles.  Things are looking good --
> >  > > most of my comments are quite minor.  Nice work, Roland :-)
> >  > >
> >  > > General:
> >  > >
> >  > >         * Seems like every AST-related Makefile contains:
> >  > >
> >  > >             # Override this top level flag so the compiler builds in its
> >  > >             # native C99 mode.  This has been enabled to support the math
> >  > >             # stuff in the AST tools.
> >  > >             C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
> >  > >
> >  > >             # silence common libast&co. warnings (upstream will handle this
> >  > >             # later) ...  ... about |#pragma prototyped| ...
> >  > >             CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
> >  > >
> >  > >           It would be really nice if we could centralize these somewhere.
> >  > >           (Just a request, not a requirement.)
> >  >
> >  > I had the same idea... but it would mean we would need an extra
> >  > "include" statement and a new file extra for these flags... and that's
> >  > IMO an overkill unless more "common" things could be abstracted somehow.
> >
> > Well, another common thing would be the shared ksh/libshell "KSHCPPFLAGS".
> > Having a usr/src/Makefile.ast that has those three things seems worthwhile
> > to me.  Yes, it's one more Makefile -- but I think it will ultimately help
> > maintainability and help us centralize the logic that bridges between the
> > lands of AST and ON.
> 
> I still feel uneasy about the idea to create one seperate file for the
> C99MODE+CERRWARN stuff because it's AFAIK not a "catch all" solution.
> Some items in the Makefiles seem to require a specific position (e.g.
> before or after "include */Makefile.lib" etc.) and somehow I feel we may
> end up with something like usr/src/Makefile.ast_pre_stuff,
> usr/src/Makefile.ast_main_stuff and usr/src/Makefile.ast_post_stuff
> (just a feeling) ...
[snip]

Or maybe I should stop worrying... :-)
...I've added the "Makefile.ast" thing and attached the new patch as
"ksh93_integration_review_meem003.diff.txt" ...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
-------------- next part --------------
Index: src/Makefile.ksh93switch
===================================================================
--- src/Makefile.ksh93switch	(revision 694)
+++ src/Makefile.ksh93switch	(working copy)
@@ -26,12 +26,11 @@
 #
 
 # Should we build ksh93 as /bin/ksh ?
-# this can be overridden via
-# $ export ON_BUILD_KSH93_AS_BINKSH=1 # at build time
+# This can be overridden at build time via:
+# $ export ON_BUILD_KSH93_AS_BINKSH=1
 ON_BUILD_KSH93_AS_BINKSH=0
 
 BINKSH_IS_KSH93_1=   $(ON_BUILD_KSH93_AS_BINKSH:0=$(POUND_SIGN))
 BINKSH_ISNOT_KSH93_1=$(ON_BUILD_KSH93_AS_BINKSH:1=$(POUND_SIGN))
 BINKSH_IS_KSH93=     $(BINKSH_IS_KSH93_1:1=)
 BINKSH_ISNOT_KSH93=  $(BINKSH_ISNOT_KSH93_1:0=)
-
Index: src/cmd/ksh/Makefile.ksh93switch
===================================================================
--- src/cmd/ksh/Makefile.ksh93switch	(revision 694)
+++ src/cmd/ksh/Makefile.ksh93switch	(working copy)
@@ -1,37 +0,0 @@
-#
-# 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 2007 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-
-# Should we build ksh93 as /bin/ksh ?
-# this can be overridden via
-# $ export ON_BUILD_KSH93_AS_BINKSH=1 # at build time
-ON_BUILD_KSH93_AS_BINKSH=0
-
-BINKSH_IS_KSH93_1=   $(ON_BUILD_KSH93_AS_BINKSH:0=$(POUND_SIGN))
-BINKSH_ISNOT_KSH93_1=$(ON_BUILD_KSH93_AS_BINKSH:1=$(POUND_SIGN))
-BINKSH_IS_KSH93=     $(BINKSH_IS_KSH93_1:1=)
-BINKSH_ISNOT_KSH93=  $(BINKSH_ISNOT_KSH93_1:0=)
-
Index: src/cmd/ksh/Makefile.testshell
===================================================================
--- src/cmd/ksh/Makefile.testshell	(revision 724)
+++ src/cmd/ksh/Makefile.testshell	(working copy)
@@ -53,17 +53,17 @@
 #	    io.sh[81]: picked up file descriptor zero for opening script file
 #   -- snip --
 #
-# - "sun_solaris_getconf.sh" is currently in the whitelist for tests which are allowed to fail
-#   per explicit permission by Don Cragun
+# - "sun_solaris_getconf.sh" is currently in the whitelist for tests which are
+#   allowed to fail per explicit permission by Don Cragun
 #   (see http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2007-April/002499.html)
-#   because Solaris 11 < B64 returns a wrong value for "SSIZE_MAX" (see bug #6548104). Builds
-#   on >= B64 should no longer fail.
+#   because Solaris 11 < B64 returns a wrong value for "SSIZE_MAX" (see
+#   bug #6548104). Builds on >= B64 should no longer fail.
 #
 # - These tests need a working system clock, otherwise they'll bite you.
 #
 # - The test frontend in this Makefile should be rewritten in ksh93
 #   instead of the current /usr/bin/ksh (=ksh88i). This would be far less
-#   compliciated.
+#   complicated.
 #
 # - More locales should be tested here (via ON_KSH_TEST_LOCALES below).
 #   Locales like "ru_RU.KOI8-R","de_DE.UTF-8", "is_IS.ISO8859-1", 
@@ -77,8 +77,10 @@
 #   all important markets based on suggestions by Sun's i18n team.
 #
 
+TESTSRC= $(LIBSHELLSRC)/../tests
+
 # ON_KSH_TEST_LOCALES can be overridden via
-# % export ON_KSH_TEST_LOCALES=<value> before % make install
+# $ export ON_KSH_TEST_LOCALES=<value> # before $ make install #
 ON_KSH_TEST_LOCALES = \
 	C \
 	en_US en_US.UTF-8 \
@@ -92,53 +94,70 @@
 	zh_TW.BIG5 zh_TW.EUC zh_TW.UTF-8
 
 # ON_KSH_TEST_LIST can be overridden via
-# % export ON_KSH_TEST_LIST=<value> before % make install
-ON_KSH_TEST_LIST = $(LIBSHELLSRC)/tests/*.sh
+# $ export ON_KSH_TEST_LIST=<value> # before $ make install #
+ON_KSH_TEST_LIST = $(TESTSRC)/*.sh
 
 # We must wait for other things in this subdir to finish before running
 # the test suite, otherwise we may run into trouble that this activity
-# may disturb the test suite run (resulting in weired "heisenbug"-like
+# may disturb the test suite run (resulting in weird "heisenbug"-like
 # test failures).
 testshell: $(PROG)
 	@ \
-	print '# NOTE: Make sure your binaries in ROOT match your kernel!!' ; \
-	(set +e ; export PATH="$(SRC)/cmd/ksh/$(CMDTRANSMACH):/bin:/usr/bin" ; \
-	    printf "# which ksh='%s', ksh93='%s'\n" "$$(which ksh)" "$$(which ksh93)" ; \
+	print '# NOTE: Make sure your binaries in ROOT match your kernel!' ; \
+	( \
+	    set +o errexit ; \
+	    export PATH="$(SRC)/cmd/ksh/$(CMDTRANSMACH):/bin:/usr/bin" ; \
+	    printf "# which ksh='%s', ksh93='%s'\n" \
+	        "$$(which ksh)" "$$(which ksh93)" ; \
 	) ; \
-	if [ "$$(isalist | fgrep "$(CMDTRANSMACH)")" = "" ] ; then \
-	    printf "# ISA=$(CMDTRANSMACH) cannot be executed on this system, skipping tests...\n" ; \
+	if [[ "$$(isalist | fgrep "$(CMDTRANSMACH)")" = "" ]] ; then \
+	    printf \
+	        "# ISA='%s' not available on this system, skipping tests...\n" \
+	        "$(CMDTRANSMACH)" ; \
 	    exit 0 ; \
 	fi ; \
 	exec 2>&1 ; \
-	(supported_locales="$$(locale -a)" ; \
+	(supported_locales="$$(/usr/bin/locale -a)" ; \
 	for test_lang in $(ON_KSH_TEST_LOCALES) ; do \
-	    if [ "$$(print "$${supported_locales}" | egrep "^$${test_lang}\$$")" = "" ] ; then \
-	        print "# Locale $${test_lang} not supported, skipping tests..." ; \
+	    if [[ "$$(print "$${supported_locales}" | \
+	             egrep "^$${test_lang}\$$")" = "" ]] ; then \
+	        printf \
+		    "# Locale '%s' not supported, skipping tests...\n" \
+		    "$${test_lang}" ; \
 	        continue ; \
 	    fi ; \
 	    (for test_item in $(ON_KSH_TEST_LIST) ; do \
-	            [ "$${test_item}" = "$(LIBSHELLSRC)/tests/builtins.sh" -o \
-	              "$${test_item}" = "$(LIBSHELLSRC)/tests/options.sh" -o \
-		      "$${test_item}" = "$(LIBSHELLSRC)/tests/sun_solaris_getconf.sh" ] && set +e ; \
-	            printf "## Running $(CMDTRANSMACH)/ksh test: LANG='%s' script='%s'\n" "$${test_lang}" "$$(basename "$${test_item}")"; \
-                    ( \
-	                test_output="$$( ( \
-	                    export \
-	                        SHELL="$(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh" \
-	                        LD_LIBRARY_PATH_64="$(ROOT)/usr/lib/$(MACH64)/" \
-	                        LD_LIBRARY_PATH_32="$(ROOT)/usr/lib/" ; \
-	                        LD_LIBRARY_PATH="$(ROOT)/usr/lib/$(MACH64)/:$(ROOT)/usr/lib/" ; \
-	                    "$${SHELL}" "$(LIBSHELLSRC)/tests/shtests" -t \
-	                        LD_LIBRARY_PATH_64="$${LD_LIBRARY_PATH_64}" \
-	                        LD_LIBRARY_PATH_32="$${LD_LIBRARY_PATH_32}" \
-	                        LD_LIBRARY_PATH="$${LD_LIBRARY_PATH}" \
-	                        SHELL="$${SHELL}" \
-	                        LANG="$${test_lang}" \
-	                        LC_ALL="$${test_lang}" \
-	                          "$${test_item}" \
-	                ) 2>&1 | while read ; do printf "#\t%s\n" "$${REPLY}" ; done | tee /dev/stderr)" ; \
-	                [ "$$(print "$${test_output}" | egrep 'passed \[ .* tests 0 errors \]')" != "" ] || (print "##> test failed" ; exit 1) \
-                    ) ; \
-	            set -e ; \
+	        [[ "$${test_item}" = "$(TESTSRC)/builtins.sh" || \
+	           "$${test_item}" = "$(TESTSRC)/options.sh" || \
+		   "$${test_item}" = "$(TESTSRC)/sun_solaris_getconf.sh" ]] && \
+		   set +o errexit ; \
+	        printf \
+		    "## Running %s test: LANG='%s' script='%s'\n" \
+		    "$(CMDTRANSMACH)/ksh" \
+		    "$${test_lang}" \
+		    "$$(basename "$${test_item}")"; \
+                ( \
+	            test_output="$$( ( \
+	        	export \
+	        	    SHELL="$(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh" \
+	        	    LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \
+	        	    LD_LIBRARY_PATH_32="$(ROOTLIB)/" ; \
+	        	    LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" ; \
+	        	"$${SHELL}" "$(TESTSRC)/shtests" -t \
+	        	    LD_LIBRARY_PATH_64="$${LD_LIBRARY_PATH_64}" \
+	        	    LD_LIBRARY_PATH_32="$${LD_LIBRARY_PATH_32}" \
+	        	    LD_LIBRARY_PATH="$${LD_LIBRARY_PATH}" \
+	        	    SHELL="$${SHELL}" \
+	        	    LANG="$${test_lang}" \
+	        	    LC_ALL="$${test_lang}" \
+	        	      "$${test_item}" \
+	            ) 2>&1 | while read ; do \
+		                 printf "#\t%s\n" "$${REPLY}" ; \
+			     done | tee /dev/stderr)" ; \
+	            [[ "$$(print "$${test_output}" | \
+		          egrep 'passed \[ .* tests 0 errors \]')" != "" ]] || \
+			      (print "##> test failed" ; exit 1) \
+                ) ; \
+	        set -o errexit ; \
 	    done) ; \
 	done)
Index: src/cmd/ksh/sparcv9/Makefile
===================================================================
--- src/cmd/ksh/sparcv9/Makefile	(revision 718)
+++ src/cmd/ksh/sparcv9/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Specify the MACH we currently use to build and test ksh
 CMDTRANSMACH= $(MACH64)
 
@@ -40,7 +38,7 @@
 	(print "# Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
 	set -o xtrace ; \
 	for i in $(USRKSH_ALIAS_LIST) ; do \
-		[ $$i = $(PROG) ] && continue ; \
+		[[ "$$i" = "$(PROG)" ]] && continue ; \
 		$(RM) "$(ROOTBIN64)/$$i" ; \
 		$(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
 	done \
Index: src/cmd/ksh/sparc/Makefile
===================================================================
--- src/cmd/ksh/sparc/Makefile	(revision 718)
+++ src/cmd/ksh/sparc/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Specify the MACH we currently use to build and test ksh
 CMDTRANSMACH= $(MACH)
 
@@ -39,7 +37,7 @@
 	(print "# Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
 	set -o xtrace ; \
 	for i in $(USRKSH_ALIAS_LIST) ; do \
-		[ $$i = $(PROG) ] && continue ; \
+		[[ "$$i" = "$(PROG)" ]] && continue ; \
 		$(RM) "$(ROOTBIN32)/$$i" ; \
 		$(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
 	done \
Index: src/cmd/ksh/i386/Makefile
===================================================================
--- src/cmd/ksh/i386/Makefile	(revision 718)
+++ src/cmd/ksh/i386/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Specify the MACH we currently use to build and test ksh
 CMDTRANSMACH= $(MACH)
 
@@ -39,7 +37,7 @@
 	(print "# Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
 	set -o xtrace ; \
 	for i in $(USRKSH_ALIAS_LIST) ; do \
-		[ $$i = $(PROG) ] && continue ; \
+		[[ "$$i" = "$(PROG)" ]] && continue ; \
 		$(RM) "$(ROOTBIN32)/$$i" ; \
 		$(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
 	done \
Index: src/cmd/ksh/Makefile.com
===================================================================
--- src/cmd/ksh/Makefile.com	(revision 732)
+++ src/cmd/ksh/Makefile.com	(working copy)
@@ -25,8 +25,10 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include ../Makefile.ksh93switch
+SHELL=/usr/bin/ksh
 
+include ../../../Makefile.ksh93switch
+
 $(BINKSH_IS_KSH93)PROG= ksh
 $(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh
 
@@ -34,23 +36,12 @@
 $(BINKSH_ISNOT_KSH93)USRKSH_ALIAS_LIST=ksh93 rksh93
 
 OBJECTS= \
-	sh/pmain.o
+	pmain.o
 
-# We are storing the object files into subdirs, following the
-# object file layout of usr/src/lib/libshell/Makefile.com
-# (this Makefile is basically a cut-down version of that
-# Makefile).
-OBJDIRS =  \
-	sh
-PICSDIRS= $(OBJDIRS)
-mkpicdirs:
-	@mkdir -p $(PICSDIRS)
-	
-LIBSHELLSRC=../../../lib/libshell/common
+LIBSHELLSRC=../../../lib/libshell/common/sh
 
-SRCS=           $(OBJECTS:%.o=$(LIBSHELLSRC)/%.c)
+SRCS=	$(OBJECTS:%.o=$(LIBSHELLSRC)/%.c)
 
-
 GROUP= bin
 LDLIBS += -lshell
 
@@ -98,21 +89,18 @@
 	$(CCVERBOSE) \
 	-xstrconst
 
-# Override this top level flag so the compiler builds in its native
-# C99 mode.  This has been enabled to support the math stuff in ksh93.
-C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
+# Set common AST flags including C99/XPG6 mode (which is needed to
+# support the math stuff in ksh93 (and allow to use it as
+# /usr/xpg4/bin/sh))
+include ../../../Makefile.ast
 
-# silence common libast&co. warnings (upstream will handle this later) ...
-# ... about |#pragma prototyped| ...
-CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
-
 .KEEP_STATE:
 
 %.o:	$(LIBSHELLSRC)/%.c
 	$(COMPILE.c) -c -o $@ $<
 	$(POST_PROCESS_O)
 
-all:	mkpicdirs .WAIT $(PROG)
+all:	$(PROG)
 
 # We explicitly delete "ksh" and "ksh93" to catch changes in
 # BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
@@ -124,17 +112,20 @@
 	$(LINK.c) $(OBJECTS) -o $@ $(LDLIBS)
 	$(POST_PROCESS)
 	(set +o errexit ; \
-	[ ! -x ksh93 ] && ln $(PROG) ksh93 ; \
-	[ ! -x ksh   ] && ln $(PROG) ksh   ; \
+	[[ ! -x ksh93 ]] && ln $(PROG) ksh93 ; \
+	[[ ! -x ksh   ]] && ln $(PROG) ksh   ; \
 	true \
 	)
 
-# We explicitly delete "ksh" and "ksh93" to catch changes in
-# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
 clean:
 	$(RM) $(OBJECTS)
-	$(RM) ksh ksh93
 
+# We explicitly delete "ksh" and "ksh93" to catch changes in
+# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
+CLOBBERFILES += \
+	ksh \
+	ksh93
+
 #
 # ksh is not lint-clean yet; fake up a target.  (You can use
 # "make lintcheck" to actually run lint; please send all lint fixes
Index: src/cmd/ksh/amd64/Makefile
===================================================================
--- src/cmd/ksh/amd64/Makefile	(revision 718)
+++ src/cmd/ksh/amd64/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Specify the MACH we currently use to build and test ksh
 CMDTRANSMACH= $(MACH64)
 
@@ -40,7 +38,7 @@
 	(print "# Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
 	set -o xtrace ; \
 	for i in $(USRKSH_ALIAS_LIST) ; do \
-		[ $$i = $(PROG) ] && continue ; \
+		[[ "$$i" = "$(PROG)" ]] && continue ; \
 		$(RM) "$(ROOTBIN64)/$$i" ; \
 		$(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
 	done \
Index: src/cmd/ksh/Makefile
===================================================================
--- src/cmd/ksh/Makefile	(revision 718)
+++ src/cmd/ksh/Makefile	(working copy)
@@ -27,7 +27,7 @@
 
 SHELL=/usr/bin/ksh
 
-include Makefile.ksh93switch
+include ../../Makefile.ksh93switch
 
 $(BINKSH_IS_KSH93)PROG= ksh
 $(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh
@@ -67,7 +67,7 @@
 	$(LN) $(ISAEXEC) $(ROOTPROG)
 	@(set -o xtrace ; \
 	for i in $(USRKSH_ALIAS_LIST) ; do \
-		[ $$i = $(PROG) ] && continue ; \
+		[[ "$$i" = "$(PROG)" ]] && continue ; \
 		$(RM) "$(ROOTBIN)/$$i" ; \
 		$(LN) "$(ROOTBIN)/$(PROG)" "$(ROOTBIN)/$$i" ; \
 	done \
Index: src/cmd/Makefile
===================================================================
--- src/cmd/Makefile	(revision 715)
+++ src/cmd/Makefile	(working copy)
@@ -27,9 +27,8 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 
 include ../Makefile.master
+include ../Makefile.ksh93switch
 
-include ksh/Makefile.ksh93switch
-
 #
 #	Note that the commands 'agents', 'lp', 'perl', and 'man' are first in
 #	the list, violating alphabetical order.  This is because they are very
Index: src/cmd/nsadmin/Makefile
===================================================================
--- src/cmd/nsadmin/Makefile	(revision 694)
+++ src/cmd/nsadmin/Makefile	(working copy)
@@ -56,4 +56,3 @@
 	$(RM) .login
 
 lint:
-
Index: src/cmd/ast/msgcc/Makefile
===================================================================
--- src/cmd/ast/msgcc/Makefile	(revision 718)
+++ src/cmd/ast/msgcc/Makefile	(working copy)
@@ -31,6 +31,11 @@
 
 .KEEP_STATE:
 
+# Set common AST flags including C99/XPG6 mode (which is needed to
+# support the math stuff in the AST tools and make them fully
+# POSIX conformant).
+include ../../../Makefile.ast
+
 # build rules
 CPPFLAGS = \
         $(DTEXTDOM) $(DTS_ERRNO) \
@@ -46,14 +51,6 @@
         $(CCVERBOSE) \
         -xstrconst
 
-# Override this top level flag so the compiler builds in its native
-# C99 mode.  This has been enabled to support the math stuff in the AST tools.
-C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
-
-# silence common libast&co. warnings (upstream will handle this later) ...
-# ... about |#pragma prototyped| ...
-CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
-
 LDLIBS += -last
 msgcpp   := LDLIBS += -lpp
 
@@ -67,26 +64,14 @@
 	) >msgcc ; \
 	chmod a+rx msgcc
 
-# install rules for AST tools/commands
 ROOTCMDDIR=$(ROOT)/usr/ast/bin
 
-# main
 PROG= msgcvt msggen msgget msgcpp msgcc
 
 all: $(PROG)
 
 install: all $(ROOTCMD)
 
-clean:
+clean lint:
 
-lint:
-
-# cleanup
-CLOBBERFILES += \
-	msgcc \
-	msgcvt \
-	msggen \
-	msgget \
-	msgcpp
-
 include ../../Makefile.targ
Index: src/Makefile.ast
===================================================================
--- src/Makefile.ast	(revision 0)
+++ src/Makefile.ast	(revision 0)
@@ -0,0 +1,35 @@
+#
+# 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 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+# Override this top level flag so the compiler builds in its native
+# C99 mode.  This has been enabled to support the math stuff in the
+# AST tools (including ksh93).
+C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
+
+# silence common AST&co. warnings...
+# ... about |#pragma prototyped| ...
+CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
Index: src/lib/libshell/Makefile.demo
===================================================================
--- src/lib/libshell/Makefile.demo	(revision 720)
+++ src/lib/libshell/Makefile.demo	(working copy)
@@ -71,5 +71,4 @@
 		$(ROOTDEMODIRBASE)/fun \
 		$(ROOTDEMODIRBASE)/tests
 
-install: \
-	$(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES)
+install: $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES)
Index: src/lib/libshell/sparcv9/Makefile
===================================================================
--- src/lib/libshell/sparcv9/Makefile	(revision 718)
+++ src/lib/libshell/sparcv9/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 include ../../Makefile.lib.64
 
Index: src/lib/libshell/sparc/Makefile
===================================================================
--- src/lib/libshell/sparc/Makefile	(revision 698)
+++ src/lib/libshell/sparc/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 
 install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
Index: src/lib/libshell/i386/Makefile
===================================================================
--- src/lib/libshell/i386/Makefile	(revision 698)
+++ src/lib/libshell/i386/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 
 install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
Index: src/lib/libshell/Makefile.com
===================================================================
--- src/lib/libshell/Makefile.com	(revision 718)
+++ src/lib/libshell/Makefile.com	(working copy)
@@ -25,6 +25,8 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
+SHELL=/usr/bin/ksh
+
 LIBRARY=	libshell.a
 VERS=		.1
 
@@ -119,7 +121,7 @@
 
 LIBS =		$(DYNLIB) $(LINTLIB)
 
-# load dll, socket, nsl and secdb libraries on demand
+# load dll, socket, and secdb libraries on demand
 LDLIBS += \
 	-lcmd \
 	-z lazyload -ldll -z nolazyload \
@@ -137,7 +139,7 @@
 # case - it MUST come as the last element but future changes in -D options
 # may then cause silent breakage in the AST sources because the last -D
 # option specified overrides previous -D options so we prefer the current
-# way to expliclity list each single flag.
+# way to explicitly list each single flag.
 CPPFLAGS = \
 	$(DTEXTDOM) $(DTS_ERRNO) \
 	-Isrc/cmd/ksh93 \
Index: src/lib/libshell/amd64/Makefile
===================================================================
--- src/lib/libshell/amd64/Makefile	(revision 718)
+++ src/lib/libshell/amd64/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 include ../../Makefile.lib.64
 
Index: src/lib/libshell/Makefile
===================================================================
--- src/lib/libshell/Makefile	(revision 718)
+++ src/lib/libshell/Makefile	(working copy)
@@ -45,7 +45,6 @@
 
 LIBRARY= 	libshell.a
 
-# definitions for install_h target
 HDRS= \
 	history.h \
 	nval.h \
Index: src/lib/Makefile.astmsg
===================================================================
--- src/lib/Makefile.astmsg	(revision 718)
+++ src/lib/Makefile.astmsg	(working copy)
@@ -26,13 +26,13 @@
 #
 
 #
-# Temporary control building AST l10n catalogs until all build machines
-# have been updated.
+# Temporarily control building AST l10n catalogs until all build
+# machines have been updated.
 #
 
 # Should we build AST l10n catalogs ?
-# this can be overridden via
-# % export ON_BUILD_AST_L10N_CATALOGS=1 # at build time
+# This can be overridden at build time via:
+# $ export ON_BUILD_KSH93_AS_BINKSH=1
 ON_BUILD_AST_L10N_CATALOGS=0
 
 DO_BUILD_AST_CATALOGS_1=	$(ON_BUILD_AST_L10N_CATALOGS:0=$(POUND_SIGN))
@@ -41,7 +41,7 @@
 DONT_BUILD_AST_CATALOGS=	$(DONT_BUILD_AST_CATALOGS_1:0=)
 
 #
-# l10n mesage catalog generation for AST libraries
+# l10n message catalog generation for AST libraries
 #
 
 MSGLIBNAME= $(LIBRARY:.a=)
@@ -57,11 +57,11 @@
 ASTMSGS=  $(OBJECTS:%.o=msgs/%.mso)
 
 # cpp defines needed by msgcc
-i386_ASTMSGCCFLAGS=	-D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR -D__i386
-amd64_ASTMSGCCFLAGS=	-D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR -D__amd64
-sparc_ASTMSGCCFLAGS=	-D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR -D__sparc
-sparcv9_ASTMSGCCFLAGS=	-D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR -D__sparcv9
-ASTMSGCCFLAGS=$($(TARGETMACH)_ASTMSGCCFLAGS)
+i386_ASTMSGCCFLAGS=	-D__i386
+amd64_ASTMSGCCFLAGS=	-D__amd64
+sparc_ASTMSGCCFLAGS=	-D__sparc
+sparcv9_ASTMSGCCFLAGS=	-D__sparcv9
+ASTMSGCCFLAGS= -D_STDC_C99 -D__STDC__ -D__BUILTIN_VA_ARG_INCR $($(TARGETMACH)_ASTMSGCCFLAGS)
 
 msgs/%.mso: ../common/%.c
 	@mkdir -p "$$(dirname "$@")" ; \
@@ -78,7 +78,7 @@
 
 $(ASTMSGCATALOG): $(MSGLIBNAME).msg
 	@$(RM) "$(ASTMSGCATALOG)" ; \
-	cat "$(MSGLIBNAME).msg" | sed 's/^$$translation msgcc .*//' | gencat "$@" -
+	sed 's/^$$translation msgcc .*//' <"$(MSGLIBNAME).msg" | gencat "$@" -
 
 # Main catalog target
 $(DO_BUILD_AST_CATALOGS)_msg: $(ASTMSGCATALOG)
@@ -87,7 +87,7 @@
 # package database each time we toggle the switch)
 $(DONT_BUILD_AST_CATALOGS)_msg:
 $(DONT_BUILD_AST_CATALOGS)	$(RM) $(ASTMSGCATALOG) ; \
-	touch $(ASTMSGCATALOG)
+	$(TOUCH) $(ASTMSGCATALOG)
 
 # Add message catalogs to the list of files to "clobber"
 CLOBBERFILES += \
Index: src/lib/libcmd/sparcv9/Makefile
===================================================================
--- src/lib/libcmd/sparcv9/Makefile	(revision 698)
+++ src/lib/libcmd/sparcv9/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 include ../../Makefile.lib.64
 
Index: src/lib/libcmd/sparc/Makefile
===================================================================
--- src/lib/libcmd/sparc/Makefile	(revision 698)
+++ src/lib/libcmd/sparc/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 
 all: $(LIBS)
Index: src/lib/libcmd/i386/Makefile
===================================================================
--- src/lib/libcmd/i386/Makefile	(revision 698)
+++ src/lib/libcmd/i386/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 
 all: $(LIBS)
Index: src/lib/libcmd/Makefile.com
===================================================================
--- src/lib/libcmd/Makefile.com	(revision 718)
+++ src/lib/libcmd/Makefile.com	(working copy)
@@ -25,6 +25,8 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
+SHELL=/usr/bin/ksh
+
 LIBRARY =	libcmd.a
 VERS =		.1
 OBJECTS =	\
@@ -77,10 +79,10 @@
 # automated code updates easier.
 MAPFILES=       ../mapfile-vers
 
-# Override this top level flag so the compiler builds in its native
-# C99+XPG6 mode.  This has been enabled to support the math stuff
-# and other features in ksh93.
-C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
+# Set common AST flags including C99/XPG6 mode (which is needed to
+# support the math stuff in ksh93 (and allow to use it as
+# /usr/xpg4/bin/sh))
+include ../../../Makefile.ast
 
 LIBS =		$(DYNLIB) $(LINTLIB)
 
@@ -95,7 +97,7 @@
 # case - it MUST come as the last element but future changes in -D options
 # may then cause silent breakage in the AST sources because the last -D
 # option specified overrides previous -D options so we prefer the current
-# way to expliclity list each single flag.
+# way to explicitly list each single flag.
 # Notes:
 #   - "-D_BLD_DLL" comes from ${mam_cc_DLL} in Mamfile
 CPPFLAGS = \
@@ -121,15 +123,10 @@
 	$(CCVERBOSE) \
 	-xstrconst
 
-# silence common libast&co. warnings (upstream will handle this later) ...
-# ... about |#pragma prototyped| ...
-CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
 pics/sync.o	:= CERRWARN += -erroff=E_END_OF_LOOP_CODE_NOT_REACHED
 
 .KEEP_STATE:
 
-# libcmd API is completely private and therefore does not need
-# to call "fnamecheck" here
 all: $(LIBS) 
 
 #
Index: src/lib/libcmd/amd64/Makefile
===================================================================
--- src/lib/libcmd/amd64/Makefile	(revision 698)
+++ src/lib/libcmd/amd64/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 include ../../Makefile.lib.64
 
Index: src/lib/libcmd/Makefile
===================================================================
--- src/lib/libcmd/Makefile	(revision 718)
+++ src/lib/libcmd/Makefile	(working copy)
@@ -43,13 +43,10 @@
 
 all clean clobber install lint _msg: $(SUBDIRS)
 
-# definitions for install_h target
 HDRS=	\
 	cmd.h \
 	cmdext.h
 
-# libast/libcmd headers are partially generated and depend on
-# the architecture (e.g. "i386", "sparc", ...)
 HDRDIR32= $(MACH)/include/ast
 HDRDIR64= $(MACH64)/include/ast
 include ../Makefile.astinclude
Index: src/lib/libc/sparcv9/Makefile
===================================================================
--- src/lib/libc/sparcv9/Makefile	(revision 715)
+++ src/lib/libc/sparcv9/Makefile	(working copy)
@@ -934,7 +934,7 @@
 
 # Conditionally add support for making |wordexp()| check whether
 # /usr/bin/ksh is ksh93 or not
-include ../../../cmd/ksh/Makefile.ksh93switch
+include ../../../Makefile.ksh93switch
 CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
 
 # Inform the run-time linker about libc specialized initialization
Index: src/lib/libc/sparc/Makefile
===================================================================
--- src/lib/libc/sparc/Makefile	(revision 715)
+++ src/lib/libc/sparc/Makefile	(working copy)
@@ -988,7 +988,7 @@
 
 # Conditionally add support for making |wordexp()| check whether
 # /usr/bin/ksh is ksh93 or not
-include ../../../cmd/ksh/Makefile.ksh93switch
+include ../../../Makefile.ksh93switch
 CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
 
 # Inform the run-time linker about libc specialized initialization
Index: src/lib/libc/i386/Makefile.com
===================================================================
--- src/lib/libc/i386/Makefile.com	(revision 715)
+++ src/lib/libc/i386/Makefile.com	(working copy)
@@ -971,7 +971,7 @@
 
 # Conditionally add support for making |wordexp()| check whether
 # /usr/bin/ksh is ksh93 or not
-include ../../../cmd/ksh/Makefile.ksh93switch
+include ../../../Makefile.ksh93switch
 CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
 
 # Inform the run-time linker about libc specialized initialization
Index: src/lib/libc/amd64/Makefile
===================================================================
--- src/lib/libc/amd64/Makefile	(revision 715)
+++ src/lib/libc/amd64/Makefile	(working copy)
@@ -924,7 +924,7 @@
 
 # Conditionally add support for making |wordexp()| check whether
 # /usr/bin/ksh is ksh93 or not
-include ../../../cmd/ksh/Makefile.ksh93switch
+include ../../../Makefile.ksh93switch
 CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
 
 # Inform the run-time linker about libc specialized initialization
Index: src/lib/Makefile
===================================================================
--- src/lib/Makefile	(revision 731)
+++ src/lib/Makefile	(working copy)
@@ -512,7 +512,7 @@
 libsasl:	libgss libsocket pkcs11 libmd
 sasl_plugins:	pkcs11 libgss libsocket libsasl
 libsctp:	libsocket
-libshell:	libast libcmd libdll libsocket libnsl libsecdb
+libshell:	libast libcmd libdll libsocket libsecdb
 libsip:		libmd5
 libsocket:	libnsl
 libldap5:	libsasl libsocket libnsl libmd
Index: src/lib/libdll/sparcv9/Makefile
===================================================================
--- src/lib/libdll/sparcv9/Makefile	(revision 718)
+++ src/lib/libdll/sparcv9/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libdll/sparc/Makefile
===================================================================
--- src/lib/libdll/sparc/Makefile	(revision 698)
+++ src/lib/libdll/sparc/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libdll/i386/Makefile
===================================================================
--- src/lib/libdll/i386/Makefile	(revision 698)
+++ src/lib/libdll/i386/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libdll/Makefile.com
===================================================================
--- src/lib/libdll/Makefile.com	(revision 718)
+++ src/lib/libdll/Makefile.com	(working copy)
@@ -25,6 +25,8 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
+SHELL=/usr/bin/ksh
+
 LIBRARY=	libdll.a
 VERS=		.1
 
@@ -44,10 +46,10 @@
 # automated code updates easier.
 MAPFILES=       ../mapfile-vers
 
-# Override this top level flag so the compiler builds in its native
-# C99+XPG6 mode.  This has been enabled to support the math stuff
-# and other features in ksh93.
-C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
+# Set common AST flags including C99/XPG6 mode (which is needed to
+# support the math stuff in ksh93 (and allow to use it as
+# /usr/xpg4/bin/sh))
+include ../../../Makefile.ast
 
 LIBS =		$(DYNLIB) $(LINTLIB)
 LDLIBS +=	-last -lc
@@ -59,7 +61,7 @@
 # case - it MUST come as the last element but future changes in -D options
 # may then cause silent breakage in the AST sources because the last -D
 # option specified overrides previous -D options so we prefer the current
-# way to expliclity list each single flag.
+# way to explicitly list each single flag.
 # Notes:
 #   - "-D_BLD_DLL" comes from ${mam_cc_DLL} in Mamfile
 CPPFLAGS = \
@@ -80,9 +82,6 @@
 	$(CCVERBOSE) \
 	-xstrconst
 
-# silence common libast&co. warning about |#pragma prototyped|
-CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
-
 .KEEP_STATE:
 
 all: $(LIBS)
Index: src/lib/libdll/amd64/Makefile
===================================================================
--- src/lib/libdll/amd64/Makefile	(revision 718)
+++ src/lib/libdll/amd64/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libdll/Makefile
===================================================================
--- src/lib/libdll/Makefile	(revision 718)
+++ src/lib/libdll/Makefile	(working copy)
@@ -45,7 +45,6 @@
 
 LIBRARY= 	libdll.a
 
-# definitions for install_h target
 HDRS= \
 	dlldefs.h
 
Index: src/lib/libast/sparcv9/Makefile
===================================================================
--- src/lib/libast/sparcv9/Makefile	(revision 718)
+++ src/lib/libast/sparcv9/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libast/sparc/Makefile
===================================================================
--- src/lib/libast/sparc/Makefile	(revision 718)
+++ src/lib/libast/sparc/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libast/i386/Makefile
===================================================================
--- src/lib/libast/i386/Makefile	(revision 718)
+++ src/lib/libast/i386/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libast/Makefile.com
===================================================================
--- src/lib/libast/Makefile.com	(revision 718)
+++ src/lib/libast/Makefile.com	(working copy)
@@ -25,6 +25,8 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
+SHELL=/usr/bin/ksh
+
 LIBRARY=	libast.a
 VERS=		.1
 
@@ -644,10 +646,10 @@
 # automated code updates easier.
 MAPFILES=       ../mapfile-vers
 
-# Override this top level flag so the compiler builds in its native
-# C99+XPG6 mode.  This has been enabled to support the math stuff
-# and other features in ksh93.
-C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
+# Set common AST flags including C99/XPG6 mode (which is needed to
+# support the math stuff in ksh93 (and allow to use it as
+# /usr/xpg4/bin/sh))
+include ../../../Makefile.ast
 
 # special rule because sources live both ../common (normal)
 # and $(TRANSMACH) (generated)
@@ -704,8 +706,6 @@
 	$(CCVERBOSE) \
 	-xstrconst
 
-# silence common libast&co. warnings (upstream will handle this later) ...
-CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
 pics/$(MACH)/src/lib/libast/conftab.o	:= CERRWARN += -erroff=E_C99_INTEGER_PROMOTION
 pics/$(MACH)/src/lib/libast/conftab.o \
 pics/$(MACH64)/src/lib/libast/conftab.o	:= CERRWARN += -erroff=E_INIT_DOES_NOT_FIT
Index: src/lib/libast/amd64/Makefile
===================================================================
--- src/lib/libast/amd64/Makefile	(revision 718)
+++ src/lib/libast/amd64/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 # Fetch minor version from RELEASE, e.g. "10" for "5.10", "11" for "5.11" etc.
 GETRELEASEMINOR = /usr/bin/ksh -c 'x=$(RELEASE) ; print "$${x$(POUND_SIGN)$(POUND_SIGN)*.}"'
 
Index: src/lib/libast/Makefile
===================================================================
--- src/lib/libast/Makefile	(revision 718)
+++ src/lib/libast/Makefile	(working copy)
@@ -45,7 +45,6 @@
 
 LIBRARY= 	libast.a
 
-# definitions for install_h target
 HDRS=	\
 	align.h \
 	ast_botch.h \
Index: src/lib/libpp/sparc/Makefile
===================================================================
--- src/lib/libpp/sparc/Makefile	(revision 698)
+++ src/lib/libpp/sparc/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 
 install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
Index: src/lib/libpp/i386/Makefile
===================================================================
--- src/lib/libpp/i386/Makefile	(revision 698)
+++ src/lib/libpp/i386/Makefile	(working copy)
@@ -25,8 +25,6 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-SHELL=/usr/bin/ksh
-
 include ../Makefile.com
 
 install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
Index: src/lib/libpp/Makefile.com
===================================================================
--- src/lib/libpp/Makefile.com	(revision 718)
+++ src/lib/libpp/Makefile.com	(working copy)
@@ -25,6 +25,8 @@
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
+SHELL=/usr/bin/ksh
+
 LIBRARY=	libpp.a
 VERS=		.1
 
@@ -62,10 +64,10 @@
 # automated code updates easier.
 MAPFILES=       ../mapfile-vers
 
-# Override this top level flag so the compiler builds in its native
-# C99+XPG6 mode.  This has been enabled to support the math stuff
-# and other features in ksh93.
-C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
+# Set common AST flags including C99/XPG6 mode (which is needed to
+# support the math stuff in ksh93 (and allow to use it as
+# /usr/xpg4/bin/sh))
+include ../../../Makefile.ast
 
 LIBS =		$(DYNLIB) $(LINTLIB)
 LDLIBS +=	-last -lc
@@ -77,7 +79,7 @@
 # case - it MUST come as the last element but future changes in -D options
 # may then cause silent breakage in the AST sources because the last -D
 # option specified overrides previous -D options so we prefer the current
-# way to expliclity list each single flag.
+# way to explicitly list each single flag.
 CPPFLAGS = \
 	$(DTEXTDOM) $(DTS_ERRNO) \
 	-I. \
@@ -96,10 +98,6 @@
 	$(CCVERBOSE) \
 	-xstrconst
 
-# silence common libast&co. warning about |#pragma prototyped|
-# (upstream is working on getting everything execept the
-# E_UNRECOGNIZED_PRAGMA_IGNORED stuff fixed)
-CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED
 pics/ppcall.o 		:= CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED
 pics/ppcontrol.o 	:= CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED
 pics/ppcpp.o		:= CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED
Index: src/lib/libpp/Makefile
===================================================================
--- src/lib/libpp/Makefile	(revision 718)
+++ src/lib/libpp/Makefile	(working copy)
@@ -45,7 +45,6 @@
 
 LIBRARY= 	libpp.a
 
-# definitions for install_h target
 HDRS= \
 	pp.h \
 	ppkey.h


More information about the ksh93-integration-discuss mailing list