# Makefile for Freedom remailer
# 1995-1997  jfleming@indiana.edu
# 1997-1998  hanne@squirrel.owl.de

#FREEDOM = $(HOME)/freedom

# Define these for your system and your tastes.
CC = gcc
#CC = cc
CFLAGS = -O2
#CFLAGS = -g -Wall -Wwrite-strings -Wsign-compare

# Delete "-DUSE_RX" if you don't want regexp blocking
REMAILER_DEFS = -DREMAILER_DIR='"$(FREEDOM)"' -DUSE_RX

# Don't use "-s" if you compile with debugging options
LDFLAGS = -s
#LDFLAGS = -static

# Delete "-lrx" if you don't want to use the Rx library
REMAILER_LIBS = -lrx

########################################################################
# Things after this point probably don't need to be changed.
########################################################################

PGP_OBJS = idea.o md5.o randpool.o

REMAILER_OBJS = remailer.o util1.o util2.o util3.o util4.o util5.o \
		stats.o $(PGP_OBJS)

TESTCRYPT_OBJS = testcrypt.o $(PGP_OBJS)

all:		remailer testcrypt

remailer:	$(REMAILER_OBJS)
		$(CC) $(LDFLAGS) -o $@ $(REMAILER_OBJS) $(REMAILER_LIBS)

testcrypt:	$(TESTCRYPT_OBJS)
		$(CC) $(LDFLAGS) -o $@ $(TESTCRYPT_OBJS)

remailer.o:	remailer.c freedom.h
		$(CC) $(CFLAGS) $(REMAILER_DEFS) -c $< -o $@

util1.o:	util1.c freedom.h
		$(CC) $(CFLAGS) $(REMAILER_DEFS) -c $< -o $@

util2.o:	util2.c freedom.h
		$(CC) $(CFLAGS) $(REMAILER_DEFS) -c $< -o $@

util3.o:	util3.c freedom.h
		$(CC) $(CFLAGS) $(REMAILER_DEFS) -c $< -o $@

util4.o:	util4.c freedom.h
		$(CC) $(CFLAGS) $(REMAILER_DEFS) -c $< -o $@

util5.o:	util5.c freedom.h idea.h usuals.h md5.h
		$(CC) $(CFLAGS) $(REMAILER_DEFS) -c $< -o $@

stats.o:	stats.c freedom.h
		$(CC) $(CFLAGS) $(REMAILER_DEFS) -c $< -o $@

testcrypt.o:	idea.h usuals.h md5.h

idea.o:		idea.h randpool.h usuals.h
md5.o:		md5.h
randpool.o:	randpool.h usuals.h md5.h

.PHONY:		clean
clean:
		rm -f remailer testcrypt $(REMAILER_OBJS) $(TESTCRYPT_OBJS)
