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 2009 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 #
  25 # Copyright 2015 RackTop Systems.
  26 # Copyright 2017 Gary Mills
  27 #
  28 
  29 MYPROG = svc.configd
  30 MYOBJS = \
  31         backend.o \
  32         configd.o \
  33         client.o \
  34         file_object.o \
  35         maindoor.o \
  36         object.o \
  37         rc_node.o \
  38         snapshot.o
  39 
  40 PROG = $(MYPROG)
  41 OBJS = $(MYOBJS)
  42 
  43 SRCS = $(MYOBJS:%.o=%.c)
  44 
  45 include ../../Makefile.cmd
  46 include ../../Makefile.ctf
  47 
  48 NATIVE_BUILD=$(POUND_SIGN)
  49 $(NATIVE_BUILD)PROG = $(MYPROG:%=%-native)
  50 $(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o)
  51 
  52 ROOTCMDDIR=     $(ROOT)/lib/svc/bin
  53 
  54 MYCPPFLAGS = -I. -I../common -I../../../common/svc \
  55         -I$(ROOT)/usr/include/sqlite-sys -D_REENTRANT
  56 CPPFLAGS += $(MYCPPFLAGS)
  57 CFLAGS  += $(CCVERBOSE)
  58 CERRWARN += -_gcc=-Wno-parentheses
  59 CERRWARN += -_gcc=-Wno-type-limits
  60 CERRWARN += -_gcc=-Wno-unused-label
  61 CERRWARN += -_gcc=-Wno-unused-variable
  62 CERRWARN += -_gcc=-Wno-unused-function
  63 CERRWARN += -_gcc=-Wno-uninitialized
  64 MYLDLIBS = -lumem -luutil
  65 LDLIBS  += -lsecdb -lbsm $(MYLDLIBS)
  66 LINTFLAGS += -errtags -erroff=E_BAD_FORMAT_ARG_TYPE2 -erroff=E_NAME_DEF_NOT_USED2
  67 
  68 CLOBBERFILES += $(MYPROG:%=%-native)
  69 
  70 LIBUUTIL        = $(SRC)/lib/libuutil
  71 LIBSCF          = $(SRC)/lib/libscf
  72 
  73 SCRIPTFILE      = restore_repository
  74 ROOTSCRIPTFILE  = $(ROOTCMDDIR)/$(SCRIPTFILE)
  75 
  76 #
  77 # Native variant (used in ../seed)
  78 #
  79 $(NATIVE_BUILD)CC =     $(NATIVECC)
  80 $(NATIVE_BUILD)LD =     $(NATIVELD)
  81 $(NATIVE_BUILD)CFLAGS = $(NATIVE_CFLAGS)
  82 $(NATIVE_BUILD)CPPFLAGS = $(MYCPPFLAGS) -I$(LIBUUTIL)/common -I$(LIBSCF)/inc
  83 $(NATIVE_BUILD)CPPFLAGS += -DNATIVE_BUILD
  84 $(NATIVE_BUILD)LDFLAGS =
  85 $(NATIVE_BUILD)LDLIBS = -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \
  86                         -L$(LIBUUTIL)/native -R $(LIBUUTIL)/native $(MYLDLIBS)
  87 
  88 DIRMODE = 0755
  89 FILEMODE = 0555
  90 
  91 OBJSQLITE =
  92 LIBSQLITE = -lsqlite-sys
  93 $(NATIVE_BUILD)OBJSQLITE = $(ROOT)/lib/libsqlite-native.o
  94 $(NATIVE_BUILD)LIBSQLITE =
  95 
  96 OBJS += $(OBJSQLITE)
  97 LDLIBS += $(LIBSQLITE)
  98 
  99 # Suppress error for: event_id
 100 rc_node-native.o := CERRWARN += -_gcc=-Wno-unused-but-set-variable
 101 
 102 install := TARGET = install
 103 clobber := TARGET = clobber
 104 
 105 .KEEP_STATE:
 106 .PARALLEL: $(MYOBJS) $(MYOBJS:%.o=%-native.o)
 107 
 108 all: $(PROG)
 109 
 110 native: FRC
 111         @cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install
 112         @NATIVE_BUILD= $(MAKE) $(MFLAGS) all
 113 
 114 $(PROG): $(OBJS)
 115         $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
 116         $(POST_PROCESS)
 117 
 118 %-native.o: %.c
 119         $(COMPILE.c) -o $@ $<
 120         $(POST_PROCESS_O)
 121 
 122 $(ROOTCMDDIR)/%: %.sh
 123         $(INS.rename)
 124 
 125 install: all $(ROOTCMD) $(ROOTVARSADMFILE) $(ROOTSCRIPTFILE)
 126 
 127 clean: FRC
 128         $(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o)
 129 
 130 clobber:
 131 
 132 lint:   lint_SRCS
 133 
 134 lint_SRCS:
 135 
 136 include ../../Makefile.targ
 137 
 138 FRC: