## Copyright (c) 2002 David Santo Orcero irbis@orcero.org
## http://www.orcero.org/irbis
## Mosix is (c) of prof. Barak http://www.mosix.org
## OpenMosix is (c) of Moshe Bar http://www.openmosix.com
## Each respective trademark is of its own owner
## All rights reserved.
## This software is distributed under GPL 2
##
## THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTY IS ASSUMED.
## NO LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING
## FROM THE USE OF THIS SOFTWARE WILL BE ACCEPTED. IT CAN BURN
## YOUR HARD DISK, ERASE ALL YOUR DATA AND BROKE DOWN YOUR 
## MICROWAVE OVEN. YOU ARE ADVISED.
##


include ../configuration



CFLAGS	+= -I../moslib 
LDFLAGS += -s

LIBS = ../moslib/libmos.a


all: clean build man install

build: tune mtune tunepass tune_kernel prep_tune


tune: tune.o testloop.o
	$(CC) $(LDFLAGS) -o tune tune.o testloop.o

mtune: mtune.o testloop.o
	$(CC) $(LDFLAGS) -o mtune mtune.o testloop.o

tunepass: tunepass.o
	$(CC) -o tunepass tunepass.o

testloop.o: testloop.s

tune_kernel: tune_kernel.sh
	cp -f tune_kernel.sh tune_kernel
	chmod 550 tune_kernel

prep_tune: prep_tune.sh
	cp -f prep_tune.sh prep_tune
	chmod 550 prep_tune


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

man	: tune.man
	cp $? tune.1

install: build man
	$(INSTALL) -d -m 0755 $(INSTALLDIR)/sbin
	$(INSTALL) -d -m 0755 $(INSTALLDIR)/man/man1
	$(INSTALL) -c -m 0444 tune.1 $(INSTALLDIR)/man/man1
	$(INSTALL) -c -m 0555 -s tune $(INSTALLDIR)/sbin
	$(INSTALL) -c -m 0555 -s mtune $(INSTALLDIR)/sbin
	$(INSTALL) -c -m 0555 -s tunepass $(INSTALLDIR)/sbin
	$(INSTALL) -c -m 0555 tune_kernel $(INSTALLDIR)/sbin
	$(INSTALL) -c -m 0555 prep_tune $(INSTALLDIR)/sbin

clean:
	rm -f *.a *.o core
	rm -f tune mtune tunepass tune_kernel prep_tune tune.1

