2008-01-08 00:19:24 +00:00
|
|
|
############################################################################
|
|
|
|
# arch/sim/src/Makefile
|
2007-02-17 23:21:28 +00:00
|
|
|
#
|
2021-03-13 11:24:50 +01:00
|
|
|
# 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
|
2007-02-17 23:21:28 +00:00
|
|
|
#
|
2021-03-13 11:24:50 +01:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-17 23:21:28 +00:00
|
|
|
#
|
2021-03-13 11:24:50 +01:00
|
|
|
# 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.
|
2007-02-17 23:21:28 +00:00
|
|
|
#
|
2008-01-08 00:19:24 +00:00
|
|
|
############################################################################
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2020-09-23 12:48:02 +01:00
|
|
|
-include $(TOPDIR)/Make.defs
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2020-05-19 17:43:29 +08:00
|
|
|
ARCH_SRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
|
|
|
|
|
2020-05-25 21:23:11 +08:00
|
|
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)}
|
2020-05-19 17:43:29 +08:00
|
|
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip}
|
|
|
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)sched}
|
|
|
|
|
2020-09-13 19:14:28 -03:00
|
|
|
CPPFLAGS += $(INCLUDES)
|
|
|
|
CFLAGS += $(INCLUDES)
|
|
|
|
CXXFLAGS += $(INCLUDES)
|
|
|
|
AFLAGS += $(INCLUDES)
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2022-03-08 22:33:50 +08:00
|
|
|
NUTTX = $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx$(EXEEXT))
|
|
|
|
|
2020-02-08 08:52:34 -06:00
|
|
|
# Determine which objects are required in the link.The
|
|
|
|
# up_head object normally draws in all that is needed, but
|
|
|
|
# there are a fews that must be included because they
|
|
|
|
# are called only from the host OS-specific logic(HOSTOBJS)
|
|
|
|
|
|
|
|
LINKOBJS = up_head$(OBJEXT)
|
|
|
|
REQUIREDOBJS = $(LINKOBJS)
|
|
|
|
|
2014-10-03 08:23:57 -06:00
|
|
|
ifeq ($(CONFIG_HOST_X86_64),y)
|
|
|
|
ifeq ($(CONFIG_SIM_M32),y)
|
2022-01-07 10:45:25 +08:00
|
|
|
ASRCS += up_vfork_x86.S
|
2014-10-03 08:23:57 -06:00
|
|
|
else
|
2022-01-07 10:45:25 +08:00
|
|
|
ASRCS += up_vfork_x86_64.S
|
2014-10-03 08:23:57 -06:00
|
|
|
endif
|
2017-09-04 07:25:10 -06:00
|
|
|
else ifeq ($(CONFIG_HOST_X86),y)
|
2022-01-07 10:45:25 +08:00
|
|
|
ASRCS += up_vfork_x86.S
|
2017-09-04 07:25:10 -06:00
|
|
|
else ifeq ($(CONFIG_HOST_ARM),y)
|
2020-12-31 16:27:08 +08:00
|
|
|
ASRCS += up_vfork_arm.S
|
2022-02-02 23:36:23 +01:00
|
|
|
else ifeq ($(CONFIG_HOST_ARM64),y)
|
|
|
|
ASRCS += up_vfork_arm64.S
|
2017-08-26 11:44:48 -06:00
|
|
|
endif
|
|
|
|
|
2011-01-23 17:40:10 +00:00
|
|
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
2014-09-01 16:21:29 -06:00
|
|
|
|
|
|
|
CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_initialstate.c
|
|
|
|
CSRCS += up_createstack.c up_usestack.c up_releasestack.c up_stackframe.c
|
|
|
|
CSRCS += up_unblocktask.c up_blocktask.c up_releasepending.c
|
2020-02-08 08:52:34 -06:00
|
|
|
CSRCS += up_reprioritizertr.c up_exit.c up_schedulesigaction.c
|
2022-07-14 11:22:50 +08:00
|
|
|
CSRCS += up_heap.c up_uart.c up_assert.c up_nputs.c
|
2020-11-26 20:43:51 +09:00
|
|
|
CSRCS += up_copyfullstate.c
|
2021-04-01 14:38:16 +09:00
|
|
|
CSRCS += up_sigdeliver.c
|
2014-09-01 16:21:29 -06:00
|
|
|
|
2021-12-25 23:28:16 +08:00
|
|
|
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
|
|
|
CSRCS += up_backtrace.c
|
|
|
|
endif
|
|
|
|
|
2020-12-31 16:27:08 +08:00
|
|
|
ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
|
|
|
|
ifeq ($(CONFIG_SCHED_WAITPID),y)
|
|
|
|
CSRCS += up_vfork.c
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-08-07 16:05:00 -06:00
|
|
|
VPATH = sim
|
2019-08-26 13:09:57 -06:00
|
|
|
DEPPATH = $(patsubst %,--dep-path %,$(subst :, ,$(VPATH)))
|
2019-08-07 16:05:00 -06:00
|
|
|
|
2022-08-21 15:16:05 +08:00
|
|
|
CFLAGS += -fvisibility=default
|
2022-03-01 03:04:50 +08:00
|
|
|
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
2022-08-21 15:16:05 +08:00
|
|
|
$(ARCHCFLAGS) $(HOSTINCLUDES) $(EXTRAFLAGS) -D__SIM__ -pipe \
|
|
|
|
-fvisibility=default
|
2022-03-01 03:04:50 +08:00
|
|
|
|
2020-05-19 17:43:29 +08:00
|
|
|
HOSTCFLAGS += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)}
|
2020-08-29 20:18:48 -07:00
|
|
|
ifeq ($(CONFIG_HOST_MACOS),y)
|
|
|
|
HOSTCFLAGS += -Wno-deprecated-declarations
|
|
|
|
endif
|
|
|
|
|
2021-12-25 23:28:16 +08:00
|
|
|
HOSTSRCS = up_hostirq.c up_hostmemory.c up_hosttime.c up_simuart.c up_hostmisc.c
|
2020-05-09 19:56:52 +03:00
|
|
|
STDLIBS += -lpthread
|
2020-10-22 15:47:34 +09:00
|
|
|
ifeq ($(CONFIG_HOST_MACOS),y)
|
2022-01-20 02:05:40 +08:00
|
|
|
ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y)
|
2020-10-22 21:39:01 +09:00
|
|
|
# Note: up_macho_init.c is not in CSRCS because it's picky about
|
|
|
|
# the place in the object list for linking. Namely, its constructor
|
|
|
|
# should be the first one in the executable.
|
|
|
|
HEADSRC = up_macho_init.c
|
2020-10-22 15:47:34 +09:00
|
|
|
endif
|
|
|
|
else
|
2020-07-26 20:45:57 +08:00
|
|
|
STDLIBS += -lrt
|
2020-03-26 13:58:26 +09:00
|
|
|
endif
|
|
|
|
|
2019-09-28 10:46:12 -06:00
|
|
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
|
|
|
CSRCS += up_checkstack.c
|
|
|
|
endif
|
|
|
|
|
2016-02-11 12:16:19 -06:00
|
|
|
ifeq ($(CONFIG_SPINLOCK),y)
|
|
|
|
HOSTSRCS += up_testset.c
|
|
|
|
endif
|
|
|
|
|
2016-02-10 14:58:21 -06:00
|
|
|
ifeq ($(CONFIG_SMP),y)
|
2020-02-09 14:36:02 +08:00
|
|
|
CSRCS += up_smpsignal.c up_cpuidlestack.c
|
2016-02-10 14:58:21 -06:00
|
|
|
HOSTSRCS += up_simsmp.c
|
|
|
|
endif
|
|
|
|
|
2016-08-12 13:14:03 -06:00
|
|
|
ifeq ($(CONFIG_ONESHOT),y)
|
|
|
|
CSRCS += up_oneshot.c
|
|
|
|
endif
|
|
|
|
|
2020-02-13 01:53:05 +08:00
|
|
|
ifeq ($(CONFIG_RTC_DRIVER),y)
|
|
|
|
CSRCS += up_rtc.c
|
|
|
|
endif
|
|
|
|
|
2020-11-01 22:38:48 -03:00
|
|
|
ifeq ($(CONFIG_SIM_LCDDRIVER),y)
|
2020-02-08 08:52:34 -06:00
|
|
|
CSRCS += up_lcd.c
|
2021-10-28 18:44:40 +08:00
|
|
|
else ifeq ($(CONFIG_SIM_FRAMEBUFFER),y)
|
2021-12-31 18:46:21 +08:00
|
|
|
CSRCS += up_framebuffer.c
|
2020-11-01 22:38:48 -03:00
|
|
|
endif
|
|
|
|
|
2011-09-28 14:59:54 +00:00
|
|
|
ifeq ($(CONFIG_SIM_X11FB),y)
|
2011-08-04 01:25:58 +00:00
|
|
|
HOSTSRCS += up_x11framebuffer.c
|
2020-02-08 08:52:34 -06:00
|
|
|
STDLIBS += -lX11 -lXext
|
2011-09-28 17:41:58 +00:00
|
|
|
ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
|
|
|
|
CSRCS += up_touchscreen.c
|
|
|
|
HOSTSRCS += up_x11eventloop.c
|
2020-02-13 01:53:05 +08:00
|
|
|
else ifeq ($(CONFIG_SIM_AJOYSTICK),y)
|
2014-12-14 10:19:07 -06:00
|
|
|
CSRCS += up_ajoystick.c
|
|
|
|
HOSTSRCS += up_x11eventloop.c
|
2020-11-03 15:53:20 -03:00
|
|
|
else ifeq ($(CONFIG_SIM_BUTTONS),y)
|
|
|
|
HOSTSRCS += up_x11eventloop.c
|
2014-12-14 10:19:07 -06:00
|
|
|
endif
|
2022-04-06 12:37:32 +08:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_SIM_KEYBOARD),y)
|
|
|
|
CSRCS += up_keyboard.c
|
|
|
|
endif
|
2011-09-28 17:41:58 +00:00
|
|
|
endif
|
2011-07-01 19:08:04 +00:00
|
|
|
|
2007-05-12 16:21:19 +00:00
|
|
|
ifeq ($(CONFIG_FS_FAT),y)
|
2015-11-25 08:36:44 -06:00
|
|
|
CSRCS += up_blockdevice.c up_deviceimage.c
|
2020-02-08 07:52:26 -06:00
|
|
|
STDLIBS += -lz
|
2007-05-12 16:21:19 +00:00
|
|
|
endif
|
2011-07-01 19:08:04 +00:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_ROMGETC),y)
|
2015-11-25 08:36:44 -06:00
|
|
|
CSRCS += up_romgetc.c
|
2011-07-01 19:08:04 +00:00
|
|
|
endif
|
|
|
|
|
2020-03-18 21:12:26 +09:00
|
|
|
ifeq ($(CONFIG_SIM_NETDEV_TAP),y)
|
2015-11-25 08:36:44 -06:00
|
|
|
CSRCS += up_netdriver.c
|
2020-10-26 01:26:55 +08:00
|
|
|
ifneq ($(CONFIG_WINDOWS_CYGWIN),y)
|
2020-02-10 11:21:27 +08:00
|
|
|
HOSTSRCS += up_tapdev.c
|
2020-10-26 01:26:55 +08:00
|
|
|
else # CONFIG_WINDOWS_CYGWIN != y
|
2020-02-10 11:21:27 +08:00
|
|
|
HOSTSRCS += up_wpcap.c
|
2021-03-08 19:32:41 -08:00
|
|
|
STDLIBS = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
2020-10-26 01:26:55 +08:00
|
|
|
endif # CONFIG_WINDOWS_CYGWIN != y
|
2020-03-18 21:12:26 +09:00
|
|
|
else ifeq ($(CONFIG_SIM_NETDEV_VPNKIT),y)
|
|
|
|
CSRCS += up_netdriver.c
|
|
|
|
HOSTSRCS += up_vpnkit.c
|
|
|
|
VPATH += :sim/vpnkit
|
|
|
|
HOSTSRCS += protocol.c negotiate.c
|
|
|
|
endif
|
2007-05-12 16:21:19 +00:00
|
|
|
|
2021-08-29 17:52:02 +08:00
|
|
|
ifeq ($(CONFIG_SIM_NETUSRSOCK),y)
|
|
|
|
HOSTSRCS += up_usrsock_host.c
|
|
|
|
CSRCS += up_usrsock.c
|
|
|
|
endif
|
|
|
|
|
2020-08-26 17:38:44 -07:00
|
|
|
ifeq ($(CONFIG_SIM_HCISOCKET),y)
|
|
|
|
HOSTSRCS += up_hcisocket_host.c
|
|
|
|
CSRCS += up_hcisocket.c
|
2020-11-28 11:43:30 +08:00
|
|
|
endif
|
2020-08-26 17:38:44 -07:00
|
|
|
|
2020-10-29 01:41:58 -07:00
|
|
|
ifeq ($(CONFIG_SIM_I2CBUS_LINUX),y)
|
|
|
|
HOSTSRCS += up_i2cbuslinux.c
|
|
|
|
endif
|
|
|
|
|
2021-09-02 17:09:10 +08:00
|
|
|
ifeq ($(CONFIG_SIM_SPI_LINUX),y)
|
|
|
|
HOSTSRCS += up_spilinux.c
|
|
|
|
endif
|
|
|
|
|
2019-11-12 08:03:38 -06:00
|
|
|
ifeq ($(CONFIG_RPTUN),y)
|
|
|
|
CSRCS += up_rptun.c
|
2020-05-02 00:41:07 +08:00
|
|
|
endif
|
2019-11-12 08:03:38 -06:00
|
|
|
|
2020-07-24 10:40:54 +08:00
|
|
|
ifeq ($(CONFIG_SIM_SOUND_ALSA),y)
|
|
|
|
CSRCS += up_alsa.c
|
|
|
|
STDLIBS += -lasound
|
|
|
|
endif
|
|
|
|
|
2021-11-24 22:23:14 +08:00
|
|
|
ifeq ($(CONFIG_SIM_HOSTFS),y)
|
2015-11-25 08:36:44 -06:00
|
|
|
HOSTSRCS += up_hostfs.c
|
|
|
|
|
|
|
|
hostfs.h: $(TOPDIR)/include/nuttx/fs/hostfs.h
|
|
|
|
@echo "CP: $<"
|
|
|
|
$(Q) cp $< $@
|
2021-07-26 15:50:40 +08:00
|
|
|
|
|
|
|
up_hostfs.c: hostfs.h
|
2015-11-25 08:36:44 -06:00
|
|
|
endif
|
|
|
|
|
2011-01-23 17:40:10 +00:00
|
|
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2011-09-29 16:25:21 +00:00
|
|
|
NUTTXOBJS = $(AOBJS) $(COBJS)
|
2011-01-23 17:40:10 +00:00
|
|
|
HOSTOBJS = $(HOSTSRCS:.c=$(OBJEXT))
|
2020-10-22 21:39:01 +09:00
|
|
|
HEADOBJ = $(HEADSRC:.c=$(OBJEXT))
|
2008-06-01 13:18:51 +00:00
|
|
|
|
2011-01-23 17:40:10 +00:00
|
|
|
SRCS = $(ASRCS) $(CSRCS) $(HOSTSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS) $(HOSTOBJS)
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2016-05-17 10:43:15 -06:00
|
|
|
# Override in Make.defs if linker is not 'ld'
|
|
|
|
|
2020-10-26 01:26:55 +08:00
|
|
|
ifneq ($(CONFIG_HOST_MACOS),y)
|
2022-02-14 16:29:40 -05:00
|
|
|
ARCHSCRIPT += nuttx.ld
|
2021-06-11 08:14:48 +09:00
|
|
|
LDSTARTGROUP ?= --start-group
|
|
|
|
LDENDGROUP ?= --end-group
|
2020-01-28 00:00:52 +09:00
|
|
|
endif
|
2022-03-07 20:08:12 +08:00
|
|
|
|
|
|
|
# Additional rules for system call wrapper
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_SCHED_INSTRUMENTATION_SYSCALL),y)
|
|
|
|
EXTRALINKCMDS += @$(TOPDIR)/syscall/syscall_wraps.ldcmd
|
|
|
|
endif
|
|
|
|
|
2022-02-14 16:29:40 -05:00
|
|
|
LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT)))
|
2016-05-17 10:43:15 -06:00
|
|
|
|
2011-09-29 16:25:21 +00:00
|
|
|
# Determine which NuttX libraries will need to be linked in
|
|
|
|
# Most are provided by LINKLIBS on the MAKE command line
|
|
|
|
|
2012-11-12 01:54:54 +00:00
|
|
|
RELLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
|
2018-05-29 11:36:21 -06:00
|
|
|
RELPATHS += -L"$(TOPDIR)/staging"
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2011-09-29 16:25:21 +00:00
|
|
|
# Add the board-specific library and directory
|
|
|
|
|
2012-11-12 01:54:54 +00:00
|
|
|
RELPATHS += -L board
|
|
|
|
RELLIBS += -lboard
|
2011-09-29 16:25:21 +00:00
|
|
|
|
|
|
|
# Make targets begin here
|
|
|
|
|
2007-02-27 23:59:20 +00:00
|
|
|
all: up_head$(OBJEXT) libarch$(LIBEXT)
|
2012-01-29 20:07:16 +00:00
|
|
|
|
2022-05-12 18:41:27 +08:00
|
|
|
.PHONY: export_startup clean distclean cleanrel depend
|
2007-02-27 23:59:20 +00:00
|
|
|
|
|
|
|
$(AOBJS): %$(OBJEXT): %.S
|
2008-01-08 17:06:21 +00:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2007-02-28 23:45:56 +00:00
|
|
|
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
2008-01-08 17:06:21 +00:00
|
|
|
$(call COMPILE, $<, $@)
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2020-10-22 21:39:01 +09:00
|
|
|
$(HOSTOBJS) $(HEADOBJ): %$(OBJEXT): %.c
|
2012-11-02 00:22:52 +00:00
|
|
|
$(Q) echo "CC: $<"
|
2012-11-11 23:44:31 +00:00
|
|
|
$(Q) "$(CC)" -c $(HOSTCFLAGS) $< -o $@
|
2007-08-28 00:18:50 +00:00
|
|
|
|
2008-06-01 13:18:51 +00:00
|
|
|
# The architecture-specific library
|
2011-09-29 16:25:21 +00:00
|
|
|
|
|
|
|
libarch$(LIBEXT): $(NUTTXOBJS)
|
2012-11-15 17:43:29 +00:00
|
|
|
$(call ARCHIVE, $@, $(NUTTXOBJS))
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2011-09-29 16:25:21 +00:00
|
|
|
# The "board"-specific library. Of course, there really are no boards in
|
|
|
|
# the simulation. However, this is a good place to keep parts of the simulation
|
|
|
|
# that are not hardware-related.
|
|
|
|
|
2011-10-11 14:34:18 +00:00
|
|
|
board/libboard$(LIBEXT):
|
2020-09-14 13:53:37 -03:00
|
|
|
$(Q) $(MAKE) -C board libboard$(LIBEXT) EXTRAFLAGS="$(EXTRAFLAGS)"
|
2011-09-29 16:25:21 +00:00
|
|
|
|
2008-06-01 13:18:51 +00:00
|
|
|
# A partially linked object containing only NuttX code (no interface to host OS)
|
|
|
|
# Change the names of most symbols that conflict with libc symbols.
|
|
|
|
# Generate the final NuttX binary by linking the host-specific objects with the NuttX
|
|
|
|
# specific objects (with munged names)
|
|
|
|
|
2020-07-10 01:20:18 +08:00
|
|
|
# C++ global objects are constructed before main get executed, but it isn't a good
|
|
|
|
# point for simulator because NuttX doesn't finish the kernel initialization yet.
|
|
|
|
# So we have to skip the standard facilities and do the construction by ourself.
|
|
|
|
# But how to achieve the goal?
|
|
|
|
# 1.Command linker generate the default script(-verbose)
|
2022-03-31 14:10:33 -03:00
|
|
|
# 2.Move input sections out of .init_array/.fini_array into new .sinit/.einit
|
|
|
|
# output sections
|
|
|
|
# 3.Replace __init_array_start/__init_array_end with _sinit/_einit
|
|
|
|
# 4.Append __init_array_start = .; __init_array_end = .;
|
|
|
|
# Step 2 cheat the host there is no object to construct (glibc >= 2.34)
|
|
|
|
# Step 3 let nxtask_startup find objects need to construct
|
|
|
|
# Step 4 cheat the host there is no object to construct (glibc < 2.34)
|
2020-07-10 01:20:18 +08:00
|
|
|
# Note: the destructor can be fixed in the same way.
|
|
|
|
|
2020-10-08 08:28:46 +09:00
|
|
|
nuttx-names.dat: nuttx-names.in
|
2020-07-10 12:00:56 +08:00
|
|
|
$(call PREPROCESS, nuttx-names.in, nuttx-names.dat)
|
2020-10-08 08:28:46 +09:00
|
|
|
|
2022-03-08 22:33:50 +08:00
|
|
|
define LINK_ALLSYMS
|
|
|
|
$(Q) $(TOPDIR)/tools/mkallsyms.sh noconst $(NUTTX) $(CROSSDEV) > allsyms.tmp
|
|
|
|
$(Q) $(call COMPILE, -x c allsyms.tmp, allsyms$(OBJEXT))
|
|
|
|
$(if $(CONFIG_HAVE_CXX),\
|
|
|
|
$(Q) "$(CXX)" $(CFLAGS) $(LDFLAGS) -o $(NUTTX) \
|
|
|
|
$(HEADOBJ) nuttx.rel $(HOSTOBJS) $(STDLIBS) allsyms$(OBJEXT),\
|
|
|
|
$(Q) "$(CC)" $(CFLAGS) $(LDFLAGS) -o $(NUTTX) \
|
|
|
|
$(HEADOBJ) nuttx.rel $(HOSTOBJS) $(STDLIBS) allsyms$(OBJEXT))
|
|
|
|
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
|
|
|
endef
|
|
|
|
|
2022-02-14 12:03:22 +09:00
|
|
|
# Note: Use objcopy for Linux because for some reasons visibility=hidden
|
|
|
|
# stuff doesn't work there as we expect.
|
|
|
|
# Note: _stext stuff is for CONFIG_CXX_INITIALIZE_SINIT, which in not
|
|
|
|
# necessary for macOS.
|
2020-10-22 21:39:01 +09:00
|
|
|
nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS) $(HOSTOBJS) nuttx-names.dat
|
2020-10-08 08:28:46 +09:00
|
|
|
$(Q) echo "LD: nuttx$(EXEEXT)"
|
2022-03-07 20:08:12 +08:00
|
|
|
$(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) $(EXTRALINKCMDS) \
|
|
|
|
-o nuttx.rel $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
|
2022-02-14 12:03:22 +09:00
|
|
|
ifneq ($(CONFIG_HOST_MACOS),y)
|
2020-07-09 13:57:30 +08:00
|
|
|
$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
|
2022-02-28 18:31:17 +08:00
|
|
|
$(Q) $(CC) $(CFLAGS) -Wl,-verbose 2>&1 | \
|
2022-03-31 14:10:33 -03:00
|
|
|
sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' \
|
|
|
|
-e 's/^\(\s\+\)\(\.init_array\)/\1\2 : { }\n\1.sinit/g' \
|
|
|
|
-e 's/^\(\s\+\)\(\.fini_array\)/\1\2 : { }\n\1.einit/g' \
|
|
|
|
-e 's/__init_array_start/_sinit/g' -e 's/__init_array_end/_einit/g' \
|
|
|
|
-e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld
|
2020-07-10 01:20:18 +08:00
|
|
|
$(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld
|
2022-02-10 00:39:40 +01:00
|
|
|
endif
|
2022-03-08 22:33:50 +08:00
|
|
|
ifneq ($(CONFIG_ALLSYMS),y)
|
2020-05-08 20:10:45 +08:00
|
|
|
$(if $(CONFIG_HAVE_CXX),\
|
2022-03-01 03:04:50 +08:00
|
|
|
$(Q) "$(CXX)" $(CFLAGS) $(LDFLAGS) -o $(TOPDIR)/$@ $(HEADOBJ) nuttx.rel $(HOSTOBJS) $(STDLIBS),\
|
|
|
|
$(Q) "$(CC)" $(CFLAGS) $(LDFLAGS) -o $(TOPDIR)/$@ $(HEADOBJ) nuttx.rel $(HOSTOBJS) $(STDLIBS))
|
2022-03-08 22:33:50 +08:00
|
|
|
else
|
|
|
|
$(Q) # Link and generate default table
|
|
|
|
$(Q) $(if $(wildcard $(shell echo $(NUTTX))),,$(call LINK_ALLSYMS, $@))
|
|
|
|
$(Q) # Extract all symbols
|
|
|
|
$(Q) $(call LINK_ALLSYMS, $^)
|
|
|
|
$(Q) # Extract again since the table offset may changed
|
|
|
|
$(Q) $(call LINK_ALLSYMS, $^)
|
|
|
|
endif
|
2012-11-02 00:22:52 +00:00
|
|
|
$(Q) $(NM) $(TOPDIR)/$@ | \
|
2007-09-23 16:58:09 +00:00
|
|
|
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
|
|
|
sort > $(TOPDIR)/System.map
|
2007-02-27 23:59:20 +00:00
|
|
|
|
2011-07-11 22:52:51 +00:00
|
|
|
# This is part of the top-level export target
|
|
|
|
|
2022-05-12 18:41:27 +08:00
|
|
|
export_startup: up_head.o $(HOSTOBJS) nuttx-names.dat
|
2012-03-25 16:22:07 +00:00
|
|
|
cp up_head.o $(HOSTOBJS) ${EXPORT_DIR}/startup
|
|
|
|
cp nuttx-names.dat ${EXPORT_DIR}/libs
|
2011-07-11 22:52:51 +00:00
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
|
2020-11-18 13:44:58 -03:00
|
|
|
makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds) $(HOSTSRCS:.c=.ddh)
|
|
|
|
$(call CATFILE, Make.dep, $^)
|
|
|
|
$(call DELFILE, $^)
|
|
|
|
|
2021-07-26 15:50:40 +08:00
|
|
|
config.h: $(TOPDIR)/include/nuttx/config.h
|
|
|
|
@echo "CP: $<"
|
|
|
|
$(Q) cp $< $@
|
|
|
|
|
|
|
|
.depend: Makefile config.h $(SRCS) $(TOPDIR)$(DELIM).config
|
2019-10-24 08:10:55 -06:00
|
|
|
$(Q) if [ -e board/Makefile ]; then \
|
2020-09-14 13:53:37 -03:00
|
|
|
$(MAKE) -C board depend ; \
|
2019-10-24 08:10:55 -06:00
|
|
|
fi
|
2020-11-18 13:44:58 -03:00
|
|
|
$(Q) $(MAKE) makedepfile
|
2020-03-23 11:44:03 +09:00
|
|
|
$(Q) touch $@
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2020-03-23 11:44:03 +09:00
|
|
|
depend: .depend
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2020-09-23 12:48:02 +01:00
|
|
|
context::
|
|
|
|
|
2020-07-09 13:57:30 +08:00
|
|
|
clean:
|
2012-11-02 00:22:52 +00:00
|
|
|
$(Q) if [ -e board/Makefile ]; then \
|
2020-09-14 13:53:37 -03:00
|
|
|
$(MAKE) -C board clean ; \
|
2011-10-11 14:34:18 +00:00
|
|
|
fi
|
2020-07-10 01:20:18 +08:00
|
|
|
$(call DELFILE, nuttx.ld)
|
2012-11-20 15:47:41 +00:00
|
|
|
$(call DELFILE, nuttx.rel)
|
2020-07-09 13:57:30 +08:00
|
|
|
$(call DELFILE, nuttx-names.dat)
|
2012-11-20 15:47:41 +00:00
|
|
|
$(call DELFILE, libarch$(LIBEXT))
|
2008-01-10 13:38:13 +00:00
|
|
|
$(call CLEAN)
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2021-07-21 18:48:05 +02:00
|
|
|
distclean:: clean
|
2012-11-02 00:22:52 +00:00
|
|
|
$(Q) if [ -e board/Makefile ]; then \
|
2020-09-14 13:53:37 -03:00
|
|
|
$(MAKE) -C board distclean ; \
|
2011-10-11 14:34:18 +00:00
|
|
|
fi
|
2012-11-20 15:47:41 +00:00
|
|
|
$(call DELFILE, Make.dep)
|
2020-03-23 11:44:03 +09:00
|
|
|
$(call DELFILE, .depend)
|
2021-07-26 15:50:40 +08:00
|
|
|
$(call DELFILE, config.h)
|
2015-11-25 08:36:44 -06:00
|
|
|
$(call DELFILE, hostfs.h)
|
2007-02-17 23:21:28 +00:00
|
|
|
|
|
|
|
-include Make.dep
|