# $Id: Makefile,v 2.0 1996/12/16 16:44:14 gaertner Exp $
# ----------------------------------------------------------------------

#
# Makefile for Attribute class and testers.
#

# ----------------------------------------------------------------------
# Here are the things that determine the configuration:
# ----------------------------------------------------------------------

# what compiler do we use?
CC 	= g++

# compiler flags:
CFLAGS	= -g -I../include -L.. -lpretzel

# Groups of files:

# all noweb sources
NOWEBS	= attr.nw attrtest.nw

# root chunk name of headers
HEADERCHUNK	= header

# root chunk name of implementation
IMPLEMENTATIONCHUNK	= implementation

# all `WEB' sources (old)
#WEBS	= attr.spc attr.w attrtest.w

# all other program WEB sources (old)
ETCWEBS	=

# all TeX documents
TEXDOCS	=

# all other files for the distribution
DISTFILES = Makefile test.output.correct

# name of the distribution package
DISTNAME =


# Which program to make by default:
PROG	= attrtest

# objects of this program:
OBJS 	= attrtest.o attr.o

# objects to release
RELOBJS	= attr.o

# headers created
HEADRS	= attr.h

# C sources of this program:
CSRCES	= attrtest.c attr.c

# these files can be deleted too if we say `make clean'
REST	= attr.aux attr.idx attr.log attr.scn attr.tex attr.toc	\
		attrtest.aux attrtest.idx attrtest.log attrtest.scn \
		attrtest.tex attrtest.toc attr.dvi test.output 	\
		attrtest.dvi

# ----------------------------------------------------------------------
# these are all the headers for the compiler
HEADERS = $(HEADRS)

# these are all the objects for the compiler
OBJECTS = $(OBJS)

# these are all the C sources to make the objects
CSOURCES = $(CSRCES)

# These are all of the flags for the compiler:
CCFLAGS = $(CFLAGS) $(DBVERSION)

# these are all C sources that might possibly crop up
ALLCSRCS = $(CSOURCES)

# these are all object files that may appear
ALLOBJS = $(OBJECTS)

# these are all header files produced from WEBs that may appear
ALLHEADERS = $(HEADERS)

# these are all the executables that could be produced
ALLPROGS = attrtest

# ----------------------------------------------------------------------

CWEAVE 	= cweave
CTANGLE	= ctangle
NOTANGLE= notangle
NOWEAVE	= noweave
TEX 	= tex
DVIPS 	= dvips
REMOVE	= rm -f
MAKE	= make
LEX	= flex -d
#LEX	= lex
YACC	= bison
#YACC	= yacc
TEX	= tex
LATEX	= tex-it latex

# ----------------------------------------------------------------------

.SUFFIXES:	.nw .spc .ps .tex .dvi .w .c .o .h

# overall rules:

.nw.tex:
	$(NOWEAVE) -delay -index $*.nw > $*.tex

.w.tex:
	$(CWEAVE) $*

.tex.dvi:
	$(LATEX) $<

.w.dvi:
	$(MAKE) $*.tex
	$(MAKE) $*.dvi

.dvi.ps:
	$(DVIPS) $< -o $*.ps

.nw.h:
	$(NOTANGLE) -L -R$(HEADERCHUNK) $*.nw > $*.h

.nw.c:
	$(NOTANGLE) -L -R$(IMPLEMENTATIONCHUNK) $*.nw > $*.c

.w.c:
	$(CTANGLE) $*

.spc.h:
	$(CTANGLE) $*.spc - $*.h

#.w.o:
#	$(MAKE) $*.c
#	$(MAKE) $*.o

.c.o:
	$(CC) $(CCFLAGS) -c $*.c



# ----------------------------------------------------------------------

# regenerate whole system:


system: $(PROG)


$(PROG): $(OBJECTS)
	$(CC) $(CCFLAGS) -o $@ $(OBJECTS)

$(OBJS): $(HEADERS) $(CSRCES)



# list all source code:

#print:


# apply lint to all C sources:

#lint:


# regression:
regression: $(PROG)
	attrtest > test.output
	if  diff test.output test.output.correct;		\
		then echo "Regression test is fine."; 		\
		else echo "Regression test failed.";		\
		fi


# remove all intermediate products but not executables or sources!

clean:
	$(REMOVE) $(ALLOBJS) $(ALLCSRCS) $(ALLHEADERS) $(REST)


# remove everything that doesn't belong to original source:

clobber: clean
	$(REMOVE) $(ALLPROGS)


# bundle source files together into an archive:

#bundle:
#	tar cf $(DISTNAME).tar 			\
#		$(WEBS) $(ETCWEBS) $(TEXDOCS) $(DISTFILES)


# copy executables into PATH directories, et al.

#install:


# release headers and object code:
release: $(HEADERS) $(RELOBJS)
	cp $(HEADERS) ../include
	ar vrus ../libpretzel.a $(RELOBJS)




# ======================================================================
#
# $Log: Makefile,v $
# Revision 2.0  1996/12/16 16:44:14  gaertner
# *** empty log message ***
#
# Revision 1.6  1995/04/26  17:22:25  gaertner
# Making dvi uses LaTeX now.
# You can make a regression test now.
# Compiling and releasing use lpretzel library.
#
# Revision 1.5  1994/10/31  19:00:05  gaertner
# Now make bundle works and creates attr.tar
#
# Revision 1.4  1994/10/24  16:46:09  gaertner
# Now the attrtest.o object isn't released.
#
# Revision 1.3  1994/10/07  10:36:46  gaertner
# Now all LaTeX intermediates will be removed too if you make clean.
#
# Revision 1.2  1994/10/04  18:40:44  gaertner
# Initial revision of the simple granny version.
#
#
