1e1c679faSaf# 2e1c679faSaf# CDDL HEADER START 3e1c679faSaf# 4e1c679faSaf# The contents of this file are subject to the terms of the 5e1c679faSaf# Common Development and Distribution License (the "License"). 6e1c679faSaf# You may not use this file except in compliance with the License. 7e1c679faSaf# 8e1c679faSaf# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9e1c679faSaf# or http://www.opensolaris.org/os/licensing. 10e1c679faSaf# See the License for the specific language governing permissions 11e1c679faSaf# and limitations under the License. 12e1c679faSaf# 13e1c679faSaf# When distributing Covered Code, include this CDDL HEADER in each 14e1c679faSaf# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15e1c679faSaf# If applicable, add the following below this CDDL HEADER, with the 16e1c679faSaf# fields enclosed by brackets "[]" replaced with your own identifying 17e1c679faSaf# information: Portions Copyright [yyyy] [name of copyright owner] 18e1c679faSaf# 19e1c679faSaf# CDDL HEADER END 20e1c679faSaf# 21e1c679faSaf# 22b6955755SRobert Johnston# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23e1c679faSaf# Use is subject to license terms. 24e1c679faSaf# 25e1c679faSaf 26e1c679faSafLIBRARY = libfmd_msg.a 27e1c679faSafVERS = .1 28e1c679faSaf 29e1c679faSafLIBSRCS = fmd_msg.c 30e1c679faSafOBJECTS = $(LIBSRCS:%.c=%.o) 31e1c679faSaf 32e1c679faSafinclude ../../../Makefile.lib 33e1c679faSafinclude ../../Makefile.lib 34e1c679faSaf 35e1c679faSafSRCS = $(LIBSRCS:%.c=../common/%.c) 36e1c679faSafLIBS = $(DYNLIB) $(LINTLIB) 37e1c679faSaf 38e1c679faSafSRCDIR = ../common 39e1c679faSaf 40e1c679faSafCPPFLAGS += -I../common -I. 41e1c679faSafCFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS) 42e1c679faSafCFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS) 43*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 44*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized 45b6955755SRobert JohnstonLDLIBS += -lnvpair -lc 46e1c679faSaf 47e1c679faSafLINTFLAGS = -msux 480bb07399SNick ToddLINTFLAGS64 = -msux -m64 49e1c679faSaf 50b6955755SRobert JohnstonCLOBBERFILES += fmd_msg_test fmd_msg_test.core fmd_msg_test.out 51b6955755SRobert Johnston 52e1c679faSaf$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) 53e1c679faSaf$(LINTLIB) := LINTFLAGS = -nsvx 540bb07399SNick Todd$(LINTLIB) := LINTFLAGS64 = -nsvx -m64 55e1c679faSaf 56e1c679faSaf.KEEP_STATE: 57e1c679faSaf 58e1c679faSafall: $(LIBS) 59e1c679faSaf 60e1c679faSaflint: $(LINTLIB) lintcheck 61e1c679faSaf 62e1c679faSafinclude ../../../Makefile.targ 63e1c679faSafinclude ../../Makefile.targ 64b6955755SRobert Johnston 65b6955755SRobert JohnstonLDLIBS_$(MACH) = -L$(ROOT)/usr/lib/fm -R$(ROOT)/usr/lib/fm 66b6955755SRobert JohnstonLDLIBS_$(MACH64) = -L$(ROOT)/usr/lib/fm/$(MACH64) -R$(ROOT)/usr/lib/fm/$(MACH64) 67b6955755SRobert Johnston 68b6955755SRobert Johnston# 69b6955755SRobert Johnston# To ease the development and maintenance of libfmd_msg, a test suite is built 70b6955755SRobert Johnston# directly into the library. The test program fmd_msg_test.c includes a set of 71b6955755SRobert Johnston# tests for all the code paths in the library. The test program executes the 72b6955755SRobert Johnston# calls, and then forks into the background and dumps core. After the test 73b6955755SRobert Johnston# runs, we diff the output against the master hand-verified output, and confirm 74b6955755SRobert Johnston# no leaks or corruption exist. To run the entire suite, type "make test" and 75b6955755SRobert Johnston# inspect the results (the make target will fail on an error). 76b6955755SRobert Johnston# 77b6955755SRobert Johnston# The cmp skips the first 900 bytes of $(SRCDIR)/fmd_msg_test.out to get us 78b6955755SRobert Johnston# passed the CDDL header and copyright in that file. 79b6955755SRobert Johnston# 80b6955755SRobert Johnstontest: install fmd_msg_test 81b6955755SRobert Johnston @echo; echo "Running `pwd | sed 's/.*\///'` fmd_msg test suite ... \c" 82b6955755SRobert Johnston @coreadm -p core $$$$ 83b6955755SRobert Johnston @UMEM_DEBUG=default,verbose UMEM_LOGGING=fail,contents LANG=C \ 84b6955755SRobert Johnston LC_ALL=C ./fmd_msg_test | grep -v EVENT-TIME > fmd_msg_test.out 85b6955755SRobert Johnston @chmod 0444 core; mv -f core fmd_msg_test.core 86b6955755SRobert Johnston @echo; echo "Checking test output ... \c" 87b6955755SRobert Johnston @cmp -s $(SRCDIR)/fmd_msg_test.out fmd_msg_test.out 900 0 && echo pass \ 88b6955755SRobert Johnston || ( echo FAIL && diff $(SRCDIR)/fmd_msg_test.out fmd_msg_test.out ) 89b6955755SRobert Johnston @echo; echo Checking for memory leaks: 90b6955755SRobert Johnston @echo ::findleaks | mdb fmd_msg_test.core 91b6955755SRobert Johnston @echo; echo Checking for latent corruption: 92b6955755SRobert Johnston @echo ::umem_verify | mdb fmd_msg_test.core | grep -v clean 93b6955755SRobert Johnston @echo 94b6955755SRobert Johnston 95b6955755SRobert Johnstonfmd_msg_test: $(SRCDIR)/fmd_msg_test.c 96b6955755SRobert Johnston $(LINT.c) $(SRCDIR)/fmd_msg_test.c 97b6955755SRobert Johnston $(LINK.c) -o fmd_msg_test $(SRCDIR)/fmd_msg_test.c \ 98b6955755SRobert Johnston $(LDLIBS_$(TARGETMACH)) -lfmd_msg -lnvpair -lumem 99