#
# Really Simple Threads package.  Copyright Robert S. Thau 1996.
# This code may be used for any purpose.  It may be redistributed on
# the following terms: 1) this paragraph and the next must appear
# unaltered in any source distribution, and be prominently displayed
# in the supporting documentation for any source or binary
# distribution; 2) if you wish to distribute modified or derived
# works, each such work must bear a notice of who last altered the
# included version of Really Simple Threads, and when.  The notice of
# alterations shall be attached to the derivative works in the same
# manner as these two paragraphs, and shall be at least as prominent.
# Redistribution for any purpose is otherwise unrestricted.
#
# THIS CODE IS IN AN UNFINISHED STATE, AND HAS NOT BEEN TESTED
# TO THE POINT THAT THE AUTHOR BELIEVES IT CAN BE EXPECTED TO
# WORK RELIABLY.  IT IS SUITABLE, AT THIS POINT, FOR EXPERIMENTATION
# AND DEBUGGING ONLY.  TREAT ACCORDINGLY.

CC=gcc

## For SunOS:
CFLAGS=-g -DSUNOS4 -Wall -Wno-implicit 
DNSLIBS= -lresolv 

## For Linux:
#CFLAGS=-g -DLINUX -Wall

## For IRIX:
#CC = cc
#CFLAGS=-g -DIRIX 

## For HP-UX:
#CFLAGS=-DHPUX -Wall
#AR=ar

## For Digital Alpha OSF/1
#CC=cc
#CFLAGS=-g -DOSF1 

## For Solaris: 
#CFLAGS=-g -DSOLARIS2 -Wall
#DNSLIBS=-lsocket -lresolv

## For SCO OpenServer 5:
#CC = cc
#CFLAGS= -g -DSCO5 -w3 -v
#DNSLIBS=-lsocket

## For AIX:
#CFLAGS=-g -DAIX -Wall 
#MACHOBJS=rsthreads_aix.o

## For Ultrix:
#CFLAGS=-g -DULTRIX -Wall

## For A/UX:
#CFLAGS=-g -DAUX -Wall -D_POSIX_SOURCE
#EXTRA_LIBS=-lposix
#DNSLIBS= 

## For BSDI
#CFLAGS = -g -Wall

## For SunOS with gprof:
#CFLAGS=-O -g -pg -DSUNOS4 -Wall -Wno-implicit 
#DNSLIBS= -lresolv 

################################################################
# Should not have to modify for porting below this line.

LIBOBJS=rsthreads.o rsthreads_dns.o $(MACHOBJS)
LIB=librsthreads.a
TARGETS=$(LIB) rsthread_test rsthread_test_dns rsthread_test_getht

all: $(TARGETS)

rsthread_test: rsthread_test.o $(LIB)
	$(CC) rsthread_test.o $(LIB) $(DNSLIBS) -o rsthread_test $(EXTRA_LIBS)

rsthread_test_dns: rsthread_test_dns.o $(LIB)
	$(CC) rsthread_test_dns.o $(LIB) $(DNSLIBS) -o rsthread_test_dns $(EXTRA_LIBS)

rsthread_test_getht: rsthread_test_getht.o $(LIB)
	$(CC) rsthread_test_getht.o $(LIB) $(DNSLIBS) -o rsthread_test_getht $(EXTRA_LIBS)

$(LIB): $(LIBOBJS)
	$(AR) cr $(LIB) $(LIBOBJS)
	-(ranlib $(LIB); exit 0) >/dev/null 2>&1

rsthreads.o: rsthreads.c rsthreads.h
rsthreads_dns.o: rsthreads_dns.c rsthreads_dns.h rsthreads.h
rsthreads_aix.o: rsthreads_aix.s

rsthread_test.o: rsthread_test.c rsthreads.h 
rsthread_test_dns.o: rsthread_test_dns.c rsthreads_dns.h rsthreads.h
rsthread_test_getht.o: rsthread_test_dns.c rsthreads_dns.h rsthreads.h

clean:
	rm -f $(TARGETS)
	rm -f *.o *~
