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