xref: /titanic_41/usr/src/cmd/getconf/Makefile (revision 9e99a257392fad77c4f02e727cccac042d74e9ac)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#ident	"%Z%%M%	%I%	%E% SMI"
27
28PROG= getconf
29XPG4PROG= getconf
30XPG6PROG= getconf
31X4= objs.xpg4
32X6= objs.xpg6
33OBJS= getconf.o
34XPG4EXOBJS= $(X4)/getconf.o
35XPG6EXOBJS= $(X6)/getconf.o
36
37include ../Makefile.cmd
38
39XPG4EXOBJS += values-xpg4.o
40CFLAGS += $(CCVERBOSE)
41# XPG4
42$(XPG4) := CFLAGS += -D_XOPEN_SOURCE -I$(SRC)/lib/libc/inc
43
44# XPG6MODE:  Depending on the version of the compiler, the value of
45# __STDC_VERSION__ may differ even in the presence of the same compilation
46# options. The default compilation mode for Sun compilers that support the
47# C99 standard is -xc99=all,no_lib. C99MODE= is equivalent to -xc99=all,no_lib.
48# This translates to C99 semantics without the C99 library specific behaviors
49# and dependencies.
50#
51# For pre-5.7 compilers (unless patched with 117551-04 or 117552-05), in the
52# default compilation mode, __STDC_VERSION__ was defined to be 199901L. For
53# 5.7 and on compilers, __STDC_VERSION__ defaults to 199409L in order to
54# maintain source compatibility. Neither of these cases results in the
55# importing of /usr/lib/values-xpg6.o, so we need to either manually import
56# it via linking with a local version of the object, or set -xc99=%all which
57# by default imports /usr/lib/values-xpg6.o. C99MODE=C99_ENABLE is equivalent
58# to -xc99=all. If C99_ENABLE is defined and we also attempt to link with a
59# local version of values-xpg6.o, an error will occur due to multiple
60# definitions for __xpg4 and __xpg6. Because /usr/lib/values-xpg6.o was
61# delivered in Solaris 10 and is a stable interface, there is no need to
62# build and link with a local version of the object.
63#
64# The gcc compiler behaves differently and requires -std=gnu99.
65#
66# For XPG4, we need to link with a local version of values-xpg4.o because
67# the compiler only imports this by default (from /usr/lib/values-xpg4.o)
68# if we use the c89 utility as opposed to cc.
69
70XPG6MODE = $(C99_ENABLE)
71$(XPG6) := C99MODE = $(XPG6MODE)
72$(XPG6) := CFLAGS += -D_XOPEN_SOURCE=600 -I$(SRC)/lib/libc/inc
73
74.KEEP_STATE:
75
76all: $(PROG) $(XPG4) $(XPG6)
77
78$(PROG):	$(OBJS)
79	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
80	$(POST_PROCESS)
81
82$(XPG4):	$(X4) $(XPG4EXOBJS)
83	$(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
84	$(POST_PROCESS)
85
86$(XPG6):	$(X6) $(XPG6EXOBJS)
87	$(LINK.c) -o $@ $(XPG6EXOBJS) $(LDLIBS)
88	$(POST_PROCESS)
89
90
91$(XPG4EXOBJS):	$(X4)
92
93
94$(X4)/%.o:	%.c
95	$(COMPILE.c) -o $@ $<
96
97
98$(X4):
99	-@mkdir -p $@
100
101
102$(XPG6EXOBJS):	$(X6)
103
104
105$(X6)/%.o:	%.c
106	$(COMPILE.c) -o $@ $<
107
108
109$(X6):
110	-@mkdir -p $@
111
112
113install: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTXPG6PROG)
114
115values-xpg4.o: ../../lib/common/common/values-xpg4.c
116	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
117
118clean:
119	-@rm -rf $(OBJS) $(XPG4EXOBJS) $(XPG6EXOBJS) $(X4) $(X6) \
120		$(PROG) $(XPG4) $(XPG6)
121
122lint:	lint_PROG
123
124include ../Makefile.targ
125