xref: /titanic_44/usr/src/cmd/getconf/Makefile (revision c28749e97052f09388969427adf7df641cdcdc22)
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 2005 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$(__GNUC)XPG6MODE = $(C99_ENABLE)
72$(XPG6) := C99MODE = $(XPG6MODE)
73$(XPG6) := CFLAGS += -D_XOPEN_SOURCE=600 -I$(SRC)/lib/libc/inc
74
75.KEEP_STATE:
76
77all: $(PROG) $(XPG4) $(XPG6)
78
79$(PROG):	$(OBJS)
80	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
81	$(POST_PROCESS)
82
83$(XPG4):	$(X4) $(XPG4EXOBJS)
84	$(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
85	$(POST_PROCESS)
86
87$(XPG6):	$(X6) $(XPG6EXOBJS)
88	$(LINK.c) -o $@ $(XPG6EXOBJS) $(LDLIBS)
89	$(POST_PROCESS)
90
91
92$(XPG4EXOBJS):	$(X4)
93
94
95$(X4)/%.o:	%.c
96	$(COMPILE.c) -o $@ $<
97
98
99$(X4):
100	-@mkdir -p $@
101
102
103$(XPG6EXOBJS):	$(X6)
104
105
106$(X6)/%.o:	%.c
107	$(COMPILE.c) -o $@ $<
108
109
110$(X6):
111	-@mkdir -p $@
112
113
114install: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTXPG6PROG)
115
116values-xpg4.o: ../../lib/common/common/values-xpg4.c
117	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
118
119clean:
120	-@rm -rf $(OBJS) $(XPG4EXOBJS) $(XPG6EXOBJS) $(X4) $(X6) \
121		$(PROG) $(XPG4) $(XPG6)
122
123lint:	lint_PROG
124
125include ../Makefile.targ
126