# $Header: /cvsroot/posix2/posix2/libext/libm/Makefile,v 1.3 2000/04/03 18:08:28 veit Exp $
#  @(#)Makefile 5.1beta 93/09/24 
# 
#  ====================================================
#  Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
# 
#  Developed at SunPro, a Sun Microsystems, Inc. business.
#  Permission to use, copy, modify, and distribute this
#  software is freely granted, provided that this notice 
#  is preserved.
#  ====================================================
# 
# 
#
# There are two options in making libm at fdlibm compile time:
# 	_IEEE_LIBM 	--- IEEE libm; smaller, and somewhat faster
#	_MULTI_LIBM	--- Support multi-standard at runtime by 
#			    imposing wrapper functions defined in 
#			    fdlibm.h:
#				_IEEE_MODE 	-- IEEE
#				_XOPEN_MODE 	-- X/OPEN
#				_POSIX_MODE 	-- POSIX/ANSI
#				_SVID3_MODE 	-- SVID
#
# Here is how to set up CFLAGS to create the desired libm at 
# compile time:
#
# 	CFLAGS = -D_IEEE_LIBM		... IEEE libm (recommended)
#	CFLAGS = -D_SVID3_MODE	... Multi-standard supported
#					    libm with SVID as the 
#					    default standard
#	CFLAGS = -D_XOPEN_MODE	... Multi-standard supported
#					    libm with XOPEN as the 
#					    default standard
#	CFLAGS = -D_POSIX_MODE	... Multi-standard supported
#					    libm with POSIX as the 
#					    default standard
#	CFLAGS = 			... Multi-standard supported
#					    libm with IEEE as the 
#					    default standard
# 
DEBUG = -O2 -g -mpentium -D_DEBUG -DDEBUG 

WFLAGS   = -Wall -Wmissing-prototypes -Wshadow -Wcast-align \
   -Wpointer-arith -Winline -Wmissing-declarations  \
   -Wstrict-prototypes 
# -Wconversion -W 

CFLAGS = $(DEBUG) $(WFLAGS) -Zmt -D__ST_MT_ERRNO__ \
 -D__LIBM_PRIVATE -D_USE_WRITE -D_MULTI_LIBM -D_POSIX_MODE

CINC = -I. -I../include

CC = gcc $(CFLAGS) $(CINC)

AR     = ar rc
EMXOMF = emxomf
EMXEXP = emxexp
RANLIB = ar s
RM     = rm -f

COMMON_SRCS = e_rem_pio2.c e_rem_pio2f.c \
	k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \
	k_standard.c k_tan.c k_tanf.c s_asinh.c s_cbrt.c s_cbrtf.c \
	s_erf.c s_erff.c s_expm1.c s_expm1f.c s_fabsf.c s_frexp.c \
	s_frexpf.c s_isinf.c s_isinff.c s_ldexpf.c s_lib_version.c \
	s_modff.c s_nextafter.c s_nextafterf.c s_tanh.c s_tanhf.c \
	w_acos.c w_atanhf.c \
	w_exp.c w_expf.c w_fmod.c w_fmodf.c w_hypot.c \
	w_hypotf.c w_j0.c w_log.c w_logf.c \
	w_pow.c w_powf.c w_remainder.c w_remainderf.c w_scalb.c w_scalbf.c \
	w_sqrt.c w_sqrtf.c
# 
SRCS = $(COMMON_SRCS) mathx.c 
OBJS = $(SRCS:.c=.o) i387math.o 

default: all

all: m.a exp

m.a:	$(OBJS)
	$(RM) $@
	$(AR) $@ $^
	$(RANLIB) $@
	$(EMXOMF) -l -s $@

$(OBJS): ../include/math.h ../include/mathx.h ../include/sys/types.h

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

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

exp: m.a
	$(EMXEXP) -u -o m.a > exp.mx


clean:
	$(RM) *.o *.lib *.a core