mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
libbuiltin/Makefile: Modify the libbuiltin makefile to standard
1. bin and kbin folders are dynamically generated 2. Context comes before depend, so the bin and kbin folders are created in the context construction phase. When the depend process comes, each library is downloaded, and a relative bin/xxx and kbin/xxx directory is created for each library to place files. This is to prevent duplicate file names. Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
committed by
Xiang Xiao
parent
dbeaec4cdc
commit
f59edf8645
+18
-17
@@ -38,12 +38,8 @@ CPPOBJS = $(addprefix $(BINDIR)$(DELIM), $(CPPSRCS:.cpp=$(OBJEXT)))
|
||||
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(CPPSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) $(CPPOBJS)
|
||||
|
||||
BUILTIN_CLEANDIR = $(foreach dir,$(LIBBUILTIN),$(dir)/$(dir))
|
||||
|
||||
all: $(OBJS)
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
|
||||
.PHONY: depend clean distclean context $(LIBBUILTIN)
|
||||
all: $(BIN)
|
||||
.PHONY: depend clean distclean context
|
||||
|
||||
$(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
@@ -57,15 +53,21 @@ $(CXXOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cxx
|
||||
$(CPPOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cpp
|
||||
$(call COMPILEXX, $<, $@)
|
||||
|
||||
context::
|
||||
bin:
|
||||
$(Q) mkdir $@
|
||||
|
||||
.depend: $(LIBBUILTIN)
|
||||
kbin:
|
||||
$(Q) mkdir $@
|
||||
|
||||
context:: bin kbin
|
||||
|
||||
.depend: Makefile $(SRCS) $(TOPDIR)$(DELIM).config
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
depend:: .depend
|
||||
|
||||
$(BIN): depend
|
||||
$(Q) $(MAKE) all EXTRAFLAGS="$(EXTRAFLAGS)"
|
||||
$(BIN): $(OBJS)
|
||||
$(call ARCHIVE, $@, $(OBJS))
|
||||
|
||||
# C library for the kernel phase of the two-pass kernel build
|
||||
|
||||
@@ -75,12 +77,11 @@ $(KBIN): $(OBJS)
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(call CLEAN)
|
||||
$(call DELFILE, $(BIN))
|
||||
$(Q) $(MAKE) -C bin clean
|
||||
$(Q) $(MAKE) -C kbin clean
|
||||
$(call DELFILE, $(KBIN))
|
||||
|
||||
distclean:: clean
|
||||
$(Q) $(MAKE) -C bin distclean
|
||||
$(Q) $(MAKE) -C kbin distclean
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELDIR, $(BUILTIN_CLEANDIR))
|
||||
$(call DELDIR, bin)
|
||||
$(call DELDIR, kbin)
|
||||
$(call DELDIR, .depend)
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
############################################################################
|
||||
# libs/libbuiltin/bin/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
|
||||
|
||||
all:
|
||||
.PHONY: clean distclean
|
||||
|
||||
# Clean Targets:
|
||||
|
||||
clean:
|
||||
$(call DELFILE, *.o)
|
||||
|
||||
# Deep clean -- removes all traces of the configuration
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, *.dep)
|
||||
$(call DELFILE, .depend)
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
LIBBUILTIN += compiler-rt
|
||||
|
||||
COMPILER_RT_VERSION=$(CONFIG_COMPILER_RT_VERSION)
|
||||
|
||||
ifeq ($(CONFIG_ARCH_ARM),y)
|
||||
@@ -34,7 +32,18 @@ else ifeq ($(CONFIG_ARCH_ARM64),y)
|
||||
ARCH = aarch64
|
||||
endif
|
||||
|
||||
COMPILER_RT_OBJDIR = compiler-rt \
|
||||
compiler-rt/compiler-rt \
|
||||
compiler-rt/compiler-rt/lib \
|
||||
compiler-rt/compiler-rt/lib/builtins \
|
||||
compiler-rt/compiler-rt/lib/builtins/$(ARCH) \
|
||||
compiler-rt/compiler-rt/lib/profile
|
||||
|
||||
BIN_OBJDIR = $(addprefix $(BINDIR)$(DELIM),$(COMPILER_RT_OBJDIR))
|
||||
KBIN_OBJDIR = $(addprefix $(KBINDIR)$(DELIM),$(COMPILER_RT_OBJDIR))
|
||||
|
||||
ifeq ($(wildcard compiler-rt/compiler-rt/lib),)
|
||||
|
||||
compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz:
|
||||
$(call DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPILER_RT_VERSION),$@)
|
||||
|
||||
@@ -42,19 +51,20 @@ compiler-rt/compiler-rt: compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz
|
||||
$(Q) tar -xf $<
|
||||
$(Q) mv compiler-rt-$(COMPILER_RT_VERSION).src $@
|
||||
$(call DELDIR, $<)
|
||||
$(Q) mkdir $(BIN_OBJDIR) $(KBIN_OBJDIR)
|
||||
|
||||
compiler-rt: compiler-rt/compiler-rt
|
||||
$(Q) mkdir $(BINDIR)/compiler-rt \
|
||||
$(BINDIR)/compiler-rt/compiler-rt \
|
||||
$(BINDIR)/compiler-rt/compiler-rt/lib \
|
||||
$(BINDIR)/compiler-rt/compiler-rt/lib/builtins \
|
||||
$(BINDIR)/compiler-rt/compiler-rt/lib/builtins/$(ARCH) \
|
||||
$(BINDIR)/compiler-rt/compiler-rt/lib/profile
|
||||
|
||||
endif
|
||||
|
||||
.PHONY: compiler-rt
|
||||
|
||||
depend:: compiler-rt
|
||||
|
||||
distclean::
|
||||
$(call DELDIR, $(BINDIR)/compiler-rt)
|
||||
$(call DELDIR, $(BIN_OBJDIR))
|
||||
$(call DELDIR, $(KBIN_OBJDIR))
|
||||
$(call DELDIR, compiler-rt/compiler-rt)
|
||||
|
||||
FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/include
|
||||
FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
############################################################################
|
||||
# libs/libbuiltin/kbin/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
|
||||
|
||||
all:
|
||||
.PHONY: clean distclean
|
||||
|
||||
# Clean Targets:
|
||||
|
||||
clean:
|
||||
$(call DELFILE, *.o)
|
||||
|
||||
# Deep clean -- removes all traces of the configuration
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, *.dep)
|
||||
$(call DELFILE, .depend)
|
||||
@@ -122,7 +122,7 @@ CLEANDIRS += syscall
|
||||
endif
|
||||
endif
|
||||
|
||||
CONTEXTDIRS += libs$(DELIM)libc
|
||||
CONTEXTDIRS += libs$(DELIM)libc libs$(DELIM)libbuiltin
|
||||
|
||||
ifeq ($(CONFIG_LIBM_TOOLCHAIN)$(CONFIG_LIBM_NONE),)
|
||||
CONTEXTDIRS += libs$(DELIM)libm
|
||||
|
||||
Reference in New Issue
Block a user