xref: /titanic_44/usr/src/cmd/sgs/link_audit/common/Makefile.demo (revision 12ae924a5d4f6af89ee47f2908555a487618d82b)
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#
23# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
24#
25
26MACH:sh=	uname -p
27
28sparc_XARCH=
29sparc64_XARCH=	-m64
30i386_XARCH=
31i38664_XARCH=	-m64
32C_PICFLAGS=	-Kpic
33C_PICFLAGS64=	-Kpic
34
35PROGS=		dumpbind
36LIBS=		truss.so.1 symbindrep.so.1 perfcnt.so.1 who.so.1 bindings.so.1
37KSHSRC=		sotruss.ksh symbindrep.ksh perfcnt.ksh whocalls.ksh
38SCRIPTS=	$(KSHSRC:%.ksh=%)
39
40DIRS=		obj32 obj64 lib32 lib64
41
42sparc_LIBS32=	$(LIBS:%=lib32/%)
43sparc_LIBS64=	$(LIBS:%=lib64/%)
44i386_LIBS32=	$(LIBS:%=lib32/%)
45i386_LIBS64=	$(LIBS:%=lib64/%)
46
47LIBS64=		$($(MACH)_LIBS64)
48LIBS32=		$($(MACH)_LIBS32)
49
50ALLIBS=		$(LIBS32) $(LIBS64)
51
52$(LIBS32):=	CFLAGS += $($(MACH)_XARCH) $(C_PICFLAGS)
53$(LIBS32):=	LDLIBS += -lmapmalloc -ldl -lc
54$(LIBS64):=	CFLAGS += $($(MACH)64_XARCH) $(C_PICFLAGS64)
55$(LIBS64):=	LDLIBS += -lmapmalloc -ldl -lc
56
57CPPFLAGS +=	-Isrc -D__EXTENSIONS__
58LDFLAGS =	$(ZDEFS) $(ZTEXT) $(ZIGNORE)
59
60
61.KEEP_STATE:
62
63all:	$(DIRS) .WAIT $(ALLIBS) $(SCRIPTS) $(PROGS)
64
65%:	src/%.ksh
66	$(RM) $@
67	cat $< | sed -e s,/opt/SUNWonld/lib/,`pwd`/lib, | \
68		sed -e s,/usr/lib/link_audit/,`pwd`/lib, > $@
69	chmod a+x $@
70
71obj32/%.o \
72obj64/%.o: src/%.c
73	$(COMPILE.c) $< -o $@
74
75dumpbind: \
76	obj32/dumpbind.o
77	$(LINK.c) obj32/dumpbind.o -o $@
78
79lib32/bindings.so.1: \
80	obj32/bindings.o obj32/env.o
81	$(LINK.c) -G obj32/bindings.o obj32/env.o -o $@ $(LDLIBS)
82
83lib64/bindings.so.1: \
84	obj64/bindings.o obj64/env.o
85	$(LINK.c) -G obj64/bindings.o obj64/env.o -o $@ $(LDLIBS)
86
87lib32/perfcnt.so.1: \
88	obj32/perfcnt.o obj32/hash.o obj32/env.o
89	$(LINK.c) -G obj32/perfcnt.o obj32/hash.o obj32/env.o -o $@ $(LDLIBS)
90
91lib64/perfcnt.so.1: \
92	obj64/perfcnt.o obj64/hash.o obj64/env.o
93	$(LINK.c) -G obj64/perfcnt.o obj64/hash.o obj64/env.o -o $@ $(LDLIBS)
94
95lib32/symbindrep.so.1: \
96	obj32/symbindrep.o obj32/env.o
97	$(LINK.c) -G obj32/symbindrep.o obj32/env.o -o $@ $(LDLIBS)
98
99lib64/symbindrep.so.1: \
100	obj64/symbindrep.o obj64/env.o
101	$(LINK.c) -G obj64/symbindrep.o obj64/env.o -o $@ $(LDLIBS)
102
103lib32/truss.so.1: \
104	obj32/truss.o obj32/env.o
105	$(LINK.c) -G obj32/truss.o obj32/env.o -o $@ $(LDLIBS)
106
107lib64/truss.so.1: \
108	obj64/truss.o obj64/env.o
109	$(LINK.c) -G obj64/truss.o obj64/env.o -o $@ $(LDLIBS)
110
111lib32/who.so.1: \
112	obj32/who.o obj32/env.o
113	$(LINK.c) -G obj32/who.o obj32/env.o -o $@ -lelf $(LDLIBS)
114
115lib64/who.so.1: \
116	obj64/who.o obj64/env.o
117	$(LINK.c) -G obj64/who.o obj64/env.o -o $@ -lelf $(LDLIBS)
118
119obj32 \
120obj64 \
121lib32 \
122lib64:
123	@mkdir $@ | cat
124
125clean \
126clobber:FRC
127	$(RM) -r $(DIRS) $(SCRIPTS) $(PROGS) core .make.state
128
129FRC:
130