# Copyright 2002-2005 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

DEPFILE=depends

#all these setting come from the arguments passed in to runConfigure.

PLATFORM = @platform@

CC  = @cc@
CXX = @cxx@
CXXFLAGS = @cxxflags@
CPPFLAGS = @cppflags@

PREFIX = @prefix@
LDFLAGS = @ldflags@
LIBS = @libs@
OBJSUFFIX = @objsuffix@
SHLIBSUFFIX = @shlibsuffix@

CC1 = @cc1@
CC4 = @cc4@
MAKE_SHARED = @make_shared@
LINK = @link@

LN_S = @ln_s@

# Packaging

PACKAGE_NAME = @package_name@
PACKAGE_TARNAME = @package_tarname@
PACKAGE_VERSION = @package_version@
PACKAGE_VERSION_MAJOR = @package_version_major@

# Directory specific
SRC_BASE=..
XSEC_INCL=-I${SRC_BASE}/../include

LIBDIR=${SRC_BASE}/../lib
BINDIR=${SRC_BASE}/../bin
OBJDIR=${BINDIR}/obj

LDXSEC=-L${LIBDIR} -l${PACKAGE_TARNAME}

alltools: ${BINDIR}/xtest \
          ${BINDIR}/c14n \
          ${BINDIR}/checksig \
          ${BINDIR}/templatesign \
		  ${BINDIR}/txfmout \
		  ${BINDIR}/siginf \
		  ${BINDIR}/cipher \
		  ${BINDIR}/xklient

compile: ${OBJ_FILES}

#============================= xtest =============================

${OBJDIR}/xtest${OBJSUFFIX}: xtest/xtest.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/xtest: ${OBJDIR}/xtest${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $< $(LDXSEC) $(LIBS) -o $@

#============================== c14n =============================

${OBJDIR}/c14n${OBJSUFFIX}: c14n/c14n.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/c14n: ${OBJDIR}/c14n${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $< $(LDXSEC) $(LIBS) -o $@


#============================ checksig ===========================

${OBJDIR}/checksig${OBJSUFFIX}: checksig/checksig.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${OBJDIR}/AnonymousResolver${OBJSUFFIX}: checksig/AnonymousResolver.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${OBJDIR}/InteropResolver${OBJSUFFIX}: checksig/InteropResolver.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/checksig: ${OBJDIR}/checksig${OBJSUFFIX} ${OBJDIR}/AnonymousResolver${OBJSUFFIX} ${OBJDIR}/InteropResolver${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $^ $(LDXSEC) $(LIBS) -o $@

#========================== templatesign =========================

${OBJDIR}/templatesign${OBJSUFFIX}: templatesign/templatesign.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/templatesign: ${OBJDIR}/templatesign${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $< $(LDXSEC) $(LIBS) -o $@

#============================= txfmout ============================

${OBJDIR}/txfmout${OBJSUFFIX}: txfmout/txfmout.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/txfmout: ${OBJDIR}/txfmout${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $< $(LDXSEC) $(LIBS) -o $@

#============================= siginf =============================

${OBJDIR}/siginf${OBJSUFFIX}: siginf/siginf.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/siginf: ${OBJDIR}/siginf${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $< $(LDXSEC) $(LIBS) -o $@

#============================= cipher =============================

${OBJDIR}/cipher${OBJSUFFIX}: cipher/cipher.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${OBJDIR}/XencInteropResolver${OBJSUFFIX}: cipher/XencInteropResolver.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/cipher: ${OBJDIR}/cipher${OBJSUFFIX} ${OBJDIR}/XencInteropResolver${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $^ $(LDXSEC) $(LIBS) -o $@

#============================= xklient =============================

${OBJDIR}/xklient${OBJSUFFIX}: xklient/xklient.cpp
	${CC1} -c ${CPPFLAGS} ${XSEC_INCL} -o ${@} $<

${BINDIR}/xklient: ${OBJDIR}/xklient${OBJSUFFIX}
	$(LINK) $(LDFLAGS) $< $(LDXSEC) $(LIBS) -o $@

#============================= Clean =============================

distclean:
	rm -f Makefile.bak
	rm -f Makefile

# Include Library pattern rules

include ${SRC_BASE}/Makefile.incl
