t-libf7 revision 1.1.1.2 1 # Used except --with-libf7=no
2
3 avrsrc := $(srcdir)/config/avr
4
5 libf7 := $(avrsrc)/libf7
6
7 F7_PREFIX = __f7_
8
9 include $(libf7)/libf7-common.mk
10
11 LIBF7_DF_CONV += floatundidf floatdidf # floatunsidf floatsidf
12
13 # Wrappers like f7_lt_impl for f7_lt etc. because the latter is inline.
14 LIBF7_DF_CMP += lt le gt ge ne eq unord
15
16 F7_C_PARTS += $(LIBF7_DF_CONV) $(LIBF7_DF_CMP)
17
18 # -mcall-prologues
19 CALL_PROLOGUES += $(LIBF7_DF_CONV)
20
21 # -Wno-missing-prototypes
22 NO_PROTO += $(LIBF7_DF_CONV)
23
24 F7F += le_impl lt_impl gt_impl ge_impl ne_impl eq_impl unord_impl
25
26
27 $(libf7)/f7-renames.h: $(libf7)/f7renames.sh $(libf7)/libf7-common.mk
28 $< head $(F7_PREFIX) t-libf7 > $@
29 $< c $(F7_PREFIX) $(F7F) >> $@
30 $< cst $(F7_PREFIX) $(F7F_cst) >> $@
31 $< asm $(F7_PREFIX) $(F7F_asm) >> $@
32 $< tail $(F7_PREFIX) >> $@
33
34 # The right-hand sides like g_ddd come from libf7-common.mk.
35 # The _m_ wraps are added by t-libf7-math
36
37 # __adddf3, ...
38 F7_ASM_WRAPS_g_ddd += $(g_ddd)
39
40 # __ltdf2, ...
41 F7_ASM_WRAPS_g_xdd_cmp += $(g_xdd_cmp)
42
43 # __floatsidf, ...
44 F7_ASM_WRAPS_g_dx += $(g_dx)
45
46 # __fixdfsi, ...
47 F7_ASM_WRAPS_g_xd += $(g_xd)
48
49 $(libf7)/f7-wraps.h: $(libf7)/f7wraps.sh \
50 $(libf7)/libf7-common.mk $(libf7)/t-libf7-math
51 $< header "WITH_LIBF7_MATH_FUNCTIONS=$(WITH_LIBF7_MATH_FUNCTIONS)" "WITH_LIBF7_MATH_SYMBOLS=$(WITH_LIBF7_MATH_SYMBOLS)" > $@
52 $< ddd_libgcc $(F7_ASM_WRAPS_g_ddd) >> $@
53 $< xdd_libgcc_cmp $(F7_ASM_WRAPS_g_xdd_cmp) >> $@
54 $< xd_libgcc $(F7_ASM_WRAPS_g_xd) >> $@
55 $< dx_libgcc $(F7_ASM_WRAPS_g_dx) >> $@
56 $< ddd_math $(F7_ASM_WRAPS_m_ddd) >> $@
57 $< ddx_math $(F7_ASM_WRAPS_m_ddx) >> $@
58 $< dd_math $(F7_ASM_WRAPS_m_dd) >> $@
59 $< xd_math $(F7_ASM_WRAPS_m_xd) >> $@
60
61 F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_xd)
62 F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_dx)
63 F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_ddd)
64 F7_ASM_WRAPS += $(F7_ASM_WRAPS_g_xdd_cmp)
65 F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_ddd)
66 F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_ddx)
67 F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_dd)
68 F7_ASM_WRAPS += $(F7_ASM_WRAPS_m_xd)
69
70 F7_ASM_PARTS += $(patsubst %, D_%, $(F7_ASM_WRAPS))
71
72 # Options
73 F7_FLAGS += -I $(libf7) -save-temps=obj
74
75 # t-avr::HOST_LIBGCC2_CFLAGS sets -mcall-prologues which will inhibits
76 # tail-call optimizations. The user could get it with -mrelax, but we
77 # just switch it off here and then explicitly on again for the
78 # CALL_PROLOGUES modules.
79
80 F7_C_FLAGS += $(F7_FLAGS) \
81 -dp -g0 \
82 -mno-call-prologues \
83 -fno-lto -Os \
84 -fdata-sections -ffunction-sections \
85 -fno-reorder-blocks \
86 -fno-tree-loop-optimize \
87 -fno-tree-loop-im -fno-move-loop-invariants
88
89 F7_ASM_FLAGS += $(F7_FLAGS)
90
91 $(patsubst %, f7_c_%.o, $(CALL_PROLOGUES)) \
92 : F7_C_FLAGS += -mcall-prologues
93
94 $(patsubst %, f7_c_%.o, $(STRICT_X)) \
95 : F7_C_FLAGS += -mstrict-X
96
97 $(patsubst %, f7_c_%.o, $(NO_PROTO)) \
98 : F7_C_FLAGS += -Wno-missing-prototypes
99
100 # Depends will be worked out by the libgcc build system.
101
102 F7_C_OBJECTS = $(patsubst %, f7_c_%$(objext), $(F7_C_PARTS))
103 F7_ASM_OBJECTS = $(patsubst %, f7_asm_%$(objext), $(F7_ASM_PARTS))
104
105 $(F7_ASM_OBJECTS) $(F7_C_OBJECTS) : $(libf7)/t-libf7
106 $(F7_ASM_OBJECTS) $(F7_C_OBJECTS) : $(libf7)/t-libf7-math
107 $(F7_ASM_OBJECTS) $(F7_C_OBJECTS) : $(libf7)/t-libf7-math-symbols
108
109 .PHONY: log_vars
110
111 all: log_vars
112
113 log_vars:
114 $(info # libf7: WITH_LIBF7_MATH_FUNCTIONS = $(WITH_LIBF7_MATH_FUNCTIONS))
115 $(info # libf7: WITH_LIBF7_MATH_SYMBOLS = $(WITH_LIBF7_MATH_SYMBOLS))
116 $(info # libf7: F7_C_PARTS = $(F7_C_PARTS))
117 $(info # libf7: F7_C_OBJECTS = $(F7_C_OBJECTS))
118 $(info # libf7: F7_ASM_PARTS = $(F7_ASM_PARTS))
119 $(info # libf7: F7_ASM_OBJECTS = $(F7_ASM_OBJECTS))
120
121 # Build the libf7 C objects and add them to libgcc.a.
122
123 f7_parts := $(F7_C_PARTS)
124
125 iter-items := $(f7_parts)
126 iter-labels := $(f7_parts)
127
128 -include $(patsubst %,$(libf7)/libf7-c-object.mk,$(iter-items))
129
130 libgcc-objects += $(patsubst %,f7_c_%$(objext),$(F7_C_PARTS))
131
132 # Build the libf7 ASM objects and add them to libgcc.a.
133
134 f7_parts := $(F7_ASM_PARTS)
135
136 iter-items := $(f7_parts)
137 iter-labels := $(f7_parts)
138
139 -include $(patsubst %,$(libf7)/libf7-asm-object.mk,$(iter-items))
140
141 libgcc-objects += $(patsubst %,f7_asm_%$(objext),$(F7_ASM_PARTS))
142
143 .PHONY: clean-f7
144
145 clean: clean-f7
146
147 clean-f7:
148 rm -f $(wildcard f7_*.i f7_*.s f7_*.o)
149
150 # Get rid if any DFmode remains.
151
152 LIB2FUNCS_EXCLUDE += \
153 _sf_to_df \
154 _fixdfdi \
155 _fixunsdfsi \
156 _floatundidf \
157 _fixunsdfdi \
158 _floatdidf \
159 _powidf2
160