#------------------------------->  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

HEADERDIR=../include
LIBDEST=../lib
CFLAGS +=$(PCFLAGS) $(PSATHER) -I$(HEADERDIR)

SRC=psather.c alloc.c attach.c cache.c debug.c exceptions.c fakegc.c general.c \
    import.c locks.c parloop.c stat.c trace.c

HEADER=atomic.h attach.h debug.h local.h locks.h memory.h psather.h simple-par.h \
       stat.h trace.h

ARCHITECTURES=linux_lwp linux_smp


default: beware psather_$(ARCH).o

beware:
ifndef ARCH
	@echo ERROR: Variable ARCH has to be specified
	@exit 1
endif

psather_$(ARCH).o: $(SRC) $(HEADER)
	$(CC) $(CFLAGS) -c psather.c -o $@

install: beware psather_$(ARCH).o
	[ -d ../lib ] || mkdir ../lib
	[ -d ../include ] || mkdir ../include
	$(CP) psather_$(ARCH).o $(LIBDEST)
	$(CP) psather.h $(HEADERDIR)
	$(CP) simple-par.h $(HEADERDIR)

clean:
	rm -f *.o
