1# SPDX-License-Identifier: BSD-3-Clause
2
3#=============================================================================
4#
5# This Makefile is part of the SoftFloat IEEE Floating-Point Arithmetic
6# Package, Release 3a, by John R. Hauser.
7#
8# Copyright 2011, 2012, 2013, 2014 The Regents of the University of
9# 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
39SPECIALIZE_TYPE = 8086-SSE
40
41SOFTFLOAT_OPTS = -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV64TO32
42
43DELETE = rm -f
44C_INCLUDES = -I. -I$(SOURCE_DIR)/$(SPECIALIZE_TYPE) -I$(SOURCE_DIR)/include
45COMPILE_C = \
46  gcc -c -Werror-implicit-function-declaration -DSOFTFLOAT_FAST_INT64 \
47    $(SOFTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@
48MAKELIB = ar crs $@
49
50OBJ = .o
51LIB = .a
52
53.PHONY: all
54all: softfloat$(LIB)
55
56OBJS_PRIMITIVES = \
57  s_eq128$(OBJ) \
58  s_le128$(OBJ) \
59  s_lt128$(OBJ) \
60  s_shortShiftLeft128$(OBJ) \
61  s_shortShiftRight128$(OBJ) \
62  s_shortShiftRightJam64$(OBJ) \
63  s_shortShiftRightJam64Extra$(OBJ) \
64  s_shortShiftRightJam128$(OBJ) \
65  s_shortShiftRightJam128Extra$(OBJ) \
66  s_shiftRightJam32$(OBJ) \
67  s_shiftRightJam64$(OBJ) \
68  s_shiftRightJam64Extra$(OBJ) \
69  s_shiftRightJam128$(OBJ) \
70  s_shiftRightJam128Extra$(OBJ) \
71  s_shiftRightJam256M$(OBJ) \
72  s_countLeadingZeros8$(OBJ) \
73  s_countLeadingZeros32$(OBJ) \
74  s_countLeadingZeros64$(OBJ) \
75  s_add128$(OBJ) \
76  s_add256M$(OBJ) \
77  s_sub128$(OBJ) \
78  s_sub256M$(OBJ) \
79  s_mul64ByShifted32To128$(OBJ) \
80  s_mul64To128$(OBJ) \
81  s_mul128By32$(OBJ) \
82  s_mul128To256M$(OBJ) \
83  s_approxRecip32_1$(OBJ) \
84  s_approxRecipSqrt32_1$(OBJ) \
85
86OBJS_SPECIALIZE = \
87  softfloat_raiseFlags$(OBJ) \
88  s_f32UIToCommonNaN$(OBJ) \
89  s_commonNaNToF32UI$(OBJ) \
90  s_propagateNaNF32UI$(OBJ) \
91  s_f64UIToCommonNaN$(OBJ) \
92  s_commonNaNToF64UI$(OBJ) \
93  s_propagateNaNF64UI$(OBJ) \
94  extF80M_isSignalingNaN$(OBJ) \
95  s_extF80UIToCommonNaN$(OBJ) \
96  s_commonNaNToExtF80UI$(OBJ) \
97  s_propagateNaNExtF80UI$(OBJ) \
98  f128M_isSignalingNaN$(OBJ) \
99  s_f128UIToCommonNaN$(OBJ) \
100  s_commonNaNToF128UI$(OBJ) \
101  s_propagateNaNF128UI$(OBJ) \
102
103OBJS_OTHERS = \
104  s_roundPackToUI32$(OBJ) \
105  s_roundPackToUI64$(OBJ) \
106  s_roundPackToI32$(OBJ) \
107  s_roundPackToI64$(OBJ) \
108  s_normSubnormalF32Sig$(OBJ) \
109  s_roundPackToF32$(OBJ) \
110  s_normRoundPackToF32$(OBJ) \
111  s_addMagsF32$(OBJ) \
112  s_subMagsF32$(OBJ) \
113  s_mulAddF32$(OBJ) \
114  s_normSubnormalF64Sig$(OBJ) \
115  s_roundPackToF64$(OBJ) \
116  s_normRoundPackToF64$(OBJ) \
117  s_addMagsF64$(OBJ) \
118  s_subMagsF64$(OBJ) \
119  s_mulAddF64$(OBJ) \
120  s_normSubnormalExtF80Sig$(OBJ) \
121  s_roundPackToExtF80$(OBJ) \
122  s_normRoundPackToExtF80$(OBJ) \
123  s_addMagsExtF80$(OBJ) \
124  s_subMagsExtF80$(OBJ) \
125  s_normSubnormalF128Sig$(OBJ) \
126  s_roundPackToF128$(OBJ) \
127  s_normRoundPackToF128$(OBJ) \
128  s_addMagsF128$(OBJ) \
129  s_subMagsF128$(OBJ) \
130  s_mulAddF128$(OBJ) \
131  softfloat_state$(OBJ) \
132  ui32_to_f32$(OBJ) \
133  ui32_to_f64$(OBJ) \
134  ui32_to_extF80$(OBJ) \
135  ui32_to_extF80M$(OBJ) \
136  ui32_to_f128$(OBJ) \
137  ui32_to_f128M$(OBJ) \
138  ui64_to_f32$(OBJ) \
139  ui64_to_f64$(OBJ) \
140  ui64_to_extF80$(OBJ) \
141  ui64_to_extF80M$(OBJ) \
142  ui64_to_f128$(OBJ) \
143  ui64_to_f128M$(OBJ) \
144  i32_to_f32$(OBJ) \
145  i32_to_f64$(OBJ) \
146  i32_to_extF80$(OBJ) \
147  i32_to_extF80M$(OBJ) \
148  i32_to_f128$(OBJ) \
149  i32_to_f128M$(OBJ) \
150  i64_to_f32$(OBJ) \
151  i64_to_f64$(OBJ) \
152  i64_to_extF80$(OBJ) \
153  i64_to_extF80M$(OBJ) \
154  i64_to_f128$(OBJ) \
155  i64_to_f128M$(OBJ) \
156  f32_to_ui32$(OBJ) \
157  f32_to_ui64$(OBJ) \
158  f32_to_i32$(OBJ) \
159  f32_to_i64$(OBJ) \
160  f32_to_ui32_r_minMag$(OBJ) \
161  f32_to_ui64_r_minMag$(OBJ) \
162  f32_to_i32_r_minMag$(OBJ) \
163  f32_to_i64_r_minMag$(OBJ) \
164  f32_to_f64$(OBJ) \
165  f32_to_extF80$(OBJ) \
166  f32_to_extF80M$(OBJ) \
167  f32_to_f128$(OBJ) \
168  f32_to_f128M$(OBJ) \
169  f32_roundToInt$(OBJ) \
170  f32_add$(OBJ) \
171  f32_sub$(OBJ) \
172  f32_mul$(OBJ) \
173  f32_mulAdd$(OBJ) \
174  f32_div$(OBJ) \
175  f32_rem$(OBJ) \
176  f32_sqrt$(OBJ) \
177  f32_eq$(OBJ) \
178  f32_le$(OBJ) \
179  f32_lt$(OBJ) \
180  f32_eq_signaling$(OBJ) \
181  f32_le_quiet$(OBJ) \
182  f32_lt_quiet$(OBJ) \
183  f32_isSignalingNaN$(OBJ) \
184  f64_to_ui32$(OBJ) \
185  f64_to_ui64$(OBJ) \
186  f64_to_i32$(OBJ) \
187  f64_to_i64$(OBJ) \
188  f64_to_ui32_r_minMag$(OBJ) \
189  f64_to_ui64_r_minMag$(OBJ) \
190  f64_to_i32_r_minMag$(OBJ) \
191  f64_to_i64_r_minMag$(OBJ) \
192  f64_to_f32$(OBJ) \
193  f64_to_extF80$(OBJ) \
194  f64_to_extF80M$(OBJ) \
195  f64_to_f128$(OBJ) \
196  f64_to_f128M$(OBJ) \
197  f64_roundToInt$(OBJ) \
198  f64_add$(OBJ) \
199  f64_sub$(OBJ) \
200  f64_mul$(OBJ) \
201  f64_mulAdd$(OBJ) \
202  f64_div$(OBJ) \
203  f64_rem$(OBJ) \
204  f64_sqrt$(OBJ) \
205  f64_eq$(OBJ) \
206  f64_le$(OBJ) \
207  f64_lt$(OBJ) \
208  f64_eq_signaling$(OBJ) \
209  f64_le_quiet$(OBJ) \
210  f64_lt_quiet$(OBJ) \
211  f64_isSignalingNaN$(OBJ) \
212  extF80_to_ui32$(OBJ) \
213  extF80_to_ui64$(OBJ) \
214  extF80_to_i32$(OBJ) \
215  extF80_to_i64$(OBJ) \
216  extF80_to_ui32_r_minMag$(OBJ) \
217  extF80_to_ui64_r_minMag$(OBJ) \
218  extF80_to_i32_r_minMag$(OBJ) \
219  extF80_to_i64_r_minMag$(OBJ) \
220  extF80_to_f32$(OBJ) \
221  extF80_to_f64$(OBJ) \
222  extF80_to_f128$(OBJ) \
223  extF80_roundToInt$(OBJ) \
224  extF80_add$(OBJ) \
225  extF80_sub$(OBJ) \
226  extF80_mul$(OBJ) \
227  extF80_div$(OBJ) \
228  extF80_rem$(OBJ) \
229  extF80_sqrt$(OBJ) \
230  extF80_eq$(OBJ) \
231  extF80_le$(OBJ) \
232  extF80_lt$(OBJ) \
233  extF80_eq_signaling$(OBJ) \
234  extF80_le_quiet$(OBJ) \
235  extF80_lt_quiet$(OBJ) \
236  extF80_isSignalingNaN$(OBJ) \
237  extF80M_to_ui32$(OBJ) \
238  extF80M_to_ui64$(OBJ) \
239  extF80M_to_i32$(OBJ) \
240  extF80M_to_i64$(OBJ) \
241  extF80M_to_ui32_r_minMag$(OBJ) \
242  extF80M_to_ui64_r_minMag$(OBJ) \
243  extF80M_to_i32_r_minMag$(OBJ) \
244  extF80M_to_i64_r_minMag$(OBJ) \
245  extF80M_to_f32$(OBJ) \
246  extF80M_to_f64$(OBJ) \
247  extF80M_to_f128M$(OBJ) \
248  extF80M_roundToInt$(OBJ) \
249  extF80M_add$(OBJ) \
250  extF80M_sub$(OBJ) \
251  extF80M_mul$(OBJ) \
252  extF80M_div$(OBJ) \
253  extF80M_rem$(OBJ) \
254  extF80M_sqrt$(OBJ) \
255  extF80M_eq$(OBJ) \
256  extF80M_le$(OBJ) \
257  extF80M_lt$(OBJ) \
258  extF80M_eq_signaling$(OBJ) \
259  extF80M_le_quiet$(OBJ) \
260  extF80M_lt_quiet$(OBJ) \
261  f128_to_ui32$(OBJ) \
262  f128_to_ui64$(OBJ) \
263  f128_to_i32$(OBJ) \
264  f128_to_i64$(OBJ) \
265  f128_to_ui32_r_minMag$(OBJ) \
266  f128_to_ui64_r_minMag$(OBJ) \
267  f128_to_i32_r_minMag$(OBJ) \
268  f128_to_i64_r_minMag$(OBJ) \
269  f128_to_f32$(OBJ) \
270  f128_to_extF80$(OBJ) \
271  f128_to_f64$(OBJ) \
272  f128_roundToInt$(OBJ) \
273  f128_add$(OBJ) \
274  f128_sub$(OBJ) \
275  f128_mul$(OBJ) \
276  f128_mulAdd$(OBJ) \
277  f128_div$(OBJ) \
278  f128_rem$(OBJ) \
279  f128_sqrt$(OBJ) \
280  f128_eq$(OBJ) \
281  f128_le$(OBJ) \
282  f128_lt$(OBJ) \
283  f128_eq_signaling$(OBJ) \
284  f128_le_quiet$(OBJ) \
285  f128_lt_quiet$(OBJ) \
286  f128_isSignalingNaN$(OBJ) \
287  f128M_to_ui32$(OBJ) \
288  f128M_to_ui64$(OBJ) \
289  f128M_to_i32$(OBJ) \
290  f128M_to_i64$(OBJ) \
291  f128M_to_ui32_r_minMag$(OBJ) \
292  f128M_to_ui64_r_minMag$(OBJ) \
293  f128M_to_i32_r_minMag$(OBJ) \
294  f128M_to_i64_r_minMag$(OBJ) \
295  f128M_to_f32$(OBJ) \
296  f128M_to_extF80M$(OBJ) \
297  f128M_to_f64$(OBJ) \
298  f128M_roundToInt$(OBJ) \
299  f128M_add$(OBJ) \
300  f128M_sub$(OBJ) \
301  f128M_mul$(OBJ) \
302  f128M_mulAdd$(OBJ) \
303  f128M_div$(OBJ) \
304  f128M_rem$(OBJ) \
305  f128M_sqrt$(OBJ) \
306  f128M_eq$(OBJ) \
307  f128M_le$(OBJ) \
308  f128M_lt$(OBJ) \
309  f128M_eq_signaling$(OBJ) \
310  f128M_le_quiet$(OBJ) \
311  f128M_lt_quiet$(OBJ) \
312
313OBJS_ALL = $(OBJS_PRIMITIVES) $(OBJS_SPECIALIZE) $(OBJS_OTHERS)
314
315$(OBJS_ALL): \
316  platform.h $(SOURCE_DIR)/include/primitiveTypes.h \
317  $(SOURCE_DIR)/include/primitives.h
318$(OBJS_SPECIALIZE) $(OBJS_OTHERS): \
319  $(SOURCE_DIR)/include/softfloat_types.h $(SOURCE_DIR)/include/internals.h \
320  $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/specialize.h \
321  $(SOURCE_DIR)/include/softfloat.h
322
323$(OBJS_PRIMITIVES) $(OBJS_OTHERS): %$(OBJ): $(SOURCE_DIR)/%.c
324	$(COMPILE_C) $(SOURCE_DIR)/$*.c
325
326$(OBJS_SPECIALIZE): %$(OBJ): $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/%.c
327	$(COMPILE_C) $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/$*.c
328
329softfloat$(LIB): $(OBJS_ALL)
330	$(DELETE) $@
331	$(MAKELIB) $^
332
333.PHONY: clean
334clean:
335	$(DELETE) $(OBJS_ALL) softfloat$(LIB)
336
337