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