# === Makefile ================================================================
# Copyright (c) 1991, 1992, 1993 Chris Provenzano, proven@athena.mit.edu
#
#	Description: This file is for creating libpthread.a
#
#	1.00 93/07/15 proven
#		-Initial cut for pthreads.
#

#INSTALL_PATH = $${HOME}
      BINDIR = $(INSTALL_PATH)/bin/@sys
      LIBDIR = $(INSTALL_PATH)/lib/@sys
      MANDIR = $(INSTALL_PATH)/man
      INCDIR = $(INSTALL_PATH)/include
   SUBINCDIR = $(INCDIR)/pthread

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

        CSRC = globals.c queue.c mutex.c signal.c machdep.c pthread.c malloc.c \
               fd.c fd_kern.c syscall.S file.c fd_pipe.c cond.c pthread_attr.c \
               process.c wait.c wrapper.c

     HEADERS = queue.h mutex.h machdep.h

        OBJS = globals.o queue.o mutex.o signal.o machdep.o pthread.o malloc.o \
               fd.o fd_kern.o syscall.o file.o fd_pipe.o cond.o pthread_attr.o \
               process.o wait.o wrapper.o

       LINKS = machdep.c machdep.h syscall.S

   LIBRARIES = libpthread.a

################################################################################
#
# Here starts the nitty grity part of the Makefile.

all: $(LIBRARIES) $(BINARIES)

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) $(LINKS)

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

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

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

.s.o:
	$(AS) $<

# Some make programs are braindead
syscall.o: syscall.S
	$(CC) $(CFLAGS) -c syscall.S

libpthread.a: $(OBJS)
	ar rv libpthread.a $(OBJS)
	ranlib libpthread.a

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