xref: /titanic_52/usr/src/cmd/sgs/link_audit/common/Makefile.demo (revision d50bcaae2118610560f2b107d0d282315e47e4e4)
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#
2320c1c355SRod Evans# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
24*d50bcaaeSAndrew Stormont# Copyright 2015 RackTop Systems.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gateMACH:sh=	uname -p
287c478bd9Sstevel@tonic-gate
29bebb829dSRod Evanssparc_XARCH=
30bebb829dSRod Evanssparc64_XARCH=	-m64
317c478bd9Sstevel@tonic-gatei386_XARCH=
32bebb829dSRod Evansi38664_XARCH=	-m64
337c478bd9Sstevel@tonic-gateC_PICFLAGS=	-Kpic
347c478bd9Sstevel@tonic-gateC_PICFLAGS64=	-Kpic
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gatePROGS=		dumpbind
377c478bd9Sstevel@tonic-gateLIBS=		truss.so.1 symbindrep.so.1 perfcnt.so.1 who.so.1 bindings.so.1
387c478bd9Sstevel@tonic-gateKSHSRC=		sotruss.ksh symbindrep.ksh perfcnt.ksh whocalls.ksh
397c478bd9Sstevel@tonic-gateSCRIPTS=	$(KSHSRC:%.ksh=%)
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gateDIRS=		obj32 obj64 lib32 lib64
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gatesparc_LIBS32=	$(LIBS:%=lib32/%)
447c478bd9Sstevel@tonic-gatesparc_LIBS64=	$(LIBS:%=lib64/%)
457c478bd9Sstevel@tonic-gatei386_LIBS32=	$(LIBS:%=lib32/%)
467c478bd9Sstevel@tonic-gatei386_LIBS64=	$(LIBS:%=lib64/%)
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gateLIBS64=		$($(MACH)_LIBS64)
497c478bd9Sstevel@tonic-gateLIBS32=		$($(MACH)_LIBS32)
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gateALLIBS=		$(LIBS32) $(LIBS64)
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate$(LIBS32):=	CFLAGS += $($(MACH)_XARCH) $(C_PICFLAGS)
547c478bd9Sstevel@tonic-gate$(LIBS32):=	LDLIBS += -lmapmalloc -ldl -lc
557c478bd9Sstevel@tonic-gate$(LIBS64):=	CFLAGS += $($(MACH)64_XARCH) $(C_PICFLAGS64)
567c478bd9Sstevel@tonic-gate$(LIBS64):=	LDLIBS += -lmapmalloc -ldl -lc
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gateCPPFLAGS +=	-Isrc -D__EXTENSIONS__
597c478bd9Sstevel@tonic-gateLDFLAGS =	$(ZDEFS) $(ZTEXT) $(ZIGNORE)
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gate.KEEP_STATE:
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gateall:	$(DIRS) .WAIT $(ALLIBS) $(SCRIPTS) $(PROGS)
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gate%:	src/%.ksh
677c478bd9Sstevel@tonic-gate	$(RM) $@
687c478bd9Sstevel@tonic-gate	cat $< | sed -e s,/opt/SUNWonld/lib/,`pwd`/lib, | \
697c478bd9Sstevel@tonic-gate		sed -e s,/usr/lib/link_audit/,`pwd`/lib, > $@
707c478bd9Sstevel@tonic-gate	chmod a+x $@
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gateobj32/%.o \
737c478bd9Sstevel@tonic-gateobj64/%.o: src/%.c
747c478bd9Sstevel@tonic-gate	$(COMPILE.c) $< -o $@
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gatedumpbind: \
777c478bd9Sstevel@tonic-gate	obj32/dumpbind.o
78*d50bcaaeSAndrew Stormont	$(LINK.c) obj32/dumpbind.o -o $@ $(LDLIBS)
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gatelib32/bindings.so.1: \
817c478bd9Sstevel@tonic-gate	obj32/bindings.o obj32/env.o
827c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/bindings.o obj32/env.o -o $@ $(LDLIBS)
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gatelib64/bindings.so.1: \
857c478bd9Sstevel@tonic-gate	obj64/bindings.o obj64/env.o
867c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/bindings.o obj64/env.o -o $@ $(LDLIBS)
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gatelib32/perfcnt.so.1: \
897c478bd9Sstevel@tonic-gate	obj32/perfcnt.o obj32/hash.o obj32/env.o
907c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/perfcnt.o obj32/hash.o obj32/env.o -o $@ $(LDLIBS)
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gatelib64/perfcnt.so.1: \
937c478bd9Sstevel@tonic-gate	obj64/perfcnt.o obj64/hash.o obj64/env.o
947c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/perfcnt.o obj64/hash.o obj64/env.o -o $@ $(LDLIBS)
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gatelib32/symbindrep.so.1: \
977c478bd9Sstevel@tonic-gate	obj32/symbindrep.o obj32/env.o
987c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/symbindrep.o obj32/env.o -o $@ $(LDLIBS)
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gatelib64/symbindrep.so.1: \
1017c478bd9Sstevel@tonic-gate	obj64/symbindrep.o obj64/env.o
1027c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/symbindrep.o obj64/env.o -o $@ $(LDLIBS)
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gatelib32/truss.so.1: \
1057c478bd9Sstevel@tonic-gate	obj32/truss.o obj32/env.o
1067c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/truss.o obj32/env.o -o $@ $(LDLIBS)
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gatelib64/truss.so.1: \
1097c478bd9Sstevel@tonic-gate	obj64/truss.o obj64/env.o
1107c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/truss.o obj64/env.o -o $@ $(LDLIBS)
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gatelib32/who.so.1: \
1137c478bd9Sstevel@tonic-gate	obj32/who.o obj32/env.o
1147c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj32/who.o obj32/env.o -o $@ -lelf $(LDLIBS)
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gatelib64/who.so.1: \
1177c478bd9Sstevel@tonic-gate	obj64/who.o obj64/env.o
1187c478bd9Sstevel@tonic-gate	$(LINK.c) -G obj64/who.o obj64/env.o -o $@ -lelf $(LDLIBS)
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gateobj32 \
1217c478bd9Sstevel@tonic-gateobj64 \
1227c478bd9Sstevel@tonic-gatelib32 \
1237c478bd9Sstevel@tonic-gatelib64:
1247c478bd9Sstevel@tonic-gate	@mkdir $@ | cat
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gateclean \
1277c478bd9Sstevel@tonic-gateclobber:FRC
1287c478bd9Sstevel@tonic-gate	$(RM) -r $(DIRS) $(SCRIPTS) $(PROGS) core .make.state
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gateFRC:
131