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