#
# Filter Compiler makefile.
#
# To make for a particular platform do a "make <platform>".
#
# Current supported platforms are: solaris, sunos, and aix.
#
# This makefile will attempt to build for Solaris by default.
# The settings under Solaris may be applicable to other
# platforms so try just "make" if your platform is not explicitly
# supported.
#
# Change the following line to set the destination directory for fm.
#
# If you port this package to another platform not listed and
# made modifications to source code or this makefile then please
# send them to drawbridge@net.tamu.edu so they can be incorporated
# into the general release. Thanks.
#
INSTALLDIR=/usr/local/bin

#
# You shouldn't need to change anything below here.
#
HEADERS=chario.h groups.h macros.h protocols.h version.h classes.h \
	hosts.h ports.h services.h y.tab.h
OBJS=y.tab.o fc.o lex.o groups.o hosts.o services.o classes.o chario.o
SRCS=$(OBJS:%.c=%.o)
YACC=bison -y

solaris:
	make CC=gcc CFLAGS="-g -O4" ARCHLIBS="-lsocket -lnsl" fc
	
sunos:
	make CC=gcc CFLAGS="-O4" fc

aix:
	make CC=cc CFLAGS="-gx" fc

fc: $(OBJS)
	$(CC) $(CFLAGS) -o fc $(OBJS) $(ARCHLIBS)

query: query.c
	$(CC) $(CFLAGS) query.c -o query

$(OBJS): $(HEADERS)

y.tab.c y.tab.h:: grammar.y
	$(YACC) -d grammar.y

y.tab.o: y.tab.c

install:
	install -o root -g other -m 755 -s fc $(INSTALLDIR)

clean:
	rm -f $(OBJS) fc y.tab.c y.tab.h

