# Makefile for Ptolemy graphical interface edg 5/23/90
# Version identification:
# @(#)makefile	2.37	12/8/92
#
# Copyright (c) 1991 The Regents of the University of California.
#			All Rights Reserved.
# Written by: J. Buck
#
# This makefile may be copied and modified to make your own version of
# pigiRpc, with a different set of compiled-in stars or support for a
# different set of domains.  If you do this, change ROOT to point to
# the root of the Ptolemy source tree, change OBJDIR to point to
# the directory containing the object files, and revise ALLSTARS and
# ALLTARGETS to specify the stars and targets you wish to include
# (using symbols defined in the stars.mk file or your own additions).

# root of source tree
ROOT	      = ../..
# Path (absolute or relative) to the object directory root
OBJDIR=..
# VPATH points to the "real" source directory
VPATH         = $(ROOT)/src/pigiRpc

# get configuration info
CONFIG=$(ROOT)/config-$(ARCH).mk
include $(CONFIG)

# Include information on all stars and targets.

include $(ROOT)/stars.mk

# Oct Tools libraries.
OCTLIBS = -loh -lrpc -llist -ltr -lutility -lst -lerrtrap -luprintf -lport

# Entire library list.
# note that -lrpc is searched twice, before and after -lpigi.
# (it is also in OCTLIBS).
LIBS	= $(STAR_LIBS) -lrpc -lpigi -lgantt -lptolemy $(OCTLIBS) \
		$(LX11) $(SYSLIBS)

# We use "frozen" Oct libraries so we do not depend on them.  Mistake?
LIBFILES = $(STAR_LIBFILES) \
	$(LIBDIR)/libpigi.a $(LIBDIR)/libptolemy.a $(LIBDIR)/libgantt.a

VERSION=0.4.1

ALLSTARS = $(SDFSTARS) $(CGCSTARS) $(CG96STARS) $(CG56STARS) $(CGSTARS) \
	$(DDFSTARS) $(CGDDFSTARS) $(THORSTARS) $(DESTARS)
ALLTARGETS =	$(SDFTARGETS) $(CGTARGETS) $(CGCTARGETS) \
	$(CG56TARGETS) $(CG96TARGETS)

# Rule for compiling with g++
.SUFFIXES: .cc
.cc.o:
	$(GNU) $(GPPFLAGS) -c $<

all:	makefile pigiRpc

# The "sed" command is used because BSD and SysV versions of echo are
# different; there is no portable way to use echo to get "\n" in the
# output.  Yuk.

pigiRpc:	pigiMain.o defpalettes.o $(LIBFILES) $(ALLSTARS) $(ALLTARGETS)
	rm -f pigiRpc
	echo char '*pigiVersion = "Version:' $(VERSION) \
		'%created' `date` '";' | sed 's/%/\\n/' > version.c
	$(CC) -c version.c
	$(LINKER) $(LINKFLAGS) -L$(OCTLIBDIR) $(X11LIBDIR) version.o \
		pigiMain.o defpalettes.o $(ALLSTARS) $(ALLTARGETS) $(LIBS) \
		-o pigiRpc

pigiRpc.debug:	pigiMain.o defpalettes.o $(LIBFILES) $(ALLSTARS) $(ALLTARGETS)
	rm -f pigiRpc.debug
	echo char '*pigiVersion = "Version:' $(VERSION) \
		'(with debug symbols)' \
		'%created' `date` '";' | sed 's/%/\\n/' > debugVersion.c
	$(CC) -c debugVersion.c
	$(LINKER) $(LINKFLAGS_D) -L$(OCTLIBDIR) $(X11LIBDIR) debugVersion.o \
		pigiMain.o defpalettes.o $(ALLSTARS) $(ALLTARGETS) $(LIBS) \
		-o pigiRpc.debug

DESTBIN = $(BINDIR)/pigiRpc

$(DESTBIN):	pigiRpc
		@echo Installing pigiRpc
		rm -f $(DESTBIN)
		ln pigiRpc $(DESTBIN)

install: makefile $(DESTBIN)

# "make clean" removes .o files and other cruft
clean:
		rm -f *.o core *~ *.bak *#

# even cleaner
realclean:	clean
		rm -f pigiRpc pigiRpc.debug

# "make sources" will do SCCS get on anything where SCCS file is newer.
sources:	defpalettes.c pigiMain.cc

depend:	
		@echo no dependencies in pigiRpc directory

sccsinfo:
		sccs info
