# CFLAGS for "make":
# -pg can be used by gprof
CFLAGS = -pg -DMORETRACE -DAPPLICATION
# -p can be used by prof
CFLAGS = -p -DMORETRACE -DAPPLICATION 
# -g can be used by gdb
CFLAGS = -O3 -DMORETRACE -DMINONE -DTLCLAUSE
CFLAGS = -Wall -O3 -DMORETRACE

# choose your C compiler.
CC = cc
CC = gcc

.SUFFIXES:	.o .c .f .h

#---------------------- user defined files
SATONFIL = main.c sato.c util.c trie.c

SATONOBJ = main.o sato.o util.o trie.o

APPLYFIL = qap.c team.c latin.c wht.c

APPLYOBJ = qap.o team.o latin.o wht.o

#---------------------- make binary code
lean: $(SATONOBJ)
	$(CC) $(CFLAGS) $(SATONOBJ) -lc -o satbox
	chmod a+x satbox

full: $(SATONOBJ) $(APPLYOBJ)
	$(CC) $(CFLAGS) $(SATONOBJ) $(APPLYOBJ) -lc -o satbox
	chmod a+x satbox

library: $(SAONOBJ)
	$(CC) $(CFLAGS) -DSATBOX_LIBRARY_ONLY -c -fpic $(SATONFIL)
	$(CC) -DSATBOX_LIBRARY_ONLY -shared -lc -o libsatbox.so $(SATONOBJ)
	$(CC) $(CFLAGS) -DSATBOX_LIBRARY_ONLY -c $(SATONFIL)
	ar rs libsatbox.a $(SATONOBJ)


$(SATONOBJ): main.h

main.o: common.h main.h sato.h weight.h

sato.o: common.h sato.h tape.h vstack.h select.h satbox.h array.h

util.o: common.h main.h clocks.h

trie.o: trie.h
