# $Id: PTMakefile,v 1.8 2000/02/06 01:15:10 carlo Exp $
#
# ProtoType Test 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
#

include $(PROTODIR)/common/PTMakefile

MAIN=$(OBJS:.o=)

%.o: %.c Makefile $(PROTODIR)/Makedefs.h
	$(CC) $(CFLAGS) $(IFLAGS) -I- $(SYSTEMINCLUDEFLAGS) -c $< -o $@

%.o: %$(CPPEXT) Makefile $(PROTODIR)/Makedefs.h
	$(CXX) $(CXXFLAGS) $(IFLAGS) -I- $(SYSTEMINCLUDEFLAGS) -c $< -o $@

build:: .depend-timestamp subdirs $(MAIN)

# The trick with the 'ifeq' is necessary because '$@' isn't understood as dependency.
# Otherwise we could have used '$@' instead of $(EXECUTABLE_NAME) everywhere.
ifeq ($(EXECUTABLE_NAME),)
$(MAIN): phony
	@$(MAKE) EXECUTABLE_NAME=$@ $@
phony:
else
# Assume all libraries are up to date
$(MAIN): $(EXECUTABLE_NAME).o $(EXTRA_OBJS)
ifneq ($(CXXSRC),)
	$(CXX) $(LDFLAGS) $(EXECUTABLE_NAME).o $(EXTRA_OBJS) $(STATICLIBS) $(LIBFLAGS) $(SHAREDLIBS) -o $(EXECUTABLE_NAME)
else
	$(CC) $(LDFLAGS) $(EXECUTABLE_NAME).o $(EXTRA_OBJS) $(STATICLIBS) $(LIBFLAGS) $(SHAREDLIBS) -o $(EXECUTABLE_NAME)
endif
	$(CHMOD) $(MODE) $(EXECUTABLE_NAME)
endif

clean::
	$(RM) -f $(MAIN) gmon.out
