xref: /titanic_51/usr/src/cmd/ksh/Makefile.com (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
1da2e3ebdSchin#
2da2e3ebdSchin# CDDL HEADER START
3da2e3ebdSchin#
4da2e3ebdSchin# The contents of this file are subject to the terms of the
5da2e3ebdSchin# Common Development and Distribution License (the "License").
6da2e3ebdSchin# You may not use this file except in compliance with the License.
7da2e3ebdSchin#
8da2e3ebdSchin# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9da2e3ebdSchin# or http://www.opensolaris.org/os/licensing.
10da2e3ebdSchin# See the License for the specific language governing permissions
11da2e3ebdSchin# and limitations under the License.
12da2e3ebdSchin#
13da2e3ebdSchin# When distributing Covered Code, include this CDDL HEADER in each
14da2e3ebdSchin# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15da2e3ebdSchin# If applicable, add the following below this CDDL HEADER, with the
16da2e3ebdSchin# fields enclosed by brackets "[]" replaced with your own identifying
17da2e3ebdSchin# information: Portions Copyright [yyyy] [name of copyright owner]
18da2e3ebdSchin#
19da2e3ebdSchin# CDDL HEADER END
20da2e3ebdSchin#
217c2fbfb3SApril Chin
22da2e3ebdSchin#
23134a1f4eSCasper H.S. Dik# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24da2e3ebdSchin#
25da2e3ebdSchin
267c2fbfb3SApril ChinSHELL=/usr/bin/ksh93
27da2e3ebdSchin
28ead1f93eSLiane PrazaPROG= ksh
29da2e3ebdSchin
30134a1f4eSCasper H.S. DikUSRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93
31da2e3ebdSchin
32da2e3ebdSchinOBJECTS= \
33da2e3ebdSchin	pmain.o
34da2e3ebdSchin
357c2fbfb3SApril ChinLIBSHELLBASE=../../../lib/libshell
367c2fbfb3SApril ChinLIBSHELLSRC=$(LIBSHELLBASE)/common/sh
37da2e3ebdSchin
38da2e3ebdSchinSRCS=	$(OBJECTS:%.o=$(LIBSHELLSRC)/%.c)
39da2e3ebdSchin
40da2e3ebdSchinLDLIBS += -lshell
41da2e3ebdSchin
427c2fbfb3SApril Chin# Set common AST build flags (e.g., needed to support the math stuff).
437c2fbfb3SApril Chininclude ../../../Makefile.ast
447c2fbfb3SApril Chin
45da2e3ebdSchin# 1. Make sure that the -D/-U defines in CFLAGS below are in sync
46da2e3ebdSchin# with usr/src/lib/libshell/Makefile.com
47da2e3ebdSchin# 2. We use "=" here since using $(CPPFLAGS.master) is very tricky in our
48da2e3ebdSchin# case - it MUST come as the last element but future changes in -D options
49da2e3ebdSchin# may then cause silent breakage in the AST sources because the last -D
50da2e3ebdSchin# option specified overrides previous -D options so we prefer the current
51da2e3ebdSchin# way to explicitly list each single flag.
52da2e3ebdSchinCPPFLAGS = \
53da2e3ebdSchin	$(DTEXTDOM) $(DTS_ERRNO) \
54da2e3ebdSchin	$(LIBSHELLCPPFLAGS)
55da2e3ebdSchin
56da2e3ebdSchinCFLAGS += \
577c2fbfb3SApril Chin	$(ASTCFLAGS)
58da2e3ebdSchinCFLAGS64 += \
597c2fbfb3SApril Chin	$(ASTCFLAGS64)
60da2e3ebdSchin
617c2fbfb3SApril Chin# Workaround for CR#6628728 ("|memcntl()| prototype not available for C99/XPG6")
62*7014882cSRichard Lowepmain.o	:= CERRWARN += -_gcc=-Wno-implicit-function-declaration
637c2fbfb3SApril Chinpmain.o	:= CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED
64da2e3ebdSchin
65da2e3ebdSchin.KEEP_STATE:
66da2e3ebdSchin
67da2e3ebdSchin%.o:	$(LIBSHELLSRC)/%.c
68da2e3ebdSchin	$(COMPILE.c) -c -o $@ $<
69da2e3ebdSchin	$(POST_PROCESS_O)
70da2e3ebdSchin
71da2e3ebdSchinall:	$(PROG)
72da2e3ebdSchin
73da2e3ebdSchin# We explicitly delete "ksh" and "ksh93" to catch changes in
74da2e3ebdSchin# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
75da2e3ebdSchin# and soft-link $(PROG) to ksh/ksh93 below because ksh93 test
76da2e3ebdSchin# suite seems to require that ksh93 is available as "ksh" in
77da2e3ebdSchin# ${PATH} (see comment about "io.sh" in Makefile.testshell).
78da2e3ebdSchin$(PROG):	$(OBJECTS)
79da2e3ebdSchin	$(RM) ksh ksh93
80da2e3ebdSchin	$(LINK.c) $(OBJECTS) -o $@ $(LDLIBS)
81da2e3ebdSchin	$(POST_PROCESS)
82da2e3ebdSchin	(set +o errexit ; \
83da2e3ebdSchin	[[ ! -x ksh93 ]] && ln $(PROG) ksh93 ; \
84da2e3ebdSchin	[[ ! -x ksh   ]] && ln $(PROG) ksh   ; \
85da2e3ebdSchin	true \
86da2e3ebdSchin	)
87da2e3ebdSchin
88da2e3ebdSchinclean:
89da2e3ebdSchin	$(RM) $(OBJECTS)
90da2e3ebdSchin
91da2e3ebdSchin# We explicitly delete "ksh" and "ksh93" to catch changes in
92da2e3ebdSchin# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
93da2e3ebdSchinCLOBBERFILES += \
94da2e3ebdSchin	ksh \
95da2e3ebdSchin	ksh93
96da2e3ebdSchin
977c2fbfb3SApril Chin# Install rule for $(MACH)/Makefile (32bit)
987c2fbfb3SApril ChinINSTALL.ksh.32bit=@ \
997c2fbfb3SApril Chin	(print "$(POUND_SIGN) Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
1007c2fbfb3SApril Chin	set -o xtrace ; \
1017c2fbfb3SApril Chin	for i in $(USRKSH_ALIAS_LIST) ; do \
1027c2fbfb3SApril Chin		[[ "$$i" == "$(PROG)" ]] && continue ; \
1037c2fbfb3SApril Chin		$(RM) "$(ROOTBIN32)/$$i" ; \
1047c2fbfb3SApril Chin		$(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
1057c2fbfb3SApril Chin	done \
1067c2fbfb3SApril Chin	)
1077c2fbfb3SApril Chin
1087c2fbfb3SApril Chin# Install rule for $(MACH64)/Makefile (64bit)
1097c2fbfb3SApril ChinINSTALL.ksh.64bit=@ \
1107c2fbfb3SApril Chin	(print "$(POUND_SIGN) Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
1117c2fbfb3SApril Chin	set -o xtrace ; \
1127c2fbfb3SApril Chin	for i in $(USRKSH_ALIAS_LIST) ; do \
1137c2fbfb3SApril Chin		[[ "$$i" == "$(PROG)" ]] && continue ; \
1147c2fbfb3SApril Chin		$(RM) "$(ROOTBIN64)/$$i" ; \
1157c2fbfb3SApril Chin		$(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
1167c2fbfb3SApril Chin	done \
1177c2fbfb3SApril Chin	)
1187c2fbfb3SApril Chin
119da2e3ebdSchin#
120da2e3ebdSchin# ksh is not lint-clean yet; fake up a target.  (You can use
121da2e3ebdSchin# "make lintcheck" to actually run lint; please send all lint fixes
122da2e3ebdSchin# upstream (to AT&T) so the next update will pull them into ON.)
123da2e3ebdSchin#
124da2e3ebdSchinlint:
125da2e3ebdSchin	@ print "usr/src/cmd/ksh is not lint-clean: skipping"
126da2e3ebdSchin
127da2e3ebdSchininclude ../Makefile.testshell
128