xref: /titanic_50/usr/src/cmd/sgs/libelf/demo/Makefile (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5*20c1c355SRod Evans# Common Development and Distribution License (the "License").
6*20c1c355SRod Evans# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
22*20c1c355SRod Evans# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate#
247c478bd9Sstevel@tonic-gate
257c478bd9Sstevel@tonic-gatePROGS=		pcom acom dcom tpcom dispsyms
267c478bd9Sstevel@tonic-gateLDLIBS=		-lelf
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateOBJS=	$(PROGS:%=%.o)
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate.KEEP_STATE:
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateall:	libobj.a .WAIT $(PROGS)
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gatelibobj.a: $(OBJS)
357c478bd9Sstevel@tonic-gate	ar -r $@ $(OBJS)
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate%.o:	%.c
387c478bd9Sstevel@tonic-gate	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
397c478bd9Sstevel@tonic-gate	mcs -d -a "ELF demo: object comment: $@" $@
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate%:	%.o
427c478bd9Sstevel@tonic-gate	$(CC) $(CFLAGS) -o $@ $< $(LDLIBS)
437c478bd9Sstevel@tonic-gate	mcs -d -a "ELF demo: executable comment: $@" $@
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gatetest: test1 test2 test3 test4 test5 test6
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gatetest1: pcom FRC
487c478bd9Sstevel@tonic-gate	@ echo ""
497c478bd9Sstevel@tonic-gate	@ echo "<<< Test 1 >>>"
507c478bd9Sstevel@tonic-gate	@ echo "Print comments of pcom"
517c478bd9Sstevel@tonic-gate	pcom pcom
527c478bd9Sstevel@tonic-gate	@ echo
537c478bd9Sstevel@tonic-gate	@ echo "Print comments from archive libobj.a"
547c478bd9Sstevel@tonic-gate	pcom libobj.a
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gatetest2: dcom pcom FRC
577c478bd9Sstevel@tonic-gate	@ echo ""
587c478bd9Sstevel@tonic-gate	@ echo "<<< Test 2 >>>"
597c478bd9Sstevel@tonic-gate	@ echo "Delete the comment section from pcom"
607c478bd9Sstevel@tonic-gate	TMPDIR= dcom pcom
617c478bd9Sstevel@tonic-gate	pcom pcom
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gatetest3: pcom acom test2 FRC
647c478bd9Sstevel@tonic-gate	@ echo ""
657c478bd9Sstevel@tonic-gate	@ echo "<<< Test 3 >>>"
667c478bd9Sstevel@tonic-gate	@ echo "update comments from pcom and then print them out."
677c478bd9Sstevel@tonic-gate	acom "Newly Updated Comments" pcom
687c478bd9Sstevel@tonic-gate	pcom pcom
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gatetest4: acom pcom test3 FRC
717c478bd9Sstevel@tonic-gate	@ echo ""
727c478bd9Sstevel@tonic-gate	@ echo "<<< Test 4 >>>"
737c478bd9Sstevel@tonic-gate	@ echo "Append to the comment section of pcom."
747c478bd9Sstevel@tonic-gate	acom "This comment has been appended" pcom
757c478bd9Sstevel@tonic-gate	pcom pcom
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gatetest5: $(PROGS) FRC
787c478bd9Sstevel@tonic-gate	@ echo ""
797c478bd9Sstevel@tonic-gate	@ echo "<<< Test 5 >>>"
807c478bd9Sstevel@tonic-gate	@ echo "Relabel the new utilities using the new utilities."
817c478bd9Sstevel@tonic-gate	TMPDIR= dcom $(PROGS)
827c478bd9Sstevel@tonic-gate	cp acom acom.safe
837c478bd9Sstevel@tonic-gate	acom.safe "libelf Demonstration Tools" $(PROGS)
847c478bd9Sstevel@tonic-gate	pcom $(PROGS)
857c478bd9Sstevel@tonic-gate	$(RM) acom.safe
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gatetest6: dispsyms FRC
887c478bd9Sstevel@tonic-gate	@ echo ""
897c478bd9Sstevel@tonic-gate	@ echo "<<< Test 6 >>>"
907c478bd9Sstevel@tonic-gate	@ echo "Display symbols in dispsyms itself."
917c478bd9Sstevel@tonic-gate	dispsyms dispsyms | egrep -v "LOCL|ABS|SECT|UNDEF"
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gatetest-extra: tpcom FRC
947c478bd9Sstevel@tonic-gate	@ echo ""
957c478bd9Sstevel@tonic-gate	@ echo "<<< Test-extra >>>"
967c478bd9Sstevel@tonic-gate	@ echo "Using the threaded tpcom, go through and examine all"
977c478bd9Sstevel@tonic-gate	@ echo "libraries in /lib.  This is an output intensive test."
987c478bd9Sstevel@tonic-gate	tpcom /lib/lib*.so.?
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gateclean: FRC
1017c478bd9Sstevel@tonic-gate	$(RM) $(OBJS) $(PROGS) libobj.a core
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gateFRC:
104