diff --git a/libs/libbuiltin/Makefile b/libs/libbuiltin/Makefile index bbc92215f43..c4fd243e75d 100644 --- a/libs/libbuiltin/Makefile +++ b/libs/libbuiltin/Makefile @@ -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)) \ No newline at end of file + $(call DELDIR, bin) + $(call DELDIR, kbin) + $(call DELDIR, .depend) diff --git a/libs/libbuiltin/bin/Makefile b/libs/libbuiltin/bin/Makefile deleted file mode 100644 index d60aef150e9..00000000000 --- a/libs/libbuiltin/bin/Makefile +++ /dev/null @@ -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) diff --git a/libs/libbuiltin/compiler-rt/Make.defs b/libs/libbuiltin/compiler-rt/Make.defs index 3fa73d7c5b4..febc3753cde 100644 --- a/libs/libbuiltin/compiler-rt/Make.defs +++ b/libs/libbuiltin/compiler-rt/Make.defs @@ -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 diff --git a/libs/libbuiltin/kbin/Makefile b/libs/libbuiltin/kbin/Makefile deleted file mode 100644 index 2703454c79e..00000000000 --- a/libs/libbuiltin/kbin/Makefile +++ /dev/null @@ -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) diff --git a/tools/Directories.mk b/tools/Directories.mk index c3395fe2907..1f796c02e24 100644 --- a/tools/Directories.mk +++ b/tools/Directories.mk @@ -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