# Copyright (C) 2001 Vladimir Popov <jumbo@narod.ru>
# $Id: Makefile,v 1.5 2001/05/12 18:44:31 pva Exp $
# Makefile for wmfmio - X frontend for fmio
CC?= cc
CFLAGS?= -O2 -Wall
CFLAGS+= -I/usr/X11R6/include

# separate volume and frequency management, not all cards support this
#CFLAGS+= -DVFSEPARATE

LIBDIR+= -L/usr/X11R6/lib
LIBS= -lXpm -lXext -lX11
OBJS= wmfmio.o wmgeneral.o
PREFIX?= /usr/local
MANPAGE= wmfmio.1

all: wmfmio man

wmfmio: $(OBJS)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBDIR) $(LIBS)

man: wmfmio.0

install: all
	install -d -o root -g bin $(PREFIX)/bin
	install -d -o root -g wheel $(PREFIX)/man/cat1
	install -c -s -o root -g bin -m 555 wmfmio $(PREFIX)/bin/wmfmio
	install -c -o root -g bin -m 444 wmfmio.0 $(PREFIX)/man/cat1/wmfmio.0

deinstall:
	rm -f $(PREFIX)/bin/wmfmio
	rm -f $(PREFIX)/man/cat1/wmfmio.0

clean:
	rm -f $(OBJS) wmfmio *core

distclean:
	rm -f $(OBJS) wmfmio *core wmfmio.0

wmfmio.0: $(MANPAGE)
	@echo "groff -Tascii -mandoc $(MANPAGE) > $@"
	@groff -Tascii -mandoc $(MANPAGE) > $@ || rm -f $@
