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