Makefile revision 7014882c6a3672fd0e5d60200af8643ae53c5928
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews#
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# CDDL HEADER START
04428429c4e689333e3ef8d19a2debeb20d4d15dMark Andrews#
e999539fb3e45b2617571e0e3ecd651992291701Mark Andrews# The contents of this file are subject to the terms of the
e999539fb3e45b2617571e0e3ecd651992291701Mark Andrews# Common Development and Distribution License, Version 1.0 only
2a40fdc2d34adb8a5c72a748449699666032d461Mark Andrews# (the "License"). You may not use this file except in compliance
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# with the License.
a3b428812703d22a605a9f882e71ed65f0ffdc65Mark Andrews#
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# or http://www.opensolaris.org/os/licensing.
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# See the License for the specific language governing permissions
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# and limitations under the License.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington#
d56e188030368b835122d759ebbf8d9613c166f4Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# CDDL HEADER END
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews#
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Use is subject to license terms.
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews#
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews
aa1d397c4736cd86540555193d71e55fa3b37b2aMark AndrewsPROG= getconf
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonXPG4PROG= getconf
aa1d397c4736cd86540555193d71e55fa3b37b2aMark AndrewsXPG6PROG= getconf
aa1d397c4736cd86540555193d71e55fa3b37b2aMark AndrewsX4= objs.xpg4
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonX6= objs.xpg6
aa1d397c4736cd86540555193d71e55fa3b37b2aMark AndrewsOBJS= getconf.o
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian WellingtonXPG4EXOBJS= $(X4)/getconf.o
a3b428812703d22a605a9f882e71ed65f0ffdc65Mark AndrewsXPG6EXOBJS= $(X6)/getconf.o
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrewsinclude ../Makefile.cmd
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark AndrewsXPG4EXOBJS += values-xpg4.o
c718d15a9a95054ee3c71540c02335426071fc6dMark AndrewsCFLAGS += $(CCVERBOSE)
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark AndrewsCERRWARN += -_gcc=-Wno-parentheses
c069a20053d41ae299eb9457e50ea44ae9f73ed2Mark Andrews# XPG4
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews$(XPG4) := CFLAGS += -D_XOPEN_SOURCE -I$(SRC)/lib/libc/inc
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrews# XPG6MODE: Depending on the version of the compiler, the value of
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# __STDC_VERSION__ may differ even in the presence of the same compilation
3f6174bffe227be44e241a29d186add00c032ff6Mark Andrews# options. The default compilation mode for Sun compilers that support the
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews# C99 standard is -xc99=all,no_lib. C99MODE= is equivalent to -xc99=all,no_lib.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# This translates to C99 semantics without the C99 library specific behaviors
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# and dependencies.
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson#
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# For pre-5.7 compilers (unless patched with 117551-04 or 117552-05), in the
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# default compilation mode, __STDC_VERSION__ was defined to be 199901L. For
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# 5.7 and on compilers, __STDC_VERSION__ defaults to 199409L in order to
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# maintain source compatibility. Neither of these cases results in the
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# importing of /usr/lib/values-xpg6.o, so we need to either manually import
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# it via linking with a local version of the object, or set -xc99=%all which
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# by default imports /usr/lib/values-xpg6.o. C99MODE=C99_ENABLE is equivalent
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# to -xc99=all. If C99_ENABLE is defined and we also attempt to link with a
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# local version of values-xpg6.o, an error will occur due to multiple
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# definitions for __xpg4 and __xpg6. Because /usr/lib/values-xpg6.o was
26a77b80bb7ee886c6fa704348d5e80a011d8811Mark Andrews# delivered in Solaris 10 and is a stable interface, there is no need to
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# build and link with a local version of the object.
6f046a065e5543f8cd7e2f24991c65d2372f4c8dMark Andrews#
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews# The gcc compiler behaves differently and requires -std=gnu99.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# For XPG4, we need to link with a local version of values-xpg4.o because
62ee2c9f460d2e2e45dcf1abc8b4b4a4a43f5618Mark Andrews# the compiler only imports this by default (from /usr/lib/values-xpg4.o)
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews# if we use the c89 utility as opposed to cc.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark AndrewsXPG6MODE = $(C99_ENABLE)
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews$(XPG6) := C99MODE = $(XPG6MODE)
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews$(XPG6) := CFLAGS += -D_XOPEN_SOURCE=600 -I$(SRC)/lib/libc/inc
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews.KEEP_STATE:
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrewsall: $(PROG) $(XPG4) $(XPG6)
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson$(PROG): $(OBJS)
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson $(POST_PROCESS)
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington$(XPG4): $(X4) $(XPG4EXOBJS)
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrews $(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS)
80f9a970ae6681c08529ef209eaabbe078c27ca3Mark Andrews $(POST_PROCESS)
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrews$(XPG6): $(X6) $(XPG6EXOBJS)
46e873c835bf7d9ec3e1097e0aceb8db5b1ae93aMark Andrews $(LINK.c) -o $@ $(XPG6EXOBJS) $(LDLIBS)
dd9ad704c3800e3ab07ede8595871eac79984871Mark Andrews $(POST_PROCESS)
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrews
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews$(XPG4EXOBJS): $(X4)
ab81f57ca0c3addfec3df3babdcea9644757cf23Mark Andrews
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrews
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews$(X4)/%.o: %.c
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews $(COMPILE.c) -o $@ $<
413988c8166976498250c0ebb2e3a645d0366bd3Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews$(X4):
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews -@mkdir -p $@
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews$(XPG6EXOBJS): $(X6)
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews$(X6)/%.o: %.c
642e0716c8b4ab82ebc8e60f94c9e897ee89f19aMark Andrews $(COMPILE.c) -o $@ $<
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews$(X6):
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews -@mkdir -p $@
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsinstall: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTXPG6PROG)
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrewsvalues-xpg4.o: ../../lib/common/common/values-xpg4.c
ea935c46e8261ea10621e5b038426539fe8a7cc5Mark Andrews $(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
d56e188030368b835122d759ebbf8d9613c166f4Mark Andrewsclean:
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews -@rm -rf $(OBJS) $(XPG4EXOBJS) $(XPG6EXOBJS) $(X4) $(X6) \
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews $(PROG) $(XPG4) $(XPG6)
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewslint: lint_PROG
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrewsinclude ../Makefile.targ
b7aab05edae933e169d5f83c653935b17c7f0a8bMark Andrews