###############################################################################
###############################################################################
##
##  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.
##
###############################################################################
###############################################################################

include ../../make/defines.mk

TARGET=cman_tool

OBJS=	main.o \
	join.o

CFLAGS += -DCMAN_RELEASE_NAME=\"${RELEASE}\"
CFLAGS += -DSBINDIR=\"${sbindir}\"
CFLAGS += -I${ccsincdir} -I${cmanincdir}
CFLAGS += -I${incdir}

ifeq ($(DEBUG),y)
CFLAGS += -O0 -g -DDEBUG
else
CFLAGS += -O2
endif

LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -lccs -lcman

all: depends ${TARGET}

${TARGET}: ${OBJS}
	$(CC) -o $@ $^ $(LDFLAGS)

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

depends:
	$(MAKE) -C ../lib all

install: all
	install -d ${sbindir}
	install ${TARGET} ${sbindir}

uninstall:
	${UNINSTALL} ${TARGET} ${sbindir}

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