Subversion Repositories Kolibri OS

Rev

Rev 6515 | Rev 6518 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1.  
  2. export CC = kos32-gcc
  3. export AR = kos32-ar
  4. export LD = kos32-ld
  5. export STRIP = kos32-strip
  6.  
  7. export SDK_DIR:= $(abspath ../../../../sdk)
  8.  
  9. double_type_size = 64
  10. long_double_type_size = 96
  11. decimal_float = yes
  12. enable_decimal_float = bid
  13. fixed_point = no
  14.  
  15. FPBIT = true
  16.  
  17. DPBIT = true
  18. D32PBIT = 1
  19. D64PBIT = 1
  20. D128PBIT = 1
  21.  
  22. # List of functions not to build from libgcc2.c.
  23.  
  24. LIB2FUNCS_EXCLUDE =
  25.  
  26.  
  27. CFLAGS_OPT+= -fomit-frame-pointer -fno-ident -mno-ms-bitfields
  28. CFLAGS_OPT+= -fbuilding-libgcc -fno-stack-protector
  29.  
  30. CFLAGS = -c -O2 -DIN_GCC -DIN_LIBGCC2 -DHAVE_CC_TLS -DUSE_EMUTLS -DENABLE_DECIMAL_BID_FORMAT
  31. CFLAGS+= -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U_MSC_VER
  32. CFLAGS+= -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes
  33. CFLAGS+= -Wmissing-prototypes -Wold-style-definition $(CFLAGS_OPT)
  34.  
  35. INCLUDES = -I. -I../gcc -I../include
  36.  
  37. gcc_compile = $(CC) $(INCLUDES) $(CFLAGS)
  38.  
  39. objext = .o
  40.  
  41. FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
  42.         _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
  43.         _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
  44.         _sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf
  45.  
  46. DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
  47.         _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
  48.         _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
  49.         _df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df
  50.  
  51. TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
  52.         _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
  53.         _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
  54.         _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf
  55.  
  56.  
  57. lib2funcs =     _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2     \
  58.                 _clear_cache _trampoline __main _absvsi2 _absvdi2 _addvsi3      \
  59.                 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2  \
  60.                 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2     \
  61.                 _popcount_tab _popcountsi2 _popcountdi2 _paritysi2 _paritydi2   \
  62.                 _powisf2 _powidf2 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3     \
  63.                 _multc3 _divsc3 _divdc3 _divxc3 _divtc3 _bswapsi2 _bswapdi2     \
  64.                 _clrsbsi2 _clrsbdi2
  65.  
  66. swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
  67.  
  68. dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
  69.                 $(patsubst %,_fixuns%XX,sf df xf tf) \
  70.                 $(patsubst %,_floatXX%,sf df xf tf) \
  71.                 $(patsubst %,_floatunXX%,sf df xf tf)
  72.  
  73. lib2funcs += $(subst XX,si,$(swfloatfuncs))
  74. lib2funcs += $(subst XX,di,$(dwfloatfuncs))
  75.  
  76. lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
  77.  
  78. $(lib2funcs-o): %$(objext): libgcc2.c
  79.         $(gcc_compile) -DL$* -c $< -o $@
  80.  
  81. libgcc-objects =
  82.  
  83. ifeq ($(TPBIT),)
  84. # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
  85. FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
  86. DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
  87. endif
  88.  
  89. FPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(FPBIT_FUNCS))
  90. DPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(DPBIT_FUNCS))
  91. TPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(TPBIT_FUNCS))
  92.  
  93. fpbit-src := fp-bit.c
  94.  
  95. # Build FPBIT.
  96. ifneq ($(FPBIT),)
  97. fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
  98. $(fpbit-o): %$(objext): $(fpbit-src)
  99.         $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< -o $@
  100. libgcc-objects += $(fpbit-o)
  101. endif
  102.  
  103. # Build DPBIT.
  104. ifneq ($(DPBIT),)
  105. dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
  106. $(dpbit-o): %$(objext): $(fpbit-src)
  107.         $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< -o $@
  108. libgcc-objects += $(dpbit-o)
  109. endif
  110.  
  111. # Build TPBIT.
  112. ifneq ($(TPBIT),)
  113. tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
  114. $(tpbit-o): %$(objext): $(fpbit-src)
  115.         $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< -o $@
  116. libgcc-objects += $(tpbit-o)
  117. endif
  118.  
  119. # Next build individual support functions.
  120. D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \
  121.         _eq_sd _ne_sd _lt_sd _gt_sd _le_sd _ge_sd \
  122.         _sd_to_si _sd_to_di _sd_to_usi _sd_to_udi \
  123.         _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \
  124.         _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \
  125.         _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \
  126.         _sd_to_dd _sd_to_td _unord_sd _conv_sd
  127.  
  128. D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \
  129.         _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \
  130.         _dd_to_si _dd_to_di _dd_to_usi _dd_to_udi \
  131.         _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \
  132.         _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \
  133.         _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \
  134.         _dd_to_sd _dd_to_td _unord_dd _conv_dd
  135.  
  136. D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \
  137.         _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \
  138.         _td_to_si _td_to_di _td_to_usi _td_to_udi \
  139.         _si_to_td _di_to_td _usi_to_td _udi_to_td \
  140.         _td_to_sf _td_to_df _td_to_xf _td_to_tf \
  141.         _sf_to_td _df_to_td _xf_to_td _tf_to_td \
  142.         _td_to_sd _td_to_dd _unord_td _conv_td
  143.  
  144. ifeq ($(enable_decimal_float),bid)
  145. ifneq ($(D32PBIT),)
  146. D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
  147. endif
  148.  
  149. ifneq ($(D64PBIT),)
  150. D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
  151. endif
  152.  
  153. ifneq ($(D128PBIT),)
  154. D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
  155. endif
  156. endif
  157.  
  158. ifneq ($(D32PBIT),)
  159. d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
  160. ifeq ($(enable_decimal_float),bid)
  161. $(d32pbit-o): %$(objext): config/libbid/%.c
  162. else
  163. $(d32pbit-o): %$(objext): $(srcdir)/dfp-bit.c
  164. endif
  165.         $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $< -o $@
  166. libgcc-objects += $(d32pbit-o)
  167. endif
  168.  
  169. ifneq ($(D64PBIT),)
  170. d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
  171. ifeq ($(enable_decimal_float),bid)
  172. $(d64pbit-o): %$(objext): config/libbid/%.c
  173. else
  174. $(d64pbit-o): %$(objext): $(srcdir)/dfp-bit.c
  175. endif
  176.         $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
  177. libgcc-objects += $(d64pbit-o)
  178. endif
  179.  
  180. ifneq ($(D128PBIT),)
  181. d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
  182. ifeq ($(enable_decimal_float),bid)
  183. $(d128pbit-o): %$(objext): config/libbid/%.c
  184. else
  185. $(d128pbit-o): %$(objext): $(srcdir)/dfp-bit.c
  186. endif
  187.         $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
  188. libgcc-objects += $(d128pbit-o)
  189. endif
  190.  
  191. # targets
  192.  
  193. all: libgcc.a
  194.  
  195. libgcc.a : $(lib2funcs-o) $(libgcc-objects) Makefile
  196.         $(AR) crs libgcc.a $(lib2funcs-o) $(libgcc-objects)
  197. #       mv -f libbfd.a $(SDK_DIR)/lib
  198.  
  199.  
  200.