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

         SYS = 
INSTALL_PATH = $${HOME}

      BINDIR = $(INSTALL_PATH)/bin/$(SYS)
      LIBDIR = $(INSTALL_PATH)/lib/$(SYS)
      MANDIR = $(INSTALL_PATH)/man
      INCDIR = ../

          AR = gar
          AS = gas
          CC = gcc -b elf
         CPP = $(CC) -E -I$(INCDIR)
      CFLAGS = -c -b elf -g -O -I$(INCDIR) -I../include
 CDEBUGFLAGS = -g -DDEBUG		# -g, -O, -DDEBUG
          LD = gld

        CSRC = test_create.c test_wait.c test_switch.c test_sleep.c

     HEADERS = 

        OBJS = test_create.o test_switch.o test_sleep.o p_bench_read.o test_wait.o

    BINARIES = test_create test_switch test_sleep test_pause test_wait
 PBENCHMARKS = p_bench_read p_bench_semaphore p_bench_mutex p_bench_yield

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

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

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)

$(SOBJS): %.o: %.c
	$(CC) -c $<

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

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

.s.o:
	$(AS) $<

$(SBENCHMARKS): $(SOBJS)
	$(CC) -o $@ $@.o

$(PBENCHMARKS): $(OBJS) ../malloc/gmalloc.o ../lib/libgthreads.a ../lib/libmalloc.a
	$(CC) -o $@ $@.o ../malloc/gmalloc.o ../lib/libgthreads.a ../lib/libmalloc.a

$(BINARIES): $(OBJS) ../malloc/gmalloc.o ../lib/libgthreads.a ../lib/libmalloc.a
	$(CC) -b elf -o $@ $@.o  ../malloc/gmalloc.o ../lib/libmalloc.a ../lib/libgthreads.a

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