###############################################################################
# $Id: Makefile,v 1.27 2010/08/26 22:44:25 tw Exp $
#
# Build and install gds2000tools
#
# Copyright (C) 2008 - 2010 Thomas Weidenfeller
# 
# This file is part of gds2000tools.
# 
# gds2000tools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
# 
# gds2000tools 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 gds2000tools.  If not, see <http://www.gnu.org/licenses/>.
###############################################################################

###############################################################################
# Directories and Subdirectories
###############################################################################
TOP		= .
include $(TOP)/config.mk

SUBDIRS		= gds-read-bin	\
		  gdsh		\
		  gds-octave	\
		  gds-funcgen 	\
		  gds-udev	\
		  gds-desktop

.PHONY: $(SUBDIRS)

DOCS		= CHANGELOG COPYING README

###############################################################################
# Rules
###############################################################################
default: all
.PHONY: default all

#
# Run subdir commands
# 
all install clean::
	for d in $(SUBDIRS) ; do			\
		 $(MAKE) --directory=$$d $@ || exit 1;	\
	done

#
# Install some additional files
#
install:: install-doc
install-doc:
	if [ `id -u` -eq 0 ] ;                                  \
	then                                                    \
		UG="-o root -g root";                           \
	else                                                    \
		UG="" ;                                         \
	fi;                                                     \
	install $(INSTALL_FLAGS) -m 755 $$UG -d $(DOCDIR);	\
	install $(INSTALL_FLAGS) -m 644 $$UG $(DOCS) $(DOCDIR)

.PHONY: install install-doc

