TARGET = libci_milter.a 
TPATH = /usr/local/lib
TINC = /usr/local/include
TOWNER = root
TGROUP = wheel
TMODE = 664

OBJS = \
	milter_envelope.o \
	milter_func.o \
	base64.o

# For OpenFWTK:

#OBJS = \
#	milter_envelope.o \
#	milter_func.o

TCPPFLAGS = -I./include
TLDFLAGS = 
TLIBS =

HEADERS = \
	ci_milter.h 

CPP	= cpp

CPPWARN =

# CPPWARN = \
#	-W -Wall -Wbad-function-cast  \
#	-Wcast-qual -Wchar-subscripts -Winline -Wcast-align -Wformat-security \
#	-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
#	-Wshadow -Wstrict-prototypes -Wwrite-strings

#CPPDEF	= \
#	-DSILENCIO

# OpenFWTK installations should have:
#
CPPDEF	= \
	-DFWTK

CPPINC	= \
	-I.

CPPFLAGS = $(CPPWARN) $(CPPDEF) $(CPPINC)

CC	= cc
DEBUG	=
COPTFLAGS =  
#COPTFLAGS = -O2 -pipe -march=i386 -mcpu=i686
CFLAGS	= $(CPPFLAGS) $(COPTFLAGS) $(DEBUG)

AR	= ar
RANLIB	= ranlib

INSTALL	= /usr/bin/install

##############################################################################

all: $(TARGET)

$(TARGET): $(OBJS)
	$(AR) rcv $@ $(OBJS)
	$(RANLIB) $@
.c.o:
	$(CC) $(CFLAGS) $(TCPPFLAGS) -o $@ -c $<

install: $(TARGET)
	$(INSTALL) -o $(TOWNER) -g $(TGROUP) -m $(TMODE) $(TARGET) $(TPATH)/$(TARGET)
	mkdir -p $(TINC)/milter
	set -e; for i in $(HEADERS); do \
		$(INSTALL) -o $(TOWNER) -g $(TGROUP) -m $(TMODE) ./include/$$i $(TINC)/milter/$$i; \
	done

clean:  
	-rm -f *~ *.core *.out *.s *.o *.so *.a $(TARGET)

##############################################################################

