# $Id: Makefile,v 1.16 1997/07/29 00:55:14 dhb Exp $
# $Log: Makefile,v $
# Revision 1.16  1997/07/29 00:55:14  dhb
# Added delay2.o to OBJECTS
#
# Revision 1.15  1997/05/29 06:45:00  dhb
# Changes from Antwerp GENESIS 21e
#
#
# EDS21b revison: EDS BBF-UIA 96/08/02
# Added weight2
#
# Revision 1.14  1996/11/03 22:07:05  dhb
# Renamed hebbsynchan2.o to hebbsynchan3.o to avoid version
# mismatch problems.
#
# Revision 1.13  1996/11/01  22:49:47  dhb
# Changed synchan and hebbsynchan source file names back to
# synchan2.c and hebbsynchan2.c.  Necessary so correct patches
# can be generated against old versions.
#
# Revision 1.12  1996/07/23  18:33:29  venkat
# Added the segment directory to the include file search path
#
# Revision 1.11  1996/07/23  00:30:06  dhb
# Removed synchan2.o and hebbsynchan2.o from OBJECTS
#
# Revision 1.10  1996/05/23  22:59:18  dhb
# t3d/e port
#
# Revision 1.9  1995/11/02  01:42:41  venkat
# Replaced-/tmp-with-TMPDIR-macro
#
# Revision 1.8  1995/11/01  22:34:09  venkat
# Removed-install-target-dependencies
#
# Revision 1.7  1995/09/28  00:33:41  venkat
# Removed reference to hebbsynchan2.o
#
# Revision 1.6  1995/02/13  21:52:35  dhb
# Added @.h files to those removed by clean.
#
# Revision 1.5  1995/02/12  23:17:00  mvanier
# Removed -r$(RCSRELEASE) from %.h and %.c suffixes
#
# Revision 1.4  1995/02/12  23:06:49  mvanier
# Removed commented-out CFLAGS line with -g option
# Removed dependencies on $(SYS)/code_lib, $(SYS)/code_sym, $(SYS)/code_func
#
# Revision 1.3  1995/01/12  00:46:41  venkat
# Removed -Xs option to compile under Sun4
#
# Revision 1.2  1995/01/11  23:32:35  dhb
# Added checkout targets for RCS/*.[ch].
#
# Revision 1.1  1995/01/11  23:09:02  dhb
# Initial revision
#

#
# Makefile for newconnlib.o
#

LIBS 		=  	-lm
CPP 		= 	$(CPP) 
CFLAGS 		= 	$(COPT) -D$(MACHINE) $(DEC_HACK)
SIM 		= 	../sim
SYS 		= 	../sys
INTERP 		= 	../shell
SIMINCLUDE 	= 	-I. -I$(SYS) -I$(SIM) -I$(INTERP)
INSTALL_DIR =	$(INSTALL)
INSTALL_LIB 	= 	$(INSTALL_DIR)/lib
INSTALL_INCLUDE	= 	$(INSTALL_DIR)/include
INSTALL_STARTUP	= 	$(INSTALL_DIR)/startup
LIBRARY_NAME 	= 	newconn
FUNCTIONS 	= 	funcs
STARTUP		=	newconn.g
STRUCTURES 	= 	newconn_struct.h
EXT_HEADER	=	newconn_ext.h
LIBBUILD	=	$(LD)
LIBBUILDFLAGS	=	-r -o
LIBORDER	=	echo no lib ordering needed for
LIBEXT		=	o
TARGET_OBJ	=	newconnlib.$(LIBEXT)

default : $(TARGET_OBJ)


OBJECTS = 	\
		weight.o              \
		delay.o               \
		connect.o             \
		spikegen.o            \
		randomspike.o         \
		synaptic_event_list.o \
		synchan2.o             \
		hebbsynchan3.o         \
		getsyn.o              \
		misc_connfuncs.o      \
		weight2.o		\
		delay2.o

HEADERS = 	\
		newconn_defs.h	 \
		newconn_struct.h \
		newconn_ext.h	

HINESINCLUDE = -I../hines
SEGINCLUDE = -I../segment


$(OBJECTS) : $(HEADERS) 

.c.o:
	$(CC) $(CFLAGS) $(SIMINCLUDE) $(HINESINCLUDE) $(SEGINCLUDE) $< -c 

$(LIBRARY_NAME)_g@.c $(LIBRARY_NAME)_g@.h: $(STARTUP)
	- $(SYS)/code_g $(STARTUP) $(EXT_HEADER) $(LIBRARY_NAME)

# make the data structure section of the symbol table

$(LIBRARY_NAME)_d@.c : $(STRUCTURES)
	- $(CPP) $(SIMINCLUDE) $(HINESINCLUDE) $(SEGINCLUDE) $(STRUCTURES) $(TMPDIR)/$(STRUCTURES)
	- $(SYS)/code_sym $(TMPDIR)/$(STRUCTURES) $(LIBRARY_NAME) \
	  -I $(EXT_HEADER) -NI -o $(LIBRARY_NAME)_d@.c
	- rm $(TMPDIR)/$(STRUCTURES)

# make the function list section of the symbol table

$(LIBRARY_NAME)_f@.c : $(FUNCTIONS)
	- $(SYS)/code_func $(FUNCTIONS) $(LIBRARY_NAME) \
	  > $(LIBRARY_NAME)_f@.c

# make the library header function

$(LIBRARY_NAME)_l@.c : $(LIBRARY_NAME)_g@.c $(LIBRARY_NAME)_d@.c $(OBJECTS)
	- $(SYS)/code_lib $(LIBRARY_NAME) -o $(LIBRARY_NAME)_l@.c

SYMBOLTAB = $(LIBRARY_NAME)_d@.o $(LIBRARY_NAME)_g@.o $(LIBRARY_NAME)_l@.o

$(TARGET_OBJ): $(SYMBOLTAB) $(OBJECTS)
	$(LIBBUILD) $(LIBBUILDFLAGS) $(TARGET_OBJ) $(OBJECTS) $(SYMBOLTAB)
	$(LIBORDER) $(TARGET_OBJ)

install:
	(cp $(TARGET_OBJ) $(INSTALL_LIB))
	$(LIBORDER) $(INSTALL_LIB)/$(TARGET_OBJ)
	(cp *.h $(INSTALL_INCLUDE))

clean:
	-(rm -rf *.a *.o *@.[ch])
