# $Id: PTMakefile,v 1.1 1999/03/11 15:00:31 carlo Exp $
#
# ProtoType Template Instantiation Makefile
#
# Copyright (C) 1999
#
# 1024/624ACAD5 1997/01/26 Carlo Wood, Run on IRC <carlo@runaway.xs4all.nl>
# Key fingerprint = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
#
# All rights reserved.
#
# See the file LICENSE for copyright information.
#
# This file may be distributed under the terms of the Q Public License 1.0
# as defined by Troll Tech AS of Norway and appearing in the file LICENSE.QPL
# included in the packaging of this file.
#
#-----------------------------------------------------------------------------
#
# Edit $PROTODIR/Makedefs.h to get it working for your system
#

.PHONY: templ-inst real-clean templ-inst-clean
.SUFFIXES:

templ-inst: depend
	@( \
	  if [ -z "${LIBRTESTMAKEFILE}" ]; then \
	    APPDIR="${APPDIR}" APPDIR_OBJS="${APPDIR_OBJS}" ${PROTODIR}/templ-inst/inst-all-templ build; \
	  else \
	    for i in ${MAIN}; do \
	      APPDIR="${APPDIR}" APPDIR_OBJS="$$i.o" ${PROTODIR}/templ-inst/inst-all-templ $$i; \
	    done \
          fi )

real-clean:: clean templ-inst-clean
	@( \
	  BASENAMES=`echo "${APPDIR_OBJS}" | sed -e 's/\.o$$//' -e 's/\.o / /g'`; \
	  for i in $$BASENAMES; do \
	    if [ -e "$$i.tig" ]; then \
	      echo "${RM} -f \"$$i.tig\""; \
	      ${RM} -f "$$i.tig"; \
	      ${MV} $$i.cc $$i.cc.bak || exit -1; \
	      grep -v '^#include ".*\.tig"$$' $$i.cc.bak > $$i.cc || exit -1; \
	      ${RM} $$i.cc.bak; \
	    fi \
	  done )

templ-inst-clean::
	${RM} -f log tmpfile nm_out *.log
