xref: /illumos-gate/usr/src/cmd/getconf/Makefile (revision 7adeeb5aeae42d3b6a4686f45f1fcd4a78b5a459)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate# with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
23*7adeeb5aSmike_s# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gatePROG= getconf
297c478bd9Sstevel@tonic-gateXPG4PROG= getconf
307c478bd9Sstevel@tonic-gateXPG6PROG= getconf
317c478bd9Sstevel@tonic-gateX4= objs.xpg4
327c478bd9Sstevel@tonic-gateX6= objs.xpg6
337c478bd9Sstevel@tonic-gateOBJS= getconf.o
347c478bd9Sstevel@tonic-gateXPG4EXOBJS= $(X4)/getconf.o
357c478bd9Sstevel@tonic-gateXPG6EXOBJS= $(X6)/getconf.o
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gateXPG4EXOBJS += values-xpg4.o
407c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE)
417c478bd9Sstevel@tonic-gate# XPG4
427c478bd9Sstevel@tonic-gate$(XPG4) := CFLAGS += -D_XOPEN_SOURCE -I$(SRC)/lib/libc/inc
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate# XPG6MODE:  Depending on the version of the compiler, the value of
457c478bd9Sstevel@tonic-gate# __STDC_VERSION__ may differ even in the presence of the same compilation
467c478bd9Sstevel@tonic-gate# options. The default compilation mode for Sun compilers that support the
477c478bd9Sstevel@tonic-gate# C99 standard is -xc99=all,no_lib. C99MODE= is equivalent to -xc99=all,no_lib.
487c478bd9Sstevel@tonic-gate# This translates to C99 semantics without the C99 library specific behaviors
497c478bd9Sstevel@tonic-gate# and dependencies.
507c478bd9Sstevel@tonic-gate#
517c478bd9Sstevel@tonic-gate# For pre-5.7 compilers (unless patched with 117551-04 or 117552-05), in the
527c478bd9Sstevel@tonic-gate# default compilation mode, __STDC_VERSION__ was defined to be 199901L. For
537c478bd9Sstevel@tonic-gate# 5.7 and on compilers, __STDC_VERSION__ defaults to 199409L in order to
547c478bd9Sstevel@tonic-gate# maintain source compatibility. Neither of these cases results in the
557c478bd9Sstevel@tonic-gate# importing of /usr/lib/values-xpg6.o, so we need to either manually import
567c478bd9Sstevel@tonic-gate# it via linking with a local version of the object, or set -xc99=%all which
577c478bd9Sstevel@tonic-gate# by default imports /usr/lib/values-xpg6.o. C99MODE=C99_ENABLE is equivalent
587c478bd9Sstevel@tonic-gate# to -xc99=all. If C99_ENABLE is defined and we also attempt to link with a
597c478bd9Sstevel@tonic-gate# local version of values-xpg6.o, an error will occur due to multiple
607c478bd9Sstevel@tonic-gate# definitions for __xpg4 and __xpg6. Because /usr/lib/values-xpg6.o was
617c478bd9Sstevel@tonic-gate# delivered in Solaris 10 and is a stable interface, there is no need to
627c478bd9Sstevel@tonic-gate# build and link with a local version of the object.
637c478bd9Sstevel@tonic-gate#
647c478bd9Sstevel@tonic-gate# The gcc compiler behaves differently and requires -std=gnu99.
657c478bd9Sstevel@tonic-gate#
667c478bd9Sstevel@tonic-gate# For XPG4, we need to link with a local version of values-xpg4.o because
677c478bd9Sstevel@tonic-gate# the compiler only imports this by default (from /usr/lib/values-xpg4.o)
687c478bd9Sstevel@tonic-gate# if we use the c89 utility as opposed to cc.
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gateXPG6MODE = $(C99_ENABLE)
717c478bd9Sstevel@tonic-gate$(XPG6) := C99MODE = $(XPG6MODE)
727c478bd9Sstevel@tonic-gate$(XPG6) := CFLAGS += -D_XOPEN_SOURCE=600 -I$(SRC)/lib/libc/inc
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate.KEEP_STATE:
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gateall: $(PROG) $(XPG4) $(XPG6)
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate$(PROG):	$(OBJS)
797c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
807c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gate$(XPG4):	$(X4) $(XPG4EXOBJS)
837c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
847c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate$(XPG6):	$(X6) $(XPG6EXOBJS)
877c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $(XPG6EXOBJS) $(LDLIBS)
887c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate$(XPG4EXOBJS):	$(X4)
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate$(X4)/%.o:	%.c
957c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate$(X4):
997c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gate$(XPG6EXOBJS):	$(X6)
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate$(X6)/%.o:	%.c
1067c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gate$(X6):
1107c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gateinstall: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTXPG6PROG)
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gatevalues-xpg4.o: ../../lib/common/common/values-xpg4.c
1167c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gateclean:
1197c478bd9Sstevel@tonic-gate	-@rm -rf $(OBJS) $(XPG4EXOBJS) $(XPG6EXOBJS) $(X4) $(X6) \
1207c478bd9Sstevel@tonic-gate		$(PROG) $(XPG4) $(XPG6)
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gatelint:	lint_PROG
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
125