X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fllvm-config%2FMakefile;h=de89d290353a1406d51540a17efae3fc6a28bac4;hb=73b43b9b549a75fb0015c825df68abd95705a67c;hp=81a01034c9de7deb46d22ffab2c6de9fddcbd398;hpb=05dee5064f691d6e1f5c141a7b9862fa345dcb54;p=oota-llvm.git diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile index 81a01034c9d..de89d290353 100644 --- a/tools/llvm-config/Makefile +++ b/tools/llvm-config/Makefile @@ -2,18 +2,26 @@ # # The LLVM Compiler Infrastructure # -# This file was developed by Reid Spencer and Eric Kidd and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## LEVEL = ../.. -EXTRA_DIST = LibDeps.txt llvm-config.in.in find-cycles.pl +EXTRA_DIST = LibDeps.txt FinalLibDeps.txt llvm-config.in.in find-cycles.pl +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common +# 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) + # Combine preprocessor flags (except for -I) and CXX flags. +SUB_CPPFLAGS = ${CPP.BaseFlags} +SUB_CFLAGS = ${CPP.BaseFlags} ${C.Flags} SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags} # This is blank for now. We need to be careful about adding stuff here: @@ -21,25 +29,24 @@ SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags} # user to use libtool when linking against LLVM. SUB_LDFLAGS = -FinalLibDeps = $(PROJ_SRC_DIR)/FinalLibDeps.txt -ifdef HAVE_PERL -ifeq ($(HAVE_PERL),1) -LibDeps = $(PROJ_SRC_DIR)/LibDeps.txt -GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl -# MANUAL USE ONLY! GenLibDeps.pl is very non-portable, so LibDeps.txt -# should only be re-built manually. No other rule in this file should -# depend on LibDeps.txt. -$(LibDeps): $(GenLibDeps) $(LibDir) - $(Echo) "Regenerating LibDeps.txt" - $(Verb) $(GenLibDeps) -flat $(LibDir) | sort > $(LibDeps) +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) "Finding cyclic dependencies between LLVM libraries." - $(Verb) $(PERL) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@ -endif -endif + $(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 @@ -48,21 +55,33 @@ llvm-config.in: $(ConfigInIn) $(ConfigStatusScript) $(ConfigStatusScript) tools/llvm-config/llvm-config.in # Build our final script. -llvm-config: llvm-config.in $(FinalLibDeps) +$(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps) $(Echo) "Building llvm-config script." - $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' > temp.sed + $(Verb) $(ECHO) 's,@LLVM_CPPFLAGS@,$(SUB_CPPFLAGS),' > temp.sed + $(Verb) $(ECHO) 's,@LLVM_CFLAGS@,$(SUB_CFLAGS),' >> temp.sed + $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' >> temp.sed $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed - $(Verb) $(ECHO) 's,@CORE_IS_ARCHIVE@,$(CORE_IS_ARCHIVE),' >> temp.sed + $(Verb) $(ECHO) 's,@LLVM_BUILDMODE@,$(BuildMode),' >> temp.sed $(Verb) $(SED) -f temp.sed < $< > $@ $(Verb) $(RM) temp.sed $(Verb) cat $(FinalLibDeps) >> $@ - $(Verb) chmod +x llvm-config + $(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:: llvm-config +all-local:: $(ToolDir)/llvm-config clean-local:: - $(Verb) $(RM) -f llvm-config llvm-config.in + $(Verb) $(RM) -f $(ToolDir)/llvm-config llvm-config.in $(FinalLibDeps) \ + $(LibDeps) GenLibDeps.out install-local:: all-local $(Echo) Installing llvm-config $(Verb) $(MKDIR) $(PROJ_bindir) - $(Verb) $(ScriptInstall) llvm-config $(PROJ_bindir) + $(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(PROJ_bindir) +