# $Cambridge: hermes/src/prayer/shared/Makefile,v 1.5 2009/03/19 17:30:03 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 SYSV mutex
ifeq ($(strip $(MUTEX_SEMAPHORE)), true)
  MUTEX_DEF = -DMUTEX_SEMAPHORE
endif

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

BASECFLAGS += -I../lib

MYCFLAGS  = $(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) $(MYCFLAGS) $(GZIP_DEF) -c $<

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

# config.o: need to add MUTEX_DEF
config.o: config.c *.h Makefile
	$(CC) $(MYCFLAGS) $(MUTEX_DEF) -c $<

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

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

