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 
  26 MACH:sh=        uname -p
  27 
  28 sparc_XARCH=
  29 sparc64_XARCH=  -m64
  30 i386_XARCH=     
  31 i38664_XARCH=   -m64
  32 C_PICFLAGS=     -Kpic
  33 C_PICFLAGS64=   -Kpic
  34 
  35 PROGS=          dumpbind
  36 LIBS=           truss.so.1 symbindrep.so.1 perfcnt.so.1 who.so.1 bindings.so.1
  37 KSHSRC=         sotruss.ksh symbindrep.ksh perfcnt.ksh whocalls.ksh
  38 SCRIPTS=        $(KSHSRC:%.ksh=%)
  39 
  40 DIRS=           obj32 obj64 lib32 lib64
  41 
  42 sparc_LIBS32=   $(LIBS:%=lib32/%)
  43 sparc_LIBS64=   $(LIBS:%=lib64/%)
  44 i386_LIBS32=    $(LIBS:%=lib32/%)
  45 i386_LIBS64=    $(LIBS:%=lib64/%)
  46 
  47 LIBS64=         $($(MACH)_LIBS64)
  48 LIBS32=         $($(MACH)_LIBS32)
  49 
  50 ALLIBS=         $(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 
  57 CPPFLAGS +=     -Isrc -D__EXTENSIONS__
  58 LDFLAGS =       $(ZDEFS) $(ZTEXT) $(ZIGNORE)
  59 
  60 
  61 .KEEP_STATE:
  62 
  63 all:    $(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 
  71 obj32/%.o \
  72 obj64/%.o: src/%.c
  73         $(COMPILE.c) $< -o $@
  74 
  75 dumpbind: \
  76         obj32/dumpbind.o
  77         $(LINK.c) obj32/dumpbind.o -o $@
  78 
  79 lib32/bindings.so.1: \
  80         obj32/bindings.o obj32/env.o
  81         $(LINK.c) -G obj32/bindings.o obj32/env.o -o $@ $(LDLIBS)
  82 
  83 lib64/bindings.so.1: \
  84         obj64/bindings.o obj64/env.o
  85         $(LINK.c) -G obj64/bindings.o obj64/env.o -o $@ $(LDLIBS)
  86 
  87 lib32/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 
  91 lib64/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 
  95 lib32/symbindrep.so.1: \
  96         obj32/symbindrep.o obj32/env.o
  97         $(LINK.c) -G obj32/symbindrep.o obj32/env.o -o $@ $(LDLIBS)
  98 
  99 lib64/symbindrep.so.1: \
 100         obj64/symbindrep.o obj64/env.o
 101         $(LINK.c) -G obj64/symbindrep.o obj64/env.o -o $@ $(LDLIBS)
 102 
 103 lib32/truss.so.1: \
 104         obj32/truss.o obj32/env.o
 105         $(LINK.c) -G obj32/truss.o obj32/env.o -o $@ $(LDLIBS)
 106 
 107 lib64/truss.so.1: \
 108         obj64/truss.o obj64/env.o
 109         $(LINK.c) -G obj64/truss.o obj64/env.o -o $@ $(LDLIBS)
 110 
 111 lib32/who.so.1: \
 112         obj32/who.o obj32/env.o
 113         $(LINK.c) -G obj32/who.o obj32/env.o -o $@ -lelf $(LDLIBS)
 114 
 115 lib64/who.so.1: \
 116         obj64/who.o obj64/env.o
 117         $(LINK.c) -G obj64/who.o obj64/env.o -o $@ -lelf $(LDLIBS)
 118 
 119 obj32 \
 120 obj64 \
 121 lib32 \
 122 lib64:
 123         @mkdir $@ | cat
 124 
 125 clean \
 126 clobber:FRC
 127         $(RM) -r $(DIRS) $(SCRIPTS) $(PROGS) core .make.state
 128 
 129 FRC: