include /mit/6.170/include/make/commondefs

DEST = $(hosttype)bin
BINDIR = $(DEST)

C++FILES =  simple_pattern.C file.C database.C time.C main.C
LC++OPTS = -fexternal-templates -pg

LLDOPTS = -pg

PROGRAM = fq
TARGETS = fq test_simple_pattern test_file test_time

LIBRARY = libps3.a

default: $(PROGRAM)

all: $(TARGETS)

test_simple_pattern: $(LIBRARY) test_simple_pattern.o
	$(C++) -o $@ test_simple_pattern.o $(LIBRARY) $(LDFLAGS)

test_file: $(LIBRARY) test_file.o
	$(C++) -o $@ test_file.o $(LIBRARY) $(LDFLAGS)

test_time: $(LIBRARY) test_time.o
	$(C++) -o $@ test_time.o $(LIBRARY) $(LDFLAGS)

PROGRAM_OBJECTS = main.o file.o simple_pattern.o database.o time.o

$(PROGRAM): $(PROGRAM_OBJECTS)
	$(C++F) -o $@ $(PROGRAM_OBJECTS) $(LDFLAGS)

$(LIBRARY): $(OBJECTS)
	@-rm -f $(LIBRARY)
	ar rs $(LIBRARY) $(OBJECTS)

localinstall: all
	-mkdir $(DEST)
	cp -p $(TARGETS) $(BINDIR)

include $(COMMONRULES)
