2011-11-10 19:59:35 +00:00
|
|
|
##===- tools/llvm-config/Makefile --------------------------*- Makefile -*-===##
|
|
|
|
#
|
2006-03-19 22:10:53 +00:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
2007-12-29 20:07:17 +00:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2006-03-19 22:10:53 +00:00
|
|
|
#
|
|
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
|
2011-11-10 19:59:35 +00:00
|
|
|
LEVEL = ../..
|
2006-03-19 22:10:53 +00:00
|
|
|
|
2011-11-10 19:59:35 +00:00
|
|
|
EXTRA_DIST = LibDeps.txt FinalLibDeps.txt llvm-config.in.in find-cycles.pl
|
2011-11-10 18:49:59 +00:00
|
|
|
|
|
|
|
include $(LEVEL)/Makefile.common
|
2006-05-03 17:49:50 +00:00
|
|
|
|
2011-11-10 19:59:35 +00:00
|
|
|
# If we don't have Perl, we can't generate the library dependencies upon which
|
|
|
|
# llvm-config depends. Therefore, only if we detect perl will we do anything
|
|
|
|
# useful.
|
|
|
|
ifeq ($(HAVE_PERL),1)
|
|
|
|
|
2006-03-22 15:59:55 +00:00
|
|
|
# Combine preprocessor flags (except for -I) and CXX flags.
|
2011-11-10 19:59:35 +00:00
|
|
|
SUB_CPPFLAGS = ${CPP.BaseFlags}
|
|
|
|
SUB_CFLAGS = ${CPP.BaseFlags} ${C.Flags}
|
|
|
|
SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
|
2006-03-22 15:59:55 +00: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-11-10 19:59:35 +00:00
|
|
|
SUB_LDFLAGS =
|
2006-03-22 15:59:55 +00:00
|
|
|
|
2011-11-10 19:59:35 +00:00
|
|
|
FinalLibDeps = $(PROJ_OBJ_DIR)/FinalLibDeps.txt
|
|
|
|
LibDeps = $(PROJ_OBJ_DIR)/LibDeps.txt
|
|
|
|
LibDepsTemp = $(PROJ_OBJ_DIR)/LibDeps.txt.tmp
|
|
|
|
GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl
|
|
|
|
|
|
|
|
$(LibDepsTemp): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o)
|
|
|
|
$(Echo) "Regenerating LibDeps.txt.tmp"
|
|
|
|
$(Verb) $(PERL) $(GenLibDeps) -flat $(LibDir) "$(NM_PATH)" > $(LibDepsTemp)
|
|
|
|
|
|
|
|
$(LibDeps): $(LibDepsTemp)
|
|
|
|
$(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \
|
|
|
|
$(EchoCmd) Updated LibDeps.txt because dependencies changed )
|
|
|
|
|
|
|
|
# Find all the cyclic dependencies between various LLVM libraries, so we
|
|
|
|
# don't have to process them at runtime.
|
|
|
|
$(FinalLibDeps): find-cycles.pl $(LibDeps)
|
|
|
|
$(Echo) "Checking for cyclic dependencies between LLVM libraries."
|
|
|
|
$(Verb) $(PERL) $< < $(LibDeps) > $@ || rm -f $@
|
|
|
|
|
|
|
|
# Rerun our configure substitutions as needed.
|
|
|
|
ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in
|
|
|
|
llvm-config.in: $(ConfigInIn) $(ConfigStatusScript)
|
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; \
|
|
|
|
$(ConfigStatusScript) tools/llvm-config/llvm-config.in
|
|
|
|
|
|
|
|
# Build our final script.
|
|
|
|
$(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps)
|
|
|
|
$(Echo) "Building llvm-config script."
|
2011-11-10 18:49:59 +00:00
|
|
|
$(Verb) $(ECHO) 's/@LLVM_CPPFLAGS@/$(subst /,\/,$(SUB_CPPFLAGS))/' \
|
2011-11-10 19:59:35 +00:00
|
|
|
> temp.sed
|
2009-03-10 19:01:23 +00: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
|
2011-11-10 19:59:35 +00:00
|
|
|
$(Verb) $(ECHO) 's/@LLVM_OBJ_SUFFIX@/$(subst /,\/,/$(BuildMode))/' \
|
2011-10-28 01:02:16 +00:00
|
|
|
>> temp.sed
|
2006-03-22 15:59:55 +00:00
|
|
|
$(Verb) $(SED) -f temp.sed < $< > $@
|
|
|
|
$(Verb) $(RM) temp.sed
|
2011-11-10 19:59:35 +00:00
|
|
|
$(Verb) cat $(FinalLibDeps) >> $@
|
|
|
|
$(Verb) chmod +x $@
|
|
|
|
|
|
|
|
else
|
|
|
|
# We don't have perl, just generate a dummy llvm-config
|
|
|
|
$(ToolDir)/llvm-config:
|
|
|
|
$(Echo) "Building place holder llvm-config script."
|
|
|
|
$(Verb) $(ECHO) 'echo llvm-config: Perl not found so llvm-config could not be generated' >> $@
|
|
|
|
$(Verb) chmod +x $@
|
|
|
|
|
|
|
|
endif
|
|
|
|
# Hook into the standard Makefile rules.
|
|
|
|
all-local:: $(ToolDir)/llvm-config
|
|
|
|
clean-local::
|
|
|
|
$(Verb) $(RM) -f $(ToolDir)/llvm-config llvm-config.in $(FinalLibDeps) \
|
|
|
|
$(LibDeps) GenLibDeps.out
|
|
|
|
install-local:: all-local
|
|
|
|
$(Echo) Installing llvm-config
|
|
|
|
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_bindir)
|
|
|
|
$(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(DESTDIR)$(PROJ_bindir)
|
|
|
|
|