diff --git a/cephes-double/makefile b/cephes-double/makefile index a5b6212..07d5ba2 100644 --- a/cephes-double/makefile +++ b/cephes-double/makefile @@ -1,16 +1,17 @@ # Double precision Cephes library # Makefile for unix or GCC +# IMPORTANT: select desired assmbly language utilities for your machine type. CC = gcc +#CC = /a/gnu/linux/gcc/xgcc -B/a/gnu/linux/gcc/ -I/a/gnu/linux/gcc/include #CFLAGS = -g -O2 -Wall -fno-builtin # -ffloat-store -CFLAGS ?= -O3 -Wall -fno-builtin -fPIC +CFLAGS = -g -O2 -Wall -fno-builtin AR = ar RANLIB = ranlib -INCS = . +INCS = mconf.h AS = as -OUT_DIR ?= . -OBJ = acosh.o airy.o asin.o asinh.o atan.o atanh.o bdtr.o beta.o \ +OBJS = acosh.o airy.o asin.o asinh.o atan.o atanh.o bdtr.o beta.o \ btdtr.o cbrt.o chbevl.o chdtr.o clog.o cmplx.o const.o \ cosh.o dawsn.o drand.o ei.o ellie.o ellik.o ellpe.o ellpj.o ellpk.o \ exp.o exp10.o exp2.o expn.o expx2.o fabs.o fac.o fdtr.o \ @@ -22,18 +23,106 @@ shichi.o sici.o sin.o sindg.o sinh.o spence.o stdtr.o struve.o \ tan.o tandg.o tanh.o unity.o yn.o zeta.o zetac.o \ sqrt.o floor.o setprec.o mtherr.o -OBJS = $(addprefix $(OUT_DIR)/,$(OBJ)) +all: libmd.a mtst dtestvec monot dcalc paranoia # stamp-timing -$(OUT_DIR)/%.o: %.c - $(CC) $(CFLAGS) -I $(INCS) -c -o $@ $< +stamp-timing: libmd.a mtst time-it + time-it "mtst > /dev/null" + touch stamp-timing -$(OUT_DIR)/libmd.a: $(OBJS) $(INCS) - $(AR) rv $@ $(OBJS) - $(RANLIB) $@ +time-it: time-it.o + $(CC) -o time-it time-it.o -lib: $(OUT_DIR)/libmd.a +time-it.o: time-it.c + $(CC) -O2 -c time-it.c + +dcalc: dcalc.o libmd.a + $(CC) -o dcalc dcalc.o libmd.a +# aout2exe mtst + +mtst: mtst.o libmd.a + $(CC) -v -o mtst mtst.o libmd.a +# gcc -Wl,-verbose -b i486-linuxaout -v -o mtst mtst.o libmd.a +# coff2exe mtst + +mtst.o: mtst.c + $(CC) -O2 -Wall -c mtst.c + +dtestvec: dtestvec.o libmd.a + $(CC) -o dtestvec dtestvec.o libmd.a + +dtestvec.o: dtestvec.c + $(CC) -g -c dtestvec.c + +monot: monot.o libmd.a + $(CC) -o monot monot.o libmd.a + +monot.o: monot.c + $(CC) -g -c monot.c + +paranoia: paranoia.o setprec.o libmd.a + $(CC) -o paranoia paranoia.o setprec.o libmd.a + +paranoia.o: paranoia.c + $(CC) -Wno-implicit -c paranoia.c + +libmd.a: $(OBJS) $(INCS) +# for real Unix: + $(AR) rv libmd.a $(OBJS) +# for djgcc MSDOS: +# >libmd.rf -rv libmd.a $(OBJS) +# $(AR) @libmd.rf + $(RANLIB) libmd.a + +# Assembly language utilities. +# If the following are all commented out, the C versions +# will be used by default. + +# IBM PC: +#sqrt.o: sqrt.387 +# $(AS) -o sqrt.o sqrt.387 +# +#floor.o: floor.387 +# $(AS) -o floor.o floor.387 +# +#setprec.o: setprec.387 +# $(AS) -o setprec.o setprec.387 + +# ELF versions for linux (no underscores) + +#sqrt.o: sqrtelf.387 +# $(AS) -o sqrt.o sqrtelf.387 + +#floor.o: floorelf.387 +# $(AS) -o floor.o floorelf.387 + +#setprec.o: setprelf.387 +# $(AS) -o setprec.o setprelf.387 + +sqrt.o: sqrtelf.amd64 + $(AS) -o sqrt.o sqrtelf.amd64 + +setprec.o: setprelf.amd64 + $(AS) -o setprec.o setprelf.amd64 + +# Motorola 68881. Caution, subroutine return conventions vary. +#sqrt.o: sqrt.688 +# $(AS) -o sqrt.o sqrt.688 +# +#setprec.o: setprec.688 +# $(AS) -o setprec.o setprec.688 + +# SPARC: +#sqrt.o: sqrt.spa +# $(AS) -o sqrt.o sqrt.spa clean: - rm -f $(OUT_DIR)/*.o - rm -f $(OUT_DIR)/libmd.a + rm -f *.o + rm -f mtst + rm -f paranoia + rm -f dcalc + rm -f dtestvec + rm -f monot + rm -f libmd.a + rm -f time-it + rm -f dtestvec diff --git a/cephes-double/setprelf.amd64 b/cephes-double/setprelf.amd64 index d6f7d21..2954119 100644 --- a/cephes-double/setprelf.amd64 +++ b/cephes-double/setprelf.amd64 @@ -14,9 +14,9 @@ LFB0: subq $8,%rsp fstcw (%rsp) fwait - movw (%rsp),%rax - andw $0xfcff,%rax - movw %rax,(%rsp) + movw (%rsp),%ax + andw $0xfcff,%ax + movw %ax,(%rsp) fldcw (%rsp) popq %rax popq %rax @@ -36,8 +36,8 @@ dprec: andq $0xfcff,%rax /* trap on overflow */ /* andq $0xfcf7,%rax */ - orw $0x200,%rax - movw %rax,(%rsp) + orw $0x200,%ax + movw %ax,(%rsp) fldcw (%rsp) popq %rax popq %rax @@ -52,8 +52,8 @@ ldprec: subq $8,%rsp fstcw (%rsp) fwait - movw (%rsp),%rax - orw $0x300,%rax + movw (%rsp),%ax + orw $0x300,%ax movq %rax,(%rsp) fldcw (%rsp) popq %rax