# VRML/PROGS/vrmlview/Makefile
############################################################################

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

POOLSDIR = ../../POOLS
VRMLDIR = ../../VRML

############################################################################
# No need to change anything below here
############################################################################
# the source files in this directory
CXXSOURCES = \
	main.C \
	oglrenderer.C \
	ui_render.C
CSOURCES = \
	ui_main.c \
	ui_file.c \
	ui_camera.c \
	ui_help.c \
	ui_defaults.c \
	uit.c \
	canvas.c \
	render.c \
	rendercommon.c \
	bounds.c \
	camera.c \
	transform.c \
	error.c
SOURCES = $(CXXSOURCES) $(CSOURCES)
OBJECTS = ${CXXSOURCES:.C=.o} ${CSOURCES:.c=.o}

CFLAGS = $(_CFLAGS) -I$(VRMLDIR) -I$(POOLSDIR) \
	-I$(VRMLDIR)/NODES -I$(VRMLDIR)/PhBRML \
	$(XINCLUDES) $(MOTIFINCLUDES) $(DRIVERFLAGS) $(TIMERFLAGS) -I.
LDFLAGS = $(_LDFLAGS)

#default target: make the vv (ViewVRML or VRMLView as you like) executable
all: vv

# generate source file dependencies
depend:
	$(MAKEDEPEND) $(CFLAGS) $(SOURCES) > deps

# automatically create a C file containing fallback resources from 
# the application defaults in the file 'RenderPark'
ui_defaults.c: ViewVRML
	echo "/* ui_defaults.c: automatically generated from the application defaults file 'ViewVRML' */" > ui_defaults.c
	echo "" >> ui_defaults.c
	echo "char *fallback_resources[] = {" >> ui_defaults.c
	sh ad2c.script < ViewVRML >> ui_defaults.c
	echo "(char *)0" >> ui_defaults.c
	echo "};" >> ui_defaults.c

.phony: libvrml

$(VRMLDIR)/libvrml.a:
	$(MAKE) -C $(VRMLDIR)/VRML libvrml

vv: $(OBJECTS) $(VRMLDIR)/libvrml.a
	$(CXX) $(LDFLAGS) -o vv $(OBJECTS) \
		-L$(VRMLDIR) -lvrml \
		-L$(POOLSDIR) -lpools \
		$(DRIVERLIBS) $(MOTIFLIBS) $(XLIBS) \
		-lm

cleanhere: cleangen
	-${RM} vv

clean: cleanhere

distclean: cleanhere

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