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

LIBNAME=am_$(ARCH).a
LIBDIR=../lib
HEADERNAME=am.h
HEADERDIR=../include
#Nobbi:
PCFLAGS=-g -Wall -DAM_THREADS -DLWP -I../include
PLIBS=$(SATHER_HOME)/system/lib/lwp.a

CFLAGS+=$(PCFLAGS) $(AM) -I$(HEADERDIR)
LIBS=-L$(LIBDIR) $(PLIBS)

AMCFILES=am.c am_add.c am.h am_int.h mesg.c \
         am_nothread.c am_lwp.c am_solaris.c am_linux.c am_win32.c \
	 am_tcp.c am_lanai.c am_meiko.c 

OBJ=am.o am_tcp.o am_add.o am_meiko.o am_lanai.o am_lwp.o am_solaris.o am_linux.o \
    am_win32.o am_nothread.o

default: $(LIBNAME)

$(LIBNAME): $(OBJ) Makefile
	$(RM) -f $(LIBNAME)
	$(AR) rcs $(LIBNAME) $(OBJ)

install: $(LIBNAME) Makefile
	$(CP) $(LIBNAME) $(LIBDIR)/$(LIBNAME)
	$(CP) am.h $(HEADERDIR)/$(HEADERNAME)

am.o:		Makefile am.c am.h am_int.h
am_nothread.o:	Makefile am_nothread.c am.h am_int.h
am_lwp.o:	Makefile am_lwp.c am.h am_int.h
am_tcp.o:	Makefile am_tcp.c am.h am_int.h
am_add.o:	Makefile am_add.c am.h am_int.h
am_lanai.o:	Makefile am_lanai.c am.h am_int.h # ../config/lanai/lcp/ep.h ../config/lanai/lcp/ifc.h 
am_meiko.o:	Makefile am_meiko.c am.h am_int.h
am_solaris.o:	Makefile am_solaris.c am.h am_int.h
am_linux.o:	Makefile am_linux.c am.h am_int.h
am_win32.o:	Makefile am_win32.c am.h am_int.h

mesg.o:		Makefile mesg.c am.h

clean:
	$(RM) -f *.o am_*.a mesg

test: mesg Makefile
#	@-echo "*** The Library is now beeing tested."
#	@-echo "*** On a slow system the test will run for several minutes"
#	$(AM_TEST)
mesg: mesg.o $(LIBNAME) am.h $(OBJ) $(LWP)
	$(CC) $(CFLAGS) -o mesg mesg.o $(OBJ) $(LIBS)
