# $Cambridge: hermes/src/prayer/session/Makefile,v 1.9 2011/06/17 15:22:57 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

BASECFLAGS += -I../lib -I../shared

# Enable LDAP
ifeq ($(strip $(LDAP_ENABLE)), true)
  LDAP_DEF    = -DLDAP_ENABLE
  BASECFLAGS += $(LDAP_INCLUDE)
endif

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

# Enable libtidy or libtidyp fork
ifeq ($(strip $(TIDY_ENABLE)), true)
  TIDY_DEF = -DTIDY_ENABLE=1
  ifeq ($(strip $(TIDY_IS_TIDYP)), true)
    TIDY_DEF += -DTIDY_IS_TIDYP=1
  endif
  BASECFLAGS += $(TIDY_INCLUDE)
  BASE_LIBS  += $(TIDY_LIBS)
endif

MYCFLAGS  = $(BASECFLAGS) $(CCLIENT_INCLUDE)

SESSION_OBJS = abook.o \
 account.o account_msshell.o account_sieve.o account_support.o \
 addr.o checksum.o dictionary.o display.o draft.o favourite.o \
 filter.o folderlist.o html_secure.o html_secure_tidy.o lookup.o \
 mc.o ml.o mm.o msgmap.o options.o prefs.o rfc1522.o \
 role.o session.o session_streams.o \
 sieve.o speller.o stream.o utf8_calc.o wrap.o


all: $(SESSION_OBJS)
	rm -f session.a
	ar r session.a $(SESSION_OBJS)

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

# lookup.o: need to add LDAP_ENABLE
lookup.o: lookup.c *.h Makefile
	$(CC) $(MYCFLAGS) $(LDAP_DEF) -c $<

html_secure_tidy.o: html_secure_tidy.c *.h Makefile
	$(CC) $(MYCFLAGS) $(TIDY_DEF) -c $<

clean:
	-rm -f session.a $(SESSION_OBJS) *.flc *~ \#*\#

