nuttx/libs/libbuiltin/Makefile
wangmingrong1 b59e3616f4 gcov: Support for the most streamlined profile of LLVM-embedded-toolchain-for-Arm
1. Excerpted from: https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/blob/main/samples/src/cpp-baremetal-semihosting-prof/proflib.c
2. Since llvm profile supports more than just gcov, and some features have not yet been explored, two clang gcov implementations are supported after this patch
3. Using this lib only supports the gcov compilation options of "-fprofile-instr-generate -fcoverage-mapping"
4. This file is heavily dependent on the compiler clang version, and is currently aligned with ci, supporting 17.0.1 and below. 18 and above are not supported by this library due to different internal implementations of the compiler

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-13 05:33:00 +08:00

87 lines
2.3 KiB
Makefile

############################################################################
# libs/libbuiltin/Makefile
#
# 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)/Make.defs
BIN ?= libbuiltin$(LIBEXT)
BINDIR ?= bin
KBIN = libkbuiltin$(LIBEXT)
KBINDIR = kbin
include compiler-rt/Make.defs
include libgcc/Make.defs
AOBJS = $(addprefix $(BINDIR)$(DELIM), $(ASRCS:.S=$(OBJEXT)))
COBJS = $(addprefix $(BINDIR)$(DELIM), $(CSRCS:.c=$(OBJEXT)))
CXXOBJS = $(addprefix $(BINDIR)$(DELIM), $(CXXSRCS:.cxx=$(OBJEXT)))
CPPOBJS = $(addprefix $(BINDIR)$(DELIM), $(CPPSRCS:.cpp=$(OBJEXT)))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(CPPSRCS)
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) $(CPPOBJS)
all: $(BIN)
.PHONY: depend clean distclean context
$(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(CXXOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cxx
$(call COMPILEXX, $<, $@)
$(CPPOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cpp
$(call COMPILEXX, $<, $@)
bin:
$(Q) mkdir $@
kbin:
$(Q) mkdir $@
context:: bin kbin
.depend: Makefile $(SRCS) $(TOPDIR)$(DELIM).config
$(Q) touch $@
depend:: .depend
$(BIN): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
# C library for the kernel phase of the two-pass kernel build
ifneq ($(BIN),$(KBIN))
$(KBIN): $(OBJS)
$(Q) $(MAKE) $(KBIN) BIN=$(KBIN) BINDIR=$(KBINDIR) EXTRAFLAGS="$(EXTRAFLAGS)"
endif
clean:
$(call CLEAN)
$(call DELFILE, $(BIN))
$(call DELFILE, $(KBIN))
distclean:: clean
$(call DELDIR, bin)
$(call DELDIR, kbin)
$(call DELDIR, .depend)