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) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  24 #
  25 # Copyright (c) 2018, Joyent, Inc.
  26 
  27 
  28 SHELL=/usr/bin/ksh93
  29 
  30 LIBRARY =       libcmd.a
  31 VERS =          .1
  32 OBJECTS =       \
  33         basename.o \
  34         cat.o \
  35         chgrp.o \
  36         cksum.o \
  37         chmod.o \
  38         chown.o \
  39         cmdinit.o \
  40         cmp.o \
  41         comm.o \
  42         cp.o \
  43         cut.o \
  44         date.o \
  45         dirname.o \
  46         expr.o \
  47         grep.o \
  48         fds.o \
  49         fmt.o \
  50         fold.o \
  51         fts_fix.o \
  52         getconf.o \
  53         head.o \
  54         id.o \
  55         join.o \
  56         ln.o \
  57         logname.o \
  58         md5sum.o \
  59         mkdir.o \
  60         mkfifo.o \
  61         mktemp.o \
  62         mv.o \
  63         paste.o \
  64         pathchk.o \
  65         pids.o \
  66         readlink.o \
  67         rev.o \
  68         revlib.o \
  69         rm.o \
  70         rmdir.o \
  71         stty.o \
  72         sum.o \
  73         sync.o \
  74         tail.o \
  75         tee.o \
  76         tty.o \
  77         uname.o \
  78         uniq.o \
  79         vmstate.o \
  80         wc.o \
  81         wclib.o
  82 
  83 include ../../Makefile.astmsg
  84 
  85 include ../../Makefile.lib
  86 
  87 # mapfile-vers does not live with the sources in in common/ to make
  88 # automated code updates easier.
  89 MAPFILES=       ../mapfile-vers
  90 
  91 # Set common AST build flags (e.g. C99/XPG6, needed to support the math stuff)
  92 include ../../../Makefile.ast
  93 
  94 LIBS =          $(DYNLIB) $(LINTLIB)
  95 
  96 $(LINTLIB) :=   SRCS = $(SRCDIR)/$(LINTSRC)
  97 
  98 LDLIBS += \
  99         -lsum \
 100         -last \
 101         -lsocket \
 102         -lnsl \
 103         -lc
 104 
 105 SRCDIR =        ../common
 106 
 107 # We use "=" here since using $(CPPFLAGS.master) is very tricky in our
 108 # case - it MUST come as the last element but future changes in -D options
 109 # may then cause silent breakage in the AST sources because the last -D
 110 # option specified overrides previous -D options so we prefer the current
 111 # way to explicitly list each single flag.
 112 # Notes:
 113 #   - "-D_BLD_DLL" comes from ${mam_cc_DLL} in Mamfile
 114 CPPFLAGS = \
 115         $(DTEXTDOM) $(DTS_ERRNO) \
 116         -I../common \
 117         -Isrc/lib/libcmd \
 118         -I$(ROOT)/usr/include/ast \
 119         -I$(ROOT)/usr/include \
 120         -D_BLD_cmd \
 121         -D_PACKAGE_ast \
 122         -D_BLD_DLL \
 123         '-DERROR_CATALOG="libcmd"' \
 124         '-DUSAGE_LICENSE=\
 125                 "[-author?Glenn Fowler <gsf@research.att.com>]"\
 126                 "[-author?David Korn <dgk@research.att.com>]"\
 127                 "[-copyright?Copyright (c) 1992-2010 AT&T Intellectual Property]"\
 128                 "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\
 129                 "[--catalog?libcmd]"'
 130 
 131 CFLAGS += \
 132         $(ASTCFLAGS)
 133 CFLAGS64 += \
 134         $(ASTCFLAGS64)
 135 
 136 CERRWARN        += -_gcc=-Wno-unused-value
 137 CERRWARN        += -_gcc=-Wno-parentheses
 138 CERRWARN        += -_gcc=-Wno-uninitialized
 139 CERRWARN        += -_gcc=-Wno-unused-variable
 140 CERRWARN        += -_gcc=-Wno-implicit-function-declaration
 141 
 142 # not linted
 143 SMATCH=off
 144 
 145 pics/cut.o      := CERRWARN += -erroff=E_END_OF_LOOP_CODE_NOT_REACHED
 146 pics/sync.o     := CERRWARN += -erroff=E_END_OF_LOOP_CODE_NOT_REACHED
 147 pics/vmstate.o  := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED
 148 
 149 .KEEP_STATE:
 150 
 151 all: $(LIBS) 
 152 
 153 #
 154 # libcmd is not lint-clean yet; fake up a target.  (You can use
 155 # "make lintcheck" to actually run lint; please send all lint fixes
 156 # upstream (to AT&T) so the next update will pull them into ON.)
 157 #
 158 lint:
 159         @ print "usr/src/lib/libcmd is not lint-clean: skipping"
 160 
 161 include ../../Makefile.targ