#------------------------------->  Makefile  <--------------------------------#
#- Copyright (C) 1994 by International Computer Science Institute            -#
#- This file is part of the GNU Sather package. It is free software; you may -#
#- redistribute  and/or modify it under the terms of the  GNU General Public -#
#- License (GPL)  as  published  by the  Free  Software  Foundation;  either -#
#- version 2 of the license, 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 Doc/GPL for more details.        -#
#- The license text is also available from:  Free Software Foundation, Inc., -#
#- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     -#
#------------->  Please email comments to <bug-sather@gnu.org>  <-------------#

SATHER_HOME=$(shell cd ../..;pwd)

include $(SATHER_HOME)/config.default

CFLAGS += -DLWP

OBJ =lwp.o sem.o queue.o clk.o sig.o timing.o
HEADER =arch.h lwp.h
ARCH_HEADER =arch_cygwin.h arch_linux.h
# arch_386bsd.h arch_mips.h arch_sun3.h arch_sun4.h

default: lwp.a

install: lwp.a
	[ -d ../lib ] || mkdir ../lib
	[ -d ../include ] || mkdir ../include
	cp -f lwp.a ../lib
	cp -f $(HEADER) $(ARCH_HEADER) ../include

test: producer timer

producer: producer.o lwp.a
	$(CC) $(CFLAGS) -o producer producer.o lwp.a

timer: timer.o lwp.a
	$(CC) $(CFLAGS) -o timer timer.o lwp.a

lwp.a: $(OBJ) lwp.h
	$(AR) rc lwp.a $(OBJ)
	$(RANLIB) lwp.a

bm.o: bm.c lwp.h arch.h
clk.o: clk.c lwp.h arch.h
lwp.o: lwp.c lwp.h arch.h arch.c
producer.o: producer.c lwp.h arch.h
queue.o: queue.c lwp.h arch.h
sem.o: sem.c lwp.h arch.h
sig.o: sig.c lwp.h arch.h
timing.o: timing.c
timer.o: timer.c lwp.h arch.h
producer.o: producer.c lwp.h arch.h

clean:
	rm -f *.o timer producer lwp.a
