1*906afcb8SAndy Fiddaman# 2*906afcb8SAndy Fiddaman# CDDL HEADER START 3*906afcb8SAndy Fiddaman# 4*906afcb8SAndy Fiddaman# The contents of this file are subject to the terms of the 5*906afcb8SAndy Fiddaman# Common Development and Distribution License (the "License"). 6*906afcb8SAndy Fiddaman# You may not use this file except in compliance with the License. 7*906afcb8SAndy Fiddaman# 8*906afcb8SAndy Fiddaman# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*906afcb8SAndy Fiddaman# or http://www.opensolaris.org/os/licensing. 10*906afcb8SAndy Fiddaman# See the License for the specific language governing permissions 11*906afcb8SAndy Fiddaman# and limitations under the License. 12*906afcb8SAndy Fiddaman# 13*906afcb8SAndy Fiddaman# When distributing Covered Code, include this CDDL HEADER in each 14*906afcb8SAndy Fiddaman# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*906afcb8SAndy Fiddaman# If applicable, add the following below this CDDL HEADER, with the 16*906afcb8SAndy Fiddaman# fields enclosed by brackets "[]" replaced with your own identifying 17*906afcb8SAndy Fiddaman# information: Portions Copyright [yyyy] [name of copyright owner] 18*906afcb8SAndy Fiddaman# 19*906afcb8SAndy Fiddaman# CDDL HEADER END 20*906afcb8SAndy Fiddaman# 21*906afcb8SAndy Fiddaman 22*906afcb8SAndy Fiddaman# 23*906afcb8SAndy Fiddaman# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 24*906afcb8SAndy Fiddaman# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. 25*906afcb8SAndy Fiddaman# 26*906afcb8SAndy Fiddaman 27*906afcb8SAndy FiddamanC_AST = $(CONTRIB)/ast 28*906afcb8SAndy FiddamanC_ASTINIT = $(C_AST)/src/cmd/INIT 29*906afcb8SAndy Fiddaman 30*906afcb8SAndy FiddamanAST= $(SRC)/cmd/ast 31*906afcb8SAndy Fiddaman 32*906afcb8SAndy FiddamanAST_TOOLS = $(AST)/tools 33*906afcb8SAndy FiddamanAST_LCGEN = $(AST_TOOLS)/lcgen 34*906afcb8SAndy FiddamanAST_PROTO = $(AST_TOOLS)/proto -p -s -l $(C_AST)/lib/package/ast.lic \ 35*906afcb8SAndy Fiddaman -o '$(AST_LICENSE)' 36*906afcb8SAndy Fiddaman 37*906afcb8SAndy Fiddaman# Override this top level flag so the compiler builds in its native C99 mode. 38*906afcb8SAndy FiddamanC99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 39*906afcb8SAndy Fiddaman 40*906afcb8SAndy Fiddaman# 41*906afcb8SAndy Fiddaman# Shell feature flags. 42*906afcb8SAndy Fiddaman# * - the upstream build configuration can be viewed at 43*906afcb8SAndy Fiddaman# $(CONTRIB)/ast/src/cmd/ksh93/Makefile 44*906afcb8SAndy Fiddaman# 45*906afcb8SAndy Fiddaman 46*906afcb8SAndy Fiddaman# These options are enabled, and are also enabled by default in the upstream 47*906afcb8SAndy Fiddaman# build framework*: 48*906afcb8SAndy Fiddaman# 49*906afcb8SAndy Fiddaman# SHOPT_2DMATCH two dimensional .sh.match for ${var//pat/str} 50*906afcb8SAndy Fiddaman# SHOPT_BGX one SIGCHLD trap per completed job 51*906afcb8SAndy Fiddaman# SHOPT_BRACEPAT C-shell {...,...} expansions (, required) 52*906afcb8SAndy Fiddaman# SHOPT_DYNAMIC dynamic loading for builtins 53*906afcb8SAndy Fiddaman# SHOPT_ESH emacs/gmacs edit mode 54*906afcb8SAndy Fiddaman# SHOPT_FILESCAN fast file scan 55*906afcb8SAndy Fiddaman# SHOPT_FIXEDARRAY fixed dimension indexed array 56*906afcb8SAndy Fiddaman# SHOPT_HISTEXPAND csh-style history file expansions 57*906afcb8SAndy Fiddaman# SHOPT_KIA shell information database generation 58*906afcb8SAndy Fiddaman# SHOPT_MULTIBYTE multibyte character handling 59*906afcb8SAndy Fiddaman# SHOPT_NAMESPACE allow namespaces 60*906afcb8SAndy Fiddaman# SHOPT_OPTIMIZE optimize loop invariants 61*906afcb8SAndy Fiddaman# SHOPT_PFSH solaris exec_attr(4) profile execution 62*906afcb8SAndy Fiddaman# SHOPT_RAWONLY make viraw the only vi mode 63*906afcb8SAndy Fiddaman# SHOPT_STATS add .sh.stats variable 64*906afcb8SAndy Fiddaman# SHOPT_SUID_EXEC allow (safe) suid/sgid shell scripts 65*906afcb8SAndy Fiddaman# SHOPT_TYPEDEF enable typeset type definitions 66*906afcb8SAndy Fiddaman# SHOPT_VSH vi edit mode 67*906afcb8SAndy Fiddaman 68*906afcb8SAndy Fiddaman# These options are enabled but are not enabled by default in the upstream 69*906afcb8SAndy Fiddaman# build framework*: 70*906afcb8SAndy Fiddaman# 71*906afcb8SAndy Fiddaman# SHOPT_SYSRC attempt . /etc/ksh.kshrc if interactive 72*906afcb8SAndy Fiddaman 73*906afcb8SAndy Fiddaman# These options are NOT enabled but are enabled by default in the upstream 74*906afcb8SAndy Fiddaman# build framework*: 75*906afcb8SAndy Fiddaman# 76*906afcb8SAndy Fiddaman# SHOPT_AUDIT enable auditing per SHOPT_AUDITFILE 77*906afcb8SAndy Fiddaman# SHOPT_COSHELL build with connection to coshell 78*906afcb8SAndy Fiddaman# SHOPT_EDPREDICT predictive editing 79*906afcb8SAndy Fiddaman 80*906afcb8SAndy Fiddaman# These options are NOT enabled and are also NOT enabled in the upstream 81*906afcb8SAndy Fiddaman# build framework*: 82*906afcb8SAndy Fiddaman# 83*906afcb8SAndy Fiddaman# SHOPT_ACCT accounting 84*906afcb8SAndy Fiddaman# SHOPT_ACCTFILE per user accounting info 85*906afcb8SAndy Fiddaman# SHOPT_AUDITFILE "/etc/ksh_audit" auditing file 86*906afcb8SAndy Fiddaman# SHOPT_BASH bash compatibility code 87*906afcb8SAndy Fiddaman# SHOPT_CRNL accept <cr><nl> for <nl> 88*906afcb8SAndy Fiddaman# SHOPT_ECHOPRINT make echo equivalent to print 89*906afcb8SAndy Fiddaman# SHOPT_FS_3D 3d file system 90*906afcb8SAndy Fiddaman# SHOPT_OLDTERMIO support both TCGETA and TCGETS 91*906afcb8SAndy Fiddaman# SHOPT_P_SUID real uid's that require -p for set[ug]id 92*906afcb8SAndy Fiddaman# SHOPT_REGRESS enable __regress__ builtin 93*906afcb8SAndy Fiddaman# SHOPT_REMOTE enable --rc if running as a remote shell 94*906afcb8SAndy Fiddaman# SHOPT_SEVENBIT strip the eigth bit from characters 95*906afcb8SAndy Fiddaman# SHOPT_SPAWN use spawnveg for fork/exec 96*906afcb8SAndy Fiddaman# SHOPT_TIMEOUT number of seconds for shell timeout 97*906afcb8SAndy Fiddaman 98*906afcb8SAndy FiddamanLIBSHELLFEATUREFLAGS= \ 99*906afcb8SAndy Fiddaman -DSHOPT_2DMATCH \ 100*906afcb8SAndy Fiddaman -DSHOPT_BGX \ 101*906afcb8SAndy Fiddaman -DSHOPT_BRACEPAT \ 102*906afcb8SAndy Fiddaman -DSHOPT_DYNAMIC \ 103*906afcb8SAndy Fiddaman -DSHOPT_ESH \ 104*906afcb8SAndy Fiddaman -DSHOPT_FILESCAN \ 105*906afcb8SAndy Fiddaman -DSHOPT_FIXEDARRAY \ 106*906afcb8SAndy Fiddaman -DSHOPT_HISTEXPAND \ 107*906afcb8SAndy Fiddaman -DSHOPT_KIA \ 108*906afcb8SAndy Fiddaman -DSHOPT_MULTIBYTE \ 109*906afcb8SAndy Fiddaman -DSHOPT_NAMESPACE \ 110*906afcb8SAndy Fiddaman -DSHOPT_OPTIMIZE \ 111*906afcb8SAndy Fiddaman -DSHOPT_PFSH \ 112*906afcb8SAndy Fiddaman -DSHOPT_RAWONLY \ 113*906afcb8SAndy Fiddaman -DSHOPT_STATS \ 114*906afcb8SAndy Fiddaman -DSHOPT_SUID_EXEC \ 115*906afcb8SAndy Fiddaman -DSHOPT_SYSRC \ 116*906afcb8SAndy Fiddaman -DSHOPT_TYPEDEF \ 117*906afcb8SAndy Fiddaman -DSHOPT_VSH 118*906afcb8SAndy Fiddaman 119*906afcb8SAndy Fiddaman# 120*906afcb8SAndy Fiddaman# common CPP flags for libshell consumers (ksh, shcomp etc.) 121*906afcb8SAndy Fiddaman# 122*906afcb8SAndy Fiddaman 123*906afcb8SAndy FiddamanLIBSHELLCPPFLAGS= \ 124*906afcb8SAndy Fiddaman -I$(LIBSHELLBASE)/$(LIBSHELLMACH) \ 125*906afcb8SAndy Fiddaman -I$(ASTSRC)/include \ 126*906afcb8SAndy Fiddaman -I$(ROOT)/usr/include/ast \ 127*906afcb8SAndy Fiddaman -I$(ROOT)/usr/include \ 128*906afcb8SAndy Fiddaman \ 129*906afcb8SAndy Fiddaman -DSHOPT_CMDLIB_BLTIN=0 \ 130*906afcb8SAndy Fiddaman '-DSH_CMDLIB_DIR="/usr/ast/bin"' \ 131*906afcb8SAndy Fiddaman '-DSHOPT_CMDLIB_HDR="../common/illumos_cmdlist.h"' \ 132*906afcb8SAndy Fiddaman \ 133*906afcb8SAndy Fiddaman $(LIBSHELLFEATUREFLAGS) \ 134*906afcb8SAndy Fiddaman \ 135*906afcb8SAndy Fiddaman -DKSHELL \ 136*906afcb8SAndy Fiddaman -D_BLD_shell \ 137*906afcb8SAndy Fiddaman -D_PACKAGE_ast \ 138*906afcb8SAndy Fiddaman -D_API_ast=20100309 \ 139*906afcb8SAndy Fiddaman '-DERROR_CATALOG="libshell"' \ 140*906afcb8SAndy Fiddaman -DERROR_CONTEXT_T=Error_context_t \ 141*906afcb8SAndy Fiddaman '-DUSAGE_LICENSE=\ 142*906afcb8SAndy Fiddaman "[-author?David Korn <dgk@research.att.com>]" \ 143*906afcb8SAndy Fiddaman "[-copyright?Copyright (c) 1982-2012 AT&T Intellectual Property]" \ 144*906afcb8SAndy Fiddaman "[-license?http://www.eclipse.org/org/documents/epl-v10.html]" \ 145*906afcb8SAndy Fiddaman "[--catalog?libshell]"' 146*906afcb8SAndy Fiddaman 147*906afcb8SAndy Fiddaman# Default CFLAGS/CFLAGS64 for AST sources 148*906afcb8SAndy FiddamanASTCFLAGS= $(CCVERBOSE) 149*906afcb8SAndy FiddamanASTCFLAGS64= $(CCVERBOSE) 150*906afcb8SAndy Fiddaman 151*906afcb8SAndy Fiddaman# Generated header files generated using this system have a number of 152*906afcb8SAndy Fiddaman# artifacts that are cleaned up by the following action. 153*906afcb8SAndy Fiddaman# 154*906afcb8SAndy Fiddaman# They include a 'generated by' header which includes the full path to 155*906afcb8SAndy Fiddaman# the source file. The path to the root of the gate is removed, leaving only 156*906afcb8SAndy Fiddaman# the relative part of the path. 157*906afcb8SAndy Fiddaman# 158*906afcb8SAndy Fiddaman# They have trailing whitespace, which is removed. 159*906afcb8SAndy Fiddaman 160*906afcb8SAndy FiddamanPOST_PROCESS_AST = $(SED) -i ' \ 161*906afcb8SAndy Fiddaman s^$(SRC)/^^g; \ 162*906afcb8SAndy Fiddaman s/ *$$//; \ 163*906afcb8SAndy Fiddaman /def.* _def_.*_$(MACH64)/s/$(MACH64)/$(HDRGUARD)/; \ 164*906afcb8SAndy Fiddaman /def.* _def_.*_$(MACH)/s/$(MACH)/$(HDRGUARD)/; \ 165*906afcb8SAndy Fiddaman ' 166