2006-04-20 23:13:58 +02:00
|
|
|
##===- tools/llvm-config/Makefile --------------------------*- Makefile -*-===##
|
2006-04-20 22:53:23 +02:00
|
|
|
#
|
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
2007-12-29 21:07:17 +01:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2006-04-20 22:53:23 +02:00
|
|
|
#
|
|
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
|
|
|
|
LEVEL = ../..
|
|
|
|
|
2006-05-03 19:49:50 +02:00
|
|
|
EXTRA_DIST = LibDeps.txt FinalLibDeps.txt llvm-config.in.in find-cycles.pl
|
2006-07-07 02:46:19 +02:00
|
|
|
REQUIRES_EH := 1
|
2006-04-20 22:53:23 +02:00
|
|
|
|
|
|
|
include $(LEVEL)/Makefile.common
|
|
|
|
|
2006-05-03 19:49:50 +02: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-04-20 22:53:23 +02:00
|
|
|
# Combine preprocessor flags (except for -I) and CXX flags.
|
2007-07-10 09:21:34 +02:00
|
|
|
SUB_CPPFLAGS = ${CPP.BaseFlags}
|
|
|
|
SUB_CFLAGS = ${CPP.BaseFlags} ${C.Flags}
|
2006-04-20 22:53:23 +02:00
|
|
|
SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
SUB_LDFLAGS =
|
|
|
|
|
2006-05-03 19:49:50 +02:00
|
|
|
FinalLibDeps = $(PROJ_OBJ_DIR)/FinalLibDeps.txt
|
2006-06-06 19:43:03 +02:00
|
|
|
LibDeps = $(PROJ_OBJ_DIR)/LibDeps.txt
|
2006-12-12 01:43:38 +01:00
|
|
|
LibDepsTemp = $(PROJ_OBJ_DIR)/LibDeps.txt.tmp
|
2006-06-06 19:43:03 +02:00
|
|
|
GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl
|
|
|
|
|
2006-12-12 01:43:38 +01:00
|
|
|
$(LibDepsTemp): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o)
|
|
|
|
$(Echo) "Regenerating LibDeps.txt.tmp"
|
2007-11-27 18:53:54 +01:00
|
|
|
$(Verb) $(PERL) $(GenLibDeps) -flat $(LibDir) "$(NM_PATH)" > $(LibDepsTemp)
|
2006-12-12 01:43:38 +01:00
|
|
|
|
|
|
|
$(LibDeps): $(LibDepsTemp)
|
|
|
|
$(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \
|
2007-02-04 23:08:16 +01:00
|
|
|
$(EchoCmd) Updated LibDeps.txt because dependencies changed )
|
2006-04-20 22:53:23 +02:00
|
|
|
|
|
|
|
# Find all the cyclic dependencies between various LLVM libraries, so we
|
|
|
|
# don't have to process them at runtime.
|
2006-04-20 23:13:58 +02:00
|
|
|
$(FinalLibDeps): find-cycles.pl $(LibDeps)
|
2006-12-06 06:39:18 +01:00
|
|
|
$(Echo) "Checking for cyclic dependencies between LLVM libraries."
|
2006-09-04 03:49:10 +02:00
|
|
|
$(Verb) $(PERL) $< < $(LibDeps) > $@ || rm -f $@
|
2006-04-20 22:53:23 +02:00
|
|
|
|
|
|
|
# Rerun our configure substitutions as needed.
|
2006-04-20 23:13:58 +02:00
|
|
|
ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in
|
|
|
|
llvm-config.in: $(ConfigInIn) $(ConfigStatusScript)
|
2006-04-20 22:53:23 +02:00
|
|
|
$(Verb) cd $(PROJ_OBJ_ROOT) ; \
|
2006-04-20 23:13:58 +02:00
|
|
|
$(ConfigStatusScript) tools/llvm-config/llvm-config.in
|
2006-04-20 22:53:23 +02:00
|
|
|
|
|
|
|
# Build our final script.
|
2006-06-01 03:52:49 +02:00
|
|
|
$(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps)
|
2006-04-20 22:53:23 +02:00
|
|
|
$(Echo) "Building llvm-config script."
|
2009-03-10 20:01:23 +01:00
|
|
|
$(Verb) $(ECHO) 's/@LLVM_CPPFLAGS@/$(subst /,\/,$(SUB_CPPFLAGS))/' \
|
|
|
|
> temp.sed
|
|
|
|
$(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
|
2006-04-20 22:53:23 +02:00
|
|
|
$(Verb) $(SED) -f temp.sed < $< > $@
|
|
|
|
$(Verb) $(RM) temp.sed
|
2006-04-20 23:13:58 +02:00
|
|
|
$(Verb) cat $(FinalLibDeps) >> $@
|
2006-05-03 19:49:50 +02:00
|
|
|
$(Verb) chmod +x $@
|
|
|
|
|
|
|
|
else
|
|
|
|
# We don't have perl, just generate a dummy llvm-config
|
2006-06-01 03:52:49 +02:00
|
|
|
$(ToolDir)/llvm-config:
|
2006-05-03 19:49:50 +02:00
|
|
|
$(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 $@
|
2006-04-20 22:53:23 +02:00
|
|
|
|
2006-05-03 19:49:50 +02:00
|
|
|
endif
|
2006-04-20 22:53:23 +02:00
|
|
|
# Hook into the standard Makefile rules.
|
2006-06-01 03:52:49 +02:00
|
|
|
all-local:: $(ToolDir)/llvm-config
|
2006-04-20 22:53:23 +02:00
|
|
|
clean-local::
|
2006-06-01 03:52:49 +02:00
|
|
|
$(Verb) $(RM) -f $(ToolDir)/llvm-config llvm-config.in $(FinalLibDeps) \
|
|
|
|
$(LibDeps) GenLibDeps.out
|
2006-04-20 22:53:23 +02:00
|
|
|
install-local:: all-local
|
|
|
|
$(Echo) Installing llvm-config
|
|
|
|
$(Verb) $(MKDIR) $(PROJ_bindir)
|
2006-06-01 03:52:49 +02:00
|
|
|
$(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(PROJ_bindir)
|
2006-05-03 19:49:50 +02:00
|
|
|
|