# Makefile for cbook/08-Random-Numbers/programs
# Created by the ExportAll facility
# ***************************************************************

PROGRAMS = \
    randtest \
    cointest \
    dicetest \
    craps 

# ***************************************************************
# Parameters to control Makefile operation

CSINCDIR = $$HOME/cslib/standard
CSLIBDIR = $$HOME/cslib/standard
CC = gcc
CFLAGS = -g -I. -I$(CSINCDIR)

LIBRARIES = $(CSLIBDIR)/cslib.a -lm

# ***************************************************************
# Entry to bring the package up to date

all: $(PROGRAMS)

# ***************************************************************
# Standard entries to remove files from the directories
#    tidy    -- eliminate unwanted files
#    scratch -- delete derived files in preparation for rebuild

tidy:
	rm -f ,* .,* *~ core a.out graphics.ps

scratch: tidy
	rm -f *.o *.a $(PROGRAMS)

# ***************************************************************
# C compilations

randtest.o: randtest.c
	$(CC) $(CFLAGS) -c randtest.c

cointest.o: cointest.c
	$(CC) $(CFLAGS) -c cointest.c

dicetest.o: dicetest.c
	$(CC) $(CFLAGS) -c dicetest.c

craps.o: craps.c
	$(CC) $(CFLAGS) -c craps.c


randtest: randtest.o
	$(CC) $(CFLAGS) -o randtest randtest.o $(LIBRARIES)

cointest: cointest.o
	$(CC) $(CFLAGS) -o cointest cointest.o $(LIBRARIES)

dicetest: dicetest.o
	$(CC) $(CFLAGS) -o dicetest dicetest.o $(LIBRARIES)

craps: craps.o
	$(CC) $(CFLAGS) -o craps craps.o $(LIBRARIES)
