
#*****************************************************************************
# FILE           : $Source: /usr/local/bv/SNNS/SNNSv4.0/configuration/RCS/toolstuff,v $
# SHORTNAME      : Makefile body
# SNNS VERSION   : 4.0
#
# PURPOSE        : Body of the SNNS tools Makefile
# NOTES          : Do not change Makefiles manually
#
# AUTHOR         : Michael Vogt
# DATE           : 25.4.94
#
# CHANGED BY     : 
# IDENTIFICATION : $State: Exp $ $Locker:  $
# RCS VERSION    : $Revision: 2.6 $
# LAST CHANGE    : $Date: 1995/05/11 09:20:45 $
#
#            Copyright (c) 1990-1995  SNNS Group, IPVR, Univ. Stuttgart, FRG
#
#*****************************************************************************

TOOLSBINDIR	= $(SNNSDIR)/tools/bin/$(MACHINENAME)
KERNELLIBDIR	= $(SNNSDIR)/kernel/bin/$(MACHINENAME)
KERNELSOURCES	= $(SNNSDIR)/kernel/sources

# -- C-Compiler Configuration --

CC              = $(COMPILER)
CPPFLAGS        = -I$(KERNELSOURCES)
CFLAGS          = $(CDEBUG) $(CCFLAGS) $(FPOPTIONS) $(CPPFLAGS)
CDEPFLG         = -MM

# -- Archive Configuration --

CP		= cp
PATHDEL		= /
AR              = ar
ARFLAGS 	= rc
RANLIB          = $(RLIB)

# -- Libraries --

LIBKERNEL	= $(KERNELLIBDIR)/libkernel.a $(KERNELLIBDIR)/libfunc.a

# -- Source files --
#
# important notes:
#
# NO_LIB_SOURCE:  each .c file produces one executable program
# USE_LIB_SOURCE: each .c file produces one executable program with 
#                 linked kernel libraries
# SNNS2C_SOURCE:  all .c files together produce one single program (snns2c) 
#                 with linked kernel libraries
#

# -- snns2c sources --

SNNS2C_SOURCE_C    = snns2c.c \
                     snns2clib.c

SNNS2C_SOURCE_H    = templates.h \
		     functions.h \
                     snns2clib.h

SNNS2C_SOURCE      = $(SNNS2C_SOURCE_C) \
                     $(SNNS2C_SOURCE_H)

# -- single programs which use kernel libraries --

USE_LIB_SOURCE_C   = netlearn.c \
                     bignet.c \
                     netperf.c \
                     snnsbat.c \
                     feedback-gennet.c \
                     convert2snns.c

USE_LIB_SOURCE_H   = snnsbat.h

USE_LIB_SOURCE     = $(USE_LIB_SOURCE_C) \
                     $(USE_LIB_SOURCE_H)

# -- single programs --

NO_LIB_SOURCE_C    = analyze.c \
                     pat_sel.c \
                     mkhead.c \
                     mkout.c \
                     mkpat.c
NO_LIB_SOURCE      = $(NO_LIB_SOURCE_C)

# -- all sources --

SOURCES            = $(USE_LIB_SOURCE) \
                     $(NO_LIB_SOURCE) \
                     $(SNNS2C_SOURCE)

# -- Modul files --

MODULES            = $(USE_LIB_SOURCE_C) \
                     $(NO_LIB_SOURCE_C) \
                     $(SNNS2C_SOURCE_C)

# -- Object files --

USE_LIB_OBJECTS    = $(USE_LIB_SOURCE_C:.c=.o)
NO_LIB_OBJECTS     = $(NO_LIB_SOURCE_C:.c=.o)
SNNS2C_OBJECTS     = $(SNNS2C_SOURCE_C:.c=.o)

# -- Programs  --

USE_LIB_PROGS      = $(USE_LIB_SOURCE_C:.c=)
NO_LIB_PROGS       = $(NO_LIB_SOURCE_C:.c=)
SNNS2C_PROGS       = snns2c

# -- Rules --

.KEEP_STATE:

default: $(NO_LIB_PROGS) $(USE_LIB_PROGS) $(SNNS2C_PROGS)

all: $(NO_LIB_PROGS) $(USE_LIB_PROGS) $(SNNS2C_PROGS)

$(NO_LIB_PROGS): $(NO_LIB_OBJECTS)
	$(CC) $@.o -lm -o $@

$(USE_LIB_PROGS): $(USE_LIB_OBJECTS) $(LIBKERNEL)
	$(CC) $@.o $(LIBKERNEL) -lm $(LEXLIB) -o $@

$(SNNS2C_PROGS): $(SNNS2C_OBJECTS)
	$(CC) $(SNNS2C_OBJECTS) $(LIBKERNEL) -lm $(LEXLIB) -o $@

install: $(NO_LIB_PROGS) $(USE_LIB_PROGS) $(SNNS2C_PROGS)
	-strip $(NO_LIB_PROGS)
	$(CP) $(NO_LIB_PROGS) $(TOOLSBINDIR)
	-strip $(USE_LIB_PROGS)
	$(CP) $(USE_LIB_PROGS) $(TOOLSBINDIR)
	-strip $(SNNS2C_PROGS)
	$(CP) $(SNNS2C_PROGS) $(TOOLSBINDIR)

list:
	cat $(SOURCES) > toolssrc.all

clean:
	/bin/rm -f $(USE_LIB_OBJECTS) $(USE_LIB_PROGS)
	/bin/rm -f $(NO_LIB_OBJECTS) $(NO_LIB_PROGS)
	/bin/rm -f $(SNNS2C_OBJECTS) $(SNNS2C_PROGS)

tarfile:
	tar cvf tools.tar $(SOURCES) Makefile*
	compress tools.tar

depend:
	$(CC) $(CDEPFLG) $(CPPFLAGS) $(MODULES) > tools.ddt

# -- Dependencies --

include tools.ddt
