# $Cambridge: hermes/src/prayer/shared/Makefile,v 1.3 2008/06/02 18:12:18 dpc22 Exp $
#
# Prayer - a Webmail Interface
#
# Copyright (c) University of Cambridge 2000 - 2008
# See the file NOTICE for conditions of use and distribution.

ifeq ($(strip $(RPM_BUILD)), true)
include ../Config-RPM
else
include ../Config
endif

# Enable on the fly compression
ifeq ($(strip $(GZIP_ENABLE)), true)
  GZIP_DEF    = -DGZIP_ENABLE
  BASECFLAGS += $(Z_INCLUDE)
endif

# Enable Electric Fence
ifeq ($(strip $(FENCE_ENABLE)), true)
  BASECFLAGS += $(FENCE_INCLUDE)
endif

BASECFLAGS += -I../lib

CFLAGS  = $(BASECFLAGS)

SHARED_OBJS = \
 config.o gzip.o html_common.o log.o \
 request.o response.o user_agent.o


all: $(SHARED_OBJS)
	rm -f shared.a
	ar r shared.a $(SHARED_OBJS)

# response.o: need to add GZIP_ENABLE
response.o: response.c *.h Makefile
	$(CC) $(CFLAGS) $(GZIP_DEF) -c $<

# gzip.o: need to add GZIP_ENABLE
gzip.o: gzip.c *.h Makefile
	$(CC) $(CFLAGS) $(GZIP_DEF) -c $<

# Default build rule
%.o: %.c *.h Makefile
	$(CC) $(CFLAGS) -c $<

clean:
	-rm -f shared.a $(SHARED_OBJS) *.flc *~ \#*\#

