xref: /titanic_44/usr/src/cmd/sgs/link_audit/common/Makefile.demo (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5bebb829dSRod Evans# Common Development and Distribution License (the "License").
6bebb829dSRod Evans# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
21bebb829dSRod Evans
227c478bd9Sstevel@tonic-gate#
23*20c1c355SRod Evans# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gateMACH:sh=	uname -p
277c478bd9Sstevel@tonic-gate
28bebb829dSRod Evanssparc_XARCH=
29bebb829dSRod Evanssparc64_XARCH=	-m64
307c478bd9Sstevel@tonic-gatei386_XARCH=
31bebb829dSRod Evansi38664_XARCH=	-m64
327c478bd9Sstevel@tonic-gateC_PICFLAGS=	-Kpic
337c478bd9Sstevel@tonic-gateC_PICFLAGS64=	-Kpic
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gatePROGS=		dumpbind
367c478bd9Sstevel@tonic-gateLIBS=		truss.so.1 symbindrep.so.1 perfcnt.so.1 who.so.1 bindings.so.1
377c478bd9Sstevel@tonic-gateKSHSRC=		sotruss.ksh symbindrep.ksh perfcnt.ksh whocalls.ksh
387c478bd9Sstevel@tonic-gateSCRIPTS=	$(KSHSRC:%.ksh=%)
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gateDIRS=		obj32 obj64 lib32 lib64
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gatesparc_LIBS32=	$(LIBS:%=lib32/%)
437c478bd9Sstevel@tonic-gatesparc_LIBS64=	$(LIBS:%=lib64/%)
447c478bd9Sstevel@tonic-gatei386_LIBS32=	$(LIBS:%=lib32/%)
457c478bd9Sstevel@tonic-gatei386_LIBS64=	$(LIBS:%=lib64/%)
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gateLIBS64=		$($(MACH)_LIBS64)
487c478bd9Sstevel@tonic-gateLIBS32=		$($(MACH)_LIBS32)
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gateALLIBS=		$(LIBS32) $(LIBS64)
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate$(LIBS32):=	CFLAGS += $($(MACH)_XARCH) $(C_PICFLAGS)
537c478bd9Sstevel@tonic-gate$(LIBS32):=	LDLIBS += -lmapmalloc -ldl -lc
547c478bd9Sstevel@tonic-gate$(LIBS64):=	CFLAGS += $($(MACH)64_XARCH) $(C_PICFLAGS64)
557c478bd9Sstevel@tonic-gate$(LIBS64):=	LDLIBS += -lmapmalloc -ldl -lc
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gateCPPFLAGS +=	-Isrc -D__EXTENSIONS__
587c478bd9Sstevel@tonic-gateLDFLAGS =	$(ZDEFS) $(ZTEXT) $(ZIGNORE)
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate.KEEP_STATE:
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gateall:	$(DIRS) .WAIT $(ALLIBS) $(SCRIPTS) $(PROGS)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate%:	src/%.ksh
667c478bd9Sstevel@tonic-gate	$(RM) $@
677c478bd9Sstevel@tonic-gate	cat $< | sed -e s,/opt/SUNWonld/lib/,`pwd`/lib, | \
687c478bd9Sstevel@tonic-gate		sed -e s,/usr/lib/link_audit/,`pwd`/lib, > $@
697c478bd9Sstevel@tonic-gate	chmod a+x $@
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gateobj32/%.o \
727c478bd9Sstevel@tonic-gateobj64/%.o: src/%.c
737c478bd9Sstevel@tonic-gate	$(COMPILE.c) $< -o $@
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gatedumpbind: \
767c478bd9Sstevel@tonic-gate	obj32/dumpbind.o
777c478bd9Sstevel@tonic-gate	$(LINK.c) obj32/dumpbind.o -o $@
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gatelib32/bindings.so.1: \
807c478bd9Sstevel@tonic-gate	obj32/bindings.o obj32/env.o
817c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/bindings.o obj32/env.o -o $@ $(LDLIBS)
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gatelib64/bindings.so.1: \
847c478bd9Sstevel@tonic-gate	obj64/bindings.o obj64/env.o
857c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/bindings.o obj64/env.o -o $@ $(LDLIBS)
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gatelib32/perfcnt.so.1: \
887c478bd9Sstevel@tonic-gate	obj32/perfcnt.o obj32/hash.o obj32/env.o
897c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/perfcnt.o obj32/hash.o obj32/env.o -o $@ $(LDLIBS)
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gatelib64/perfcnt.so.1: \
927c478bd9Sstevel@tonic-gate	obj64/perfcnt.o obj64/hash.o obj64/env.o
937c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/perfcnt.o obj64/hash.o obj64/env.o -o $@ $(LDLIBS)
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gatelib32/symbindrep.so.1: \
967c478bd9Sstevel@tonic-gate	obj32/symbindrep.o obj32/env.o
977c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/symbindrep.o obj32/env.o -o $@ $(LDLIBS)
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gatelib64/symbindrep.so.1: \
1007c478bd9Sstevel@tonic-gate	obj64/symbindrep.o obj64/env.o
1017c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/symbindrep.o obj64/env.o -o $@ $(LDLIBS)
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gatelib32/truss.so.1: \
1047c478bd9Sstevel@tonic-gate	obj32/truss.o obj32/env.o
1057c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/truss.o obj32/env.o -o $@ $(LDLIBS)
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gatelib64/truss.so.1: \
1087c478bd9Sstevel@tonic-gate	obj64/truss.o obj64/env.o
1097c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/truss.o obj64/env.o -o $@ $(LDLIBS)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gatelib32/who.so.1: \
1127c478bd9Sstevel@tonic-gate	obj32/who.o obj32/env.o
1137c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/who.o obj32/env.o -o $@ -lelf $(LDLIBS)
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gatelib64/who.so.1: \
1167c478bd9Sstevel@tonic-gate	obj64/who.o obj64/env.o
1177c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/who.o obj64/env.o -o $@ -lelf $(LDLIBS)
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gateobj32 \
1207c478bd9Sstevel@tonic-gateobj64 \
1217c478bd9Sstevel@tonic-gatelib32 \
1227c478bd9Sstevel@tonic-gatelib64:
1237c478bd9Sstevel@tonic-gate	@mkdir $@ | cat
1247c478bd9Sstevel@tonic-gate
1257c478bd9Sstevel@tonic-gateclean \
1267c478bd9Sstevel@tonic-gateclobber:FRC
1277c478bd9Sstevel@tonic-gate	$(RM) -r $(DIRS) $(SCRIPTS) $(PROGS) core .make.state
1287c478bd9Sstevel@tonic-gate
1297c478bd9Sstevel@tonic-gateFRC:
130