#####################################################################
#
#   Makefile for the GNU cfengine  (C) Mark Burgess 1994
#
#   It should not be necessary to run make manually. To install
#   cfengine you should cd to the directory containing this
#   file and run "./configure". configure will invoke "make"
#   automatically after generating the makefile. If you want to
#   fine tune it afterwards, type CTRL-C to stop the installation
#   and run make manually.
#
#####################################################################

HEADERS = cf.defs.h
PARSER = cf.y cf.l

OBJ = cfengine.o \
      ifconf.o   \
      variables.o\
      classes.o  \
      toolkits.o \
      parsehandler.o \
      edittools.o\
      patches.o \
      ../gnulib/getopt.o \
      ../gnulib/getopt1.o\
      y.tab.o    \
      lex.yy.o

SCI_CC = -cckr
LD_LIBRARY_PATH=/usr/ucblib

#
# Note that if you are compiling with gcc -- you will almost certainly
# need the ADDITIONAL CFLAGS  -w
#
# On solaris, you can remove the -w flag from CFLAGS is you're not using the
# GNU compiler and add -Xs to CFLAGS.
#


CC=gcc
YACC=bison -y
LEX=flex
LDFLAGS= -lfl
CFLAGS=-DLINUX -DNO_NETGR -O -w  -w -DDEBIAN
prefix=/usr
exec-prefix=${prefix}
srcdir=/mnt/i/packages/work/0.93/cfengine-1.1.2/cfengine-1.1.2/src
bindir=${prefix}/bin
VPATH=/mnt/i/packages/work/0.93/cfengine-1.1.2/cfengine-1.1.2/src

cfbindir=$(srcdir)/../bin

#####################################################################
# Rules
######################################################################

all:
	make cfengine

cfengine: ${OBJ}
	${CC} -o $@ ${OBJ} ${LDFLAGS}
	./cfengine -V > .cfversion

lex.yy.c: cf.l
	${LEX} $?

y.tab.c: cf.y
	${YACC} -d $?

${OBJ}: ${HEADERS}

.c.o: 
	${CC} -c ${CFLAGS} ${INCLUDE} $<


#######################################################################

tidy:
	make mostlyclean

mostlyclean:
	rm -f ${OBJ}
	rm -f y.tab.c lex.yy.c y.tab.h
	rm -f y.tab lex.yy
	rm -f *% *~ *.o ../gnulib/*.o
	rm -f *.tab.c *.tab.h a.out
	rm -f cfengine.dvi cfengine.aux cfengine.log cfengine.toc
	rm -f *.tar.*
	rm -f getopt.c getopt1.c getopt.h
	rm -f ../bin/*~ ../bin/cfwrap ../bin/cfdaily ../bin/noseyparker

distclean:
	make tidy
	rm -f cfengine
	rm -f ../bin/cfengine
	rm -f Makefile ../gnulib/Makefile
	rm -f ../Makefile
	rm -f ../doc/cfengine.info* ../doc/cfengine.[cpdvfkal]* ../doc/*~
	rm -f ../doc/cfengine.toc ../doc/cfengine.tp ../doc/texput.log

install:
	../bin/Install $(prefix)

uninstall:
	../bin/Uninstall $(prefix)

dist:
	make distclean
	../bin/MakeDist





