1 #
   2 # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
   3 # Copyright (c) 2018, Joyent, Inc.
   4 #
   5 
   6 #
   7 # BSD 3 Clause License
   8 #
   9 # Copyright (c) 2007, The Storage Networking Industry Association.
  10 #
  11 # Redistribution and use in source and binary forms, with or without
  12 # modification, are permitted provided that the following conditions
  13 # are met:
  14 #       - Redistributions of source code must retain the above copyright
  15 #         notice, this list of conditions and the following disclaimer.
  16 #
  17 #       - Redistributions in binary form must reproduce the above copyright
  18 #         notice, this list of conditions and the following disclaimer in
  19 #         the documentation and/or other materials provided with the
  20 #         distribution.
  21 #
  22 #       - Neither the name of The Storage Networking Industry Association (SNIA)
  23 #         nor the names of its contributors may be used to endorse or promote
  24 #         products derived from this software without specific prior written
  25 #         permission.
  26 #
  27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  28 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  29 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  30 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  31 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  32 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  33 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  34 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  35 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  36 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  37 # POSSIBILITY OF SUCH DAMAGE.
  38 #
  39 PROG = ndmpd
  40 
  41 include $(SRC)/cmd/Makefile.cmd
  42 
  43 NDMP_DIR = ndmp
  44 TLM_DIR = tlm
  45 
  46 include $(NDMP_DIR)/Makefile.rpcgen
  47 
  48 CFLAGS += $(CCVERBOSE)
  49 
  50 CPPFLAGS += $(LFLAGS64)
  51 
  52 CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DDEBUG
  53 CPPFLAGS += -I. -Iinclude
  54 
  55 # not linted
  56 SMATCH=off
  57 
  58 CSTD = $(CSTD_GNU99)
  59 
  60 # lint does not like unused _umem_*_init
  61 LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2 
  62 
  63 # function argument declared inconsistently
  64 LINTFLAGS += -xerroff=E_INCONS_ARG_DECL2
  65 # value type used inconsistently
  66 LINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_USED2
  67 # value type declared inconsistently
  68 LINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_DECL2
  69 # argument used inconsistently
  70 LINTFLAGS += -xerroff=E_INCONS_ARG_USED2 
  71 
  72 CERRWARN += -_gcc=-Wno-unused-variable
  73 CERRWARN += -_gcc=-Wno-switch
  74 CERRWARN += -_gcc=-Wno-uninitialized
  75 CERRWARN += -_gcc=-Wno-address
  76 
  77 LDLIBS   += -lsocket -lnsl -lzfs -lsec -lndmp -lmd5 -lnvpair -lumem -lbsm -lgen -lcmdutils -linetutil
  78 
  79 OBJS= \
  80         $(NDMP_DIR)/ndmp_xdr.o \
  81         $(NDMP_OBJ:%.o=$(NDMP_DIR)/%.o) $(TLM_OBJ:%.o=$(TLM_DIR)/%.o)
  82 
  83 NDMP_OBJ = \
  84         ndmpd_callbacks.o \
  85         ndmpd_chkpnt.o \
  86         ndmpd_comm.o \
  87         ndmpd_config.o \
  88         ndmpd_connect.o \
  89         ndmpd_data.o \
  90         ndmpd_door.o \
  91         ndmpd_dtime.o \
  92         ndmpd_fhistory.o \
  93         ndmpd_handler.o \
  94         ndmpd_log.o \
  95         ndmpd_main.o \
  96         ndmpd_mark.o \
  97         ndmpd_mover.o \
  98         ndmpd_prop.o \
  99         ndmpd_scsi.o \
 100         ndmpd_tape.o \
 101         ndmpd_tar.o \
 102         ndmpd_tar3.o \
 103         ndmpd_util.o \
 104         ndmpd_zfs.o
 105 
 106 TLM_OBJ = \
 107         tlm_backup_reader.o \
 108         tlm_bitmap.o \
 109         tlm_buffers.o \
 110         tlm_info.o \
 111         tlm_init.o \
 112         tlm_lib.o \
 113         tlm_restore_writer.o \
 114         tlm_traverse.o \
 115         tlm_util.o \
 116         tlm_hardlink.o
 117 
 118 SRCS= $(NDMP_OBJ:%.o=$(NDMP_DIR)/%.c) $(TLM_OBJ:%.o=$(TLM_DIR)/%.c)
 119 
 120 SVCMETHOD = svc-ndmp
 121 $(ROOTSVCMETHOD) := FILEMODE = 0555
 122 
 123 MANIFEST = ndmp.xml
 124 ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
 125 $(ROOTMANIFEST) := FILEMODE = 444
 126 
 127 ROOTNDMPDDIR=   $(ROOTLIB)/ndmp
 128 ROOTNDMPDFILE = $(PROG:%=$(ROOTNDMPDDIR)/%)
 129 
 130 FILEMODE = 0444
 131 $(ROOTNDMPDFILE):= FILEMODE = 0555
 132 
 133 $(ROOTNDMPDDIR):
 134         $(INS.dir)
 135 
 136 $(ROOTNDMPDDIR)/%: %
 137         $(INS.file)
 138 
 139 .KEEP_STATE:
 140 
 141 all: $(PROG)
 142 
 143 install: all $(ROOTNDMPDDIR)  $(ROOTNDMPDFILE) $(ROOTSVCMETHOD) $(ROOTMANIFEST) 
 144 
 145 check:  $(CHKMANIFEST)
 146 
 147 clobber:
 148 
 149 $(PROG) : $(OBJS)
 150         $(LINK.c) -o $@  $(OBJS) $(LDLIBS)
 151         $(POST_PROCESS)
 152 
 153 $(NDMP_DIR)/%.o : $(NDMP_DIR)/%.c
 154         $(COMPILE.c) -o $@ $<
 155 
 156 $(TLM_DIR)/%.o : $(TLM_DIR)/%.c
 157         $(COMPILE.c) -o $@ $<
 158 
 159 lint:   lint_SRCS
 160 
 161 clean:  rpcclean
 162         rm -f $(NDMP_DIR)/*.o $(TLM_DIR)/*.o
 163 
 164 include $(SRC)/cmd/Makefile.targ