Skip to content

Commit

Permalink
libxx: Map all output files to the bin directory
Browse files Browse the repository at this point in the history
1. There are files with the same name in libcxx, so the generated files must be separated by files

Signed-off-by: wangmingrong1 <[email protected]>
  • Loading branch information
W-M-R committed Nov 6, 2024
1 parent 0fad2ee commit 07039cb
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 11 deletions.
23 changes: 13 additions & 10 deletions libs/libxx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,32 @@ ifeq ($(CONFIG_LIBCXXABI),y)
include libcxxabi.defs
endif

BIN = libxx$(LIBEXT)
BINDIR = bin

# Object Files

AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
CPPOBJS = $(CPPSRCS:.cpp=$(OBJEXT))
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)

BIN = libxx$(LIBEXT)

all: $(BIN)
.PHONY: depend clean distclean context

$(AOBJS): %$(OBJEXT): %.S
$(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)

$(COBJS): %$(OBJEXT): %.c
$(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
$(call COMPILE, $<, $@)

$(CXXOBJS): %$(OBJEXT): %.cxx
$(CXXOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cxx
$(call COMPILEXX, $<, $@)

$(CPPOBJS): %$(OBJEXT): %.cpp
$(CPPOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cpp
$(call COMPILEXX, $<, $@)

$(BIN): $(OBJS)
Expand All @@ -90,10 +91,12 @@ makedepfile: $(CXXSRCS:.cxx=.ddx) $(CPPSRCS:.cpp=.ddp)
depend: .depend

clean:
$(Q) $(MAKE) -C bin clean
$(call DELFILE, $(BIN))
$(call CLEAN)

distclean:: clean
$(Q) $(MAKE) -C bin distclean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)

Expand Down
35 changes: 35 additions & 0 deletions libs/libxx/bin/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
############################################################################
# libs/libxx/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)
11 changes: 10 additions & 1 deletion libs/libxx/libcxx.defs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz
$(Q) patch -p0 < 0001-libcxx-remove-mach-time-h.patch
$(Q) patch -p0 < 0001-libcxx-fix-ld-errors.patch
$(Q) touch $@
$(Q) mkdir $(BINDIR)/libcxx \
$(BINDIR)/libcxx/src \
$(BINDIR)/libcxx/src/experimental \
$(BINDIR)/libcxx/src/filesystem \
$(BINDIR)/libcxx/src/ryu
endif

$(TOPDIR)/include/libcxx: libcxx
Expand All @@ -49,6 +54,11 @@ distclean::
ifeq ($(wildcard libcxx/.git),)
$(Q) $(DELFILE) libcxx-$(LIBCXX_VERSION).src.tar.xz
$(call DELDIR, libcxx)
$(call DELDIR, $(BINDIR)/libcxx \
$(BINDIR)/libcxx/src \
$(BINDIR)/libcxx/src/experimental \
$(BINDIR)/libcxx/src/filesystem \
$(BINDIR)/libcxx/src/ryu)
endif

CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_BUILDING_LIBRARY
Expand Down Expand Up @@ -83,4 +93,3 @@ ifeq ($(CONFIG_CXX_LOCALIZATION),)
LOCALE_CPPSRCS += libcxx/src/strstream.cpp
CPPSRCS := $(filter-out $(LOCALE_CPPSRCS), $(CPPSRCS))
endif

0 comments on commit 07039cb

Please sign in to comment.