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