# $Id: Makefile,v 2.1 1998/12/03 10:57:53 felix Exp $
# ----------------------------------------------------------------------

#
# Makefile for pretzel-it
#
# It's not much of a Makefile. It's mainly for making a release
# and testing.
#
# (Note that the .tex.dvi implicit rule uses LaTeX instead of TeX)

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

# what compiler do we use?
CC 	= CC

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

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


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

# Groups of files:

# all `WEB' sources
WEBS	=

# all other program WEB sources
ETCWEBS	=

# all TeX documents
TEXDOCS	=

# all other files for the distribution
DISTFILES =

# name of the distribution package
DISTNAME =


# Which program to make by default:
PROG	= pretzel-it

# objects of this program:
OBJS 	= dummy

# C sources of this program:
CSRCES	=

# all stuff to be removed too:
OTHERCRAP = ptokdefs.h test.l test.y test.lex.c test.lex.o test.tab.c 	\
		test.tab.o test.y testpp

# ----------------------------------------------------------------------
# these are all the headers for the compiler
HEADERS =

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

# these are all the executables that could be produced
ALLPROGS = $(PROG)

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

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

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

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

# overall rules:

.w.tex:
	$(CWEAVE) $*

.tex.dvi:
	$(LATEX) $<

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

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

.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)
	echo You can only make regression here
#	$(CC) $(OBJECTS) $(CCFLAGS) -o $@

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



# list all source code:

print:


# apply lint to all C sources:

lint:


# remove all intermediate products but not executables or sources!

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


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

clobber: clean


# bundle source files together into an archive:

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

# make a regression test:
regression:
	./pretzel-it -h
	./pretzel-it -v test testpp

#	if { diff pascal.l pascal.correct.l && 		\
#		diff pascal.y pascal.correct.y; } 	\
#		then echo "Regression test is fine.";	\
#	else echo "Regression test failed.";		\
#	fi


# copy executables into PATH directories, et al.

release:
	cp $(PROG) ../bin




# ======================================================================
#
# $Log: Makefile,v $
# Revision 2.1  1998/12/03 10:57:53  felix
# added ./ to invocations of pretzel-it
#
# Revision 2.0  1996/12/16 17:38:32  gaertner
# release 2.0
#
# Revision 1.2  1996/02/06  19:24:31  gaertner
# Added a few small things to be able to simply make a regression test.
#
# Revision 1.1  1996/02/06  18:22:36  gaertner
# Initial revision
#
