2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
8c4f9701439555b41fbfe7848508f53b52166007Janice Chang# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# BSD 3 Clause License
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# Copyright (c) 2007, The Storage Networking Industry Association.
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# Redistribution and use in source and binary forms, with or without
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# modification, are permitted provided that the following conditions
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# are met:
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# - Redistributions of source code must retain the above copyright
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# notice, this list of conditions and the following disclaimer.
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# - Redistributions in binary form must reproduce the above copyright
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# notice, this list of conditions and the following disclaimer in
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# the documentation and/or other materials provided with the
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# distribution.
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# - Neither the name of The Storage Networking Industry Association (SNIA)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# nor the names of its contributors may be used to endorse or promote
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# products derived from this software without specific prior written
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# permission.
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# POSSIBILITY OF SUCH DAMAGE.
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar#
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarPROG = ndmpd
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarinclude $(SRC)/cmd/Makefile.cmd
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarNDMP_DIR = ndmp
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarTLM_DIR = tlm
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarinclude $(NDMP_DIR)/Makefile.rpcgen
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarCFLAGS += $(CCVERBOSE)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarCPPFLAGS += $(LFLAGS64)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarCPPFLAGS += -D_FILE_OFFSET_BITS=64 -DDEBUG
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarCPPFLAGS += -I. -Iinclude
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarC99MODE = $(C99_ENABLE)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# lint does not like unused _umem_*_init
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarLINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# function argument declared inconsistently
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarLINTFLAGS += -xerroff=E_INCONS_ARG_DECL2
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# value type used inconsistently
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarLINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_USED2
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# value type declared inconsistently
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarLINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_DECL2
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar# argument used inconsistently
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarLINTFLAGS += -xerroff=E_INCONS_ARG_USED2
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-unused-variable
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-switch
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-uninitialized
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-address
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe
588541fbf64fffe619698198cef04af1900f1f86Reza SabdarLDLIBS += -lsocket -lnsl -lzfs -lsec -lndmp -lmd5 -lnvpair -lumem -lbsm -lgen -lcmdutils -linetutil
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarOBJS= \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(NDMP_DIR)/ndmp_xdr.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(NDMP_OBJ:%.o=$(NDMP_DIR)/%.o) $(TLM_OBJ:%.o=$(TLM_DIR)/%.o)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarNDMP_OBJ = \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_callbacks.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_chkpnt.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_comm.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_config.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_connect.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_data.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_door.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_dtime.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_fhistory.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_handler.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_log.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_main.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_mark.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_mover.o \
8c4f9701439555b41fbfe7848508f53b52166007Janice Chang ndmpd_prop.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_scsi.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_tape.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_tar.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar ndmpd_tar3.o \
8c4f9701439555b41fbfe7848508f53b52166007Janice Chang ndmpd_util.o \
8c4f9701439555b41fbfe7848508f53b52166007Janice Chang ndmpd_zfs.o
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarTLM_OBJ = \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_backup_reader.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_bitmap.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_buffers.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_info.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_init.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_lib.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_restore_writer.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_traverse.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_util.o \
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar tlm_hardlink.o
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarSRCS= $(NDMP_OBJ:%.o=$(NDMP_DIR)/%.c) $(TLM_OBJ:%.o=$(TLM_DIR)/%.c)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarSVCMETHOD = svc-ndmp
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(ROOTSVCMETHOD) := FILEMODE = 0555
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarMANIFEST = ndmp.xml
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(ROOTMANIFEST) := FILEMODE = 444
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarROOTNDMPDDIR= $(ROOTLIB)/ndmp
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarROOTNDMPDFILE = $(PROG:%=$(ROOTNDMPDDIR)/%)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza SabdarFILEMODE = 0444
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(ROOTNDMPDFILE):= FILEMODE = 0555
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(ROOTNDMPDDIR):
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(INS.dir)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(ROOTNDMPDDIR)/%: %
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(INS.file)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar.KEEP_STATE:
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarall: $(PROG)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarinstall: all $(ROOTNDMPDDIR) $(ROOTNDMPDFILE) $(ROOTSVCMETHOD) $(ROOTMANIFEST)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
3afe87ebb25691cb6d158edaa34a6fb9b703a691Roger A. Faulknercheck: $(CHKMANIFEST)
3afe87ebb25691cb6d158edaa34a6fb9b703a691Roger A. Faulkner
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarclobber:
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(PROG) : $(OBJS)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(POST_PROCESS)
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(NDMP_DIR)/%.o : $(NDMP_DIR)/%.c
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(COMPILE.c) -o $@ $<
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar$(TLM_DIR)/%.o : $(TLM_DIR)/%.c
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar $(COMPILE.c) -o $@ $<
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarlint: lint_SRCS
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarclean: rpcclean
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar rm -f $(NDMP_DIR)/*.o $(TLM_DIR)/*.o
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdar
2654012f83cec5dc15b61dfe3e4a4915f186e7a6Reza Sabdarinclude $(SRC)/cmd/Makefile.targ