# Generated automatically from Makefile.in by configure.
# --------------------------------------------------------------------
#    Copyright (C) 1999,  Daniel Schulz	   
# 
#    This file is part of the TDI library. The TDI library implements  
#    the generic part of the Thread Debug Interface for POSIX Threads
#    Implementations - TDI.
#
#    This library is free software; you can redistribute it and/or
#    modify it 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.
#
#    This library 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; if not, write to the Free
#    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#    Report problems and direct all questions to:
#
#    tdi-bugs@informatik.hu-berlin.de
#	
# $Author: dschulz $ $Date: 1999/05/03 23:04:07 $ $Name: TDI-alpha-release-2 $ 
# File: Makefile.in 
#
# ----------------------------------------------------------------------
CC             = cc
LIBC           = /usr/lib/libc.so
SHELL          = bash # all scripts run in bash
AR             = ar
RANLIB         = ranlib

SYSNAME        = $(shell uname -s)

TDI_CFLAGS     = -g -DTDI_SERVER
TDI_INCLUDE    = ../include/
TDI_SERVER_OBS = tdi-dlgen.o \
                 smalloc.o \
                 tdi-server.o \
                 tdi-access-y.o \
                 tdi-access-l.o \
                 tdi-access.o \
                 tdi-comm.o \
                 tdi-comm-sm.o 

SRV_LIB_OBJ_DEPS= $(TDI_SERVER_OBS)
SRV_LIB_SRC_DEPS= $(SRV_LIB_OBJ_DEPS:.o=.c)

SHADED_DEF      = tdi-shaded.$(SYSNAME)

SHARED_FLAG     = -G -z text
PIC_FLAG        = -fPIC

EXT_INC_DEPS = tdi-comm-sm.h tdi-comm.h tdi-server.h tdi.h
EXT_SRC_DEPS = tdi-comm-sm.c tdi-comm.c comm-config.h

EXT_DEPS = $(EXT_INC_DEPS) $(EXT_SRC_DEPS)

new: libTDISrv.a libTDISrv.so

# prefix was specified with /home/mueller/tdi/TDI/..
install: libTDISrv.a libTDISrv.so
	cp $? /home/mueller/tdi/TDI/../lib 

tdi-server.o: tdi-server.c $(EXT_DEPS)

tdi-access.o: tdi-access.c $(EXT_DEPS)

tdi-access-y.o: tdi-access-y.c $(EXT_DEPS)

tdi-access-l.o: tdi-access-l.c $(EXT_DEPS)

tdi-access-l.c: tdi-access.lex 
	flex -t tdi-access.lex > $@

tdi-access-y.c: tdi-access-y.y 
	bison -v -d -o$@ tdi-access-y.y

tdi-dlgen.c: $(SHADED_DEF)
	./tdi-dlgen $(SHADED_DEF) $(LIBC)


libTDISrv.so: $(SRV_LIB_OBJ_DEPS:%.o=%.do)
	$(LD) -o $@ $(SHARED_FLAG)  $^

libTDISrv.a: $(SRV_LIB_OBJ_DEPS)
	$(AR) ru $@ $^
	$(RANLIB) $@

tdi-clean:
	@for i in  $(SRV_LIB_OBJ_DEPS:%.o=%.do) $(SRV_LIB_OBJ_DEPS) tdi-access-y.c tdi-access-l.c tdi-access-y.h tdi-access-y.output tdi-dlgen.[ch]; do \
	if [ -f $$i ] ;then \
    echo -n "Removing $$i ... "; \
    rm -f $$i  ; \
    echo "done."; \
    fi ;\
	done            

tdi-clean-lib:
	@if [ -f libTDISrv.a ] ;then \
	echo -n "Removing libTDISrv.a ... "; \
	rm -f libTDISrv.a ; \
	echo "done."; \
	fi
	@if [ -f libTDISrv.so ] ;then \
	echo -n "Removing libTDISrv.so ... "; \
	rm -f libTDISrv.so ; \
	echo "done."; \
	fi


clean:
	make tdi-clean-lib
	make tdi-clean
	rm -rf *~ *.o $(EXT_DEPS)
	rm -f ../lib/libTDISrv.*

%.o:	%.c Makefile $(EXT_DEPS)
	$(CC) $(TDI_CFLAGS) -I. -I$(TDI_INCLUDE) -c $(@:%.o=%.c)

%.do:%.c Makefile $(EXT_DEPS)
	$(CC) $(TDI_CFLAGS) -I. -I$(TDI_INCLUDE) $(PIC_FLAG) -c $(@:%.do=%.c)  -o $@

$(EXT_INC_DEPS):
	ln -s ../include/$@ .

$(EXT_SRC_DEPS):
	ln -s ../Comm/$@ .
