xref: /titanic_51/usr/src/cmd/ast/ksh/Makefile.com (revision b4dd7d09880f14016feece03929a224eca1cf39a)
1*b4dd7d09SAndy Fiddaman#
2*b4dd7d09SAndy Fiddaman# CDDL HEADER START
3*b4dd7d09SAndy Fiddaman#
4*b4dd7d09SAndy Fiddaman# The contents of this file are subject to the terms of the
5*b4dd7d09SAndy Fiddaman# Common Development and Distribution License (the "License").
6*b4dd7d09SAndy Fiddaman# You may not use this file except in compliance with the License.
7*b4dd7d09SAndy Fiddaman#
8*b4dd7d09SAndy Fiddaman# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*b4dd7d09SAndy Fiddaman# or http://www.opensolaris.org/os/licensing.
10*b4dd7d09SAndy Fiddaman# See the License for the specific language governing permissions
11*b4dd7d09SAndy Fiddaman# and limitations under the License.
12*b4dd7d09SAndy Fiddaman#
13*b4dd7d09SAndy Fiddaman# When distributing Covered Code, include this CDDL HEADER in each
14*b4dd7d09SAndy Fiddaman# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*b4dd7d09SAndy Fiddaman# If applicable, add the following below this CDDL HEADER, with the
16*b4dd7d09SAndy Fiddaman# fields enclosed by brackets "[]" replaced with your own identifying
17*b4dd7d09SAndy Fiddaman# information: Portions Copyright [yyyy] [name of copyright owner]
18*b4dd7d09SAndy Fiddaman#
19*b4dd7d09SAndy Fiddaman# CDDL HEADER END
20*b4dd7d09SAndy Fiddaman#
21*b4dd7d09SAndy Fiddaman
22*b4dd7d09SAndy Fiddaman#
23*b4dd7d09SAndy Fiddaman# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24*b4dd7d09SAndy Fiddaman#
25*b4dd7d09SAndy Fiddaman# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
26*b4dd7d09SAndy Fiddaman
27*b4dd7d09SAndy FiddamanSHELL=/usr/bin/ksh93
28*b4dd7d09SAndy Fiddaman
29*b4dd7d09SAndy FiddamanPROG= ksh
30*b4dd7d09SAndy Fiddaman
31*b4dd7d09SAndy FiddamanUSRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93
32*b4dd7d09SAndy Fiddaman
33*b4dd7d09SAndy Fiddaman# Set common AST build flags (e.g., needed to support the math stuff).
34*b4dd7d09SAndy Fiddamaninclude ../../Makefile.ast
35*b4dd7d09SAndy Fiddaman
36*b4dd7d09SAndy FiddamanOBJECTS= pmain.o
37*b4dd7d09SAndy Fiddaman
38*b4dd7d09SAndy FiddamanASTSRC= $(C_AST)/src/cmd/ksh93
39*b4dd7d09SAndy FiddamanLIBSHELLBASE= ../../libshell
40*b4dd7d09SAndy FiddamanLIBSHELLSRC= $(ASTSRC)/sh
41*b4dd7d09SAndy Fiddaman
42*b4dd7d09SAndy FiddamanSRCS=	$(OBJECTS:%.o=$(LIBSHELLSRC)/%.c)
43*b4dd7d09SAndy Fiddaman
44*b4dd7d09SAndy FiddamanLDLIBS += -lshell -lumem
45*b4dd7d09SAndy Fiddaman
46*b4dd7d09SAndy Fiddaman# We use "=" here since using $(CPPFLAGS.master) is very tricky in our
47*b4dd7d09SAndy Fiddaman# case - it MUST come as the last element but future changes in -D options
48*b4dd7d09SAndy Fiddaman# may then cause silent breakage in the AST sources because the last -D
49*b4dd7d09SAndy Fiddaman# option specified overrides previous -D options so we prefer the current
50*b4dd7d09SAndy Fiddaman# way to explicitly list each single flag.
51*b4dd7d09SAndy FiddamanCPPFLAGS= \
52*b4dd7d09SAndy Fiddaman	$(DTEXTDOM) $(DTS_ERRNO) \
53*b4dd7d09SAndy Fiddaman	$(LIBSHELLCPPFLAGS)
54*b4dd7d09SAndy Fiddaman
55*b4dd7d09SAndy FiddamanCFLAGS += $(ASTCFLAGS)
56*b4dd7d09SAndy FiddamanCFLAGS64 += $(ASTCFLAGS64)
57*b4dd7d09SAndy Fiddaman
58*b4dd7d09SAndy Fiddaman# Workaround for CR#6628728 ("|memcntl()| prototype not available for C99/XPG6")
59*b4dd7d09SAndy Fiddamanpmain.o	:= CERRWARN += -_gcc=-Wno-implicit-function-declaration
60*b4dd7d09SAndy Fiddaman
61*b4dd7d09SAndy Fiddaman.KEEP_STATE:
62*b4dd7d09SAndy Fiddaman
63*b4dd7d09SAndy Fiddaman%.o:	$(LIBSHELLSRC)/%.c
64*b4dd7d09SAndy Fiddaman	$(COMPILE.c) -c -o $@ $<
65*b4dd7d09SAndy Fiddaman	$(POST_PROCESS_O)
66*b4dd7d09SAndy Fiddaman
67*b4dd7d09SAndy Fiddamanall:	$(PROG)
68*b4dd7d09SAndy Fiddaman
69*b4dd7d09SAndy Fiddaman# We explicitly delete "ksh" and "ksh93" to catch changes in
70*b4dd7d09SAndy Fiddaman# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
71*b4dd7d09SAndy Fiddaman# and soft-link $(PROG) to ksh/ksh93 below because ksh93 test
72*b4dd7d09SAndy Fiddaman# suite seems to require that ksh93 is available as "ksh" in
73*b4dd7d09SAndy Fiddaman# ${PATH} (see comment about "io.sh" in Makefile.testshell).
74*b4dd7d09SAndy Fiddaman$(PROG):	$(OBJECTS)
75*b4dd7d09SAndy Fiddaman	$(RM) ksh ksh93
76*b4dd7d09SAndy Fiddaman	$(LINK.c) $(OBJECTS) -o $@ $(LDLIBS)
77*b4dd7d09SAndy Fiddaman	$(POST_PROCESS)
78*b4dd7d09SAndy Fiddaman	(set +o errexit ; \
79*b4dd7d09SAndy Fiddaman	[[ ! -x ksh93 ]] && ln $(PROG) ksh93 ; \
80*b4dd7d09SAndy Fiddaman	[[ ! -x ksh   ]] && ln $(PROG) ksh   ; \
81*b4dd7d09SAndy Fiddaman	true \
82*b4dd7d09SAndy Fiddaman	)
83*b4dd7d09SAndy Fiddaman
84*b4dd7d09SAndy Fiddamanclean:
85*b4dd7d09SAndy Fiddaman	$(RM) $(OBJECTS)
86*b4dd7d09SAndy Fiddaman
87*b4dd7d09SAndy Fiddaman# We explicitly delete "ksh" and "ksh93" to catch changes in
88*b4dd7d09SAndy Fiddaman# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
89*b4dd7d09SAndy FiddamanCLOBBERFILES += ksh ksh93
90*b4dd7d09SAndy Fiddaman
91*b4dd7d09SAndy Fiddaman# Install rule for $(MACH)/Makefile (32bit)
92*b4dd7d09SAndy FiddamanINSTALL.ksh.32bit=@ \
93*b4dd7d09SAndy Fiddaman	(print "$(POUND_SIGN) Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
94*b4dd7d09SAndy Fiddaman	set -o xtrace ; \
95*b4dd7d09SAndy Fiddaman	for i in $(USRKSH_ALIAS_LIST) ; do \
96*b4dd7d09SAndy Fiddaman		[[ "$$i" == "$(PROG)" ]] && continue ; \
97*b4dd7d09SAndy Fiddaman		$(RM) "$(ROOTBIN32)/$$i" ; \
98*b4dd7d09SAndy Fiddaman		$(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
99*b4dd7d09SAndy Fiddaman	done \
100*b4dd7d09SAndy Fiddaman	)
101*b4dd7d09SAndy Fiddaman
102*b4dd7d09SAndy Fiddaman# Install rule for $(MACH64)/Makefile (64bit)
103*b4dd7d09SAndy FiddamanINSTALL.ksh.64bit=@ \
104*b4dd7d09SAndy Fiddaman	(print "$(POUND_SIGN) Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
105*b4dd7d09SAndy Fiddaman	set -o xtrace ; \
106*b4dd7d09SAndy Fiddaman	for i in $(USRKSH_ALIAS_LIST) ; do \
107*b4dd7d09SAndy Fiddaman		[[ "$$i" == "$(PROG)" ]] && continue ; \
108*b4dd7d09SAndy Fiddaman		$(RM) "$(ROOTBIN64)/$$i" ; \
109*b4dd7d09SAndy Fiddaman		$(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
110*b4dd7d09SAndy Fiddaman	done \
111*b4dd7d09SAndy Fiddaman	)
112*b4dd7d09SAndy Fiddaman
113*b4dd7d09SAndy Fiddamaninclude ../Makefile.testshell
114