# AUTHOR
# vim:set sw=4 ts=4:
#	Created on 2004-Jun-17 by Dennis Olsson, SUSE Linux AG <DOlsson@SUSE.com>
#
# RELEASED
#	Makefile - Description file describing how to create executables from source files.
#
#	This program is released under the GPL Version 2 (or later), and is
#	Copyright (c) 2004 Dennis Olsson, SUSE Linux AG <DOlsson@SUSE.com>
#	All rights reserved.
#
#	This program is free software; you can redistribute it and/or
#	modify it under the terms of the GNU General Public License
#	as published by the Free Software Foundation; either version 2
#	of the License, or (at your option) any later version.
#
#	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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
#	The creation of this file was sponsored in 2004 by
#	T-Mobile Deutschland GmbH, Bonn, Germany, EU.
#
# REVISION HISTORY
#	$Id: Makefile,v 1.3 2005/04/11 14:14:34 fabian Exp $
#
#	Use 'cvs log' to view the history log for this script.
# -------------------------------------------------------------------------------------------------
# Our TOP_DIR is 1 level up
TOP_DIR := ..


# -------------------------------------------------------------------------------------------------
# All shell script files
SRC_SHELL_IN = 

SRC_SHELL    = make_alice_repository.sh make_inst_server.sh


# -------------------------------------------------------------------------------------------------
# All source files
SRCS = $(SRC_SHELL_IN) $(SRC_SHELL)


# -------------------------------------------------------------------------------------------------
# Construct the target names
TARGET_SHELL = $(SRC_SHELL_IN:%.sh.in=%) $(SRC_SHELL:%.sh=%)


# All targets
TARGETS = $(TARGET_SHELL)


# -------------------------------------------------------------------------------------------------
# All common targets

.PHONY: all
all: create_targets


.PHONY: install
install:
	@echo -e "Sorry, but you need to specify explicitly *what* you want to install:\n"
	@echo -e "\tinstall_sources\tInstall a source version of this dir in '$(ROOT)/src/shell'."

.PHONY: install_sources
install_sources:
	[[ ! -d $(ROOT)/src/shell ]] && mkdir -p $(ROOT)/src/shell
	cp -fp $(SRCS) $(ROOT)/src/shell


.PHONY: clean
clean:
	$(RM) $(TARGET_SHELL)

.PHONY: dist_clean distclean
dist_clean distclean: clean


.PHONY: help
help:
	@awk '\
		!/^.PHONY:/ && /^[a-zA-Z._-]+( [a-zA-Z._-]+)*:/ {\
			list = list gensub(":.*", " ", "g")\
		}\
		END {\
			print "Make Targets:\n\t" list\
		}\
	' Makefile
	@echo -e "\nSource Files:\n\t $(SRCS)"
	@echo -e "\nTarget Files:\n\t $(TARGETS)"
	@echo -e "\nOptions passed to \`$(DDV)' \c"


.PHONY: create_targets
create_targets: $(TARGETS)


# -------------------------------------------------------------------------------------------------
# General target rules

# General rule to rewrite parameterized sources
%: %.in
	$(RM) $@
	sed \
	    -e "s@Pattern@$(VALUE)g" \
	    $< >$@
	chmod 444 $@

# General rule to rewrite parameterized Broune shell sources (when different from the "%.in" rule)
%: %.sh.in
	$(RM) $@
	sed \
	    -e "s@Pattern@$(VALUE)g" \
	    $< >$@
	chmod 555 $@

# General rule to create an executable Bourne shell script
%: %.sh
	$(RM) $@
	cp $< $@
	chmod 555 $@


# -------------------------------------------------------------------------------------------------
# Individual targets

# Current none.


# End-Of-Makefile
# -------------------------------------------------------------------------------------------------
