# ============================================================================
# Makefile	Make script for building Linux WAN router utilities.
# ----------------------------------------------------------------------------
# Copyright (c) 1995-1999 Sangoma Technologies Inc.  All Rights Reserved.
# ============================================================================

# modificaton history:
# 20000103/tm	added "clean:" target
# 20000104/tm	added an "install:" target to be more like a normal
#		makefile

####### MACROS ###############################################################

# Build options.
OS_TYPE	= _LINUX_
DEBUG	= 2

# Project file paths.
#OUTDIR	= /usr/sbin
# for Debian
OUTDIR	= ../../../../debian/tmp/usr/sbin
#SYSINC	= /usr/include/linux
SYSINC	= /usr/src/linux/include
VPATH	= $(SYSINC)

# Tools options.
CFLAGS	= -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -I$(SYSINC)

####### RULES ################################################################

all:	wanconfig \
	sdladump \
	fpipemon \
	cpipemon \
	ppipemon 
	@echo "Ok."

wanconfig:	wanconfig.c 
	$(CC) $(CFLAGS) -o $@ $<

sdladump:	sdladump.c 
	$(CC) $(CFLAGS) -o $@ $<

fpipemon:	fpipemon.c 
	$(CC) -D_GNUC_ $(CFLAGS) -o $@ $<

cpipemon:	cpipemon.c 
	$(CC) -D_GNUC_ $(CFLAGS) -o $@ $<

ppipemon:	ppipemon.c
	$(CC) -D_GNUC_ $(CFLAGS) -o $@ $< 

# for Debian
clean:
	rm -f wanconfig sdladump fpipemon ppipemon	\
		cpipemon xpipemon

install:
	cp -p wanconfig $(OUTDIR)/wanconfig
	cp -p sdladump $(OUTDIR)/sdladump
	cp -p fpipemon $(OUTDIR)/fpipemon
	cp -p cpipemon $(OUTDIR)/cpipemon
	cp -p ppipemon $(OUTDIR)/ppipemon 
	@echo "wanpipe binaries installed"
