mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
libm/newlib: add newlib/libm support
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
############################################################################
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
NEWLIB_VERSION=4.3.0.20230120
|
||||
|
||||
newlib-$(NEWLIB_VERSION).tar.gz:
|
||||
$(call DOWNLOAD,ftp://sourceware.org/pub/newlib,newlib-$(NEWLIB_VERSION).tar.gz)
|
||||
|
||||
newlib/newlib: newlib-$(NEWLIB_VERSION).tar.gz
|
||||
$(Q) tar -xf newlib-$(NEWLIB_VERSION).tar.gz
|
||||
$(Q) mv newlib-$(NEWLIB_VERSION) newlib/newlib
|
||||
$(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::
|
||||
$(call DELFILE, newlib-$(NEWLIB_VERSION).tar.gz)
|
||||
$(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))
|
||||
|
||||
CFLAGS += -Wno-undef -Wno-unused-but-set-variable
|
||||
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
|
||||
Reference in New Issue
Block a user