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 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 #
  25 # Copyright (c) 2019, Joyent, Inc.
  26 
  27 LIBRARY=        libtnfctl.a
  28 VERS=           .1
  29 OBJECTS.c=      open.o          \
  30                 prb_child.o     \
  31                 prb_shmem.o     \
  32                 prb_proc.o      \
  33                 prb_lmap.o      \
  34                 prb_rtld.o      \
  35                 prb_findexec.o  \
  36                 prb_status.o    \
  37                 util.o          \
  38                 traverse.o      \
  39                 sym.o           \
  40                 elf.o           \
  41                 continue.o      \
  42                 checklib.o      \
  43                 probes.o        \
  44                 probes_ext.o    \
  45                 close.o         \
  46                 targmem.o       \
  47                 comb.o          \
  48                 kernel_int.o    \
  49                 kernel.o        \
  50                 internal.o      \
  51                 status.o
  52 
  53 
  54 OBJECTS.s=      $(MACH)_assm.o
  55 
  56 OBJECTS=        $(OBJECTS.c) $(OBJECTS.s)
  57 
  58 include ../../Makefile.lib
  59 
  60 # We omit $(OBJECTS.s:%.o=%.s) in the next line, because lint no like
  61 SRCS= $(OBJECTS.c:%.o=../%.c)
  62 
  63 LIBS=           $(DYNLIB)
  64 
  65 HDRS=           tnfctl.h
  66 ROOTHDRDIR=     $(ROOT)/usr/include/tnf
  67 ROOTHDRS=       $(HDRS:%=$(ROOTHDRDIR)/%)
  68 CHECKHDRS=      $(HDRS:%.h=%.check)
  69 $(ROOTHDRS) :=  FILEMODE = 0644
  70 CHECKHDRS =     $(HDRS:%.h=%.check)
  71 
  72 LDLIBS +=       -lc -lelf
  73 
  74 CPPFLAGS +=     -I$(SRC)/lib/libtnfprobe -D_REENTRANT -I$(SRC)/cmd/sgs/include
  75 
  76 LINTFLAGS +=    -y
  77 
  78 CERRWARN +=     $(CNOWARN_UNINIT)
  79 CERRWARN +=     -_gcc=-Wno-empty-body
  80 CERRWARN +=     -_gcc=-Wno-parentheses
  81 
  82 # not linted
  83 SMATCH=off
  84 
  85 ASFLAGS +=      -P
  86 
  87 $(ROOTHDRS) :=  FILEMODE = 644
  88 
  89 .KEEP_STATE:
  90 
  91 all: $(LIBS)
  92 
  93 install_h: $(ROOTHDRDIR) $(ROOTHDRS)
  94 
  95 lint:
  96         $(LINT.c) $(SRCS)
  97 
  98 check: $(CHECKHDRS)
  99 
 100 $(ROOTLIBDIR) $(ROOTHDRDIR):
 101         $(INS.dir)
 102 
 103 $(ROOTHDRDIR)/% : %
 104         $(INS.file)
 105 
 106 BUILD.s=        $(AS) $< -o $@
 107 
 108 objs/%.o pics/%.o: ../%.s
 109         $(COMPILE.s) -o $@ $<
 110         $(POST_PROCESS_S_O)
 111 
 112 objs/%.o pics/%.o: ../%.c
 113         $(COMPILE.c) -o $@ $<
 114         $(POST_PROCESS_O)
 115 
 116 
 117 %.o:            ../%.c
 118         $(COMPILE.c) -o $@ $<
 119         $(POST_PROCESS_O)
 120 
 121 include ../../Makefile.targ