1207151Smarius# Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.org>
2207151Smarius# All rights reserved.
3207151Smarius#
4207151Smarius# Redistribution and use in source and binary forms, with or without
5207151Smarius# modification, are permitted provided that the following conditions
6207151Smarius# are met:
7207151Smarius# 1. Redistributions of source code must retain the above copyright
8207151Smarius#    notice, this list of conditions and the following disclaimer.
9207151Smarius# 2. Redistributions in binary form must reproduce the above copyright
10207151Smarius#    notice, this list of conditions and the following disclaimer in the
11207151Smarius#    documentation and/or other materials provided with the distribution.
12207151Smarius#
13207151Smarius# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14207151Smarius# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15207151Smarius# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16207151Smarius# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17207151Smarius# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18207151Smarius# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19207151Smarius# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20207151Smarius# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21207151Smarius# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
22207151Smarius# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23207151Smarius#
24207151Smarius# $FreeBSD: releng/11.0/tools/test/testfloat/sparc64/Makefile 207151 2010-04-24 12:11:41Z marius $
25207151Smarius
26207151Smarius.PATH: ${.CURDIR}/../../../../lib/libc/softfloat/bits64 ${.CURDIR}/..
27207151Smarius
28207151SmariusLIBC_DIR=	${.CURDIR}/../../../../lib/libc
29207151SmariusEMUFLOAT_DIR=	${LIBC_DIR}/sparc64/fpu
30207151Smarius
31207151SmariusLN=	ln -sf
32207151Smarius
33207151Smarius# Common source files
34207151SmariusSRCS1=	fail.c random.c softfloat.c testCases.c testLoops.c writeHex.c
35207151Smarius
36207151Smarius# Additional common sources to build testfloat/testemufloat
37207151SmariusSRCS2=	testFunction.c testfloat.c
38207151Smarius
39207151Smarius# Additional sources to build testemufloat
40207151SmariusSRCS3=	fpu.c fpu_add.c fpu_compare.c fpu_div.c fpu_emul.S fpu_explode.c \
41207151Smarius	fpu_implode.c fpu_mul.c fpu_qp.c fpu_sqrt.c fpu_subr.c fpu_util.c
42207151Smarius
43207151Smarius# Additional sources to build testfloat
44207151SmariusSRCS4=	systflags.c systfloat.S systmodes.c
45207151Smarius
46207151Smarius# Additional sources to build testsoftfloat
47207151SmariusSRCS5=	slowfloat.c testsoftfloat.c
48207151Smarius
49207151SmariusSRCS=	${SRCS1} ${SRCS2} ${SRCS3} ${SRCS4} ${SRCS5}
50207151Smarius
51207151SmariusOBJ_TF=		${SRCS1:R:S/$/.o/g} ${SRCS2:R:S/$/.o/g} ${SRCS4:R:S/$/.o/g}
52207151SmariusOBJ_TEF=	${SRCS1:R:S/$/.o/g} ${SRCS2:R:S/$/.o/g} ${SRCS3:R:S/$/.o/g}
53207151SmariusOBJ_TSF=	${SRCS1:R:S/$/.o/g} ${SRCS5:R:S/$/.o/g}
54207151Smarius
55207151Smariusall: testfloat testemufloat testsoftfloat
56207151Smarius
57207151SmariusCFLAGS+=	-I. -I${.CURDIR} -I${.CURDIR}/.. -I${LIBC_DIR}/sparc64/fpu \
58207151Smarius	-I${LIBC_DIR}/sparc64/sys -I${LIBC_DIR}/softfloat/bits64 \
59207151Smarius	-I${LIBC_DIR}/softfloat
60207151Smarius
61207151SmariusCLEANFILES+=	fpu.c fpu_add.c fpu_compare.c fpu_div.c fpu_emu.h \
62207151Smarius	fpu_explode.c fpu_implode.c fpu_mul.c fpu_qp.c fpu_sqrt.c fpu_subr.c \
63207151Smarius	${SRCS:R:S/$/.o/g} testfloat testemufloat testsoftfloat
64207151Smarius
65207151Smariustestsoftfloat: ${OBJ_TSF}
66207151Smarius	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJ_TSF}
67207151Smarius
68207151Smariustestfloat: ${OBJ_TF}
69207151Smarius	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJ_TF}
70207151Smarius
71207151Smariustestemufloat: ${OBJ_TEF}
72207151Smarius	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJ_TEF}
73207151Smarius
74207151Smariusbeforedepend: fpu_emu.h
75207151Smarius
76207151Smarius# The emulator code needs to be built with a local fpu_reg.h instead of
77207151Smarius# the one in ${EMUFLOAT_DIR}.  Unfortunately, C preprocessor semantics
78207151Smarius# means that a header file in the same directory as the source file
79207151Smarius# overrides any alternative header file location.  In order to include
80207151Smarius# the wanted header file, create symlinks pointing to the real files
81207151Smarius# and compile through the symlink.
82207151Smariusfpu.c: ${EMUFLOAT_DIR}/fpu.c
83207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
84207151Smariusfpu_add.c: ${EMUFLOAT_DIR}/fpu_add.c
85207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
86207151Smariusfpu_compare.c: ${EMUFLOAT_DIR}/fpu_compare.c
87207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
88207151Smariusfpu_div.c: ${EMUFLOAT_DIR}/fpu_div.c
89207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
90207151Smariusfpu_emu.h: ${EMUFLOAT_DIR}/fpu_emu.h
91207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
92207151Smariusfpu_explode.c: ${EMUFLOAT_DIR}/fpu_explode.c
93207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
94207151Smariusfpu_implode.c: ${EMUFLOAT_DIR}/fpu_implode.c
95207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
96207151Smariusfpu_mul.c: ${EMUFLOAT_DIR}/fpu_mul.c
97207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
98207151Smariusfpu_qp.c: ${EMUFLOAT_DIR}/fpu_qp.c
99207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
100207151Smariusfpu_sqrt.c: ${EMUFLOAT_DIR}/fpu_sqrt.c
101207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
102207151Smariusfpu_subr.c: ${EMUFLOAT_DIR}/fpu_subr.c
103207151Smarius	${LN} ${.ALLSRC} ${.TARGET}
104207151Smarius
105207151Smarius.include <bsd.prog.mk>
106