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