2015-09-05 19:37:38 +02:00
|
|
|
############################################################################
|
|
|
|
# apps/Application.mk
|
|
|
|
#
|
2022-03-08 09:55:07 +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
|
2015-09-05 19:37:38 +02:00
|
|
|
#
|
2022-03-08 09:55:07 +01:00
|
|
|
# http:#www.apache.org/licenses/LICENSE-2.0
|
2015-09-05 19:37:38 +02:00
|
|
|
#
|
2022-03-08 09:55:07 +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.
|
2015-09-05 19:37:38 +02:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2018-08-23 19:06:15 +02:00
|
|
|
# If this is an executable program (with MAINSRC), we must build it as a
|
|
|
|
# loadable module for the KERNEL build (always) or if the tristate module
|
|
|
|
# has the value "m"
|
|
|
|
|
|
|
|
ifneq ($(MAINSRC),)
|
2019-10-06 14:14:39 +02:00
|
|
|
ifeq ($(MODULE),m)
|
2018-09-03 17:29:56 +02:00
|
|
|
BUILD_MODULE = y
|
2018-08-23 19:06:15 +02:00
|
|
|
endif
|
|
|
|
|
2019-10-06 14:14:39 +02:00
|
|
|
ifeq ($(CONFIG_BUILD_KERNEL),y)
|
|
|
|
BUILD_MODULE = y
|
|
|
|
endif
|
2018-08-23 19:06:15 +02:00
|
|
|
endif
|
|
|
|
|
2020-01-17 23:44:46 +01:00
|
|
|
# The GNU make CURDIR will always be a POSIX-like path with forward slashes
|
|
|
|
# as path segment separators. If we know that this is a native build, then
|
|
|
|
# we need to fix up the path so the DELIM will match the actual delimiter.
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
2023-03-12 14:09:44 +01:00
|
|
|
CWD = $(strip ${shell echo %CD% | cut -d: -f2})
|
2020-01-17 23:44:46 +01:00
|
|
|
else
|
2023-03-12 14:09:44 +01:00
|
|
|
CWD = $(CURDIR)
|
2020-01-17 23:44:46 +01:00
|
|
|
endif
|
|
|
|
|
2022-10-14 09:01:50 +02:00
|
|
|
# Add the static application library to the linked libraries.
|
|
|
|
|
|
|
|
LDLIBS += $(call CONVERT_PATH,$(BIN))
|
2020-05-20 06:35:03 +02:00
|
|
|
|
2022-01-27 10:25:09 +01:00
|
|
|
# When building a module, link with the compiler runtime.
|
|
|
|
# This should be linked after libapps. Consider that mbedtls in libapps
|
|
|
|
# uses __udivdi3.
|
|
|
|
ifeq ($(BUILD_MODULE),y)
|
|
|
|
# Revisit: This only works for gcc and clang.
|
|
|
|
# Do other compilers have similar?
|
|
|
|
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)
|
2022-04-15 07:46:45 +02:00
|
|
|
ifeq ($(wildcard $(COMPILER_RT_LIB)),)
|
|
|
|
# if "--print-libgcc-file-name" unable to find the correct libgcc PATH
|
|
|
|
# then go ahead and try "--print-file-name"
|
|
|
|
COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB))))
|
2022-01-27 10:25:09 +01:00
|
|
|
endif
|
2022-04-15 07:46:45 +02:00
|
|
|
LDLIBS += $(COMPILER_RT_LIB)
|
2022-01-27 10:25:09 +01:00
|
|
|
endif
|
|
|
|
|
2023-06-01 05:31:45 +02:00
|
|
|
SUFFIX ?= $(subst $(DELIM),.,$(CWD))
|
2022-11-10 18:24:10 +01:00
|
|
|
|
|
|
|
PROGNAME := $(subst ",,$(PROGNAME))
|
2019-12-13 15:27:45 +01:00
|
|
|
|
2018-08-23 19:06:15 +02:00
|
|
|
# Object files
|
|
|
|
|
2020-09-08 13:23:33 +02:00
|
|
|
RASRCS = $(filter %.s,$(ASRCS))
|
|
|
|
CASRCS = $(filter %.S,$(ASRCS))
|
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
RAOBJS = $(RASRCS:=$(SUFFIX)$(OBJEXT))
|
|
|
|
CAOBJS = $(CASRCS:=$(SUFFIX)$(OBJEXT))
|
|
|
|
COBJS = $(CSRCS:=$(SUFFIX)$(OBJEXT))
|
|
|
|
CXXOBJS = $(CXXSRCS:=$(SUFFIX)$(OBJEXT))
|
2022-02-18 17:19:12 +01:00
|
|
|
RUSTOBJS = $(RUSTSRCS:=$(SUFFIX)$(OBJEXT))
|
2022-02-27 19:23:33 +01:00
|
|
|
ZIGOBJS = $(ZIGSRCS:=$(SUFFIX)$(OBJEXT))
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2020-08-13 11:51:00 +02:00
|
|
|
MAINCXXSRCS = $(filter %$(CXXEXT),$(MAINSRC))
|
|
|
|
MAINCSRCS = $(filter %.c,$(MAINSRC))
|
2022-02-18 17:19:12 +01:00
|
|
|
MAINRUSTSRCS = $(filter %$(RUSTEXT),$(MAINSRC))
|
2022-03-16 15:38:09 +01:00
|
|
|
MAINZIGSRCS = $(filter %$(ZIGEXT),$(MAINSRC))
|
2021-05-25 17:12:05 +02:00
|
|
|
MAINCXXOBJ = $(MAINCXXSRCS:=$(SUFFIX)$(OBJEXT))
|
|
|
|
MAINCOBJ = $(MAINCSRCS:=$(SUFFIX)$(OBJEXT))
|
2022-02-18 17:19:12 +01:00
|
|
|
MAINRUSTOBJ = $(MAINRUSTSRCS:=$(SUFFIX)$(OBJEXT))
|
2022-03-16 15:38:09 +01:00
|
|
|
MAINZIGOBJ = $(MAINZIGSRCS:=$(SUFFIX)$(OBJEXT))
|
2015-09-30 18:06:28 +02:00
|
|
|
|
|
|
|
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(MAINSRC)
|
2023-02-27 12:29:14 +01:00
|
|
|
OBJS = $(RAOBJS) $(CAOBJS) $(COBJS) $(CXXOBJS) $(RUSTOBJS) $(ZIGOBJS) $(EXTOBJS)
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2018-08-23 19:06:15 +02:00
|
|
|
ifneq ($(BUILD_MODULE),y)
|
2022-09-09 12:12:47 +02:00
|
|
|
OBJS += $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ)
|
2015-09-05 19:37:38 +02:00
|
|
|
endif
|
|
|
|
|
2023-08-25 09:21:18 +02:00
|
|
|
ifneq ($(strip $(PROGNAME)),)
|
2024-01-20 09:27:03 +01:00
|
|
|
PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ)
|
2023-07-25 10:53:44 +02:00
|
|
|
PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGNAME))
|
|
|
|
REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME)))
|
|
|
|
|
|
|
|
NLIST := $(shell seq 1 $(words $(PROGNAME)))
|
|
|
|
$(foreach i, $(NLIST), \
|
|
|
|
$(eval PROGNAME_$(word $i,$(PROGOBJ)) := $(word $i,$(PROGNAME))) \
|
|
|
|
$(eval PROGOBJ_$(word $i,$(PROGLIST)) := $(word $i,$(PROGOBJ))) \
|
|
|
|
$(eval PRIORITY_$(word $i,$(REGLIST)) := \
|
|
|
|
$(if $(word $i,$(PRIORITY)),$(word $i,$(PRIORITY)),$(lastword $(PRIORITY)))) \
|
|
|
|
$(eval STACKSIZE_$(word $i,$(REGLIST)) := \
|
|
|
|
$(if $(word $i,$(STACKSIZE)),$(word $i,$(STACKSIZE)),$(lastword $(STACKSIZE)))) \
|
|
|
|
$(eval UID_$(word $i,$(REGLIST)) := \
|
|
|
|
$(if $(word $i,$(UID)),$(word $i,$(UID)),$(lastword $(UID)))) \
|
|
|
|
$(eval GID_$(word $i,$(REGLIST)) := \
|
|
|
|
$(if $(word $i,$(GID)),$(word $i,$(GID)),$(lastword $(GID)))) \
|
|
|
|
$(eval MODE_$(word $i,$(REGLIST)) := \
|
|
|
|
$(if $(word $i,$(MODE)),$(word $i,$(MODE)),$(lastword $(MODE)))) \
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
2023-07-13 09:44:41 +02:00
|
|
|
# Condition flags
|
|
|
|
|
2023-07-17 06:06:13 +02:00
|
|
|
DO_REGISTRATION ?= y
|
2023-07-13 09:44:41 +02:00
|
|
|
|
|
|
|
ifeq ($(PROGNAME),)
|
|
|
|
DO_REGISTRATION = n
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(WASM_BUILD),y)
|
|
|
|
DO_REGISTRATION = n
|
|
|
|
endif
|
|
|
|
|
2023-03-31 04:25:13 +02:00
|
|
|
# Compile flags, notice the default flags only suitable for flat build
|
2023-01-31 08:09:21 +01:00
|
|
|
|
|
|
|
ZIGELFFLAGS ?= $(ZIGFLAGS)
|
2023-03-31 04:25:13 +02:00
|
|
|
RUSTELFFLAGS ?= $(RUSTFLAGS)
|
2023-01-31 08:09:21 +01:00
|
|
|
|
2021-03-24 21:50:17 +01:00
|
|
|
DEPPATH += --dep-path .
|
|
|
|
DEPPATH += --obj-path .
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2021-03-24 21:50:17 +01:00
|
|
|
VPATH += :.
|
|
|
|
|
2018-08-23 19:06:15 +02:00
|
|
|
# Targets follow
|
|
|
|
|
2023-09-11 05:54:19 +02:00
|
|
|
all:: .built
|
2023-05-19 03:42:48 +02:00
|
|
|
@:
|
2020-07-25 00:18:37 +02:00
|
|
|
.PHONY: clean depend distclean
|
2019-10-03 22:07:17 +02:00
|
|
|
.PRECIOUS: $(BIN)
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
define ELFASSEMBLE
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_BEGIN)"AS: $1 "
|
2019-10-03 14:52:25 +02:00
|
|
|
$(Q) $(CC) -c $(AELFFLAGS) $($(strip $1)_AELFFLAGS) $1 -o $2
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_END)
|
2018-09-03 17:29:56 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ELFCOMPILE
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_BEGIN)"CC: $1 "
|
2019-10-03 14:52:25 +02:00
|
|
|
$(Q) $(CC) -c $(CELFFLAGS) $($(strip $1)_CELFFLAGS) $1 -o $2
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_END)
|
2018-09-03 17:29:56 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ELFCOMPILEXX
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_BEGIN)"CXX: $1 "
|
2019-10-03 14:52:25 +02:00
|
|
|
$(Q) $(CXX) -c $(CXXELFFLAGS) $($(strip $1)_CXXELFFLAGS) $1 -o $2
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_END)
|
2018-09-03 17:29:56 +02:00
|
|
|
endef
|
|
|
|
|
2022-02-18 17:19:12 +01:00
|
|
|
define ELFCOMPILERUST
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_BEGIN)"RUSTC: $1 "
|
2022-02-18 17:19:12 +01:00
|
|
|
$(Q) $(RUSTC) --emit obj $(RUSTELFFLAGS) $($(strip $1)_RUSTELFFLAGS) $1 -o $2
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_END)
|
2022-02-18 17:19:12 +01:00
|
|
|
endef
|
|
|
|
|
2024-01-20 09:27:03 +01:00
|
|
|
# Remove target suffix here since zig compiler add .o automatically
|
2022-02-27 19:23:33 +01:00
|
|
|
define ELFCOMPILEZIG
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_BEGIN)"ZIG: $1 "
|
2023-02-25 19:12:10 +01:00
|
|
|
$(Q) $(ZIG) build-obj $(ZIGELFFLAGS) $($(strip $1)_ZIGELFFLAGS) --name $(basename $2) $1
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_END)
|
2022-02-27 19:23:33 +01:00
|
|
|
endef
|
|
|
|
|
2019-10-06 14:14:39 +02:00
|
|
|
define ELFLD
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_BEGIN)"LD: $2 "
|
2022-04-28 11:19:58 +02:00
|
|
|
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) $(ARCHCRT0OBJ) $1 $(LDSTARTGROUP) $(LDLIBS) $(LDENDGROUP) -o $2
|
2023-02-02 10:54:29 +01:00
|
|
|
$(ECHO_END)
|
2019-10-06 14:14:39 +02:00
|
|
|
endef
|
|
|
|
|
2024-01-20 09:27:03 +01:00
|
|
|
# rename "main()" in $1 to "xxx_main()" and save to $2
|
|
|
|
define RENAMEMAIN
|
|
|
|
$(ECHO_BEGIN)"Rename main() in $1 and save to $2"
|
|
|
|
$(Q) ${shell cat $1 | sed -e "s/fn[ ]\+main/fn $(addsuffix _main,$(PROGNAME_$@))/" > $2}
|
|
|
|
$(ECHO_END)
|
|
|
|
endef
|
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(RAOBJS): %.s$(SUFFIX)$(OBJEXT): %.s
|
2020-09-18 12:23:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(AELFFLAGS)), \
|
|
|
|
$(call ELFASSEMBLE, $<, $@), $(call ASSEMBLE, $<, $@))
|
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(CAOBJS): %.S$(SUFFIX)$(OBJEXT): %.S
|
2019-10-06 14:14:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(AELFFLAGS)), \
|
|
|
|
$(call ELFASSEMBLE, $<, $@), $(call ASSEMBLE, $<, $@))
|
2018-09-03 17:29:56 +02:00
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(COBJS): %.c$(SUFFIX)$(OBJEXT): %.c
|
2019-10-06 14:14:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
|
2018-09-03 17:29:56 +02:00
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(CXXOBJS): %$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
|
2019-10-06 14:14:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
|
2018-09-03 17:29:56 +02:00
|
|
|
|
2022-02-18 17:19:12 +01:00
|
|
|
$(RUSTOBJS): %$(RUSTEXT)$(SUFFIX)$(OBJEXT): %$(RUSTEXT)
|
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILERUST, $<, $@), $(call COMPILERUST, $<, $@))
|
|
|
|
|
2022-02-27 19:23:33 +01:00
|
|
|
$(ZIGOBJS): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
|
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE), $(CELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@))
|
|
|
|
|
2023-10-17 15:07:46 +02:00
|
|
|
AROBJS :=
|
2023-10-11 06:15:21 +02:00
|
|
|
ifneq ($(OBJS),)
|
2023-10-17 15:07:46 +02:00
|
|
|
SORTOBJS := $(sort $(OBJS))
|
|
|
|
$(eval $(call SPLITVARIABLE,OBJS_SPILT,$(SORTOBJS),100))
|
2023-10-11 06:15:21 +02:00
|
|
|
$(foreach BATCH, $(OBJS_SPILT_TOTAL), \
|
|
|
|
$(foreach obj, $(OBJS_SPILT_$(BATCH)), \
|
|
|
|
$(eval substitute := $(patsubst %$(OBJEXT),%_$(BATCH)$(OBJEXT),$(obj))) \
|
|
|
|
$(eval AROBJS += $(substitute)) \
|
|
|
|
$(eval $(call AROBJSRULES, $(substitute),$(obj))) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.built: $(AROBJS)
|
|
|
|
$(call SPLITVARIABLE,ALL_OBJS,$(AROBJS),100)
|
2023-08-30 13:57:16 +02:00
|
|
|
$(foreach BATCH, $(ALL_OBJS_TOTAL), \
|
2023-09-13 09:13:15 +02:00
|
|
|
$(shell $(call ARLOCK, $(call CONVERT_PATH,$(BIN)), $(ALL_OBJS_$(BATCH)))) \
|
2023-08-30 13:57:16 +02:00
|
|
|
)
|
2023-09-11 05:54:19 +02:00
|
|
|
$(Q) touch $@
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2019-10-06 14:14:39 +02:00
|
|
|
ifeq ($(BUILD_MODULE),y)
|
2018-09-04 17:38:26 +02:00
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(MAINCXXOBJ): %$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
|
2019-10-06 14:14:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
|
2020-08-13 11:51:00 +02:00
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(MAINCOBJ): %.c$(SUFFIX)$(OBJEXT): %.c
|
2019-10-06 14:14:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
|
2018-09-04 17:38:26 +02:00
|
|
|
|
2024-01-20 09:27:03 +01:00
|
|
|
$(MAINZIGOBJ): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
|
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@))
|
|
|
|
|
|
|
|
$(PROGLIST): $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ)
|
2020-03-16 10:12:16 +01:00
|
|
|
$(Q) mkdir -p $(BINDIR)
|
2024-01-20 09:27:03 +01:00
|
|
|
$(call ELFLD, $(PROGOBJ_$@), $(call CONVERT_PATH,$@))
|
2023-07-25 10:53:44 +02:00
|
|
|
$(Q) chmod +x $@
|
2020-03-22 15:46:58 +01:00
|
|
|
ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
|
2023-07-25 10:53:44 +02:00
|
|
|
$(Q) $(STRIP) $@
|
2019-10-07 10:55:44 +02:00
|
|
|
endif
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2018-09-12 14:09:20 +02:00
|
|
|
install:: $(PROGLIST)
|
2023-05-19 03:42:48 +02:00
|
|
|
@:
|
2018-09-04 17:38:26 +02:00
|
|
|
|
2015-09-05 19:37:38 +02:00
|
|
|
else
|
2019-10-06 14:14:39 +02:00
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(MAINCXXOBJ): %$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
|
2023-07-25 10:53:44 +02:00
|
|
|
$(eval $<_CXXFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(addsuffix _main,$(PROGNAME_$@))})
|
|
|
|
$(eval $<_CXXELFFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(addsuffix _main,$(PROGNAME_$@))})
|
2019-10-06 14:14:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
|
2020-08-13 11:51:00 +02:00
|
|
|
|
2021-05-25 17:12:05 +02:00
|
|
|
$(MAINCOBJ): %.c$(SUFFIX)$(OBJEXT): %.c
|
2023-07-25 10:53:44 +02:00
|
|
|
$(eval $<_CFLAGS += ${DEFINE_PREFIX}main=$(addsuffix _main,$(PROGNAME_$@)))
|
|
|
|
$(eval $<_CELFFLAGS += ${DEFINE_PREFIX}main=$(addsuffix _main,$(PROGNAME_$@)))
|
2019-10-06 14:14:39 +02:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
|
|
|
|
|
2022-02-18 17:19:12 +01:00
|
|
|
$(MAINRUSTOBJ): %$(RUSTEXT)$(SUFFIX)$(OBJEXT): %$(RUSTEXT)
|
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
|
|
|
|
$(call ELFCOMPILERUST, $<, $@), $(call COMPILERUST, $<, $@))
|
|
|
|
|
2022-03-16 15:38:09 +01:00
|
|
|
$(MAINZIGOBJ): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
|
2024-01-20 09:27:03 +01:00
|
|
|
$(Q) $(call RENAMEMAIN, $<, $(basename $<)_tmp.zig)
|
2022-02-27 19:23:33 +01:00
|
|
|
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
|
2024-01-20 09:27:03 +01:00
|
|
|
$(call ELFCOMPILEZIG, $(basename $<)_tmp.zig, $@), $(call COMPILEZIG, $(basename $<)_tmp.zig, $@))
|
|
|
|
$(Q) rm -f $(basename $<)_tmp.zig
|
2022-02-27 19:23:33 +01:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
install::
|
2023-05-19 03:42:48 +02:00
|
|
|
@:
|
2018-09-04 17:38:26 +02:00
|
|
|
|
|
|
|
endif # BUILD_MODULE
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2020-07-16 14:29:35 +02:00
|
|
|
context::
|
2023-05-19 03:42:48 +02:00
|
|
|
@:
|
2020-07-16 14:29:35 +02:00
|
|
|
|
2023-07-13 09:44:41 +02:00
|
|
|
ifeq ($(DO_REGISTRATION),y)
|
2019-10-06 14:14:39 +02:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
$(REGLIST): $(DEPCONFIG) Makefile
|
2023-07-25 10:53:44 +02:00
|
|
|
$(eval PROGNAME_$@ := $(basename $(notdir $@)))
|
2023-04-15 09:01:04 +02:00
|
|
|
ifeq ($(CONFIG_SCHED_USER_IDENTITY),y)
|
2023-07-25 10:53:44 +02:00
|
|
|
$(call REGISTER,$(PROGNAME_$@),$(PRIORITY_$@),$(STACKSIZE_$@),$(if $(BUILD_MODULE),,$(PROGNAME_$@)_main),$(UID_$@),$(GID_$@),$(MODE_$@))
|
2023-04-15 09:01:04 +02:00
|
|
|
else
|
2023-07-25 10:53:44 +02:00
|
|
|
$(call REGISTER,$(PROGNAME_$@),$(PRIORITY_$@),$(STACKSIZE_$@),$(if $(BUILD_MODULE),,$(PROGNAME_$@)_main))
|
2023-04-15 09:01:04 +02:00
|
|
|
endif
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2020-07-16 14:29:35 +02:00
|
|
|
register:: $(REGLIST)
|
2023-05-19 03:42:48 +02:00
|
|
|
@:
|
2015-09-05 19:37:38 +02:00
|
|
|
else
|
2020-07-16 14:29:35 +02:00
|
|
|
register::
|
2023-05-19 03:42:48 +02:00
|
|
|
@:
|
2015-09-05 19:37:38 +02:00
|
|
|
endif
|
|
|
|
|
2020-07-28 04:57:30 +02:00
|
|
|
.depend: Makefile $(wildcard $(foreach SRC, $(SRCS), $(addsuffix /$(SRC), $(subst :, ,$(VPATH))))) $(DEPCONFIG)
|
2023-07-24 15:50:54 +02:00
|
|
|
$(call SPLITVARIABLE,ALL_DEP_OBJS,$^,100)
|
|
|
|
$(foreach BATCH, $(ALL_DEP_OBJS_TOTAL), \
|
|
|
|
$(shell $(MKDEP) $(DEPPATH) --obj-suffix .c$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.c,$(ALL_DEP_OBJS_$(BATCH))) >Make.dep) \
|
|
|
|
$(shell $(MKDEP) $(DEPPATH) --obj-suffix .S$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.S,$(ALL_DEP_OBJS_$(BATCH))) >>Make.dep) \
|
|
|
|
$(shell $(MKDEP) $(DEPPATH) --obj-suffix $(CXXEXT)$(SUFFIX)$(OBJEXT) "$(CXX)" -- $(CXXFLAGS) -- $(filter %$(CXXEXT),$(ALL_DEP_OBJS_$(BATCH))) >>Make.dep) \
|
2023-10-17 15:07:46 +02:00
|
|
|
)
|
2020-03-23 04:33:08 +01:00
|
|
|
$(Q) touch $@
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2020-03-23 04:33:08 +01:00
|
|
|
depend:: .depend
|
2023-05-19 03:42:48 +02:00
|
|
|
@:
|
2015-09-05 19:37:38 +02:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
clean::
|
2023-09-11 05:54:19 +02:00
|
|
|
$(call DELFILE, .built)
|
2023-10-17 15:07:46 +02:00
|
|
|
$(call CLEANAROBJS)
|
2015-09-05 19:37:38 +02:00
|
|
|
$(call CLEAN)
|
2018-09-03 17:29:56 +02:00
|
|
|
distclean:: clean
|
2015-09-05 19:37:38 +02:00
|
|
|
$(call DELFILE, Make.dep)
|
2020-03-23 04:33:08 +01:00
|
|
|
$(call DELFILE, .depend)
|
2015-09-05 19:37:38 +02:00
|
|
|
|
|
|
|
-include Make.dep
|
2023-07-18 12:17:33 +02:00
|
|
|
|
|
|
|
# Include Wasm specific definitions
|
|
|
|
include $(APPDIR)/tools/Wasm.mk
|