#############################################################################
#       $Id: GNUmakefile,v 1.14 1996/08/05 16:14:58 rich Exp $
# $Revision: 1.14 $
#     $Date: 1996/08/05 16:14:58 $
#   $Author: rich $
#    $State: Exp $
#   $Locker:  $
#
# PROJECT:	TCA
#
# FILE:		GNUmakefile
#		Based on Erebus prototypical Makefile
#		Makefile.proto,v 1.1 1992/06/16 22:50:21 jwest Exp 
#
# DESCRIPTION:
# Makes the devUtils library and other utilities.
#
# EXPORTS:
#	The following targets are available as part of Makefile.std:
#		all bins libs privs objs
#		clean install
#		lint depend
#
# HISTORY:
#
# $Log: GNUmakefile,v $
# Revision 1.14  1996/08/05  16:14:58  rich
# Added Brooke Wallace's changes to get devUtils to work with the access bus.
#
# Revision 1.13  1996/02/11  21:35:36  rich
# Updated GNUmakefiles for faster complilation.  Use FAST_COMPILE=1 for
# routine recompiles.
#
# Revision 1.12  1996/02/10  23:38:40  rich
# Added RWI's paramter parsing routines.
#
# Revision 1.11  1996/01/12  00:55:41  rich
# Simplified GNUmakefiles. Fixed header include problem with release 8.3.
#
# Revision 1.10  1995/10/07  19:11:33  rich
# Pre-alpha release of tca-8.2.
# Added PROJECT_DIR. Changed devIsConnected to devHasFd.
#
# Revision 1.9  1995/07/30  03:50:02  rich
# Fix for output parsing routine.  Compile utils with -g.
#
# Revision 1.8  1995/07/08  17:52:26  rich
# Linux Changes.  Also added GNUmakefile.defs.
#
# Revision 1.7  1995/07/06  21:23:28  rich
# Solaris and Linux changes.
#
# Revision 1.6  1995/06/14  03:25:52  rich
# Added DBMALLOC_DIR.
# Fixed problems with multiple connections.
#
# Revision 1.5  1995/04/09  20:33:38  rich
# Added /usr/local/include and /usr/local/lib to the paths for compiling
# for sunOS machines. (Support for new vendor OS).
# Added EZX_WaitForButtonIn to wait for a use to push the mouse button
# over a widget.  Useful for teleporting robots.
#
# Revision 1.4  1995/04/07  05:11:03  rich
# Fixed GNUmakefiles to find the release directory.
# Moved all system includes into libc.h
# Moved global variables into the c files and got rid of #define DECLARE_...
# Now works with xavier stuff.
#
# Revision 1.3  1995/04/04  19:48:03  rich
# Added sgi support.
# Changed setAlarm to setTimer.
# Numerous improvements and bug fixes in devUtils.
#
# Revision 1.2  1995/04/04  18:11:52  rich
# Added support for compiling on sgi machines.  Use "gmake -k CC=cc install"
#
# Revision 1.1  1995/03/30  15:53:14  rich
# DBMALLOC works.  To use "gmake -k -w DBMALLOC=DBMALLOC install"
# Added ezx library and the devutils library.
#
#
#############################################################################

#############################################################################
# Module Configuration Macros
#############################################################################

PROJECT_DIR	= /afs/cs/project/TCA/release/alpha

INSTALL_DIR	= ..
ifndef BASE_DIR
BASE_DIR	:= $(shell cd $(INSTALL_DIR);/bin/pwd)
endif
MODULE_DIR	= utils
PROJECT		= tca
MODULE		= tca
SUBDIRS		=
DEPEND_FILE	= GNUmakefile.$(THIS_MACHINE)
DEPEND_PREFIX	= $(ODIR)/ 

#############################################################################
# Where are the standard files?
#############################################################################

ifndef FAST_COMPILE
PWD 	:= $(shell /bin/pwd)
endif

ifndef STD_FILE
STD_FILE := $(shell ls $(BASE_DIR)/etc/GNUmakefile.std | grep -v "not found")
ifeq ($(STD_FILE),)
STD_FILE := $(PROJECT_DIR)/etc/GNUmakefile.std
endif
DEFS_FILE := $(shell ls $(BASE_DIR)/etc/GNUmakefile.defs | grep -v "not found")
ifeq ($(DEFS_FILE),)
DEFS_FILE := $(PROJECT_DIR)/etc/GNUmakefile.defs
endif
endif

##########
# Include standard definitions
##########

include $(DEFS_FILE)

##########
# Override defaults here.
##########

CFLAGSD_	= -g -O2

LIBRARIES	= -ltca -lezx -lDevUtils -lXt -lXaw -lXmu -lXext -lX11 \
		$(LIBS_$(THIS_OS)) -lm $(LIBS_$(DBMALLOC))

##########
# File Definition Macros.  Deletion of generated files assumed
#    to be o.k.  Source files will never be deleted.
##########

# Generated files - installed
PUBLIC_BINS		= 
PUBLIC_LIBS		= libDevUtils.a libezx.a
PUBLIC_LINTS		= 

MODULE_LIBS		= 
MODULE_LINTS		= 

# Source files - installed
PUBLIC_INCS		= 
PUBLIC_MANS		= 
PUBLIC_DOCS		= 

MODULE_INCS		= devUtils.h stdinDev.h tcaDev.h x11Dev.h \
			handlers.h timeUtils.h ezx.h cursorx.h \
			x11Utils.h simDev.h devConfig.h

MODULE_DOCS		= 

INCS			= $(MODULE_INCS) $(PUBLIC_INCS)

# Generated files - not installed
PRIVS		= testConfig

_DEV_OBJ	= devUtils.o stdinDev.o tcaDev.o x11Dev.o timeUtils.o \
		handlers.o x11Utils.o simDev.o devConfig.o

_EZX_OBJ	= ezx.o cursorx.o

DEV_OBJS            = $(patsubst %,$(ODIR)/%,$(_DEV_OBJ))

EZX_OBJS            = $(patsubst %,$(ODIR)/%,$(_EZX_OBJ))

OBJS            = $(DEV_OBJS) $(EZX_OBJS)

# Source files - not installed

SRCS		= timeUtils.c devUtils.c stdinDev.c tcaDev.c x11Dev.c \
		  handlers.c ezx.c cursorx.c x11Utils.c simDev.c devConfig.c\
		  testConfig.c headerTest.cc

PRIVATE_INCS	= 

MISC		= GNUmakefile README testConfig.param

##########
# Default Target
##########

all:: srcs libs bins privs

##########
# User Defined Targets
##########

# Define rules for all files listed in BINS, LIBS, and LINTS in this section.
# Example executable, object, library, and combined objects are shown below:
#
#  $(BDIR)/sample: file1.o file2.o $(LIBDEP)
#	$(LINK.c) -o $@ file1.o file2.o $(LIBRARIES)
#
#  $(ODIR)/alternateName.o: file1.c
#	$(COMPILE.c) -o $@ file1.c
#
#  $(LDIR)/libsample.a: file1.o file2.o
#	-$(RM) $@
#	$(AR) $(ARFLAGS) $@ file1.o file2.o
#	$(RANLIB) $@
#
#  $(ODIR)/combined.o: $(ODIR)/part1.o $(ODIR)/part2.o
#	$(LD) -r -o $@ $(ODIR)/part1.o $(ODIR)/part2.o; chmod a-x $@

$(LDIR)/libDevUtils.a: $(DEV_OBJS)
	$(RM) $@
	$(AR) $(ARFLAGS) $@ $(DEV_OBJS)
	$(RANLIB) $@

$(LDIR)/libezx.a: $(EZX_OBJS)
	$(RM) $@
	$(AR) $(ARFLAGS) $@ $(EZX_OBJS)
	$(RANLIB) $@

$(BDIR)/testConfig: $(ODIR)/testConfig.o $(LIBDEP)
	$(LINK.c) -o $@ $(ODIR)/testConfig.o  $(LIBRARIES)

##########
# Include standard target definitions and RCS rules
##########

include $(STD_FILE)
