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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 24# 25# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. 26 27SHELL=/usr/bin/ksh93 28 29PROG= ksh 30 31USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 32 33# Set common AST build flags (e.g., needed to support the math stuff). 34include ../../Makefile.ast 35 36OBJECTS= pmain.o 37 38ASTSRC= $(C_AST)/src/cmd/ksh93 39LIBSHELLBASE= ../../libshell 40LIBSHELLSRC= $(ASTSRC)/sh 41 42SRCS= $(OBJECTS:%.o=$(LIBSHELLSRC)/%.c) 43 44LDLIBS += -lshell -lumem 45 46# We use "=" here since using $(CPPFLAGS.master) is very tricky in our 47# case - it MUST come as the last element but future changes in -D options 48# may then cause silent breakage in the AST sources because the last -D 49# option specified overrides previous -D options so we prefer the current 50# way to explicitly list each single flag. 51CPPFLAGS= \ 52 $(DTEXTDOM) $(DTS_ERRNO) \ 53 $(LIBSHELLCPPFLAGS) 54 55CFLAGS += $(ASTCFLAGS) 56CFLAGS64 += $(ASTCFLAGS64) 57 58# Workaround for CR#6628728 ("|memcntl()| prototype not available for C99/XPG6") 59pmain.o := CERRWARN += -_gcc=-Wno-implicit-function-declaration 60 61.KEEP_STATE: 62 63%.o: $(LIBSHELLSRC)/%.c 64 $(COMPILE.c) -c -o $@ $< 65 $(POST_PROCESS_O) 66 67all: $(PROG) 68 69# We explicitly delete "ksh" and "ksh93" to catch changes in 70# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch) 71# and soft-link $(PROG) to ksh/ksh93 below because ksh93 test 72# suite seems to require that ksh93 is available as "ksh" in 73# ${PATH} (see comment about "io.sh" in Makefile.testshell). 74$(PROG): $(OBJECTS) 75 $(RM) ksh ksh93 76 $(LINK.c) $(OBJECTS) -o $@ $(LDLIBS) 77 $(POST_PROCESS) 78 (set +o errexit ; \ 79 [[ ! -x ksh93 ]] && ln $(PROG) ksh93 ; \ 80 [[ ! -x ksh ]] && ln $(PROG) ksh ; \ 81 true \ 82 ) 83 84clean: 85 $(RM) $(OBJECTS) 86 87# We explicitly delete "ksh" and "ksh93" to catch changes in 88# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch) 89CLOBBERFILES += ksh ksh93 90 91# Install rule for $(MACH)/Makefile (32bit) 92INSTALL.ksh.32bit=@ \ 93 (print "$(POUND_SIGN) Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \ 94 set -o xtrace ; \ 95 for i in $(USRKSH_ALIAS_LIST) ; do \ 96 [[ "$$i" == "$(PROG)" ]] && continue ; \ 97 $(RM) "$(ROOTBIN32)/$$i" ; \ 98 $(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \ 99 done \ 100 ) 101 102# Install rule for $(MACH64)/Makefile (64bit) 103INSTALL.ksh.64bit=@ \ 104 (print "$(POUND_SIGN) Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \ 105 set -o xtrace ; \ 106 for i in $(USRKSH_ALIAS_LIST) ; do \ 107 [[ "$$i" == "$(PROG)" ]] && continue ; \ 108 $(RM) "$(ROOTBIN64)/$$i" ; \ 109 $(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \ 110 done \ 111 ) 112 113include ../Makefile.testshell 114