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

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

POOLSDIR = ../POOLS
LIBDIR = ../lib
MKTOOLDIR = ../MKTOOLS

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


all: libxrml

# subdirectories

BASEDIR = base
BASEOBJ = $(BASEDIR)/*.o
BASETARGET = Base
Base:
	$(MAKE) -C $(BASEDIR) all

NODESDIR = nodes
NODESOBJ = $(NODESDIR)/*.o
NODESTARGET = Nodes
Nodes:
	$(MAKE) -C $(NODESDIR) all

PhBRMLDIR = PhBRML
PhBRMLOBJ = $(PhBRMLDIR)/*.o
PhBRMLTARGET = Phbrml
Phbrml:
	$(MAKE) -C $(PhBRMLDIR) all

VRML2_UTF8_DIR = vrml2_utf8
VRML2_UTF8_OBJ = $(VRML2_UTF8_DIR)/*.o
VRML2_UTF8_TARGET = Vrml2_utf8
# without '_' because make doesn't like it.
Vrml2_utf8:
	$(MAKE) -C $(VRML2_UTF8_DIR) all

UTILSDIR = utils
UTILSOBJ = $(UTILSDIR)/*.o
UTILSTARGET = Utils
Utils:
	$(MAKE) -C $(UTILSDIR) all

SUBDIRS = $(BASEDIR) $(VRML2_UTF8_DIR) $(UTILSDIR) $(NODESDIR) $(PhBRMLDIR)

# compiler and linker parameters

THISDIRFLAGS = -I../include

# generate source file dependencies
link_includes:
	for i in $(SUBDIRS) ; do { $(MAKE) -C $$i link_includes ; } ; done

dependhere: link_includes

depend: dependhere
	for i in $(SUBDIRS) ; do { $(MAKE) -C $$i depend || exit 1 ; } ; done

.phony: Nodes Phbrml Vrml2_utf8 pools Base Utils

here: $(OBJECTS)

libxrml: $(BASETARGET) $(NODESTARGET) $(PhBRMLTARGET) $(VRML2_UTF8_TARGET) $(UTILSTARGET) $(OBJECTS)
	$(MKTOOLDIR)/$(MKLIB) libxrml.$(LIBEXT) $(MAJOR_VERSION) $(MINOR_VERSION) $(RELEASE) $(OBJECTS) $(BASEOBJ) $(VRML2_UTF8_OBJ) $(NODESOBJ) $(PhBRMLOBJ)
	$(MOVE) libxrml* $(LIBDIR)

pools:
	$(MAKE) -C $(POOLSDIR) all

# make a clean source tree again
cleanhere: cleangen
	-${RM} libxrml.*

clean: cleanhere
	for i in $(SUBDIRS) ; do { $(MAKE) -C $$i clean || exit 1 ; } ; done

distclean: cleanhere
	for i in $(SUBDIRS) ; do { $(MAKE) -C $$i distclean || exit 1 ; } ; done

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