xref: /onnv-gate/usr/src/lib/fm/libfmd_msg/Makefile.com (revision 9501:f84d3cc28d24)
13723Saf#
23723Saf# CDDL HEADER START
33723Saf#
43723Saf# The contents of this file are subject to the terms of the
53723Saf# Common Development and Distribution License (the "License").
63723Saf# You may not use this file except in compliance with the License.
73723Saf#
83723Saf# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93723Saf# or http://www.opensolaris.org/os/licensing.
103723Saf# See the License for the specific language governing permissions
113723Saf# and limitations under the License.
123723Saf#
133723Saf# When distributing Covered Code, include this CDDL HEADER in each
143723Saf# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153723Saf# If applicable, add the following below this CDDL HEADER, with the
163723Saf# fields enclosed by brackets "[]" replaced with your own identifying
173723Saf# information: Portions Copyright [yyyy] [name of copyright owner]
183723Saf#
193723Saf# CDDL HEADER END
203723Saf#
213723Saf#
22*9501SRobert.Johnston@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
233723Saf# Use is subject to license terms.
243723Saf#
253723Saf
263723SafLIBRARY = libfmd_msg.a
273723SafVERS = .1
283723Saf
293723SafLIBSRCS = fmd_msg.c
303723SafOBJECTS = $(LIBSRCS:%.c=%.o)
313723Saf
323723Safinclude ../../../Makefile.lib
333723Safinclude ../../Makefile.lib
343723Saf
353723SafSRCS = $(LIBSRCS:%.c=../common/%.c)
363723SafLIBS = $(DYNLIB) $(LINTLIB)
373723Saf
383723SafSRCDIR =	../common
393723Saf
403723SafCPPFLAGS += -I../common -I.
413723SafCFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
423723SafCFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
43*9501SRobert.Johnston@Sun.COMLDLIBS += -lnvpair -lc
443723Saf
453723SafLINTFLAGS = -msux
467684SNick.Todd@Sun.COMLINTFLAGS64 = -msux -m64
473723Saf
48*9501SRobert.Johnston@Sun.COMCLOBBERFILES += fmd_msg_test fmd_msg_test.core fmd_msg_test.out
49*9501SRobert.Johnston@Sun.COM
503723Saf$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
513723Saf$(LINTLIB) := LINTFLAGS = -nsvx
527684SNick.Todd@Sun.COM$(LINTLIB) := LINTFLAGS64 = -nsvx -m64
533723Saf
543723Saf.KEEP_STATE:
553723Saf
563723Safall: $(LIBS)
573723Saf
583723Saflint: $(LINTLIB) lintcheck
593723Saf
603723Safinclude ../../../Makefile.targ
613723Safinclude ../../Makefile.targ
62*9501SRobert.Johnston@Sun.COM
63*9501SRobert.Johnston@Sun.COMLDLIBS_$(MACH) = -L$(ROOT)/usr/lib/fm -R$(ROOT)/usr/lib/fm
64*9501SRobert.Johnston@Sun.COMLDLIBS_$(MACH64) = -L$(ROOT)/usr/lib/fm/$(MACH64) -R$(ROOT)/usr/lib/fm/$(MACH64)
65*9501SRobert.Johnston@Sun.COM
66*9501SRobert.Johnston@Sun.COM#
67*9501SRobert.Johnston@Sun.COM# To ease the development and maintenance of libfmd_msg, a test suite is built
68*9501SRobert.Johnston@Sun.COM# directly into the library.  The test program fmd_msg_test.c includes a set of
69*9501SRobert.Johnston@Sun.COM# tests for all the code paths in the library.  The test program executes the
70*9501SRobert.Johnston@Sun.COM# calls, and then forks into the background and dumps core.  After the test
71*9501SRobert.Johnston@Sun.COM# runs, we diff the output against the master hand-verified output, and confirm
72*9501SRobert.Johnston@Sun.COM# no leaks or corruption exist.  To run the entire suite, type "make test" and
73*9501SRobert.Johnston@Sun.COM# inspect the results (the make target will fail on an error).
74*9501SRobert.Johnston@Sun.COM#
75*9501SRobert.Johnston@Sun.COM# The cmp skips the first 900 bytes of $(SRCDIR)/fmd_msg_test.out to get us
76*9501SRobert.Johnston@Sun.COM# passed the CDDL header and copyright in that file.
77*9501SRobert.Johnston@Sun.COM#
78*9501SRobert.Johnston@Sun.COMtest: install fmd_msg_test
79*9501SRobert.Johnston@Sun.COM	@echo; echo "Running `pwd | sed 's/.*\///'` fmd_msg test suite ... \c"
80*9501SRobert.Johnston@Sun.COM	@coreadm -p core $$$$
81*9501SRobert.Johnston@Sun.COM	@UMEM_DEBUG=default,verbose UMEM_LOGGING=fail,contents LANG=C \
82*9501SRobert.Johnston@Sun.COM	    LC_ALL=C ./fmd_msg_test | grep -v EVENT-TIME > fmd_msg_test.out
83*9501SRobert.Johnston@Sun.COM	@chmod 0444 core; mv -f core fmd_msg_test.core
84*9501SRobert.Johnston@Sun.COM	@echo; echo "Checking test output ... \c"
85*9501SRobert.Johnston@Sun.COM	@cmp -s $(SRCDIR)/fmd_msg_test.out fmd_msg_test.out 900 0 && echo pass \
86*9501SRobert.Johnston@Sun.COM	    || ( echo FAIL && diff $(SRCDIR)/fmd_msg_test.out fmd_msg_test.out )
87*9501SRobert.Johnston@Sun.COM	@echo; echo Checking for memory leaks:
88*9501SRobert.Johnston@Sun.COM	@echo ::findleaks | mdb fmd_msg_test.core
89*9501SRobert.Johnston@Sun.COM	@echo; echo Checking for latent corruption:
90*9501SRobert.Johnston@Sun.COM	@echo ::umem_verify | mdb fmd_msg_test.core | grep -v clean
91*9501SRobert.Johnston@Sun.COM	@echo
92*9501SRobert.Johnston@Sun.COM
93*9501SRobert.Johnston@Sun.COMfmd_msg_test: $(SRCDIR)/fmd_msg_test.c
94*9501SRobert.Johnston@Sun.COM	$(LINT.c) $(SRCDIR)/fmd_msg_test.c
95*9501SRobert.Johnston@Sun.COM	$(LINK.c) -o fmd_msg_test $(SRCDIR)/fmd_msg_test.c \
96*9501SRobert.Johnston@Sun.COM	    $(LDLIBS_$(TARGETMACH)) -lfmd_msg -lnvpair -lumem
97