mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-11 07:25:19 +00:00
The link line for applications in a kernel build is libmm, libc and the proxies. libnx is never named, though the export has been shipping it all along. So every application built on NX or NXFONTS fails to link, the nx examples and fbcon alike, with undefined references to the font and geometry routines. Name it, ahead of libc since it calls into it, and only when CONFIG_NX is set so that configurations without graphics are unaffected. Tested on an EIC7700 EVB in a kernel build: with this, an application built on NXFONTS links and runs; without it the same application fails at link time. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac>
114 lines
3.4 KiB
Text
114 lines
3.4 KiB
Text
############################################################################
|
|
# apps/import/Make.defs
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# 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.
|
|
#
|
|
############################################################################
|
|
|
|
include $(TOPDIR)/.config
|
|
include $(TOPDIR)/tools/Config.mk
|
|
-include $(TOPDIR)/scripts/Config.mk
|
|
include $(TOPDIR)/scripts/Make.defs
|
|
|
|
# Tool related definitions
|
|
# Compiler
|
|
|
|
ARCHCRT0OBJ = $(call CONVERT_PATH,$(TOPDIR)$(DELIM)startup$(DELIM)crt0$(OBJEXT))
|
|
ARCHINCLUDES += ${INCSYSDIR_PREFIX}$(TOPDIR)$(DELIM)include
|
|
|
|
ARCHXXINCLUDES += ${INCSYSDIR_PREFIX}$(TOPDIR)$(DELIM)include
|
|
ARCHXXINCLUDES += ${INCSYSDIR_PREFIX}$(TOPDIR)$(DELIM)include$(DELIM)cxx
|
|
|
|
ARCHCFLAGS += -fno-common -pipe
|
|
ARCHCXXFLAGS += -fno-common -nostdinc++ -pipe
|
|
|
|
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
|
|
|
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
|
|
|
ifeq ($(LDSTARTGROUP),)
|
|
LDSTARTGROUP = --start-group
|
|
endif
|
|
|
|
ifeq ($(LDENDGROUP),)
|
|
LDENDGROUP = --end-group
|
|
endif
|
|
|
|
# ELF module definitions
|
|
|
|
CELFFLAGS = $(CFLAGS)
|
|
CXXELFFLAGS = $(CXXFLAGS)
|
|
|
|
# C Pre-processor
|
|
|
|
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
|
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
|
|
|
# Linker
|
|
|
|
LDLIBPATH = $(addprefix -L,$(call CONVERT_PATH,$(TOPDIR)$(DELIM)libs))
|
|
|
|
# Link with user libraries
|
|
|
|
ifeq ($(CONFIG_BUILD_KERNEL),y)
|
|
# Before libc, since the graphics library calls into it. Without it
|
|
# every graphics application in a kernel build fails to find the font
|
|
# and geometry routines.
|
|
|
|
ifeq ($(CONFIG_NX),y)
|
|
LDLIBS += -lnx
|
|
endif
|
|
|
|
LDLIBS += -lmm -lc -lproxies
|
|
ifeq ($(CONFIG_HAVE_CXX),y)
|
|
LDLIBS += -lxx
|
|
endif
|
|
ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
|
|
LIBM = ${shell "$(CC)" $(ARCHCPUFLAGS) --print-file-name=libm.a}
|
|
ifneq ($(LIBM),".")
|
|
LDLIBPATH += -L "${shell dirname $(LIBM)}"
|
|
LDLIBS += -lm
|
|
endif
|
|
else ifneq ($(CONFIG_LIBM_NONE),)
|
|
LDLIBS += -lm
|
|
endif
|
|
endif
|
|
|
|
# Try to get the path to libgcc.a. Of course, this only works for GCC
|
|
# toolchains.
|
|
|
|
LIBGCC = ${shell "$(CC)" $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
|
|
ifneq ($(LIBGCC),".")
|
|
LDLIBPATH += -L "${shell dirname $(LIBGCC)}"
|
|
LDLIBS += -lgcc
|
|
endif
|
|
|
|
# ELF module definitions
|
|
|
|
ifeq ($(CONFIG_BINFMT_ELF_RELOCATABLE),y)
|
|
LDELFFLAGS += -r
|
|
endif
|
|
LDELFFLAGS += -e _start -Bstatic
|
|
|
|
# Remove other ld scripts, just use import ld scripts
|
|
#
|
|
LDFILE := $(filter -T %.ld, $(LDELFFLAGS))
|
|
LDELFFLAGS := $(filter-out $(LDFILE), $(LDELFFLAGS))
|
|
LDELFFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(TOPDIR)/scripts/gnu-elf.ld))
|