# Makefile -- makefile for Toshiba Linux Utilities
#
# Copyright 1997,98  Jonathan A. Buzzard (jonathan@buzzard.org.uk)
#
#
# 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, 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.
#


VERSION=1.1

CC = gcc
INSTALL = install
DESTDIR = /usr/local
LDFLAGS= -s

#
# if you are libc5 based add -DX_LOCALE to CFLAGS
#
CFLAGS= -O3 -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 \
-fno-strength-reduce -fcaller-saves -Wall

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

all: fan svpw hotkey

fan: fan.o
	$(CC) $(LDFLAGS) -o $@ fan.o

svpw: svpw.o
	$(CC) $(LDFLAGS) -o $@ svpw.o

hotkey: hotkey.o
	$(CC) $(LDFLAGS) -o $@ hotkey.o -L/usr/X11R6/lib -lX11

install: fan svpw hotkey
	$(INSTALL) -m 4755 fan       $(DESTDIR)/bin
	$(INSTALL) -m 0644 fan.1     $(DESTDIR)/man/man1
	$(INSTALL) -m 0755 svpw      $(DESTDIR)/bin
	$(INSTALL) -m 0644 svpw.1    $(DESTDIR)/man/man1
	$(INSTALL) -m 4755 hotkey    $(DESTDIR)/bin
	$(INSTALL) -m 0644 hotkey.1x $(DESTDIR)/man/man1

clean:
	rm -f *.o *.bak fan svpw hotkey core

dist:
	(rm -f *.o *.bak fan svpw hotkey core ChangeLog; \
	rcs2log > ChangeLog; \
	rm -rf /tmp/toshutils-$(VERSION); \
	mkdir /tmp/toshutils-$(VERSION); \
	cp * /tmp/toshutils-$(VERSION); \
	cd /tmp/toshutils-$(VERSION); \
	find -type d | xargs chmod 755; \
	find -type f | xargs chmod 644; \
	find -type d | xargs chown root:root; \
	find -type f | xargs chown root:root; \
	cd ..; \
	tar cvf toshutils-$(VERSION).tar toshutils-$(VERSION); \
	gzip -9f toshutils-$(VERSION).tar; \
	echo Done.)

