# @(#)$Id: Makefile,v 1.8 1998/09/08 01:01:14 twitham Rel $

# Copyright (C) 1998 Tim Witham <twitham@pcocd2.intel.com>

# (see the files README and COPYING for more details)

# configuration defines, you may want to tweak these:

# base prefix of where to install
PREFIX	= /usr/local

# where to install the user programs
BINPATH	= $(PREFIX)/bin

# where to install the deamon and accessory scripts
ETCPATH	= $(PREFIX)/etc/wx200

# where to write the daily wx200 data files
DATAPATH	= $(ETCPATH)/data

# where to install the manual page(s)
MANPATH	= $(PREFIX)/man

# place to look for WX200, if no WX200 environment var (e.g. /dev/ttyS1)
WX200	= /dev/wx200

# compiler
CC	= gcc

# set any additional compiler flags here:
DFLAGS	=

# compiler flags; -DDATAPATH sets data directory, -DWX200 sets device
CFLAGS	= '-DVER="$(VER)"' '-DDATAPATH="$(DATAPATH)"' \
	'-DWX200="$(WX200)"' $(DFLAGS) -Wall -O3 -m486

# load flags, add -L/extra/lib/path if necessary
LDFLAGS	= -s

# nothing should need changed below here
############################################################

VER	= 0.7

REL	= $(patsubst %,Rel%,$(subst .,_,$(VER)))

PRG	= wxstdout wxdebug wxfilter wxread wx200

PRGS	= wx200d $(PRG)

all:	$(PRGS)

install:	all
	-mkdir -p $(MANPATH)/man1
	cp *.1 $(MANPATH)/man1
	-mkdir -p $(MANPATH)/man5
	cp *.5 $(MANPATH)/man5
	-mkdir -p $(MANPATH)/man8
	cp *.8 $(MANPATH)/man8
	-mkdir -p $(ETCPATH)
	-mkdir -p $(DATAPATH)
	-mkdir -p $(BINPATH)
	cp Makefile.data $(DATAPATH)/Makefile
	cp wxplot $(PRG) $(BINPATH)
	cp wxsum wxplot2html wx200d $(ETCPATH)

clean:
	$(RM) $(PRGS) *.o core *~ *.exe *.a

wx200d:	wx200d.o serial.o buffer.o parse.o tab.o
	$(CC) $^ $(LDFLAGS) -o $@

wxstdout:	wxstdout.o client.o
	$(CC) $^ $(LDFLAGS) -o $@

wxdebug:	wxdebug.o buffer.o parse.o
	$(CC) $^ $(LDFLAGS) -o $@

wxfilter:	wxfilter.o buffer.o parse.o tab.o
	$(CC) $^ $(LDFLAGS) -o $@

wx200:	wx200.o client.o buffer.o parse.o unit.o format.o
	$(CC) $^ $(LDFLAGS) -o $@

wxread:	wxread.o serial.o
	$(CC) $^ $(LDFLAGS) -o $@

dist:	clean
	( cd .. ; tar --exclude wx200d-$(VER)/RCS -czvf wx200d-$(VER).tar.gz \
		wx200d-$(VER) )

release:	clean
	-rcs -N$(REL): -sRel *
	-co -M *
