2023-04-22 13:08:00 +02:00
|
|
|
############################################################################
|
|
|
|
# libs/libm/newlib/Make.defs
|
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2023-09-14 10:15:54 +02:00
|
|
|
ifeq ($(CONFIG_ARCH_CHIP_ESP32),y)
|
|
|
|
NEWLIB_VERSION=esp-4.1.0_20230425
|
|
|
|
NEWLIB_BASENAME=newlib-esp32
|
|
|
|
NEWLIB_URL_BASE=https://github.com/espressif/newlib-esp32/archive
|
|
|
|
NEWLIB_TARBALL=$(NEWLIB_VERSION).tar.gz
|
|
|
|
else
|
|
|
|
NEWLIB_VERSION=4.3.0.20230120
|
|
|
|
NEWLIB_BASENAME=newlib
|
|
|
|
NEWLIB_URL_BASE=ftp://sourceware.org/pub/newlib
|
|
|
|
NEWLIB_TARBALL=$(NEWLIB_BASENAME)-$(NEWLIB_VERSION).tar.gz
|
|
|
|
endif
|
2023-04-22 13:08:00 +02:00
|
|
|
|
2023-09-14 10:15:54 +02:00
|
|
|
$(NEWLIB_BASENAME)-$(NEWLIB_VERSION).tar.gz:
|
|
|
|
$(call DOWNLOAD,$(NEWLIB_URL_BASE),$(NEWLIB_TARBALL),$(NEWLIB_BASENAME)-$(NEWLIB_VERSION).tar.gz)
|
2023-04-22 13:08:00 +02:00
|
|
|
|
2023-09-14 10:15:54 +02:00
|
|
|
newlib/newlib: $(NEWLIB_BASENAME)-$(NEWLIB_VERSION).tar.gz
|
|
|
|
$(Q) tar -xf $(NEWLIB_BASENAME)-$(NEWLIB_VERSION).tar.gz
|
|
|
|
$(Q) mv $(NEWLIB_BASENAME)-$(NEWLIB_VERSION) newlib/newlib
|
2023-04-22 13:08:00 +02:00
|
|
|
$(Q) patch -p0 < newlib/0001-newlib-libm-fix-__RCSID-build-error.patch
|
|
|
|
$(Q) patch -p0 < newlib/0002-newlib-libm-remove-include-reent.h.patch
|
|
|
|
$(Q) touch $@
|
|
|
|
|
|
|
|
ifeq ($(wildcard newlib/newlib/.git),)
|
|
|
|
distclean::
|
2023-09-14 10:15:54 +02:00
|
|
|
$(call DELFILE, $(NEWLIB_BASENAME)-$(NEWLIB_VERSION).tar.gz)
|
2023-04-22 13:08:00 +02:00
|
|
|
$(call DELDIR, newlib/newlib)
|
|
|
|
|
|
|
|
context:: newlib/newlib
|
|
|
|
else
|
|
|
|
distclean::
|
|
|
|
context::
|
|
|
|
endif
|
|
|
|
|
|
|
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/common/*.c)
|
|
|
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/complex/*.c)
|
|
|
|
|
|
|
|
VPATH += :newlib/newlib/newlib/libm/common
|
|
|
|
VPATH += :newlib/newlib/newlib/libm/complex
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_ARM),y)
|
|
|
|
ARCH = arm
|
|
|
|
else ifeq ($(CONFIG_ARCH_ARM64),y)
|
|
|
|
ARCH = aarch64
|
|
|
|
else ifeq ($(CONFIG_ARCH_RISCV),y)
|
|
|
|
ARCH = riscv
|
|
|
|
else ifeq ($(CONFIG_ARCH_X86),y)
|
|
|
|
ARCH = i386
|
|
|
|
else ifeq ($(CONFIG_ARCH_X86_64),y)
|
|
|
|
ARCH = x86_64
|
|
|
|
else ifeq ($(CONFIG_ARCH_SPARC),y)
|
|
|
|
ARCH = sparc
|
|
|
|
else ifeq ($(CONFIG_ARCH_MIPS),y)
|
|
|
|
ARCH = mips
|
|
|
|
else
|
|
|
|
ARCH = $(CONFIG_ARCH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/machine/$(ARCH)/*.c)
|
|
|
|
VPATH += :newlib/newlib/newlib/libm/machine/$(ARCH)
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_LIBM_NEWLIB_HW_FP),y)
|
|
|
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/mathfp/*.c)
|
|
|
|
VPATH += :newlib/newlib/newlib/libm/mathfp
|
|
|
|
CFLAGS += -Wno-dangling-else
|
|
|
|
CFLAGS += -Wno-endif-labels
|
|
|
|
CFLAGS += -Wno-implicit-function-declaration
|
|
|
|
CFLAGS += -Wno-missing-braces
|
|
|
|
CFLAGS += -Wno-shadow
|
|
|
|
CFLAGS += -Wno-strict-prototypes
|
|
|
|
CFLAGS += -Wno-unused-const-variable
|
|
|
|
else
|
|
|
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/math/*.c)
|
|
|
|
VPATH += :newlib/newlib/newlib/libm/math
|
|
|
|
endif
|
|
|
|
|
|
|
|
CSRCS := $(shell echo $(notdir $(CSRCS) | tr " " "\n" | sort | uniq))
|
|
|
|
|
2023-09-14 10:15:54 +02:00
|
|
|
CFLAGS += -Wno-undef -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-maybe-uninitialized
|
2023-04-22 13:08:00 +02:00
|
|
|
CFLAGS += ${INCDIR_PREFIX}newlib/newlib/newlib/libm/common
|
|
|
|
CFLAGS += -D__int32_t=int32_t -D__uint32_t=uint32_t -D_REENT=0 -D_REENT_THREAD_LOCAL=1
|