# $Cambridge: hermes/src/prayer/templates/old/Makefile,v 1.4 2010/07/07 08:33:47 dpc22 Exp $

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

CFLAGS  = $(BASECFLAGS)
LDFLAGS = $(BASELDFLAGS)

TYPE=old

TARGETS=templates.a templates_frontend.a

T_FILES_FRONTEND=login.t \
  frontend_login_error.t frontend_security.t frontend_session.t \
  frontend_timeout.t frontend_compose_timeout.t header.t footer.t 

O_FILES_FRONTEND=_template_index_frontend.o ${T_FILES_FRONTEND:.t=.o} 

C_FILES_FRONTEND=${O_FILES_FRONTEND:.o=.c}

T_FILES=raven_blocked.t \
 printable.t printable_tail.t printable_hdrs.t printable_addr.t \
 abook_add_help.t abook_add.t abook_list_help.t abook_list_nav_1_icons.t \
 abook_list_nav_1_noicons.t abook_list_nav_1.t abook_list_nav_2.t \
 abook_list_search.t abook_list.t abook_list_title.t \
 abook_list_toolbar_bottom.t abook_list_toolbar_top.t abook_lookup_help.t \
 abook_lookup_nav_1_icons.t abook_lookup_nav_1_noicons.t \
 abook_lookup_nav_1.t abook_lookup_search.t abook_lookup.t \
 abook_search_help.t abook_search.t abook_take_help.t abook_take.t \
 abook_transfer_help.t abook_transfer.t abook_update_help.t abook_update.t \
 action_stub.t attachments_help.t attachments.t block_fail.t block_help.t \
 block.t compose_large_help.t compose_large_top.t compose_postponed_help.t \
 compose_postponed.t compose_small_help.t compose_small_top.t compose.t \
 compose_toolbar_left.t compose_toolbar_right.t compose_toolbar.t \
 copy_help.t copy.t copy_toolbar.t dictionary_help.t dictionary.t \
 display_addr.t display_hdrs.t display_help.t display_mime_msg.t \
 display_mime_other.t display_mime.t display_mime_text.t \
 display.t display_images.t \
 display_tail.t display_toolbar_icons.t display_toolbar_noicons.t \
 display_toolbar.t download_xfer_error.t error.t expunge.t \
 favlist_favourites.t favlist.t favourites_help.t favourites.t \
 favourites_toolbar.t filter_fail.t filter_help.t filter_select_help.t \
 filter_select.t filter_select_toolbar.t filter.t folderlist_folders.t \
 folderlist_icons.t folderlist_nfolders.t folderlist_noicons.t \
 folderlist_select.t folderlist.t folders_help.t folders.t folders_toolbar.t \
 footer.t fullname_help.t fullname.t header.t include_help.t include.t \
 list_help.t list_msgs.t list_nav_1_icons.t list_nav_1_noicons.t \
 list_nav_1.t list_nav_2.t list.t list_title.t list_toolbar_bottom.t \
 list_toolbar_top.t logout.t logout_raven.t \
 manage_help.t manage.t passwd_help.t passwd.t \
 prefs_compose1_help.t prefs_compose2_help.t prefs_compose2.t \
 prefs_compose.t prefs_display1_help.t prefs_display_abook_sort.t \
 prefs_display_folder_sort.t prefs_display.t prefs_folder_help.t \
 prefs_folder.t prefs_general_help.t prefs_general.t prefs_option.t \
 quota_help.t quota.t redirect_fail.t redirect_help.t redirect.t \
 rename_help.t rename.t rename_toolbar.t reply_help.t reply.t restart.t rm.t \
 roles_entry_help.t roles_entry.t roles_list_help.t roles_list.t \
 roles_select_help.t roles_select.t search_date_help.t search_date.t \
 search_footer.t search_header.t search_size_help.t search_size.t \
 search_status_help.t search_status.t search_text_help.t search_text.t \
 sieve_error.t sieve_error_tail.t sieve_fail.t sieve_help.t sieve.t \
 spam_fail.t spam_help.t spam.t spell.t status.t tb_icon_form.t tb_icon.t \
 toolbar_help.t toolbar_left.t toolbar_right.t toolbar_stub_help.t toolbar.t \
 transfer_help.t transfer.t transfer_toolbar_bottom.t transfer_toolbar_top.t \
 upload_select_help.t upload_select.t vacation_fail.t vacation_help.t \
 vacation.t vaclog_fail.t vaclog_help.t vaclog.t welcome_help.t welcome.t \
 sizes.t sizes_help.t sizes_toolbar.t

O_FILES=_template_index.o ${T_FILES:.t=.o} 

C_FILES=${O_FILES:.o=.c}

.PRECIOUS: $(C_FILES)

HTML=\
 abook_add.html abook_list.html abook_lookup.html \
 abook_search.html abook_take.html abook_transfer.html abook_update.html \
 attachments.html block_fail.html block.html compose_postponed.html \
 compose.html copy.html dictionary.html display.html download_xfer_error.html \
 error.html expunge.html favourites.html filter_fail.html \
 filter_select.html filter.html folders.html fullname.html include.html \
 list.html logout.html logout_raven.html manage.html passwd.html \
 prefs_compose2.html prefs_compose.html prefs_display.html prefs_folder.html \
 prefs_general.html quota.html redirect_fail.html \
 redirect.html rename.html reply.html restart.html rm.html roles_entry.html \
 roles_list.html roles_select.html search_date.html \
 search_size.html search_status.html search_text.html sieve_error.html \
 sieve_fail.html sieve.html spam_fail.html spam.html spell.html \
 transfer.html upload_select.html vacation_fail.html vacation.html \
 vaclog_fail.html vaclog.html welcome.html

EXPAND=../src/template_expand
COMPILE=../src/template_compile

all: $(TARGETS)

test: $(HTML)

%.html: %.t %.vars common.vars Makefile
	$(EXPAND) $@ $* common.vars $*.vars

templates_frontend.a: $(O_FILES_FRONTEND)
	rm -f templates_frontend.a
	ar q templates_frontend.a $(O_FILES_FRONTEND)

templates.a: $(O_FILES)
	rm -f templates.a
	ar q templates.a $(O_FILES)

%.o: %.c Makefile
	$(CC) $(CFLAGS) -I../../lib -c $<

_template_index_frontend.c:
	../src/build_index.pl $(TYPE) $(T_FILES_FRONTEND) > _template_index_frontend.c

_template_index.c:
	../src/build_index.pl $(TYPE) $(T_FILES) > _template_index.c

%.c: %.t Makefile
	$(COMPILE) $(TYPE) $@ $*

install:
	$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_DIR) -d \
	  $(BROOT)$(PREFIX)/templates/$(TYPE)
	cp *.t $(BROOT)$(PREFIX)/templates/$(TYPE)
	cp *.vars $(BROOT)$(PREFIX)/templates/$(TYPE)

clean:
	rm -f $(TARGETS) *.html *.o *.c \#*\# *~

include Makefile.deps


