# VRML/vrml2_utf8/Makefile
############################################################################

# use same configuration parameters as in parent directory
include ../../Config.common
include ../../Config.site

POOLSDIR = ../../POOLS
INCLUDIR = ../../include

############################################################################
# No need to change anything below here
############################################################################
# the source files in this directory
CXXSOURCES = \
	scanner.C \
	parser.C \
	parser2.C \
	exporter.C
SOURCES = $(CXXSOURCES) $(CSOURCES)
OBJECTS = ${CXXSOURCES:.C=.o} ${CSOURCES:.c=.o}

# compiler and linker parameters

THISDIRFLAGS = -I$(INCLUDIR)/vrml2_utf8 -I$(INCLUDIR)  -I$(POOLSDIR) $(MKLIBFLAGS)

link_includes: parser.C scanner.C
	-mkdir $(INCLUDIR)/vrml2_utf8
	-ln -sf `pwd`/*.[hH] $(INCLUDIR)/vrml2_utf8

# generate source file dependencies
dependhere: parser.C scanner.C
	$(MAKEDEPEND) $(MKDEPFLAGS) $(SOURCES) > deps

depend: dependhere

all: $(OBJECTS)

here: $(OBJECTS)

# make a clean source tree again
cleanhere: cleangen

clean: cleanhere

distclean: cleanhere

# Generate a C++ parser class that can coexist with other
# yacc/bison generated parsers in the same program.
parser.C: parser.bison
	bison -dyv  parser.bison
	mv y.tab.c parser.C
	mv y.tab.h tokens.H
	@echo "NOTE: Unless you tweaked bison, you need to manually edit the"
	@echo "bison generated parser.C file in order to get it compiled"
	@echo "without warnings or errors:"
	@echo "1) Delete the declaration of the YYSTYPE union"
	@echo "2) Delete the declaration of the global variables yylval, yychar and yynerrs"
	@echo "3) Delete the forward declaration of yyparse()"

# Generate a C++ lexical scanner class
scanner.C: scanner.flex parser.bison
	flex -p -Cfa -+ -oscanner.C scanner.flex

###############################################################################
# dependencies --- automatically generated with make depend !!
###############################################################################
-include deps
