# $Id: Makefile,v 1.1.1.1 1996/06/30 15:50:53 mtp Exp $
############################################################################
#    
#  COPYRIGHT NOTICE
#    
#  Copyright (C) 1995, 1996 Michael T. Peterson
#  This file is part of the PCthreads (tm) multithreading library
#  package.
#    
#  The source files and libraries constituting the PCthreads (tm) package
#  are free software; you can redistribute them and/or modify them under
#  the terms of the GNU Library General Public License as published by the Free
#  Software Foundation; either version 2 of the License, or (at your
#  option) any later version.
#    
#  The PCthreads (tm) package 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 the GNU
#  Library General Public License for more details.
#    
#  You should have received a copy of the GNU Library General Public
#  License along with this library (see the file COPYING.LIB); if not,
#  write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
#  MA 02139, USA.
#    
#  To report bugs, bug fixes, or provide feedback you may contact the
#  author, Michael T. Peterson, at either of the two email addresses listed
#  below:
#    
#                 mtp@big.aa.net (Preferred)
#                 mtp@zso.dec.com
#    
#    
#  Michael T. Peterson
#  Issaquah, WA
#  29 January, 1996
############################################################################
# $Log: Makefile,v $
# Revision 1.1.1.1  1996/06/30 15:50:53  mtp
# DCE threads for Linux V1.0
#
############################################################################
include     ../Make.defs
MAJOR       = 1
MINOR       = 0
REVISION    = 0
VERSION     = ${MAJOR}.${MINOR}.${REVISION}

LOCK_HEADERS = ${INCDIR}/locks.h

LIB_OBJECTS =   ${OBJDIR}/locks_priority.o \
                ${OBJDIR}/locks_shared.o

ifeq (${ISELF},yes)
    CFLAGS         += ${DEFINES} -D_ELF_
    TARGET_LIB      = ../lib/${LOCKLIB}.so.${VERSION}
    LINK            = ../lib/${LOCKLIB}.so.1
else
    TARGET_LIB      = ../lib/${LOCKLIB}.a
endif

all: ${TARGET_LIB} install tests

${TARGET_LIB}: ${LIB_OBJECTS}
	@echo + building ${TARGET_LIB}
ifeq (${ISELF},yes)
	@echo + building ${TARGET_LIB}
	@rm -f ${TARGET_LIB} ${LINK}
	@${CC} -shared -Wl,-soname,${LINK} -o ${TARGET_LIB} ${LIB_OBJECTS}
	@ln -s ${TARGET_LIB} ${LINK}
else
	@ar r ${TARGET_LIB} ${LIB_OBJECTS}    
endif

${OBJDIR}/locks_priority.o: locks_priority.c locks.h
${OBJDIR}/locks_shared.o:   locks_shared.c locks.h

LINK_LIBS   = ${LFLAGS} -llocks -lc_r -lpthread

tests: test1-${exe} test2-${exe} test3-${exe}

test1-${exe}: test1.c
	@echo + building test1
	@${CC} ${CFLAGS} test1.c ${LINK_LIBS} -o test1-${exe} 

test2-${exe}: test2.c
	@echo + building test2
	@${CC} ${CFLAGS} test2.c ${LINK_LIBS} -o test2-${exe}

test3-${exe}: test3.c ${LOCK_HEADERS}
	@echo + building test3
	@${CC} ${CFLAGS} test3.c ${LINK_LIBS} -o test3-${exe}

install:
	@cp -f locks.h ${INCDIR}

clobber: clean
	@rm -f ${TARGET_LIB} ${LINK} ${LOCK_HEADERS} ${LIB_OBJECTS}

clean:
	@rm -f *.bak *.rem *~ test*-${exe}
