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

# FREEDOM = $(HOME)/freedom

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

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

# Delete "-s" if you compile with debugging options
LDFLAGS = -s

# 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)
		chmod 511 $@

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

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)
