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