# === GNUmakefile =============================================================
# Copyright (c) 1991, 1992, 1993 Chris Provenzano, proven@athena.mit.edu
#
#	Description: This file is for creating libpthread.a
#
#	1.00 93/11/17 proven
#		-Put all the .o files into one file libpthread.a
#		-Initial cut for pthreads.
#

         SYS = 
INSTALL_PATH = $${HOME}

      BINDIR = $(INSTALL_PATH)/bin/$(SYS)
      LIBDIR = $(INSTALL_PATH)/lib/$(SYS)
      MANDIR = $(INSTALL_PATH)/man
      INCDIR = $(INSTALL_PATH)/include
   SUBINCDIR = $(INCDIR)/pthread

          AR = ar
          AS = gas
          CC = gcc
         CPP = $(CC) -E -I$(INCDIR)
      CFLAGS = -g -O -Iinclude -DPTHREAD_KERNEL
 CDEBUGFLAGS = -g -DDEBUG		# -g, -O, -DDEBUG
          LD = gld

        CSRC =

 PTHREAD_DIR = pthreads stdlib stdio gen
        DIRS = $(PTHREAD_DIR)

     HEADERS =

        OBJS = *.o
       LINKS = include/sys include/unistd.h include/pthread/machdep.h \
               include/pthread/posix.h pthreads/machdep.c pthreads/syscall.S

   LIBRARIES = libpthread.a

###############################################################################
#
# Read in any special flags that config knows about
include config.flags

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

all: $(LIBRARIES) $(BINARIES)

clean: 
	rm -f $(OBJS) a.out core maketmp makeout
	for x in $(DIRS); \
	do cd $$x; $(MAKE) clean; cd ..; \
	done

depend:
	for x in $(DIRS); \
	do cd $$x; $(MAKE) depend; cd ..; \
	done

install: all 
	for x in $(LIBRARIES); \
	do install $$x $(LIBDIR); \
	done

realclean: clean
	rm -f $(LIBRARIES) $(BINARIES) $(LINKS) config.status config.flags
	for x in $(DIRS); \
	do cd $$x; $(MAKE) realclean; cd ..; \
	done

libpthread.a: SUBDIRMAKE
	ar rv libpthread.a *.o
	ranlib libpthread.a

SUBDIRMAKE: config.status config.flags
	for x in $(DIRS); \
	do cd $$x; $(MAKE) all || exit 1; cd ..; \
	done

config.status config.flags:
	./configure $(SYSTEM_TYPE)
