# Greenbone Security Assistant
# $Id$
# Description: Makefile for generating HTML help pages
#
# Authors:
# Jan-Oliver Wagner <jan-oliver.wagner@greenbone.net>
#
# Copyright:
# Copyright (C) 2009 Greenbone Networks GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2,
# or, at your option, any later version as published by the Free
# Software Foundation
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

# Preprocessor configuration
PP=m4

# Build configuration
BUILDDIR=build
SRCDIR=src

HTM4_LIST=`cd $(SRCDIR) ; find . -name "*.htm4"`
STATIC_LIST=`find . -type f | grep -v "htm4$$" | grep -v "\/\.svn\/"`
PUBLIC_LIST=gsa-style.css favicon.gif img/gsa_splash.png \
            img/style/window_dec_a.png img/style/window_dec_b.png \
            img/style/window_dec_c.png

all: clean
	# make directories
	mkdir -p $(BUILDDIR)/help
	mkdir -p $(BUILDDIR)/img/style
	mkdir -p $(BUILDDIR)/login/img/style

	# copy all static files
	cd $(SRCDIR); \
	for f in $(STATIC_LIST); \
	do cp -R $$f ../$(BUILDDIR)/$$f; done

	# create dynamic HTML files
	for f in $(HTM4_LIST); \
	do \
	  F=`echo $$f | sed -e 's/htm4/html/'`; \
	  m4 --prefix-builtins "$(SRCDIR)/$$f" > "$(BUILDDIR)/$$F"; \
	done

	# create public area
	for f in $(PUBLIC_LIST); \
	do \
	  cp $(SRCDIR)/$$f $(BUILDDIR)/login/$$f ; \
	done

clean:
	rm -rf $(BUILDDIR)/*

