## Copyright (c) 1999 G. Adam Stanislav
## All rights reserved.
##
## This is a makefile for Graphic Counter Language 3.0
##
## NOTE:
##
##	On systems that allow it, GCLUSELONGLONG is defined. This makes the
##	count an unsigned long long, a gcc extension that gives the counter
##	64 bits to work with on 32-bit systems, thus permitting the count
##	to grow to quintillions.
##
## Use maximum optimization. On busy web sites we want gracula to work as
## fast as possible. However, these options may not work with a compiler
## other than gcc. If that is the case, comment them out.
CFLAGS+= -O3 -fexpensive-optimizations -frerun-cse-after-loop \
	-fomit-frame-pointer
## Comment out the next line if you only want 32-bit counters,
## or if you get linking errors (since it, too, may only work with gcc):
CFLAGS+=	-DGCLUSELONGLONG
## Comment out or change the next two lines for a different random number
## generator (note that both are prime numbers):
CFLAGS+=	-DGCLRNDMUL=19997
CFLAGS+=	-DGCLRNDADD=2199931
## Uncomment the next line when the C9x version of ANSI C is implemented:
#CFLAGS+=	-DGCLUSEC9X

PREFIX?=	/usr/local
INSTALL?=	install
LN?=	ln
RM?=	rm

all:	gracula sec2000

gracula:	gcl.o gd.o
	${CC} gcl.o gd.o -lc -lm -o gracula -Xlinker -s

gcl.o:	gcl.c gcldefaults.c gcl.h gcldefaults.h

gd:	gd.c mtables.c gd.h

install:	gracula sec2000
	${INSTALL} -c gracula ${PREFIX}/bin
	${INSTALL} -c sec2000 ${PREFIX}/bin

sec2000:	sec2000.c
	${CC} -o sec2000 sec2000.c -Xlinker -s

gcl:	install
	${LN} -fs ${PREFIX}/bin/gracula ${PREFIX}/bin/gcl

clean:
	${RM} -f *.o gracula sec2000

