# === 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.
#
#	1.10 93/07/15 proven
#		-Reorg, of build procedures
#

          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
          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 \
               sleep.c pthread_once.c pthread_join.c specific.c cleanup.c \
               pthread_detach.c process.c errno.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 \
               sleep.o pthread_once.o pthread_join.o cleanup.o specific.o \
               pthread_detach.o process.o errno.o wait.o wrapper.o

       LINKS = machdep.c machdep.h syscall.S

   LIBRARIES = 

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

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

REALOBJS = $(addprefix ../, $(OBJS))

all: $(REALOBJS)

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)

../%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

ifdef HPPA_HPUX_903
# For some machines it is necessary to do the following to compile the .S
# Architects include hppa
../syscall.o: syscall.S
	$(CC) $(CFLAGS) -E syscall.S > ../syscall.s
	as ../syscall.s -o ../syscall.o
	rm ../syscall.s
else
../%.o: %.S
	$(CC) $(CFLAGS) -c $< -o $@
endif


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