#!/usr/bin/make

# Makefile - Compile Program datagen (Data Generator)
# Version 1.4.0
# Copyright (C) 1999-2005  dondalah@ripco.com (Dondalah)

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to:

# 	Free Software Foundation, Inc.
# 	59 Temple Place - Suite 330
# 	Boston, MA  02111-1307, USA.

# To compile datagen for a non-Intel platform:
# 	make nonintel.mak

# To de-install datagen:
# 	make clean

OBJ=rndinit.o \
	rnd.o \
	rndpwr.o \
	rndnum.o \
	rndfrac.o \
	getmd5.o \
	md5c.o \
	greg2jd.o \
	jd2greg.o \
	astrint.o \
	datagen.tab.o \
	lex.yy.o

CFLAGS=-c -Wall -O6

all:		libdg.a datagen

datagen:	$(OBJ)
	gcc -Wall -O6 $(OBJ) -o datagen -ll -lfl -lm

libdg.a:	$(OBJ)
	rm -f libdg.a
	ar r libdg.a $(OBJ)

datagen.tab.o:		datagen.tab.c
	gcc $(CFLAGS) datagen.tab.c

lex.yy.o:	lex.yy.c
	gcc $(CFLAGS) lex.yy.c

datagen.tab.c:		datagen.y
	bison -d datagen.y
	# change YYDEBUG to 1 to debug datagen.y

lex.yy.c:	datagen.l
	flex datagen.l
	# use the -d option to turn on flex debugging
	# flex -d datagen.l

greg2jd.o:	greg2jd.c
	gcc $(CFLAGS) greg2jd.c

jd2greg.o:	jd2greg.c
	gcc $(CFLAGS) jd2greg.c

astrint.o:	astrint.c
	gcc $(CFLAGS) astrint.c

rnd.o:		rnd.s
	gcc $(CFLAGS) rnd.s

rndpwr.o:	rndpwr.s
	gcc $(CFLAGS) rndpwr.s

rndnum.o:	rndnum.s
	gcc $(CFLAGS) rndnum.s

rndfrac.o:	rndfrac.s
	gcc $(CFLAGS) rndfrac.s

rndinit.o:	rndinit.c
	gcc $(CFLAGS) rndinit.c

getmd5.o:	getmd5.c
	gcc $(CFLAGS) getmd5.c

md5c.o:		md5c.c
	gcc $(CFLAGS) md5c.c

clean:	
	rm -f datagen lex.yy.c datagen.tab*
	rm -f libdg.a
	rm -f dgtst*.data dgtst*.msg $(OBJ)
