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