# === GNUmakefile ================================================================
# Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu
#
#	Description: This file is for creating the test programs for libpthread.a
#
#	1.00 93/08/03 proven
#		-Initial cut for pthreads.
#

INSTALL_PATH = $${HOME}
      BINDIR = $(INSTALL_PATH)/bin/@sys
      LIBDIR = $(INSTALL_PATH)/lib/@sys
      MANDIR = $(INSTALL_PATH)/man
      INCDIR = ../

        MAKE = make
          AR = gar
          AS = gas
          CC = gcc
         CPP = $(CC) -E -I$(INCDIR)
      CFLAGS = -c -g -O -I$(INCDIR) -I../include
 CDEBUGFLAGS = -g -DDEBUG		# -g, -O, -DDEBUG
       CLIBS = $(LIBDIR)/mylib.a
          LD = gld

        CSRC = test_create.c test_pthread_join.c test_switch.c test_sleep.c \
               test_readdir.c test_fork.c test_execve.c

     HEADERS = 

        OBJS = test_create.o test_pthread_join.o test_switch.o test_sleep.o \
               test_readdir.o test_fork.o test_execve.o \
			   p_bench_read.o p_bench_semaphore.o p_bench_mutex.o \
               p_bench_yield.o p_bench_getpid.o p_bench_pthread_create.o

    BINARIES = test_create test_pthread_join test_switch test_sleep \
               test_readdir test_fork test_execve
 PBENCHMARKS = p_bench_read p_bench_semaphore p_bench_mutex \
               p_bench_yield p_bench_getpid p_bench_pthread_create
 SBENCHMARKS = 
 DBENCHMARKS = 

# More flags
ADDITIONALFLAGS = -DPTHREAD_INITIAL_PORT
################################################################################
#
# Here starts the nitty grity part of the Makefile.

all: $(LIBRARIES) $(BINARIES) $(PBENCHMARKS) $(SBENCHMARKS) $(DBENCHMARKS)

clean: 
	rm -f $(OBJS) a.out core maketmp makeout

depend:
	sed '/\#\#\# Dependencies/q' < Makefile > maketmp
	(for i in $(CSRC);do $(CPP) -M $$i;done) >> maketmp
	cp maketmp Makefile

install: all 
	install mylib.a $(LIBDIR)

realclean: clean
	rm -f $(LIBRARIES) $(BINARIES) $(PBENCHMARKS) $(SBENCHMARKS) $(LINKS)

.c.s:
	$(CC) $(CFLAGS) -S $<

.c.o:
	$(CC) $(CFLAGS) -c $<

.s.o:
	$(AS) $<

$(SBENCHMARKS) $(DBENCHMARKS): $(OBJS)
	$(CC) -o $@ $@.o

$(PBENCHMARKS): $(OBJS) ../libpthread.a
	$(CC) -o $@ $@.o ../libpthread.a -lm

$(BINARIES): $(OBJS) ../libpthread.a
	$(CC) -static -o $@ $@.o ../libpthread.a -lm

################################################################################
### Do not remove the following line. It is for depend #########################
### Dependencies:
