# =============================================================================
# 
# @(#) Makefile,v 0.8.2.8 2002/04/14 22:28:36 brian Exp
# 
# -----------------------------------------------------------------------------
# 
# Copyright (C) 1997-2001  Brian Bidulock <bidulock@dallas.net>
# 
# 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., 675 Mass
# Ave, Cambridge, MA 02139, USA.
# 
# -----------------------------------------------------------------------------
# 
# Last Modified 2002/04/14 22:28:36 by brian
#
# =============================================================================

INCDIR ?= $(shell ( cd ../include; pwd ))
SRCDIR ?= $(shell ( cd ../drivers; pwd ))

export INCDIR
export SRCDIR

SRCFILES = $(shell find . -name "*.c*" -o -name "*.h*")

#SUBDIRS = $(shell find . -maxdepth 1 -mindepth 1 -type d ! -name "CVS" ! -name "RCS" ! -name "include" ! -name "man" ! -name "doc")
SUBDIRS = sctp lmi sdli acb56 ss7ip ss7sctp sdti sli m2pa inet

.PHONY: all
all: # depend # tags
	for subdir in ${SUBDIRS}; do $(MAKE) -C $$subdir $@; done

.PHONY: tags
tags: $(SRCFILES)
	find . -name "*.h*" -o -name "*.c*" > files
	find ../include -name "*.h*" -o -name "*.c*" >> files
	ctags -L files
	rm -f files
	for subdir in ${SUBDIRS}; do $(MAKE) -C $$subdir $@; done

.PHONY: all
clean:
	rm -f .depend *.o *.s *_i.c *_i.cc *.log *~ core files tags
	for subdir in ${SUBDIRS}; do $(MAKE) -C $$subdir $@; done

.PHONY: install
install:
	@ if [ $$(id -u) -ne 0 ]; then \
	    echo -e "\nYou must be superuser to install!\n"; \
	    exit 1; \
	fi
	for subdir in ${SUBDIRS}; do $(MAKE) -C $$subdir $@; done

%::
	for subdir in ${SUBDIRS}; do $(MAKE) -C $$subdir $@; done

