# logresolve 2.0 - http://www.uunet.ca/~tomr/progs/logresolve/
# Tom Rathborne - tomr@uunet.ca - http://www.uunet.ca/~tomr/
#
# Please use GNU Make. Please.
#
# 'make'            compiles everything (currently just logresolve)
# 'make logresolve' builds the program (same as just 'make' right now)
# 'make sweep'      cleans up (removes pieces)
# 'make clean'      cleans up (removes objects AND executables)

.SUFFIXES: .c .o

.c.o: $(COMPILER) $(CFLAGS) -c $<

COMPILER = gcc
CFLAGS = -O1

# Required system libraries - varies by OS
# Linux, Irix and SunOS don't need anything special.

# Solaris needs socket and nameservice libraries:
# LIBS = -lsocket -lnsl

# Insert your favourite ndbm-compatible library here:
DBMLIB = -lgdbm

OBJECTS = logresolve
SOURCES = logresolve.c lr-nsrec.c lr-stats.c lr-ip.c lr-hash.c lr-dbm.c
PIECES = $(SOURCES:.c=.o)

ALLDEPS = logresolve.h 
INCLUDES = logresolve.h lr-dbm.h lr-hash.h lr-ip.h lr-nsrec.h lr-stats.h

logresolve: $(PIECES)
	$(COMPILER) $(CFLAGS) $(LIBS) $(DBMLIB) -o logresolve $(PIECES)

sweep:
	rm -f $(PIECES)

clean:
	rm -f $(OBJECTS) $(PIECES)

# not everything REALLY depends on every .h file... just being safe!

$(PIECES) : $(ALLDEPS)
	$(COMPILER) $(CFLAGS) -c $*.c

logresolve.o: logresolve.c logresolve.h
lr-nsrec.o: lr-nsrec.c lr-nsrec.h
lr-stats.o: lr-stats.c lr-stats.h
lr-ip.o: lr-ip.c lr-ip.h lr-nsrec.h
lr-hash.o: lr-hash.c lr-hash.h lr-dbm.h lr-nsrec.h
lr-dbm.o: lr-dbm.c lr-dbm.h lr-nsrec.h

