# Generated automatically from Makefile.in by configure.

# Replace with the location for the installation directory
PREFIX=tmp

# Set the following to True to build shared libraries. Note that this will
# not work on most systems, you need to at least compile with -fPIC
BUILD_SHARED=FALSE

GNATMAKE=gnatmake
CC=gcc
  
# List of all modules to compile
# You can remove "dom" if you don't intend to use the DOM interface
MODULES=unicode input_sources sax dom

# Version of the library
MAJOR=0
MINOR=8

# Compiler mode: one of "distrib", "debug", "optimize", "profile"
MODE=distrib

FPIC=
CHMOD=chmod
CP=cp -p -f
MKDIR=mkdir -p
RANLIB= 
ARFLAGS=cr
CFLAGS=
CP=cp -p -f
CHMOD=chmod
LN=ln -f -s

#########################################################################
## Nothing to modify below this point
#########################################################################

MODULE_TEST=${MODULES:%=%_test}
MODULE_INSTALL=${MODULES:%=%_inst}

.PHONY: all obj clean install install_dirs

all: obj
obj: ${MODULES}
test: ${MODULE_TEST}

${MODULES}: force
	# The following four lines are a workaround for a bug in GNAT 3.15a1
	# Since logical names are not automatically reset the a command exits
	assign/job tmp ADA_INCLUDE_PATH
	deassign/job ADA_INCLUDE_PATH
	assign/job tmp ADA_OBJECTS_PATH
	deassign/job ADA_OBJECTS_PATH
	${GNATMAKE} ${FPIC} -u -P$@/$@.gpr -XMODE=${MODE}

${MODULE_TEST}: force
	assign/job tmp ADA_INCLUDE_PATH
	deassign/job ADA_INCLUDE_PATH
	assign/job tmp ADA_OBJECTS_PATH
	deassign/job ADA_OBJECTS_PATH
	${GNATMAKE} ${FPIC} -P${@:%_test=%}/${@:%_test=%}.gpr -XMODE=debug

${MODULE_INSTALL}: force
	# Build the libraries themselves
	cd ${@:%_inst=%}/obj; ${AR} ${ARFLAGS} libxmlada_${@:%_inst=%}.a *.o
ifneq (${RANLIB}, "")
	cd ${@:%_inst=%}/obj; ${RANLIB} libxmlada_${@:%_inst=%}.a
endif
ifeq (${BUILD_SHARED}, TRUE)
	cd ${@:%_inst=%}/obj; ${CC} -shared -o libxmlada_${@:%_install=%}-${MAJOR}.${MINOR}.so *.o
endif
	#Install the libraries
	${CP} ${@:%_inst=%}/obj/*.ali ${PREFIX}/include/xmlada
	${CP} ${@:%_inst=%}/*.ad[bs]  ${PREFIX}/include/xmlada
	${CP} ${@:%_inst=%}/obj/libxmlada_* ${PREFIX}/lib
ifeq (${BUILD_SHARED}, TRUE)
	cd ${PREFIX}/lib; ${LN} libxmlada_${@:%_inst=%}-${MAJOR}.${MINOR}.so libxmlada_${@:%_inst=%}.so
endif

install_dirs: force
	@${MKDIR} ${PREFIX}/lib
	@${MKDIR} ${PREFIX}/bin
	@${MKDIR} ${PREFIX}/include/xmlada

install: obj install_dirs ${MODULE_INSTALL}
	cd ${PREFIX}/include/xmlada; ${CHMOD} -w *.ali
	${CP} xmlada-config ${PREFIX}/bin
	${CHMOD} +x ${PREFIX}/bin/xmlada-config

clean: force
	-rm ${MODULES:%=%/obj/*}  2>/dev/null
	cd docs; ${MAKE} -e clean

force:
