# $Id: PTMakefile,v 1.5 2000/07/11 23:50:31 carlo Exp $
#
# ProtoType Template Instantiation Makefile
#
# Copyright (C) 1999-2000, by
#
#   Carlo Wood, Run on IRC <carlo@alinoe.com>
#   RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
#   Fingerprint16 = 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 \
	    list='$(MAIN)'; for i in $$list; 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$(CPPEXT) $$i$(CPPEXT).bak || exit -1; \
	      grep -v '^#include ".*\.tig"$$' $$i$(CPPEXT).bak > $$i$(CPPEXT) || exit -1; \
	      $(RM) $$i$(CPPEXT).bak; \
	    fi \
	  done )

templ-inst-clean::
	$(RM) -f log tmpfile nm_out *.log
