xref: /titanic_44/usr/src/cmd/ksh/Makefile.com (revision da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968)
1*da2e3ebdSchin#
2*da2e3ebdSchin# CDDL HEADER START
3*da2e3ebdSchin#
4*da2e3ebdSchin# The contents of this file are subject to the terms of the
5*da2e3ebdSchin# Common Development and Distribution License (the "License").
6*da2e3ebdSchin# You may not use this file except in compliance with the License.
7*da2e3ebdSchin#
8*da2e3ebdSchin# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*da2e3ebdSchin# or http://www.opensolaris.org/os/licensing.
10*da2e3ebdSchin# See the License for the specific language governing permissions
11*da2e3ebdSchin# and limitations under the License.
12*da2e3ebdSchin#
13*da2e3ebdSchin# When distributing Covered Code, include this CDDL HEADER in each
14*da2e3ebdSchin# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*da2e3ebdSchin# If applicable, add the following below this CDDL HEADER, with the
16*da2e3ebdSchin# fields enclosed by brackets "[]" replaced with your own identifying
17*da2e3ebdSchin# information: Portions Copyright [yyyy] [name of copyright owner]
18*da2e3ebdSchin#
19*da2e3ebdSchin# CDDL HEADER END
20*da2e3ebdSchin#
21*da2e3ebdSchin#
22*da2e3ebdSchin# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*da2e3ebdSchin# Use is subject to license terms.
24*da2e3ebdSchin#
25*da2e3ebdSchin# ident	"%Z%%M%	%I%	%E% SMI"
26*da2e3ebdSchin#
27*da2e3ebdSchin
28*da2e3ebdSchinSHELL=/usr/bin/ksh
29*da2e3ebdSchin
30*da2e3ebdSchininclude ../../../Makefile.ksh93switch
31*da2e3ebdSchin
32*da2e3ebdSchin$(BINKSH_IS_KSH93)PROG= ksh
33*da2e3ebdSchin$(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh
34*da2e3ebdSchin
35*da2e3ebdSchin$(BINKSH_ISNOT_KSH93)PROG= ksh93
36*da2e3ebdSchin$(BINKSH_ISNOT_KSH93)USRKSH_ALIAS_LIST=ksh93 rksh93
37*da2e3ebdSchin
38*da2e3ebdSchinOBJECTS= \
39*da2e3ebdSchin	pmain.o
40*da2e3ebdSchin
41*da2e3ebdSchinLIBSHELLSRC=../../../lib/libshell/common/sh
42*da2e3ebdSchin
43*da2e3ebdSchinSRCS=	$(OBJECTS:%.o=$(LIBSHELLSRC)/%.c)
44*da2e3ebdSchin
45*da2e3ebdSchinGROUP= bin
46*da2e3ebdSchinLDLIBS += -lshell
47*da2e3ebdSchin
48*da2e3ebdSchin# 1. Make sure that the -D/-U defines in CFLAGS below are in sync
49*da2e3ebdSchin# with usr/src/lib/libshell/Makefile.com
50*da2e3ebdSchin# 2. We use "=" here since using $(CPPFLAGS.master) is very tricky in our
51*da2e3ebdSchin# case - it MUST come as the last element but future changes in -D options
52*da2e3ebdSchin# may then cause silent breakage in the AST sources because the last -D
53*da2e3ebdSchin# option specified overrides previous -D options so we prefer the current
54*da2e3ebdSchin# way to explicitly list each single flag.
55*da2e3ebdSchinCPPFLAGS = \
56*da2e3ebdSchin	$(DTEXTDOM) $(DTS_ERRNO) \
57*da2e3ebdSchin	$(LIBSHELLCPPFLAGS)
58*da2e3ebdSchin
59*da2e3ebdSchinCFLAGS += \
60*da2e3ebdSchin	$(CCVERBOSE) \
61*da2e3ebdSchin	-xstrconst
62*da2e3ebdSchinCFLAGS64 += \
63*da2e3ebdSchin	$(CCVERBOSE) \
64*da2e3ebdSchin	-xstrconst
65*da2e3ebdSchin
66*da2e3ebdSchin# Set common AST build flags (e.g., needed to support the math stuff).
67*da2e3ebdSchininclude ../../../Makefile.ast
68*da2e3ebdSchin
69*da2e3ebdSchin.KEEP_STATE:
70*da2e3ebdSchin
71*da2e3ebdSchin%.o:	$(LIBSHELLSRC)/%.c
72*da2e3ebdSchin	$(COMPILE.c) -c -o $@ $<
73*da2e3ebdSchin	$(POST_PROCESS_O)
74*da2e3ebdSchin
75*da2e3ebdSchinall:	$(PROG)
76*da2e3ebdSchin
77*da2e3ebdSchin# We explicitly delete "ksh" and "ksh93" to catch changes in
78*da2e3ebdSchin# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
79*da2e3ebdSchin# and soft-link $(PROG) to ksh/ksh93 below because ksh93 test
80*da2e3ebdSchin# suite seems to require that ksh93 is available as "ksh" in
81*da2e3ebdSchin# ${PATH} (see comment about "io.sh" in Makefile.testshell).
82*da2e3ebdSchin$(PROG):	$(OBJECTS)
83*da2e3ebdSchin	$(RM) ksh ksh93
84*da2e3ebdSchin	$(LINK.c) $(OBJECTS) -o $@ $(LDLIBS)
85*da2e3ebdSchin	$(POST_PROCESS)
86*da2e3ebdSchin	(set +o errexit ; \
87*da2e3ebdSchin	[[ ! -x ksh93 ]] && ln $(PROG) ksh93 ; \
88*da2e3ebdSchin	[[ ! -x ksh   ]] && ln $(PROG) ksh   ; \
89*da2e3ebdSchin	true \
90*da2e3ebdSchin	)
91*da2e3ebdSchin
92*da2e3ebdSchinclean:
93*da2e3ebdSchin	$(RM) $(OBJECTS)
94*da2e3ebdSchin
95*da2e3ebdSchin# We explicitly delete "ksh" and "ksh93" to catch changes in
96*da2e3ebdSchin# BUILD_KSH93_AS_BINKSH (see Makefile.ksh93switch)
97*da2e3ebdSchinCLOBBERFILES += \
98*da2e3ebdSchin	ksh \
99*da2e3ebdSchin	ksh93
100*da2e3ebdSchin
101*da2e3ebdSchin#
102*da2e3ebdSchin# ksh is not lint-clean yet; fake up a target.  (You can use
103*da2e3ebdSchin# "make lintcheck" to actually run lint; please send all lint fixes
104*da2e3ebdSchin# upstream (to AT&T) so the next update will pull them into ON.)
105*da2e3ebdSchin#
106*da2e3ebdSchinlint:
107*da2e3ebdSchin	@ print "usr/src/cmd/ksh is not lint-clean: skipping"
108*da2e3ebdSchin	@ $(TRUE)
109*da2e3ebdSchin
110*da2e3ebdSchininclude ../Makefile.testshell
111