--- Makefile.orig	Mon Oct 25 22:53:12 2004
+++ Makefile	Thu Nov 17 15:03:31 2005
@@ -3,18 +3,19 @@
 OSTYPE := $(shell uname -s)
 
 ifeq ($(OSTYPE), FreeBSD)
-	CC=gcc -Wall -pthread
-	SYNONYM_USER=daemon
-	SYNONYM_GROUP=daemon
-	INCLUDEPATH=-I/usr/local/include/libxml2 -I/usr/local/include
-	LIBXML=-lxml2
-
-	SYNONYM_BINDIR=$(SYNONYM_BASEDIR)/usr/local/sbin
-	SYNONYM_RUNDIR=$(SYNONYM_BASEDIR)/var/run/synonym
-	SYNONYM_SCRIPTDIR=$(SYNONYM_BASEDIR)/usr/local/etc/rc.d
+ 	CFLAGS+=-Wall ${PTHREAD_CFLAGS} -DPREFIX='"${PREFIX}"' -DRUNDIR='"${RUNDIR}"'
+	CFLAGS+=-DSYNONYM_USER='"${SYNONYM_USER}"' -DSYNONYM_GROUP='"${SYNONYM_GROUP}"'
+	SYNONYM_USER=${SYNONYMOWN}
+	SYNONYM_GROUP=${SYNONYMGRP}
+	INCLUDEPATH=-I${LOCALBASE}/include/libxml2 -I${LOCALBASE}/include
+	LIBXML=-lxml2 ${PTHREAD_LIBS}
+
+	SYNONYM_BINDIR=$(SYNONYM_BASEDIR)${PREFIX}/sbin
+	SYNONYM_RUNDIR=$(SYNONYM_BASEDIR)${RUNDIR}
+	SYNONYM_SCRIPTDIR=$(SYNONYM_BASEDIR)${PREFIX}/etc/rc.d
 	SYNONYM_SCRIPT_NAME=synonym.sh
-	SYNONYM_CONFIGDIR=$(SYNONYM_BASEDIR)/etc
-	SYNONYM_DOCDIR=$(SYNONYM_BASEDIR)/usr/local/share/doc/synonym
+	SYNONYM_CONFIGDIR=$(SYNONYM_BASEDIR)/${PREFIX}/etc
+	SYNONYM_DOCDIR=$(SYNONYM_BASEDIR)${DOCSDIR}
 endif
 
 ifeq ($(OSTYPE), Linux)
@@ -77,35 +78,35 @@
 # This variable will be void if libsmutil.a does not exist (and hence is not needed) on the system
 LIBSMUTIL := $(shell (echo "/lib" && echo "/usr/lib" && echo "/usr/local/lib" && if test -f /etc/ld.so.conf ; then cat /etc/ld.so.conf ; fi) | while read libpath && [ \( "$$FOUND" != "1" \) ]; do if [ -f $$libpath/libsmutil.a ] ; then echo "-lsmutil";FOUND=1 ; fi; done)
 
-LIBPATH=-L/usr/local/lib
+LIBPATH=-L${LOCALBASE}/lib
 
 
 
 all: synonym
 
 synonym: synonym.o config.o filtering.o $(DISCLAIMER)
-	$(CC) synonym.o $(DISCLAIMER) -lmilter config.o filtering.o $(PTHREAD) -o synonym $(LIBSMUTIL) $(LIBPATH) $(LIBXML) $(CCLIENTLIB) $(EXTRA_LIBS)
+	$(CC) ${CFLAGS} ${LDFLAGS} synonym.o $(DISCLAIMER) -lmilter config.o filtering.o $(PTHREAD) -o synonym $(LIBSMUTIL) $(LIBPATH) $(LIBXML) $(CCLIENTLIB) $(EXTRA_LIBS)
 
 synonym.o: synonym.c synonym.h config.h filtering.h
-	$(CC) -c synonym.c $(DISCLAIMER_DEFINE) -o synonym.o $(INCLUDEPATH) 
+	$(CC) $(CFLAGS) -c synonym.c $(DISCLAIMER_DEFINE) -o synonym.o $(INCLUDEPATH) 
 
 config.o: config.c config.h synonym.h
-	$(CC) -c config.c $(DISCLAIMER_DEFINE) -o config.o $(INCLUDEPATH)
+	$(CC) $(CFLAGS) -c config.c $(DISCLAIMER_DEFINE) -o config.o $(INCLUDEPATH)
 
 filtering.o: filtering.c filtering.h synonym.h
-	$(CC) -c filtering.c $(DISCLAIMER_DEFINE) -o filtering.o $(INCLUDEPATH)
+	$(CC) $(CFLAGS) -c filtering.c $(DISCLAIMER_DEFINE) -o filtering.o $(INCLUDEPATH)
 
 html_parser.o: html_parser.c html_parser.h
-	$(CC) -c html_parser.c -o html_parser.o $(INCLUDEPATH)
+	$(CC) $(CFLAGS) -c html_parser.c -o html_parser.o $(INCLUDEPATH)
 
 disclaimer.o: disclaimer.c disclaimer.h html_parser.o scan.o
-	$(CC) -c disclaimer.c -o disclaimer.o $(INCLUDEPATH) $(CCLIENTINCLUDE)
+	$(CC) $(CFLAGS) -c disclaimer.c -o disclaimer.o $(INCLUDEPATH) $(CCLIENTINCLUDE)
 
 scan.o: scan.c
-	$(CC) -c scan.c -o scan.o $(INCLUDEPATH)
+	$(CC) $(CFLAGS) -c scan.c -o scan.o $(INCLUDEPATH)
 
 body_parser.o: body_parser.c body_parser.h
-	$(CC) -c body_parser.c -o body_parser.o $(INCLUDEPATH) $(CCLIENTINCLUDE)
+	$(CC) $(CFLAGS) -c body_parser.c -o body_parser.o $(INCLUDEPATH) $(CCLIENTINCLUDE)
 
 filtering.h: milter_data.h
 	@touch filtering.h


syntax highlighted by Code2HTML, v. 0.9.1