1 2#============================================================================= 3# 4# This Makefile is part of TestFloat, Release 3e, a package of programs for 5# testing the correctness of floating-point arithmetic complying with the IEEE 6# Standard for Floating-Point, by John R. Hauser. 7# 8# Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the 9# University of California. All rights reserved. 10# 11# Redistribution and use in source and binary forms, with or without 12# modification, are permitted provided that the following conditions are met: 13# 14# 1. Redistributions of source code must retain the above copyright notice, 15# this list of conditions, and the following disclaimer. 16# 17# 2. Redistributions in binary form must reproduce the above copyright 18# notice, this list of conditions, and the following disclaimer in the 19# documentation and/or other materials provided with the distribution. 20# 21# 3. Neither the name of the University nor the names of its contributors 22# may be used to endorse or promote products derived from this software 23# without specific prior written permission. 24# 25# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY 26# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE 28# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY 29# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 32# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35# 36#============================================================================= 37 38SOURCE_DIR ?= ../../source 39SOFTFLOAT_DIR ?= ../../../berkeley-softfloat-3 40PLATFORM ?= Linux-x86_64-GCC 41 42SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C 43SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include 44 45SOFTFLOAT_H = \ 46 $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ 47 $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h 48SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) 49 50TESTFLOAT_OPTS ?= \ 51 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ 52 -DLONG_DOUBLE_IS_EXTFLOAT80 53 54DELETE = rm -f 55C_INCLUDES = \ 56 -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) 57COMPILE_C = \ 58 gcc -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ 59 $(C_INCLUDES) -O2 -o $@ 60COMPILE_SLOWFLOAT_C = \ 61 gcc -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ 62 $(C_INCLUDES) -O3 -o $@ 63MAKELIB = ar crs $@ 64LINK = gcc -o $@ 65OTHER_LIBS = -lm 66 67OBJ = .o 68LIB = .a 69EXE = 70 71.PHONY: all 72all: \ 73 testsoftfloat$(EXE) \ 74 timesoftfloat$(EXE) \ 75 testfloat_gen$(EXE) \ 76 testfloat_ver$(EXE) \ 77 testfloat$(EXE) \ 78 79OBJS_GENCASES = \ 80 genCases_ui32$(OBJ) \ 81 genCases_ui64$(OBJ) \ 82 genCases_i32$(OBJ) \ 83 genCases_i64$(OBJ) \ 84 genCases_f16$(OBJ) \ 85 genCases_f32$(OBJ) \ 86 genCases_f64$(OBJ) \ 87 genCases_extF80$(OBJ) \ 88 genCases_f128$(OBJ) \ 89 90OBJS_WRITECASE = \ 91 writeCase_a_ui32$(OBJ) \ 92 writeCase_a_ui64$(OBJ) \ 93 writeCase_a_f16$(OBJ) \ 94 writeCase_ab_f16$(OBJ) \ 95 writeCase_abc_f16$(OBJ) \ 96 writeCase_a_f32$(OBJ) \ 97 writeCase_ab_f32$(OBJ) \ 98 writeCase_abc_f32$(OBJ) \ 99 writeCase_a_f64$(OBJ) \ 100 writeCase_ab_f64$(OBJ) \ 101 writeCase_abc_f64$(OBJ) \ 102 writeCase_a_extF80M$(OBJ) \ 103 writeCase_ab_extF80M$(OBJ) \ 104 writeCase_a_f128M$(OBJ) \ 105 writeCase_ab_f128M$(OBJ) \ 106 writeCase_abc_f128M$(OBJ) \ 107 writeCase_z_bool$(OBJ) \ 108 writeCase_z_ui32$(OBJ) \ 109 writeCase_z_ui64$(OBJ) \ 110 writeCase_z_f16$(OBJ) \ 111 writeCase_z_f32$(OBJ) \ 112 writeCase_z_f64$(OBJ) \ 113 writeCase_z_extF80M$(OBJ) \ 114 writeCase_z_f128M$(OBJ) \ 115 116OBJS_TEST = \ 117 test_a_ui32_z_f16$(OBJ) \ 118 test_a_ui32_z_f32$(OBJ) \ 119 test_a_ui32_z_f64$(OBJ) \ 120 test_a_ui32_z_extF80$(OBJ) \ 121 test_a_ui32_z_f128$(OBJ) \ 122 test_a_ui64_z_f16$(OBJ) \ 123 test_a_ui64_z_f32$(OBJ) \ 124 test_a_ui64_z_f64$(OBJ) \ 125 test_a_ui64_z_extF80$(OBJ) \ 126 test_a_ui64_z_f128$(OBJ) \ 127 test_a_i32_z_f16$(OBJ) \ 128 test_a_i32_z_f32$(OBJ) \ 129 test_a_i32_z_f64$(OBJ) \ 130 test_a_i32_z_extF80$(OBJ) \ 131 test_a_i32_z_f128$(OBJ) \ 132 test_a_i64_z_f16$(OBJ) \ 133 test_a_i64_z_f32$(OBJ) \ 134 test_a_i64_z_f64$(OBJ) \ 135 test_a_i64_z_extF80$(OBJ) \ 136 test_a_i64_z_f128$(OBJ) \ 137 test_a_f16_z_ui32_rx$(OBJ) \ 138 test_a_f16_z_ui64_rx$(OBJ) \ 139 test_a_f16_z_i32_rx$(OBJ) \ 140 test_a_f16_z_i64_rx$(OBJ) \ 141 test_a_f16_z_ui32_x$(OBJ) \ 142 test_a_f16_z_ui64_x$(OBJ) \ 143 test_a_f16_z_i32_x$(OBJ) \ 144 test_a_f16_z_i64_x$(OBJ) \ 145 test_a_f16_z_f32$(OBJ) \ 146 test_a_f16_z_f64$(OBJ) \ 147 test_a_f16_z_extF80$(OBJ) \ 148 test_a_f16_z_f128$(OBJ) \ 149 test_az_f16$(OBJ) \ 150 test_az_f16_rx$(OBJ) \ 151 test_abz_f16$(OBJ) \ 152 test_abcz_f16$(OBJ) \ 153 test_ab_f16_z_bool$(OBJ) \ 154 test_a_f32_z_ui32_rx$(OBJ) \ 155 test_a_f32_z_ui64_rx$(OBJ) \ 156 test_a_f32_z_i32_rx$(OBJ) \ 157 test_a_f32_z_i64_rx$(OBJ) \ 158 test_a_f32_z_ui32_x$(OBJ) \ 159 test_a_f32_z_ui64_x$(OBJ) \ 160 test_a_f32_z_i32_x$(OBJ) \ 161 test_a_f32_z_i64_x$(OBJ) \ 162 test_a_f32_z_f16$(OBJ) \ 163 test_a_f32_z_f64$(OBJ) \ 164 test_a_f32_z_extF80$(OBJ) \ 165 test_a_f32_z_f128$(OBJ) \ 166 test_az_f32$(OBJ) \ 167 test_az_f32_rx$(OBJ) \ 168 test_abz_f32$(OBJ) \ 169 test_abcz_f32$(OBJ) \ 170 test_ab_f32_z_bool$(OBJ) \ 171 test_a_f64_z_ui32_rx$(OBJ) \ 172 test_a_f64_z_ui64_rx$(OBJ) \ 173 test_a_f64_z_i32_rx$(OBJ) \ 174 test_a_f64_z_i64_rx$(OBJ) \ 175 test_a_f64_z_ui32_x$(OBJ) \ 176 test_a_f64_z_ui64_x$(OBJ) \ 177 test_a_f64_z_i32_x$(OBJ) \ 178 test_a_f64_z_i64_x$(OBJ) \ 179 test_a_f64_z_f16$(OBJ) \ 180 test_a_f64_z_f32$(OBJ) \ 181 test_a_f64_z_extF80$(OBJ) \ 182 test_a_f64_z_f128$(OBJ) \ 183 test_az_f64$(OBJ) \ 184 test_az_f64_rx$(OBJ) \ 185 test_abz_f64$(OBJ) \ 186 test_abcz_f64$(OBJ) \ 187 test_ab_f64_z_bool$(OBJ) \ 188 test_a_extF80_z_ui32_rx$(OBJ) \ 189 test_a_extF80_z_ui64_rx$(OBJ) \ 190 test_a_extF80_z_i32_rx$(OBJ) \ 191 test_a_extF80_z_i64_rx$(OBJ) \ 192 test_a_extF80_z_ui32_x$(OBJ) \ 193 test_a_extF80_z_ui64_x$(OBJ) \ 194 test_a_extF80_z_i32_x$(OBJ) \ 195 test_a_extF80_z_i64_x$(OBJ) \ 196 test_a_extF80_z_f16$(OBJ) \ 197 test_a_extF80_z_f32$(OBJ) \ 198 test_a_extF80_z_f64$(OBJ) \ 199 test_a_extF80_z_f128$(OBJ) \ 200 test_az_extF80$(OBJ) \ 201 test_az_extF80_rx$(OBJ) \ 202 test_abz_extF80$(OBJ) \ 203 test_ab_extF80_z_bool$(OBJ) \ 204 test_a_f128_z_ui32_rx$(OBJ) \ 205 test_a_f128_z_ui64_rx$(OBJ) \ 206 test_a_f128_z_i32_rx$(OBJ) \ 207 test_a_f128_z_i64_rx$(OBJ) \ 208 test_a_f128_z_ui32_x$(OBJ) \ 209 test_a_f128_z_ui64_x$(OBJ) \ 210 test_a_f128_z_i32_x$(OBJ) \ 211 test_a_f128_z_i64_x$(OBJ) \ 212 test_a_f128_z_f16$(OBJ) \ 213 test_a_f128_z_f32$(OBJ) \ 214 test_a_f128_z_f64$(OBJ) \ 215 test_a_f128_z_extF80$(OBJ) \ 216 test_az_f128$(OBJ) \ 217 test_az_f128_rx$(OBJ) \ 218 test_abz_f128$(OBJ) \ 219 test_abcz_f128$(OBJ) \ 220 test_ab_f128_z_bool$(OBJ) \ 221 222OBJS_LIB = \ 223 uint128_inline$(OBJ) \ 224 uint128$(OBJ) \ 225 fail$(OBJ) \ 226 functions_common$(OBJ) \ 227 functionInfos$(OBJ) \ 228 standardFunctionInfos$(OBJ) \ 229 random$(OBJ) \ 230 genCases_common$(OBJ) \ 231 $(OBJS_GENCASES) \ 232 genCases_writeTestsTotal$(OBJ) \ 233 verCases_inline$(OBJ) \ 234 verCases_common$(OBJ) \ 235 verCases_writeFunctionName$(OBJ) \ 236 readHex$(OBJ) \ 237 writeHex$(OBJ) \ 238 $(OBJS_WRITECASE) \ 239 testLoops_common$(OBJ) \ 240 $(OBJS_TEST) \ 241 242uint128$(OBJ): $(SOURCE_DIR)/uint128.h 243fail$(OBJ): $(SOURCE_DIR)/fail.h 244functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h 245functionInfos$(OBJ): $(SOURCE_DIR)/functions.h 246standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h 247random$(OBJ): $(SOURCE_DIR)/random.h 248genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h 249$(OBJS_GENCASES): \ 250 $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h 251genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h 252genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h 253verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h 254verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h 255readHex$(OBJ): $(SOURCE_DIR)/readHex.h 256writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h 257$(OBJS_WRITECASE): \ 258 $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h 259testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h 260$(OBJS_TEST): \ 261 $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ 262 $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h 263$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c 264 $(COMPILE_C) $(SOURCE_DIR)/$*.c 265testfloat$(LIB): $(OBJS_LIB) 266 $(MAKELIB) $^ 267 268OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) 269 270slowfloat$(OBJ): \ 271 platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ 272 $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c 273 $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c 274testsoftfloat$(OBJ): \ 275 platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ 276 $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ 277 $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ 278 $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c 279 $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c 280 281testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) 282 $(LINK) $^ $(OTHER_LIBS) 283 284OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) 285 286timesoftfloat$(OBJ): \ 287 platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ 288 $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c 289 $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c 290 291timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) 292 $(LINK) $^ $(OTHER_LIBS) 293 294OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) 295 296genLoops$(OBJ): \ 297 platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ 298 $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ 299 $(SOURCE_DIR)/genLoops.c 300 $(COMPILE_C) $(SOURCE_DIR)/genLoops.c 301testfloat_gen$(OBJ): \ 302 $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ 303 $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ 304 $(SOURCE_DIR)/testfloat_gen.c 305 $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c 306 307testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) 308 $(LINK) $^ $(OTHER_LIBS) 309 310OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) 311 312verLoops$(OBJ): \ 313 platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ 314 $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ 315 $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c 316 $(COMPILE_C) $(SOURCE_DIR)/verLoops.c 317testfloat_ver$(OBJ): \ 318 platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ 319 $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ 320 $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ 321 $(SOURCE_DIR)/testfloat_ver.c 322 $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c 323 324testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) 325 $(LINK) $^ $(OTHER_LIBS) 326 327OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) 328 329subjfloat$(OBJ): \ 330 platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ 331 $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c 332 $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c 333subjfloat_functions$(OBJ): \ 334 platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ 335 $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c 336 $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c 337testfloat$(OBJ): \ 338 platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ 339 $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ 340 $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ 341 $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c 342 $(COMPILE_C) $(SOURCE_DIR)/testfloat.c 343 344testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) 345 $(LINK) $^ $(OTHER_LIBS) 346 347.PHONY: clean 348clean: 349 $(DELETE) $(OBJS_LIB) testfloat$(LIB) 350 $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) 351 $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) 352 $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) 353 $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) 354 $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) 355 356