# =============================================================================
# 
# @(#) Makefile,v 0.7.8.2 2001/12/11 15:11:42 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 2001/12/11 15:11:42 by brian
#
# =============================================================================

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

export INCDIR
export SRCDIR

export WFLAGS ?= \
    -Wall \
    -Werror \
    -Wunused \
    -Wpointer-arith \
    -Wcast-qual \
    -Wcast-align \
    -Wstrict-prototypes \
    -Wnested-externs \
    -Winline \
    -Wold-style-cast \

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 = lmi sdli acb56 ss7ip ss7sctp sdti sli m2pa sctp

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

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

clean:
	rm -f files tags
	for subdir in ${SUBDIRS}; do $(MAKE) -C $$subdir $@; done

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

