# Copyright 2000, International Business Machines Corporation and others.
# All Rights Reserved.
#
# This software has been released under the terms of the IBM Public
# License.  For details, see the LICENSE file in the top-level source
# directory or online at http://www.openafs.org/dl/license10.html
#
# Makefile for package, the AFS workstation configuration tool.
#
srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config

CFLAGS   = ${COMMON_CFLAGS} -DKFLAG -DANDREW -DVICE -UDEBUG

OBJS =  package.o \
	gram.o \
	lex.o \
	conftree.o \
	check.o \
	update.o \
	fileops.o \
	messages.o \
	misc.o \
	globfuncs.o

TEST_OBJS = test.o \
	test_gram.o \
	lex.o \
	conftree.o \
	messages.o \
	misc.o \
	globfuncs.o

LIBS=${TOP_LIBDIR}/libsys.a \
        ${TOP_LIBDIR}/libcmd.a \
	${TOP_LIBDIR}/libcom_err.a \
        ${TOP_LIBDIR}/librx.a \
	${TOP_LIBDIR}/libsys.a \
	${TOP_LIBDIR}/util.a \
	${TOP_LIBDIR}/liblwp.a \
	${XLIBS}

include ../config/Makefile.version

all	: package package_test

package	: $(OBJS)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(NON_SHARED) ${LIBS}

package_test : $(TEST_OBJS)
	$(CC) $(CFLAGS) -o package_test $(TEST_OBJS) ${LIBS}

package.o: package.c AFS_component_version_number.o
test.o: test.c AFS_component_version_number.o

lex.c:
	-$(RM) -f lex.c
	$(LEX)  -t lex.l > lex.c

clean	:
	$(RM) -f *.o gram.c test_gram.c core package package_test *.BAK y.output yacc.tmp yacc.acts\
	AFS_component_version_number.c lex.c y.tab.h

install:   ${DESTDIR}${sbindir}/package ${DESTDIR}${sbindir}/package_test ${DESTDIR}${sbindir}/makepkgfiles


${DEST}/etc/package: package
	${INSTALL} $? $@

${DESTDIR}${sbindir}/package: package
	${INSTALL} $? $@

${DEST}/etc/package_test: package_test
	${INSTALL} $? $@

${DESTDIR}${sbindir}/package_test: package_test
	${INSTALL} $? $@

${DEST}/etc/makepkgfiles: makepkgfiles
	${INSTALL} $? $@

${DESTDIR}${sbindir}/makepkgfiles: makepkgfiles
	${INSTALL} $? $@


dest:   ${DEST}/etc/package ${DEST}/etc/package_test ${DEST}/etc/makepkgfiles

