# $Id: Makefile,v 1.7 1996/03/13 11:31:26 gaertner Exp gaertner $
# ----------------------------------------------------------------------

#
# Makefile for Output class and testers.
#
#

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

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

# de-comment this if you want a debug version:
#DBVERSION = -D XXX

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

# Groups of files:

# all noweb sources
NOWEBS	= output.nw outtest.nw blankoutput.nw asciioutput.nw

# root chunk name of headers
HEADERCHUNK	= header

# root chunk name of implementation
IMPLEMENTATIONCHUNK	= implementation

# all `WEB' sources (old)
#WEBS	= output.spc output.w outtest.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 = output


# Which program to make by default:
PROG	= outtest

# objects of this program:
OBJS 	= outtest.o output.o asciioutput.o

# objects to be released:
RELOBJS	= output.o asciioutput.o

#
RELHEADERS = output.h asciioutput.h

# C sources of this program:
CSRCES	= outtest.c output.c asciioutput.c

# these files are crap and may be deleted if we say `make clean'
REST	= dvidriv.prt output.aux output.idx output.log output.scn 	\
		output.tex output.toc outtest.aux outtest.idx		\
		outtest.log outtest.scn outtest.tex outtest.toc		\
		outtest.dvi output.dvi test.output			\
		asciioutput.aux asciioutput.idx asciioutput.log		\
		asciioutput.scn asciioutput.tex asciioutput.toc

# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# You probably don't need to change anything from here:
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# these are all the headers for the compiler
HEADERS = output.h asciioutput.h

# 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 = outtest

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

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) $(OBJECTS) $(CCFLAGS) -o $@

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

# make a copy of the specs
specs: output.spc
	$(CWEAVE) output.spc - output.tex
	$(LATEX) output.tex


# list all source code:

print:


# apply lint to all C sources:

lint:

# regression:
regression: $(PROG)
	outtest > 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:


# make a release
release: $(RELHEADERS) $(RELOBJS)
	cp $(RELHEADERS) ../include
	ar vrus ../libpretzel.a $(RELOBJS)



# ======================================================================
#
# $Log: Makefile,v $
# Revision 1.7  1996/03/13  11:31:26  gaertner
# Updated for use of new noweb ports of output.
#
# Revision 1.6  1995/04/26  17:35:37  gaertner
# You can make specs now to get a printed output of the
# specifications.
# The release and compile use lpretzel library.
# You can make a regression test now.
#
# Revision 1.5  1994/10/31  19:01:59  gaertner
# Now make bundle creates output.tar.
#
# Revision 1.4  1994/10/24  16:48:00  gaertner
# Now outtest.o isn't released anymore.
#
# Revision 1.3  1994/10/07  07:48:22  gaertner
# `make clean' will remove LaTeX intermediate products now.
#
# Revision 1.2  1994/10/05  18:43:11  gaertner
# First revision using the Makefile template.
#
#
