Makefile.com revision 7014882c6a3672fd0e5d60200af8643ae53c5928
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# CDDL HEADER START
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# The contents of this file are subject to the terms of the
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# Common Development and Distribution License (the "License").
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# You may not use this file except in compliance with the License.
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# or http://www.opensolaris.org/os/licensing.
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# See the License for the specific language governing permissions
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# and limitations under the License.
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# When distributing Covered Code, include this CDDL HEADER in each
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# If applicable, add the following below this CDDL HEADER, with the
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# fields enclosed by brackets "[]" replaced with your own identifying
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# information: Portions Copyright [yyyy] [name of copyright owner]
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# CDDL HEADER END
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
d1f855d73e0bf529109aa3dc1b967fc6ac19b4fc# Use is subject to license terms.
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekLIBRARY = libfmd_msg.a
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekVERS = .1
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekLIBSRCS = fmd_msg.c
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekOBJECTS = $(LIBSRCS:%.c=%.o)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekinclude ../../../Makefile.lib
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekinclude ../../Makefile.lib
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekSRCS = $(LIBSRCS:%.c=../common/%.c)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekLIBS = $(DYNLIB) $(LINTLIB)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekSRCDIR = ../common
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekCPPFLAGS += -I../common -I.
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekCFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekCFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekCERRWARN += -_gcc=-Wno-switch
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekCERRWARN += -_gcc=-Wno-uninitialized
11506c4105b984bf64636b0e2f9e88bd67fb9651gjelinekLDLIBS += -lnvpair -lc
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekLINTFLAGS = -msux
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekLINTFLAGS64 = -msux -m64
99653d4ee642c6528e88224f12409a5f23060994eschrock
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekCLOBBERFILES += fmd_msg_test fmd_msg_test.core fmd_msg_test.out
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek$(LINTLIB) := LINTFLAGS = -nsvx
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek$(LINTLIB) := LINTFLAGS64 = -nsvx -m64
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek.KEEP_STATE:
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekall: $(LIBS)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelineklint: $(LINTLIB) lintcheck
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekinclude ../../../Makefile.targ
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekinclude ../../Makefile.targ
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekLDLIBS_$(MACH) = -L$(ROOT)/usr/lib/fm -R$(ROOT)/usr/lib/fm
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekLDLIBS_$(MACH64) = -L$(ROOT)/usr/lib/fm/$(MACH64) -R$(ROOT)/usr/lib/fm/$(MACH64)
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# To ease the development and maintenance of libfmd_msg, a test suite is built
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# directly into the library. The test program fmd_msg_test.c includes a set of
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# tests for all the code paths in the library. The test program executes the
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# calls, and then forks into the background and dumps core. After the test
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# runs, we diff the output against the master hand-verified output, and confirm
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# no leaks or corruption exist. To run the entire suite, type "make test" and
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# inspect the results (the make target will fail on an error).
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# The cmp skips the first 900 bytes of $(SRCDIR)/fmd_msg_test.out to get us
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek# passed the CDDL header and copyright in that file.
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek#
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinektest: install fmd_msg_test
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @echo; echo "Running `pwd | sed 's/.*\///'` fmd_msg test suite ... \c"
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @coreadm -p core $$$$
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @UMEM_DEBUG=default,verbose UMEM_LOGGING=fail,contents LANG=C \
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek LC_ALL=C ./fmd_msg_test | grep -v EVENT-TIME > fmd_msg_test.out
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @chmod 0444 core; mv -f core fmd_msg_test.core
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @echo; echo "Checking test output ... \c"
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @cmp -s $(SRCDIR)/fmd_msg_test.out fmd_msg_test.out 900 0 && echo pass \
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek || ( echo FAIL && diff $(SRCDIR)/fmd_msg_test.out fmd_msg_test.out )
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @echo; echo Checking for memory leaks:
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @echo ::findleaks | mdb fmd_msg_test.core
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @echo; echo Checking for latent corruption:
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @echo ::umem_verify | mdb fmd_msg_test.core | grep -v clean
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek @echo
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinekfmd_msg_test: $(SRCDIR)/fmd_msg_test.c
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek $(LINT.c) $(SRCDIR)/fmd_msg_test.c
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek $(LINK.c) -o fmd_msg_test $(SRCDIR)/fmd_msg_test.c \
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek $(LDLIBS_$(TARGETMACH)) -lfmd_msg -lnvpair -lumem
0b5de56d26c0148ad33bb3a9201091502f24d910gjelinek