#sccs	"@(#)libm:Makefile	1.7"
# MC68881 Support received from AT&TIS, W. King on 3/86 sCcSid: 1.28

#
# makefile for libm
#
# Note that the object list given in OBJECTS is in the order in which the files
# should be added to the archive when it is created.  If the files are not
# ordered correctly, linking of libm fails on the pdp11 and is slowed down
# on other machines.

include	$(MAKEINC)/Makepre.h

# -O option is buggy
CFLAGS = -Dm68k -Dm68 -Dmc68k -DFLEXNAMES -Uvax  -UMICROOMS -Updp11 -Uu3b   -I../ -I../include
LIBP	= $(LIB)/libp
VARIANT =
LIBNAME = lib$(VARIANT)m.a

OBJECTS =\
	asin.o\
	atan.o\
	erf.o\
	fabs.o\
	floor.o\
	fmod.o\
 	fpa_err.o \
	gamma.o\
	hypot.o\
	jn.o\
	j0.o\
	j1.o\
	pow.o\
	log.o\
	sin.o\
	sqrt.o\
	tan.o\
	tanh.o\
	sinh.o\
	exp.o\
	matherr.o

DEPENDLIST = asin.c \
	atan.c \
	erf.c \
	exp.c \
	fabs.c \
	floor.c \
	fmod.c \
	fpa_err.c \
	gamma.c \
	hypot.c \
	j0.c \
	j1.c \
	jn.c \
	log.c \
	matherr.c \
	pow.c \
	sin.c \
	sinh.c \
	sqrt.c \
	tan.c \
	tanh.c

all: Makeincludes $(LIBNAME)

Makeincludes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes
	$(MAKE)

includes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes

##all: $(LIBNAME) profiledlib
## profiling not working yet

$(LIBNAME): $(OBJECTS)
	rm -f $(LIBNAME)
	$(AR) cr $(LIBNAME) `$(LORDER) $(OBJECTS) | tsort`

profiledlib:
	make -e libp/$(LIBNAME) LIBNAME=libp/$(LIBNAME) \
						CFLAGS="-p $(CFLAGS)"

mq: mq.o $(LIBNAME)
	$(CC) $(CFLAGS) mq.o $(LIBNAME) -o mq

install:
	chown bin $(LIBNAME)
	chgrp bin $(LIBNAME)
	chmod 644 $(LIBNAME)
	echo $(LIBNAME) | cpio -pumv $(LIB)
	$(INSTALL) -i$(EXITFLAG) $(LIBNAME) $(INSDIR) $(PROTOFILE)

clean:
	rm -f $(OBJECTS) x

clobber: clean
	rm -f $(LIBNAME) x

populate:
	getunit

include Makeincludes
include	$(MAKEINC)/Makepost.h
