xref: /titanic_41/usr/src/cmd/ksh/Makefile.com (revision 5bbb4db2c3f208d12bf0fd11769728f9e5ba66a2)
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 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27SHELL=/usr/bin/ksh93
28
29include ../../../Makefile.ksh93switch
30
31$(BINKSH_IS_KSH93)PROG= ksh
32$(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh pfksh93 pfrksh pfrksh93
33
34$(BINKSH_ISNOT_KSH93)PROG= ksh93
35$(BINKSH_ISNOT_KSH93)USRKSH_ALIAS_LIST=ksh93 rksh93
36
37OBJECTS= \
38	pmain.o
39
40LIBSHELLBASE=../../../lib/libshell
41LIBSHELLSRC=$(LIBSHELLBASE)/common/sh
42
43SRCS=	$(OBJECTS:%.o=$(LIBSHELLSRC)/%.c)
44
45LDLIBS += -lshell
46
47# Set common AST build flags (e.g., needed to support the math stuff).
48include ../../../Makefile.ast
49
50# 1. Make sure that the -D/-U defines in CFLAGS below are in sync
51# with usr/src/lib/libshell/Makefile.com
52# 2. We use "=" here since using $(CPPFLAGS.master) is very tricky in our
53# case - it MUST come as the last element but future changes in -D options
54# may then cause silent breakage in the AST sources because the last -D
55# option specified overrides previous -D options so we prefer the current
56# way to explicitly list each single flag.
57CPPFLAGS = \
58	$(DTEXTDOM) $(DTS_ERRNO) \
59	$(LIBSHELLCPPFLAGS)
60
61CFLAGS += \
62	$(ASTCFLAGS)
63CFLAGS64 += \
64	$(ASTCFLAGS64)
65
66# Workaround for CR#6628728 ("|memcntl()| prototype not available for C99/XPG6")
67pmain.o	:= CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED
68
69.KEEP_STATE:
70
71%.o:	$(LIBSHELLSRC)/%.c
72	$(COMPILE.c) -c -o $@ $<
73	$(POST_PROCESS_O)
74
75all:	$(PROG)
76
77# We explicitly delete "ksh" and "ksh93" to catch changes in
78# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
79# and soft-link $(PROG) to ksh/ksh93 below because ksh93 test
80# suite seems to require that ksh93 is available as "ksh" in
81# ${PATH} (see comment about "io.sh" in Makefile.testshell).
82$(PROG):	$(OBJECTS)
83	$(RM) ksh ksh93
84	$(LINK.c) $(OBJECTS) -o $@ $(LDLIBS)
85	$(POST_PROCESS)
86	(set +o errexit ; \
87	[[ ! -x ksh93 ]] && ln $(PROG) ksh93 ; \
88	[[ ! -x ksh   ]] && ln $(PROG) ksh   ; \
89	true \
90	)
91
92clean:
93	$(RM) $(OBJECTS)
94
95# We explicitly delete "ksh" and "ksh93" to catch changes in
96# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
97CLOBBERFILES += \
98	ksh \
99	ksh93
100
101# Install rule for $(MACH)/Makefile (32bit)
102INSTALL.ksh.32bit=@ \
103	(print "$(POUND_SIGN) Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
104	set -o xtrace ; \
105	for i in $(USRKSH_ALIAS_LIST) ; do \
106		[[ "$$i" == "$(PROG)" ]] && continue ; \
107		$(RM) "$(ROOTBIN32)/$$i" ; \
108		$(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
109	done \
110	)
111
112# Install rule for $(MACH64)/Makefile (64bit)
113INSTALL.ksh.64bit=@ \
114	(print "$(POUND_SIGN) Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
115	set -o xtrace ; \
116	for i in $(USRKSH_ALIAS_LIST) ; do \
117		[[ "$$i" == "$(PROG)" ]] && continue ; \
118		$(RM) "$(ROOTBIN64)/$$i" ; \
119		$(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
120	done \
121	)
122
123#
124# ksh is not lint-clean yet; fake up a target.  (You can use
125# "make lintcheck" to actually run lint; please send all lint fixes
126# upstream (to AT&T) so the next update will pull them into ON.)
127#
128lint:
129	@ print "usr/src/cmd/ksh is not lint-clean: skipping"
130
131include ../Makefile.testshell
132