|
root / base / usr / src / cmd / ast / Makefile.ast
Makefile.ast Makefile 176 lines 5.4 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#
# 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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
#

C_AST =		$(CONTRIB)/ast
C_ASTINIT =	$(C_AST)/src/cmd/INIT

AST=		$(SRC)/cmd/ast

AST_TOOLS =	$(AST)/tools
AST_LCGEN =	$(AST_TOOLS)/lcgen
AST_PROTO =	$(AST_TOOLS)/proto -p -s -l $(C_AST)/lib/package/ast.lic \
		-o '$(AST_LICENSE)'

# Override this top level flag so the compiler builds in its native C99 mode.
CSTD= $(CSTD_GNU99)

#
# Shell feature flags.
# * - the upstream build configuration can be viewed at
#     $(CONTRIB)/ast/src/cmd/ksh93/Makefile
#

# These options are enabled, and are also enabled by default in the upstream
# build framework*:
#
#	SHOPT_2DMATCH		two dimensional .sh.match for ${var//pat/str}
#	SHOPT_BGX		one SIGCHLD trap per completed job
#	SHOPT_BRACEPAT		C-shell {...,...} expansions (, required)
#	SHOPT_DYNAMIC		dynamic loading for builtins
#	SHOPT_ESH		emacs/gmacs edit mode
#	SHOPT_FILESCAN		fast file scan
#	SHOPT_FIXEDARRAY	fixed dimension indexed array
#	SHOPT_HISTEXPAND	csh-style history file expansions
#	SHOPT_KIA		shell information database generation
#	SHOPT_MULTIBYTE		multibyte character handling
#	SHOPT_NAMESPACE		allow namespaces
#	SHOPT_OPTIMIZE		optimize loop invariants
#	SHOPT_RAWONLY		make viraw the only vi mode
#	SHOPT_STATS		add .sh.stats variable
#	SHOPT_SUID_EXEC		allow (safe) suid/sgid shell scripts
#	SHOPT_TYPEDEF		enable typeset type definitions
#	SHOPT_VSH		vi edit mode

# These options are enabled but are not enabled by default in the upstream
# build framework*:
#
#	SHOPT_SYSRC		attempt . /etc/ksh.kshrc if interactive

# These options are NOT enabled but are enabled by default in the upstream
# build framework*:
#
#	SHOPT_AUDIT		enable auditing per SHOPT_AUDITFILE
#	SHOPT_COSHELL		build with connection to coshell
#	SHOPT_EDPREDICT		predictive editing

# These options are NOT enabled and are also NOT enabled in the upstream
# build framework*:
#
#	SHOPT_ACCT		accounting
#	SHOPT_ACCTFILE		per user accounting info
#	SHOPT_AUDITFILE		"/etc/ksh_audit" auditing file
#	SHOPT_BASH		bash compatibility code
#	SHOPT_CRNL		accept <cr><nl> for <nl>
#	SHOPT_ECHOPRINT		make echo equivalent to print
#	SHOPT_FS_3D		3d file system
#	SHOPT_OLDTERMIO		support both TCGETA and TCGETS
#	SHOPT_P_SUID		real uid's that require -p for set[ug]id
#	SHOPT_PFSH		solaris exec_attr(5) profile execution
#	SHOPT_REGRESS		enable __regress__ builtin
#	SHOPT_REMOTE		enable --rc if running as a remote shell
#	SHOPT_SEVENBIT		strip the eigth bit from characters
#	SHOPT_SPAWN		use spawnveg for fork/exec
#	SHOPT_TIMEOUT		number of seconds for shell timeout

LIBSHELLFEATUREFLAGS= \
	-DSHOPT_2DMATCH \
	-DSHOPT_BGX \
	-DSHOPT_BRACEPAT \
	-DSHOPT_DYNAMIC \
	-DSHOPT_ESH \
	-DSHOPT_FILESCAN \
	-DSHOPT_FIXEDARRAY \
	-DSHOPT_HISTEXPAND \
	-DSHOPT_KIA \
	-DSHOPT_MULTIBYTE \
	-DSHOPT_NAMESPACE \
	-DSHOPT_OPTIMIZE \
	-DSHOPT_PFSH=0 \
	-DSHOPT_RAWONLY \
	-DSHOPT_STATS \
	-DSHOPT_SUID_EXEC \
	-DSHOPT_SYSRC \
	-DSHOPT_TYPEDEF \
	-DSHOPT_VSH

#
# common CPP flags for libshell consumers (ksh, shcomp etc.)
#

LIBSHELLCPPFLAGS= \
	-I$(LIBSHELLBASE)/$(LIBSHELLMACH) \
	-I$(ASTSRC)/include \
	-I$(ROOT)/usr/include/ast \
	-I$(ROOT)/usr/include \
	\
	-DSHOPT_CMDLIB_BLTIN=0 \
	'-DSH_CMDLIB_DIR="/usr/bin"' \
	'-DSHOPT_CMDLIB_HDR="../common/illumos_cmdlist.h"' \
	\
	$(LIBSHELLFEATUREFLAGS) \
	\
	-DKSHELL \
	-D_BLD_shell \
	-D_PACKAGE_ast \
	-D_API_ast=20100309 \
	'-DERROR_CATALOG="libshell"' \
	-DERROR_CONTEXT_T=Error_context_t \
	'-DUSAGE_LICENSE=\
	    "[-author?David Korn <dgk@research.att.com>]" \
	    "[-copyright?Copyright (c) 1982-2012 AT&T Intellectual Property]" \
	    "[-license?http://www.eclipse.org/org/documents/epl-v10.html]" \
	    "[--catalog?libshell]"'

# Default CFLAGS/CFLAGS64 for AST sources
ASTCFLAGS= $(CCVERBOSE) -Wno-unknown-pragmas
ASTCFLAGS64= $(CCVERBOSE) -Wno-unknown-pragmas

# Generated header files generated using this system have a number of
# artifacts that are cleaned up by the following action.
#
# They include a 'generated by' header which includes the full path to
# the source file. The path to the root of the gate is removed, leaving only
# the relative part of the path.
#
# They have trailing whitespace, which is removed.

# Unfortunately, due to differences in the "sed" command implemented in
# various illumos distributions, we can't portably use 'sed -i' here.

SEDPATTERN= \
	s^$(SRC)/^^g; \
	s/  *$$//; \
	/def.* _def_.*_$(MACH64)/s/$(MACH64)/$(HDRGUARD)/; \
	/def.* _def_.*_$(MACH)/s/$(MACH)/$(HDRGUARD)/;

POST_PROCESS_AST= \
	{ \
		tf=$$(mktemp /tmp/ast.XXXXXXXXXX) && \
		$(SED) < "$@" > "$$tf" '$(SEDPATTERN)' && \
		$(CP) -p "$$tf" "$@" && \
		$(RM) "$$tf"; \
	}