Skip to content

Commit

Permalink
A couple of Makefile tweaks
Browse files Browse the repository at this point in the history
- If we're building the world with a custom C++ library, make sure
  PATCHELF picks up the correct flags both at build time and when
  we use it.
- Fix base/version_git.sh to also work when using O= out of tree
  builds (important for Compat, etc.)
  • Loading branch information
Keno committed Nov 23, 2015
1 parent c37bc22 commit 44e36da
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ endif

# Custom libcxx
ifeq ($(BUILD_CUSTOM_LIBCXX),1)
LDFLAGS += -L$(build_libdir) -lc++abi
LDFLAGS += -L$(build_libdir)
CXXLDFLAGS += -L$(build_libdir) -lc++abi -stdlib=libc++ -lc++
CPPFLAGS += -I$(build_includedir)/c++/v1
CUSTOM_LD_LIBRARY_PATH := LD_LIBRARY_PATH="$(build_libdir)"
Expand Down
4 changes: 2 additions & 2 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ endif

$(BUILDDIR)/version_git.jl.phony: $(SRCDIR)/version_git.sh
ifneq ($(NO_GIT), 1)
@sh $< > $@
sh $< $(SRCDIR) > $@
@# This to avoid touching git_version.jl when it is not modified,
@# so that the system image does not need to be rebuilt.
@if ! cmp -s $@ version_git.jl; then \
Expand All @@ -94,7 +94,7 @@ ifeq ($(shell [ -f $(BUILDDIR)/version_git.jl ] && echo "true"), true)
fi
else
$(warning "WARNING: Generating boilerplate git version info")
@sh $(SRCDIR)/version_git.sh NO_GIT > $(BUILDDIR)/version_git.jl
@sh $(SRCDIR)/version_git.sh $(SRCDIR) NO_GIT > $(BUILDDIR)/version_git.jl
endif
endif

Expand Down
4 changes: 3 additions & 1 deletion base/version_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ echo " fork_master_timestamp::Float64"
echo "end"
echo ""

cd $1

# If the script didn't ask not to use git info
if [ "$#" = "1" -a "$1" = "NO_GIT" ]; then
if [ "$#" = "2" -a "$2" = "NO_GIT" ]; then
# this comment is used in base/Makefile to distinguish boilerplate
echo "# Default output if git is not available."
echo "const GIT_VERSION_INFO = GitVersionInfo(\"\" ,\"\" ,\"\" ,0 ,\"\" ,true ,0 ,0.)"
Expand Down
12 changes: 7 additions & 5 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ else
PATCHELF:=patchelf
endif
endif
PATCHELF_BIN := $(CUSTOM_LD_LIBRARY_PATH) $(PATCHELF)

## USE_SYSTEM_LIBS options

Expand Down Expand Up @@ -451,6 +452,7 @@ LLVM_CC := CFLAGS="$(CFLAGS) -fsanitize=memory -fsanitize-memory-track-origins"
LLVM_LDFLAGS += -fsanitize=memory -fsanitize-memory-track-origins
LLVM_CXXFLAGS += -fsanitize=memory -fsanitize-memory-track-origins
LLVM_CMAKE += -DLLVM_USE_SANITIZER="MemoryWithOrigins"
LLVM_FLAGS += --disable-terminfo
else
LLVM_CC := CFLAGS="$(CFLAGS) -fsanitize=address"
LLVM_LDFLAGS += -fsanitize=address
Expand Down Expand Up @@ -556,7 +558,7 @@ $(LLVM_BUILD_DIR)/libcxx-build/Makefile: | $(LLVM_SRC_DIR)/projects/libcxx $(LLV
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) -G "Unix Makefiles" $(CMAKE_COMMON) $(LLVM_CMAKE) -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$(LLVM_SRC_DIR)/projects/libcxxabi/include" $(LLVM_SRC_DIR)/projects/libcxx -DCMAKE_SHARED_LINKER_FLAGS="-L$(build_libdir) $(LIBCXX_EXTRA_FLAGS)" -DCMAKE_CXX_FLAGS="$(CXXFLAGS)"
$(LLVM_BUILD_DIR)/libcxxabi-build/Makefile: | $(LLVM_SRC_DIR)/projects/libcxxabi llvm-$(LLVM_VER)/projects/libcxx
$(LLVM_BUILD_DIR)/libcxxabi-build/Makefile: | $(LLVM_SRC_DIR)/projects/libcxxabi $(LLVM_SRC_DIR)/projects/libcxx
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) -G "Unix Makefiles" $(CMAKE_COMMON) $(LLVM_CMAKE) -DLLVM_ABI_BREAKING_CHECKS="WITH_ASSERTS" -DLLVM_PATH="$(LLVM_SRC_DIR)" $(LLVM_SRC_DIR)/projects/libcxxabi -DLIBCXXABI_CXX_ABI_LIBRARIES="$(LIBCXX_EXTRA_FLAGS)" -DCMAKE_CXX_FLAGS="$(CXXFLAGS) -std=c++11"
Expand Down Expand Up @@ -1465,7 +1467,7 @@ else ifeq ($(OS), WINNT)
mv -f $(build_shlibdir)/libfftw3f-3.dll $@
else ifeq ($(OS), Linux)
for filename in $(build_shlibdir)/libfftw3f_threads.so* ; do \
[ -L $$filename ] || $(PATCHELF) --set-rpath '$$ORIGIN' $$filename ;\
[ -L $$filename ] || $(PATCHELF_BIN) --set-rpath '$$ORIGIN' $$filename ;\
done
endif
touch -c $@
Expand All @@ -1488,7 +1490,7 @@ else ifeq ($(OS), WINNT)
mv -f $(build_shlibdir)/libfftw3-3.dll $@
else ifeq ($(OS), Linux)
for filename in $(build_shlibdir)/libfftw3_threads.so* ; do \
[ -L $$filename ] || $(PATCHELF) --set-rpath '$$ORIGIN' $$filename ;\
[ -L $$filename ] || $(PATCHELF_BIN) --set-rpath '$$ORIGIN' $$filename ;\
done
endif
touch -c $@
Expand Down Expand Up @@ -1902,10 +1904,10 @@ $(SRCDIR)/srccache/patchelf-$(PATCHELF_VER)/configure: $(SRCDIR)/srccache/patche
$(JLCHECKSUM) $<
cd $(dir $<) && $(TAR) zxf $<
touch -c $@
$(BUILDDIR)/patchelf-$(PATCHELF_VER)/config.status: $(SRCDIR)/srccache/patchelf-$(PATCHELF_VER)/configure
$(BUILDDIR)/patchelf-$(PATCHELF_VER)/config.status: $(SRCDIR)/srccache/patchelf-$(PATCHELF_VER)/configure | $(LIBCXX_DEPENDENCY)
mkdir -p $(dir $@)
cd $(dir $@) && \
$< $(CONFIGURE_COMMON)
$< $(CONFIGURE_COMMON) LDFLAGS="$(CXXLDFLAGS)" CPPFLAGS="$(CPPFLAGS)"
touch -c $@
$(PATCHELF_SOURCE): $(BUILDDIR)/patchelf-$(PATCHELF_VER)/config.status
$(MAKE) -C $(dir $<)
Expand Down

0 comments on commit 44e36da

Please sign in to comment.