2012-12-10 19:32:48 -06:00
|
|
|
# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
2012-02-10 14:07:01 -06:00
|
|
|
|
|
|
|
ifdef CFG_ENABLE_FAST_MAKE
|
|
|
|
LLVM_DEPS := $(S)/.gitmodules
|
|
|
|
else
|
2011-11-25 21:25:09 -06:00
|
|
|
|
2011-11-01 19:09:44 -05:00
|
|
|
# This is just a rough approximation of LLVM deps
|
2013-11-29 19:09:10 -06:00
|
|
|
LLVM_DEPS_SRC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)lib,*cpp *hpp)
|
|
|
|
LLVM_DEPS_INC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)include,*cpp *hpp)
|
2013-05-21 18:34:41 -05:00
|
|
|
LLVM_DEPS=$(LLVM_DEPS_SRC) $(LLVM_DEPS_INC)
|
2012-02-10 14:07:01 -06:00
|
|
|
endif
|
2011-11-01 17:48:30 -05:00
|
|
|
|
2011-11-02 18:21:17 -05:00
|
|
|
define DEF_LLVM_RULES
|
|
|
|
|
|
|
|
# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
|
|
|
|
ifeq ($(CFG_LLVM_ROOT),)
|
|
|
|
|
2013-09-04 01:47:13 -05:00
|
|
|
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
|
|
|
|
|
|
|
|
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
|
2011-11-02 18:21:17 -05:00
|
|
|
@$$(call E, make: llvm)
|
2014-01-15 19:47:48 -06:00
|
|
|
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV_$(1)) ONLY_TOOLS="$$(LLVM_TOOLS)"
|
2011-12-12 19:06:43 -06:00
|
|
|
$$(Q)touch $$(LLVM_CONFIG_$(1))
|
2011-11-02 18:21:17 -05:00
|
|
|
endif
|
|
|
|
|
2013-09-04 01:47:13 -05:00
|
|
|
# This is used to independently force an LLVM clean rebuild
|
|
|
|
# when we changed something not otherwise captured by builtin
|
|
|
|
# dependencies. In these cases, commit a change that touches
|
|
|
|
# the stamp in the source dir.
|
|
|
|
$$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
|
2013-11-28 16:16:17 -06:00
|
|
|
@$$(call E, make: cleaning llvm)
|
2015-03-03 08:11:01 -06:00
|
|
|
$(Q)touch $$@.start_time
|
2014-10-29 21:54:52 -05:00
|
|
|
$(Q)$(MAKE) clean-llvm$(1)
|
2013-11-28 16:16:17 -06:00
|
|
|
@$$(call E, make: done cleaning llvm)
|
2015-03-03 08:11:01 -06:00
|
|
|
touch -r $$@.start_time $$@ && rm $$@.start_time
|
2013-09-04 01:47:13 -05:00
|
|
|
|
2014-04-16 12:45:04 -05:00
|
|
|
ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
|
2015-03-12 06:09:12 -05:00
|
|
|
LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
|
|
|
|
-print-file-name=libstdc++.a))"
|
2014-04-16 12:45:04 -05:00
|
|
|
else
|
2015-03-12 06:09:12 -05:00
|
|
|
LLVM_STDCPP_RUSTFLAGS_$(1) =
|
2014-04-16 12:45:04 -05:00
|
|
|
endif
|
|
|
|
|
2014-11-25 17:28:49 -06:00
|
|
|
|
|
|
|
# LLVM linkage:
|
|
|
|
LLVM_LINKAGE_PATH_$(1):=$$(abspath $$(RT_OUTPUT_DIR_$(1))/llvmdeps.rs)
|
|
|
|
$$(LLVM_LINKAGE_PATH_$(1)): $(S)src/etc/mklldeps.py $$(LLVM_CONFIG_$(1))
|
|
|
|
$(Q)$(CFG_PYTHON) "$$<" "$$@" "$$(LLVM_COMPONENTS)" "$$(CFG_ENABLE_LLVM_STATIC_STDCPP)" \
|
|
|
|
$$(LLVM_CONFIG_$(1))
|
2011-11-02 18:21:17 -05:00
|
|
|
endef
|
|
|
|
|
2013-11-30 22:52:21 -06:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
2014-04-16 12:45:04 -05:00
|
|
|
$(eval $(call DEF_LLVM_RULES,$(host))))
|
2013-11-30 22:52:21 -06:00
|
|
|
|
2014-01-03 16:16:43 -06:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
2014-04-16 12:45:04 -05:00
|
|
|
$(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
|
2014-01-03 16:16:43 -06:00
|
|
|
|
2014-11-25 17:28:49 -06:00
|
|
|
# This can't be done in target.mk because it's included before this file.
|
|
|
|
define LLVM_LINKAGE_DEPS
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $$(LLVM_LINKAGE_PATH_$(3))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach source,$(CFG_HOST), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(eval $(call LLVM_LINKAGE_DEPS,0,$(target),$(source))) \
|
|
|
|
$(eval $(call LLVM_LINKAGE_DEPS,1,$(target),$(source))) \
|
|
|
|
$(eval $(call LLVM_LINKAGE_DEPS,2,$(target),$(source))) \
|
|
|
|
$(eval $(call LLVM_LINKAGE_DEPS,3,$(target),$(source)))))
|