###############################################################################
###############################################################################
##
##  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
##  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
##
##  This copyrighted material is made available to anyone wishing to use,
##  modify, copy, or redistribute it subject to the terms and conditions
##  of the GNU General Public License v.2.
##
###############################################################################
###############################################################################

TARGET= gnbd_export

top_srcdir=../..

SOURCE= gnbd_export.c $(top_srcdir)/utils/gnbd_utils.c \
	$(top_srcdir)/utils/trans.c

INCLUDE= -I$(top_srcdir)/include -I$(top_srcdir)/server \
	-I$(top_srcdir)/utils -I${top_srcdir}/config \
	-I${gnbdkincdir} -I${incdir} -I${cmanincdir}

LDLIBS+= -L${libdir} -L${cmanincdir} -lcman -ldl -lpthread

include ${top_srcdir}/make/defines.mk

CFLAGS+= -O2 -DGNBD_RELEASE_NAME=\"${RELEASE}\"

all: ${TARGET}

gnbd_export: ${SOURCE}
	${CC} ${CFLAGS} ${LDFLAGS} ${SOURCE} ${LOADLIBES} ${LDLIBS} -o $@

install: all gnbd_get_uid
	if [ ! -d ${sbindir} ]; then \
		install -d ${sbindir}; \
	fi
	strip ${TARGET}
	install -m755 ${TARGET} ${sbindir}
	install -m755 gnbd_get_uid  ${sbindir}

clean:
	rm -f *.o ${TARGET}
