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
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 $(SOFTFLOAT_OPTS) \
47    $(C_INCLUDES) -O2 -o $@
48MAKELIB = ar crs $@
49
50OBJ = .o
51LIB = .a
52
53.PHONY: all
54all: softfloat$(LIB)
55
56OBJS_PRIMITIVES = \
57  s_compare96M$(OBJ) \
58  s_compare128M$(OBJ) \
59  s_shortShiftLeft64To96M$(OBJ) \
60  s_shortShiftLeftM$(OBJ) \
61  s_shiftLeftM$(OBJ) \
62  s_shortShiftRightM$(OBJ) \
63  s_shortShiftRightJam64$(OBJ) \
64  s_shortShiftRightJamM$(OBJ) \
65  s_shiftRightJam32$(OBJ) \
66  s_shiftRightJam64$(OBJ) \
67  s_shiftRightJamM$(OBJ) \
68  s_shiftRightM$(OBJ) \
69  s_countLeadingZeros8$(OBJ) \
70  s_countLeadingZeros32$(OBJ) \
71  s_countLeadingZeros64$(OBJ) \
72  s_addM$(OBJ) \
73  s_addCarryM$(OBJ) \
74  s_addComplCarryM$(OBJ) \
75  s_negXM$(OBJ) \
76  s_sub1XM$(OBJ) \
77  s_subM$(OBJ) \
78  s_mul64To128M$(OBJ) \
79  s_mul128MTo256M$(OBJ) \
80  s_approxRecip32_1$(OBJ) \
81  s_approxRecipSqrt32_1$(OBJ) \
82  s_remStepMBy32$(OBJ) \
83
84OBJS_SPECIALIZE = \
85  softfloat_raiseFlags$(OBJ) \
86  s_f32UIToCommonNaN$(OBJ) \
87  s_commonNaNToF32UI$(OBJ) \
88  s_propagateNaNF32UI$(OBJ) \
89  s_f64UIToCommonNaN$(OBJ) \
90  s_commonNaNToF64UI$(OBJ) \
91  s_propagateNaNF64UI$(OBJ) \
92  extF80M_isSignalingNaN$(OBJ) \
93  s_extF80MToCommonNaN$(OBJ) \
94  s_commonNaNToExtF80M$(OBJ) \
95  s_propagateNaNExtF80M$(OBJ) \
96  f128M_isSignalingNaN$(OBJ) \
97  s_f128MToCommonNaN$(OBJ) \
98  s_commonNaNToF128M$(OBJ) \
99  s_propagateNaNF128M$(OBJ) \
100
101OBJS_OTHERS = \
102  s_roundPackToUI32$(OBJ) \
103  s_roundPackMToUI64$(OBJ) \
104  s_roundPackToI32$(OBJ) \
105  s_roundPackMToI64$(OBJ) \
106  s_normSubnormalF32Sig$(OBJ) \
107  s_roundPackToF32$(OBJ) \
108  s_normRoundPackToF32$(OBJ) \
109  s_addMagsF32$(OBJ) \
110  s_subMagsF32$(OBJ) \
111  s_mulAddF32$(OBJ) \
112  s_normSubnormalF64Sig$(OBJ) \
113  s_roundPackToF64$(OBJ) \
114  s_normRoundPackToF64$(OBJ) \
115  s_addMagsF64$(OBJ) \
116  s_subMagsF64$(OBJ) \
117  s_mulAddF64$(OBJ) \
118  s_tryPropagateNaNExtF80M$(OBJ) \
119  s_invalidExtF80M$(OBJ) \
120  s_normExtF80SigM$(OBJ) \
121  s_roundPackMToExtF80M$(OBJ) \
122  s_normRoundPackMToExtF80M$(OBJ) \
123  s_addExtF80M$(OBJ) \
124  s_compareNonnormExtF80M$(OBJ) \
125  s_isNaNF128M$(OBJ) \
126  s_tryPropagateNaNF128M$(OBJ) \
127  s_invalidF128M$(OBJ) \
128  s_shiftNormSigF128M$(OBJ) \
129  s_roundPackMToF128M$(OBJ) \
130  s_normRoundPackMToF128M$(OBJ) \
131  s_addF128M$(OBJ) \
132  s_mulAddF128M$(OBJ) \
133  softfloat_state$(OBJ) \
134  ui32_to_f32$(OBJ) \
135  ui32_to_f64$(OBJ) \
136  ui32_to_extF80M$(OBJ) \
137  ui32_to_f128M$(OBJ) \
138  ui64_to_f32$(OBJ) \
139  ui64_to_f64$(OBJ) \
140  ui64_to_extF80M$(OBJ) \
141  ui64_to_f128M$(OBJ) \
142  i32_to_f32$(OBJ) \
143  i32_to_f64$(OBJ) \
144  i32_to_extF80M$(OBJ) \
145  i32_to_f128M$(OBJ) \
146  i64_to_f32$(OBJ) \
147  i64_to_f64$(OBJ) \
148  i64_to_extF80M$(OBJ) \
149  i64_to_f128M$(OBJ) \
150  f32_to_ui32$(OBJ) \
151  f32_to_ui64$(OBJ) \
152  f32_to_i32$(OBJ) \
153  f32_to_i64$(OBJ) \
154  f32_to_ui32_r_minMag$(OBJ) \
155  f32_to_ui64_r_minMag$(OBJ) \
156  f32_to_i32_r_minMag$(OBJ) \
157  f32_to_i64_r_minMag$(OBJ) \
158  f32_to_f64$(OBJ) \
159  f32_to_extF80M$(OBJ) \
160  f32_to_f128M$(OBJ) \
161  f32_roundToInt$(OBJ) \
162  f32_add$(OBJ) \
163  f32_sub$(OBJ) \
164  f32_mul$(OBJ) \
165  f32_mulAdd$(OBJ) \
166  f32_div$(OBJ) \
167  f32_rem$(OBJ) \
168  f32_sqrt$(OBJ) \
169  f32_eq$(OBJ) \
170  f32_le$(OBJ) \
171  f32_lt$(OBJ) \
172  f32_eq_signaling$(OBJ) \
173  f32_le_quiet$(OBJ) \
174  f32_lt_quiet$(OBJ) \
175  f32_isSignalingNaN$(OBJ) \
176  f64_to_ui32$(OBJ) \
177  f64_to_ui64$(OBJ) \
178  f64_to_i32$(OBJ) \
179  f64_to_i64$(OBJ) \
180  f64_to_ui32_r_minMag$(OBJ) \
181  f64_to_ui64_r_minMag$(OBJ) \
182  f64_to_i32_r_minMag$(OBJ) \
183  f64_to_i64_r_minMag$(OBJ) \
184  f64_to_f32$(OBJ) \
185  f64_to_extF80M$(OBJ) \
186  f64_to_f128M$(OBJ) \
187  f64_roundToInt$(OBJ) \
188  f64_add$(OBJ) \
189  f64_sub$(OBJ) \
190  f64_mul$(OBJ) \
191  f64_mulAdd$(OBJ) \
192  f64_div$(OBJ) \
193  f64_rem$(OBJ) \
194  f64_sqrt$(OBJ) \
195  f64_eq$(OBJ) \
196  f64_le$(OBJ) \
197  f64_lt$(OBJ) \
198  f64_eq_signaling$(OBJ) \
199  f64_le_quiet$(OBJ) \
200  f64_lt_quiet$(OBJ) \
201  f64_isSignalingNaN$(OBJ) \
202  extF80M_to_ui32$(OBJ) \
203  extF80M_to_ui64$(OBJ) \
204  extF80M_to_i32$(OBJ) \
205  extF80M_to_i64$(OBJ) \
206  extF80M_to_ui32_r_minMag$(OBJ) \
207  extF80M_to_ui64_r_minMag$(OBJ) \
208  extF80M_to_i32_r_minMag$(OBJ) \
209  extF80M_to_i64_r_minMag$(OBJ) \
210  extF80M_to_f32$(OBJ) \
211  extF80M_to_f64$(OBJ) \
212  extF80M_to_f128M$(OBJ) \
213  extF80M_roundToInt$(OBJ) \
214  extF80M_add$(OBJ) \
215  extF80M_sub$(OBJ) \
216  extF80M_mul$(OBJ) \
217  extF80M_div$(OBJ) \
218  extF80M_rem$(OBJ) \
219  extF80M_sqrt$(OBJ) \
220  extF80M_eq$(OBJ) \
221  extF80M_le$(OBJ) \
222  extF80M_lt$(OBJ) \
223  extF80M_eq_signaling$(OBJ) \
224  extF80M_le_quiet$(OBJ) \
225  extF80M_lt_quiet$(OBJ) \
226  f128M_to_ui32$(OBJ) \
227  f128M_to_ui64$(OBJ) \
228  f128M_to_i32$(OBJ) \
229  f128M_to_i64$(OBJ) \
230  f128M_to_ui32_r_minMag$(OBJ) \
231  f128M_to_ui64_r_minMag$(OBJ) \
232  f128M_to_i32_r_minMag$(OBJ) \
233  f128M_to_i64_r_minMag$(OBJ) \
234  f128M_to_f32$(OBJ) \
235  f128M_to_f64$(OBJ) \
236  f128M_to_extF80M$(OBJ) \
237  f128M_roundToInt$(OBJ) \
238  f128M_add$(OBJ) \
239  f128M_sub$(OBJ) \
240  f128M_mul$(OBJ) \
241  f128M_mulAdd$(OBJ) \
242  f128M_div$(OBJ) \
243  f128M_rem$(OBJ) \
244  f128M_sqrt$(OBJ) \
245  f128M_eq$(OBJ) \
246  f128M_le$(OBJ) \
247  f128M_lt$(OBJ) \
248  f128M_eq_signaling$(OBJ) \
249  f128M_le_quiet$(OBJ) \
250  f128M_lt_quiet$(OBJ) \
251
252OBJS_ALL = $(OBJS_PRIMITIVES) $(OBJS_SPECIALIZE) $(OBJS_OTHERS)
253
254$(OBJS_ALL): \
255  platform.h $(SOURCE_DIR)/include/primitiveTypes.h \
256  $(SOURCE_DIR)/include/primitives.h
257$(OBJS_SPECIALIZE) $(OBJS_OTHERS): \
258  $(SOURCE_DIR)/include/softfloat_types.h $(SOURCE_DIR)/include/internals.h \
259  $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/specialize.h \
260  $(SOURCE_DIR)/include/softfloat.h
261
262$(OBJS_PRIMITIVES) $(OBJS_OTHERS): %$(OBJ): $(SOURCE_DIR)/%.c
263	$(COMPILE_C) $(SOURCE_DIR)/$*.c
264
265$(OBJS_SPECIALIZE): %$(OBJ): $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/%.c
266	$(COMPILE_C) $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/$*.c
267
268softfloat$(LIB): $(OBJS_ALL)
269	$(DELETE) $@
270	$(MAKELIB) $^
271
272.PHONY: clean
273clean:
274	$(DELETE) $(OBJS_ALL) softfloat$(LIB)
275
276