1# 2# CDDL HEADER START 3# 4# The contents of this file are subject to the terms of the 5# Common Development and Distribution License (the "License"). 6# You may not use this file except in compliance with the License. 7# 8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9# or http://www.opensolaris.org/os/licensing. 10# See the License for the specific language governing permissions 11# and limitations under the License. 12# 13# When distributing Covered Code, include this CDDL HEADER in each 14# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15# If applicable, add the following below this CDDL HEADER, with the 16# fields enclosed by brackets "[]" replaced with your own identifying 17# information: Portions Copyright [yyyy] [name of copyright owner] 18# 19# CDDL HEADER END 20# 21 22# 23# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26 27SHELL=/usr/bin/ksh93 28 29PROG= ksh 30 31USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh pfksh93 pfrksh pfrksh93 32 33OBJECTS= \ 34 pmain.o 35 36LIBSHELLBASE=../../../lib/libshell 37LIBSHELLSRC=$(LIBSHELLBASE)/common/sh 38 39SRCS= $(OBJECTS:%.o=$(LIBSHELLSRC)/%.c) 40 41LDLIBS += -lshell 42 43# Set common AST build flags (e.g., needed to support the math stuff). 44include ../../../Makefile.ast 45 46# 1. Make sure that the -D/-U defines in CFLAGS below are in sync 47# with usr/src/lib/libshell/Makefile.com 48# 2. We use "=" here since using $(CPPFLAGS.master) is very tricky in our 49# case - it MUST come as the last element but future changes in -D options 50# may then cause silent breakage in the AST sources because the last -D 51# option specified overrides previous -D options so we prefer the current 52# way to explicitly list each single flag. 53CPPFLAGS = \ 54 $(DTEXTDOM) $(DTS_ERRNO) \ 55 $(LIBSHELLCPPFLAGS) 56 57CFLAGS += \ 58 $(ASTCFLAGS) 59CFLAGS64 += \ 60 $(ASTCFLAGS64) 61 62# Workaround for CR#6628728 ("|memcntl()| prototype not available for C99/XPG6") 63pmain.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED 64 65.KEEP_STATE: 66 67%.o: $(LIBSHELLSRC)/%.c 68 $(COMPILE.c) -c -o $@ $< 69 $(POST_PROCESS_O) 70 71all: $(PROG) 72 73# We explicitly delete "ksh" and "ksh93" to catch changes in 74# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch) 75# and soft-link $(PROG) to ksh/ksh93 below because ksh93 test 76# suite seems to require that ksh93 is available as "ksh" in 77# ${PATH} (see comment about "io.sh" in Makefile.testshell). 78$(PROG): $(OBJECTS) 79 $(RM) ksh ksh93 80 $(LINK.c) $(OBJECTS) -o $@ $(LDLIBS) 81 $(POST_PROCESS) 82 (set +o errexit ; \ 83 [[ ! -x ksh93 ]] && ln $(PROG) ksh93 ; \ 84 [[ ! -x ksh ]] && ln $(PROG) ksh ; \ 85 true \ 86 ) 87 88clean: 89 $(RM) $(OBJECTS) 90 91# We explicitly delete "ksh" and "ksh93" to catch changes in 92# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch) 93CLOBBERFILES += \ 94 ksh \ 95 ksh93 96 97# Install rule for $(MACH)/Makefile (32bit) 98INSTALL.ksh.32bit=@ \ 99 (print "$(POUND_SIGN) Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \ 100 set -o xtrace ; \ 101 for i in $(USRKSH_ALIAS_LIST) ; do \ 102 [[ "$$i" == "$(PROG)" ]] && continue ; \ 103 $(RM) "$(ROOTBIN32)/$$i" ; \ 104 $(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \ 105 done \ 106 ) 107 108# Install rule for $(MACH64)/Makefile (64bit) 109INSTALL.ksh.64bit=@ \ 110 (print "$(POUND_SIGN) Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \ 111 set -o xtrace ; \ 112 for i in $(USRKSH_ALIAS_LIST) ; do \ 113 [[ "$$i" == "$(PROG)" ]] && continue ; \ 114 $(RM) "$(ROOTBIN64)/$$i" ; \ 115 $(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \ 116 done \ 117 ) 118 119# 120# ksh is not lint-clean yet; fake up a target. (You can use 121# "make lintcheck" to actually run lint; please send all lint fixes 122# upstream (to AT&T) so the next update will pull them into ON.) 123# 124lint: 125 @ print "usr/src/cmd/ksh is not lint-clean: skipping" 126 127include ../Makefile.testshell 128