#------------------------------->  Makefile  <--------------------------------#
#- Copyright (C) 199x 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

INC_DIR=-I. -I../src
#CFLAGS =-DAT_$(ARCH) $(INC_DIR) $(DEBUG_FLAGS) -DAT_MIGRATION
CFLAGS =-DAT_$(ARCH) $(INC_DIR) $(DEBUG_FLAGS)

OBJS   =thread_queue.o thread_dqueue.o bundle_queue.o heap.o fifo.o \
	lifo.o mcs.o fifo_lazy.o lifo_lazy.o mcs_lazy.o lff.o crt.o

HEADERS=bundle_queue.h crt.h fifo.h fifo_lazy.h heap.h lff.h lifo.h \
	lifo_lazy.h mcs.h mcs_lazy.h mig.h scheduler.h state.h \
	thread_dqueue.h thread_queue.h

default: schedulers.a

schedulers.a: $(OBJS)
	$(AR) crvs schedulers.a $(OBJS)

install: schedulers.a
	cp $(HEADERS) ../../include
	cp schedulers.a ../../lib/libsched.a

thread_queue.o: thread_queue.h thread_queue.c
thread_dqueue.o: thread_dqueue.h thread_dqueue.c
bundle_queue.o: bundle_queue.h bundle_queue.c
heap.o: heap.h heap.c
fifo.o: state.h fifo.h fifo.c
lifo.o: state.h lifo.h lifo.c
mcs.o: state.h mcs.h mcs.c
mig.o: state.h mig.h mig.c
lff.o: state.h lff.h lff.c
crt.o: state.h crt.h crt.c
fifo_lazy.o: state.h fifo_lazy.h fifo_lazy.c
lifo_lazy.o: state.h lifo_lazy.h lifo_lazy.c
mcs_lazy.o: state.h mcs_lazy.h mcs_lazy.c

clean:
	rm -f *.o
	rm -f schedulers.a
