include ../../make.include
include ../../make.pkgs

CXXFLAGS = $(CXXOPT) -I. -I.. -I../vector -I../util \
	-I../../include -I$(X11INCLUDE) \
	-I../../$(FUNTOOLSDIR)/filter -I../../$(FUNTOOLSDIR)/fitsy \
	-I../../$(FUNTOOLSDIR)/util

SS	= \
	alloc.C \
	allocgz.C \
	analysis.C \
	card.C \
	channel.C \
	column.C \
	compress.C \
	envi.C \
	gzip.C \
	iis.C \
	hcompress.C \
	hdu.C \
	head.C \
	hist.C \
	hpx.C \
	file.C \
	map.C \
	mapincr.C \
	mmap.C \
	mmapincr.C \
	nrrd.C \
	nrrdgzip.C \
	outchannel.C \
	outfile.C \
	outfits.C \
	outsocket.C \
	photo.C \
	plio.C \
	rice.C \
	savefits.C \
	share.C \
	sshare.C \
	smap.C \
	smmap.C \
	socket.C \
	socketgz.C \
	strm.C \
	var.C

SRC	= $(SS) \
	parser.C \
	lex.C \
	nrrdparser.C \
	nrrdlex.C \
	enviparser.C \
	envilex.C

INCLS	= $(wildcard *.h)
OBJS	= $(SRC:%.C=%.o)

all	: $(OBJS)

clean	: FORCE
	rm -f core *~ *#

distclean : clean
	rm -f *.o parser.output nrrdparser.output enviparser.output

parsers	: parser nrrdparser enviparser

parser	: FORCE
	bison -d -p ff -o parser.C parser.Y
	flex -Pff -olex.C lex.L

nrrdparser : FORCE
	bison -d -p nrrd -o nrrdparser.C nrrdparser.Y
	flex -Pnrrd -onrrdlex.C nrrdlex.L

enviparser : FORCE
	bison -d -p envi -o enviparser.C enviparser.Y
	flex -Penvi -oenvilex.C envilex.L

shmload	: shmload.C
	$(RM) $@
	$(CXX) $(CXXOPT) -o $@ $<
	cp $@ ../../bin/.

FORCE	:
