#
#
# Generic Makefile -- architecture level
# This is a template makefile that is used in making Heuris Logic projects
#
#
#




#
# Compiler and linker options
#
CC = gcc
CFLAGS = -c -I.
#CFLAGS = -c -I. -DDEBUG_BUFFVID -DDEBUG
#CFLAGS = -c -I. -DDEBUG_BUFFAUD -DDEBUG
#CFLAGS = -c -I. -DDEBUG_BUFF -DDEBUG
#CFLAGS = -c -I.
LINK = $(CC)
LDFLAGS = -o
#LIBS =


#
# Basic rules
#
.c.o:
	$(CC) $(CFLAGS) $<
	

#
# Definitions
#
MAKEBIN = gnumake
TRANSPORTFILE = cdisys.lha # Archive to create when making a distribution
ARCHIVER = lha # Archiver, lha or tar or whatever
ARCH_OPS = a # archiver options
MAKEFILE = Makefile.cdisys.portable #actual name of makefile in RCS
BINARYNAME = cdisys
PORTABLEDIR = ../portable
INSTALLDIR = /home/heuris/bin
INSTALLMODE = 755


#
# List of all source files, include files, pictures etc
#
CFILES = 	main.c \
			sysdrain.c\
			cdisys.c \
			outbits.c\
			strstrn.c

INCFILES =	outbits.p \
			cdisys.p \
			strstrn.p \
			cdisys.h \
			bits.h
OTHERFILES =
OBJS = $(CFILES:.c=.o)
DISTFILES =	$(CFILES) \
			$(INCFILES) \
			$(OTHERFILES)

all:
	@echo "$(MAKEBIN) [dist|clean|objects|depend|binary]"

depend: $(CFILES)
	mkdep $(CFLAGS) $(CFILES)

#
# Create the binary
#
binary: $(BINARYNAME)

$(BINARYNAME): objects
	$(LINK) $(LDFLAGS) $@ $(OBJS) $(LIBS)


#
# Update all the necessary objects
#
objects: $(OBJS)

#
# Commands to create distribution media so that code can be compiled elsewhere
# 
dist: clean makedist

makedist: $(DISTFILES)
	$(ARCHIVER) $(ARCH_OPS) $(TRANSPORTFILE) $? Makefile 

install:
	cp $(BINARYNAME) $(INSTALLDIR)
	chmod $(INSTALLMODE) $(INSTALLDIR)/$(BINARYNAME)
#
# Clean everthing up
#
clean:
	rm -i $(DISTFILES) $(TRANSPORTFILE) $(OBJS)


#####
# include dependencies
# If no support on system to auto gen these then create by hand.
#####
#include .depend
