Make file

# Things you might want to put in ENV and LENV:
# -Dvoid=int		compiler lacks void
# -DCHARBITS=0377	compiler lacks unsigned char
# -DSTATIC=extern	compiler dislikes "static foo();" as forward decl.
# -DREGISTER=		machines with few registers for register variables
# -DUTZOOERR		have utzoo-compatible error() function and friends
ENV = -DSTATIC=extern -DREGISTER= -DUTZOOERR
LENV = -Dvoid=int -DCHARBITS=0377 -DREGISTER= -DUTZOOERR
# Things you might want to put in TEST:
# -DDEBUG		debugging hooks
# -I.			header files in current directory
TEST = -DDEBUG
# Things you might want to put in PROF:
# -Dstatic='/* */'	make everything global so profiler can see it.
# -p			profiler
PROF =
CFLAGS = -O $(ENV) $(TEST) $(PROF)
LINTFLAGS = $(LENV) $(TEST) -ha
LDFLAGS = -i
OBJ = xxx
LSRC = xxx
DTR = README dMakefile tests tests.good xxx.c
xxx:	xxx.o
	$(CC) $(CFLAGS) $(LDFLAGS) xxx.o -o xxx
xxx.o:	xxx.h
lint:	$(LSRC)
	lint $(LINTFLAGS) $(LSRC) | tee lint
r:	xxx tests tests.good	# Regression test.
	xxx <tests >tests.new
	diff -h tests.new tests.good && rm tests.new
# Prepare good output for regression test -- name isn't "tests.good"
# because human judgement is needed to decide when output is good.
good:	xxx tests
	xxx <tests >tests.good
dtr:	r $(DTR)
	makedtr $(DTR) >dtr
dMakefile:	Makefile
	sed '/^L*ENV=/s/ *-DUTZOOERR//' Makefile >dMakefile
clean:
	rm -f *.o lint tests.new dMakefile dtr core mon.out xxx


Contents C program, separate input files References