xref: /titanic_41/usr/src/cmd/sgs/libelf/demo/Makefile (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24
25PROGS=		pcom acom dcom tpcom dispsyms
26LDLIBS=		-lelf
27
28OBJS=	$(PROGS:%=%.o)
29
30.KEEP_STATE:
31
32all:	libobj.a .WAIT $(PROGS)
33
34libobj.a: $(OBJS)
35	ar -r $@ $(OBJS)
36
37%.o:	%.c
38	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
39	mcs -d -a "ELF demo: object comment: $@" $@
40
41%:	%.o
42	$(CC) $(CFLAGS) -o $@ $< $(LDLIBS)
43	mcs -d -a "ELF demo: executable comment: $@" $@
44
45test: test1 test2 test3 test4 test5 test6
46
47test1: pcom FRC
48	@ echo ""
49	@ echo "<<< Test 1 >>>"
50	@ echo "Print comments of pcom"
51	pcom pcom
52	@ echo
53	@ echo "Print comments from archive libobj.a"
54	pcom libobj.a
55
56test2: dcom pcom FRC
57	@ echo ""
58	@ echo "<<< Test 2 >>>"
59	@ echo "Delete the comment section from pcom"
60	TMPDIR= dcom pcom
61	pcom pcom
62
63test3: pcom acom test2 FRC
64	@ echo ""
65	@ echo "<<< Test 3 >>>"
66	@ echo "update comments from pcom and then print them out."
67	acom "Newly Updated Comments" pcom
68	pcom pcom
69
70test4: acom pcom test3 FRC
71	@ echo ""
72	@ echo "<<< Test 4 >>>"
73	@ echo "Append to the comment section of pcom."
74	acom "This comment has been appended" pcom
75	pcom pcom
76
77test5: $(PROGS) FRC
78	@ echo ""
79	@ echo "<<< Test 5 >>>"
80	@ echo "Relabel the new utilities using the new utilities."
81	TMPDIR= dcom $(PROGS)
82	cp acom acom.safe
83	acom.safe "libelf Demonstration Tools" $(PROGS)
84	pcom $(PROGS)
85	$(RM) acom.safe
86
87test6: dispsyms FRC
88	@ echo ""
89	@ echo "<<< Test 6 >>>"
90	@ echo "Display symbols in dispsyms itself."
91	dispsyms dispsyms | egrep -v "LOCL|ABS|SECT|UNDEF"
92
93test-extra: tpcom FRC
94	@ echo ""
95	@ echo "<<< Test-extra >>>"
96	@ echo "Using the threaded tpcom, go through and examine all"
97	@ echo "libraries in /lib.  This is an output intensive test."
98	tpcom /lib/lib*.so.?
99
100clean: FRC
101	$(RM) $(OBJS) $(PROGS) libobj.a core
102
103FRC:
104