2011-12-02 04:18:09 +08:00
|
|
|
##===- tools/llvm-config/Makefile---------------------------*- Makefile -*-===##
|
|
|
|
#
|
2006-04-21 04:53:23 +08:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
2007-12-30 04:07:17 +08:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2006-04-21 04:53:23 +08:00
|
|
|
#
|
|
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
|
2011-12-02 04:18:09 +08:00
|
|
|
LEVEL := ../..
|
|
|
|
TOOLNAME := llvm-config
|
|
|
|
USEDLIBS := LLVMSupport.a
|
2011-11-11 02:49:59 +08:00
|
|
|
|
2011-12-02 04:18:09 +08:00
|
|
|
# We generate sources in the build directory, make sure it is in the include
|
|
|
|
# paths.
|
|
|
|
INCLUDE_BUILD_DIR := 1
|
2011-11-30 06:56:31 +08:00
|
|
|
|
2011-12-02 04:18:09 +08:00
|
|
|
# This tool has no plugins, optimize startup time.
|
|
|
|
TOOL_NO_EXPORTS := 1
|
2011-11-11 03:59:35 +08:00
|
|
|
|
2011-12-02 04:18:09 +08:00
|
|
|
# Note that we have to use lazy expansion here.
|
|
|
|
BUILDVARIABLES_SRCPATH = $(PROJ_SRC_ROOT)/tools/$(TOOLNAME)/BuildVariables.inc.in
|
|
|
|
BUILDVARIABLES_OBJPATH = $(ObjDir)/BuildVariables.inc
|
|
|
|
BUILT_SOURCES = $(BUILDVARIABLES_OBJPATH)
|
|
|
|
|
|
|
|
include $(LEVEL)/Makefile.common
|
2011-12-01 18:50:19 +08:00
|
|
|
|
2006-04-21 04:53:23 +08:00
|
|
|
# Combine preprocessor flags (except for -I) and CXX flags.
|
2011-12-02 04:18:09 +08:00
|
|
|
SUB_CPPFLAGS := ${CPP.BaseFlags}
|
|
|
|
SUB_CFLAGS := ${CPP.BaseFlags} ${C.Flags}
|
|
|
|
SUB_CXXFLAGS := ${CPP.BaseFlags} ${CXX.Flags}
|
2006-04-21 04:53:23 +08:00
|
|
|
|
2013-12-16 21:09:06 +08:00
|
|
|
# Override LIBS with TARGET's LIBS for cross compilation.
|
|
|
|
# FIXME: Host's llvm-config is not generated. It's for target's.
|
|
|
|
ifneq ($(TARGET_LIBS), )
|
|
|
|
LLVM_SYSTEM_LIBS := $(TARGET_LIBS)
|
|
|
|
else
|
|
|
|
LLVM_SYSTEM_LIBS := $(LIBS)
|
|
|
|
endif
|
|
|
|
|
2006-04-21 04:53:23 +08:00
|
|
|
# This is blank for now. We need to be careful about adding stuff here:
|
|
|
|
# LDFLAGS tend not to be portable, and we don't currently require the
|
|
|
|
# user to use libtool when linking against LLVM.
|
2011-12-02 04:18:09 +08:00
|
|
|
SUB_LDFLAGS :=
|
2011-12-01 18:50:19 +08:00
|
|
|
|
2011-12-02 04:18:09 +08:00
|
|
|
$(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
|
|
|
|
$(Echo) "Building llvm-config BuildVariables.inc file."
|
|
|
|
$(Verb) $(ECHO) 's/@LLVM_SRC_ROOT@/$(subst /,\/,$(LLVM_SRC_ROOT))/' \
|
2011-12-01 18:50:19 +08:00
|
|
|
> temp.sed
|
2011-12-02 04:18:09 +08:00
|
|
|
$(Verb) $(ECHO) 's/@LLVM_OBJ_ROOT@/$(subst /,\/,$(LLVM_OBJ_ROOT))/' \
|
|
|
|
>> temp.sed
|
|
|
|
$(Verb) $(ECHO) 's/@LLVM_CPPFLAGS@/$(subst /,\/,$(SUB_CPPFLAGS))/' \
|
|
|
|
>> temp.sed
|
2009-03-11 03:01:23 +08:00
|
|
|
$(Verb) $(ECHO) 's/@LLVM_CFLAGS@/$(subst /,\/,$(SUB_CFLAGS))/' \
|
|
|
|
>> temp.sed
|
|
|
|
$(Verb) $(ECHO) 's/@LLVM_CXXFLAGS@/$(subst /,\/,$(SUB_CXXFLAGS))/' \
|
|
|
|
>> temp.sed
|
|
|
|
$(Verb) $(ECHO) 's/@LLVM_LDFLAGS@/$(subst /,\/,$(SUB_LDFLAGS))/' \
|
|
|
|
>> temp.sed
|
|
|
|
$(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
|
|
|
|
>> temp.sed
|
2013-12-16 21:09:06 +08:00
|
|
|
$(Verb) $(ECHO) 's/@LLVM_SYSTEM_LIBS@/$(subst /,\/,$(LLVM_SYSTEM_LIBS))/' \
|
2011-10-28 09:02:16 +08:00
|
|
|
>> temp.sed
|
2011-12-16 08:04:43 +08:00
|
|
|
$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
|
|
|
|
>> temp.sed
|
2006-04-21 04:53:23 +08:00
|
|
|
$(Verb) $(SED) -f temp.sed < $< > $@
|
|
|
|
$(Verb) $(RM) temp.sed
|
2012-05-09 08:07:02 +08:00
|
|
|
|
|
|
|
# When cross-compiling, install a version of llvm-config that runs on the host.
|
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
|
|
|
install:: $(DESTDIR)$(PROJ_bindir)
|
|
|
|
$(Echo) Installing llvm-config-host
|
|
|
|
$(Verb) $(ProgInstall) $(BuildLLVMToolDir)/llvm-config \
|
2012-10-02 02:40:32 +08:00
|
|
|
$(DESTDIR)$(PROJ_bindir)/$(program_prefix)llvm-config-host
|
2012-05-09 08:07:02 +08:00
|
|
|
endif
|