# paramaterized flags. those ending in pthread can only run with libpthread;
# those ending in sproc can be used with libthrsproc or libthrpthread

## targets
  TARGS_pthread	= template \
		mutex \
		rwlock \
		slock \
		life_cycle

    TARGS_sproc = affinity \
	cond \
	sem \
	syscall

## libraries to link against
LDLIBS_sproc	= -l$(THRSPROC) -lTst
LDLIBS_pthread	= $(LDLIBS) -l$(THRPTHREAD) -lpthread -lTst

# objects that are part of the harness
HRN_OBJS	= hrn.o trc.o

# our thread libraries
THREADLIBPREFIX=sthr
THRSPROC=$(THREADLIBPREFIX)sproc
LIBTHRSPROC=lib$(THRSPROC).so
THRPTHREAD=$(THREADLIBPREFIX)pthread
LIBTHRPTHREAD=lib$(THRPTHREAD).so

# Add -L. so we can find libsthrsproc
LLDOPTS_sproc=$(LDOPTS) -L. -rpath .:$(PWD)
LLDOPTS_pthread=$(LDOPTS) -L. -rpath .:$(PWD)

## extra cflags 
DEFINES_sproc= -DSPROC
CFLAGS_sproc=  $(CFLAGS) $(DEFINES_sproc)
CFLAGS_pthread= $(CFLAGS)

LIBTHRSPROCOBJS=sthr_sproc.o sthr.o
LIBTHRPTHREADOBJS=sthr_pthread.o sthr.o

## the standard Makefiles want TARGETS to be all targets
TARGETS=$(LIBTHRSPROC) $(LIBTHRPTHREAD) $(TARGS_pthread) $(TARGS_sproc)

## build for debugging by default
CFLAGS:=$(CFLAGS) -g3

