# $Revision$

#    SAM-QFS_notice_begin
#
#      Solaris 2.x Sun Storage & Archiving Management File System
#
#               Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
#
#               U.S. Government Rights - Commercial software. Government users are
#       subject to the Sun Microsystems, Inc. standard license agreement and applicable
#       provisions of the FAR and its supplements.
#
#       Use is subject to license terms. Sun, Sun Microsystems and the Sun logo
#       are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S.
#       and other countries.
#
#    SAM-QFS_notice_end
#
#
#       LGPL NOTICE
#
#       This library is free software; you can redistribute it and/or
#       modify it under the terms of the GNU Lesser General Public
#       License as published by the Free Software Foundation; either
#       version 2.1 of the License, or (at your option) any later version.
#
#       This library is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#       Lesser General Public License for more details.
#
#       You should have received a copy of the GNU Lesser General Public
#       License along with this library; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

DEPTH = ../../..
LIB_HOME = $(DEPTH)/src/lib/sam

include $(DEPTH)/mk/common.mk

BUILD_64BIT = yes

SRC_VPATH = $(DEPTH)/src/lib/samut
vpath %.c $(SRC_VPATH)

LIB = sam
LIB_SRC = \
	attrtoa.c \
	dev_to_nm.c \
	fileops.c \
	lstat.c    \
	media.c \
	quota.c \
	readrminfo.c \
	request.c \
	segment_stat.c \
	segment_lstat.c \
	sgethost.c \
	stat.c \
	vsn_stat.c \
	segment_vsn_stat.c

ifeq ($(OS), SunOS)
LIB_SRC += \
	devst_string.c \
	devstat.c

LIB_LIBS +=  -L $(DEPTH)/lib/$(OBJ_DIR) $(LIBSO) -lsamconf -lintl

ifeq ($(SPARCV9), yes)
LIBDEST += /sparcv9
DEPCFLAGS += -DLIBS_64
else
ifeq ($(AMD64), yes)
LIBDEST += /amd64
DEPCFLAGS += -DLIBS_64
endif
endif
else
LIB_LIBS += $(LIBSO)
endif

DEPCFLAGS += -I$(INCLUDE)/sam/$(OBJ_DIR) $(THRCOMP)

# To build test programs post installing libsam 
ifeq ($(OS), SunOS)

TESTPROG1 = $(OBJ_DIR)/segment_vsn_stat
TESTPROG2 = $(OBJ_DIR)/vsn_stat
TESTSRC1 = segment_vsn_stat.c
TESTSRC2 = vsn_stat.c

TESTINCFLAGS = -I ../../../include/
TESTLIBFLAGS = -L /opt/SUNWsamfs/lib

test: $(TESTPROG1) $(TESTPROG2)

$(TESTPROG1): $(TESTSRC1) 
	$(CC) $< -DMAIN $(TESTINCFLAGS) $(TESTLIBFLAGS) -lsamconf -lsam -o $@

$(TESTPROG2): $(TESTSRC2) 
	$(CC) $< -DMAIN $(TESTINCFLAGS) $(TESTLIBFLAGS) -lsamconf -lsam -o $@
endif


LNOPTS = -a -u -m -x
LNLIBS =

include $(DEPTH)/mk/targets.mk

include $(DEPTH)/mk/depend.mk
