Makefile revision de9c02b171760b9514392c9965541bdc81e3c898
1##===- tools/llvm-config/Makefile --------------------------*- Makefile -*-===## 2# 3# The LLVM Compiler Infrastructure 4# 5# This file was developed by Reid Spencer and Eric Kidd and is distributed under 6# the University of Illinois Open Source License. See LICENSE.TXT for details. 7# 8##===----------------------------------------------------------------------===## 9 10LEVEL = ../.. 11 12EXTRA_DIST = LibDeps.txt FinalLibDeps.txt llvm-config.in.in find-cycles.pl 13REQUIRES_EH := 1 14 15include $(LEVEL)/Makefile.common 16 17# If we don't have Perl, we can't generate the library dependencies upon which 18# llvm-config depends. Therefore, only if we detect perl will we do anything 19# useful. 20ifeq ($(HAVE_PERL),1) 21 22# Combine preprocessor flags (except for -I) and CXX flags. 23SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags} 24 25# This is blank for now. We need to be careful about adding stuff here: 26# LDFLAGS tend not to be portable, and we don't currently require the 27# user to use libtool when linking against LLVM. 28SUB_LDFLAGS = 29 30FinalLibDeps = $(PROJ_OBJ_DIR)/FinalLibDeps.txt 31LibDeps = $(PROJ_OBJ_DIR)/LibDeps.txt 32GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl 33 34$(LibDeps): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o) 35 $(Echo) "Regenerating LibDeps.txt" 36 $(Verb) $(GenLibDeps) -flat $(LibDir) $(NM_PATH) 37 38# Find all the cyclic dependencies between various LLVM libraries, so we 39# don't have to process them at runtime. 40$(FinalLibDeps): find-cycles.pl $(LibDeps) 41 $(Echo) "Finding cyclic dependencies between LLVM libraries." 42 $(Verb) $(PERL) $< < $(LibDeps) > $@ 43 44# Rerun our configure substitutions as needed. 45ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in 46llvm-config.in: $(ConfigInIn) $(ConfigStatusScript) 47 $(Verb) cd $(PROJ_OBJ_ROOT) ; \ 48 $(ConfigStatusScript) tools/llvm-config/llvm-config.in 49 50# Build our final script. 51$(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps) 52 $(Echo) "Building llvm-config script." 53 $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' > temp.sed 54 $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed 55 $(Verb) $(ECHO) 's,@LLVM_BUILDMODE@,$(BuildMode),' >> temp.sed 56 $(Verb) $(SED) -f temp.sed < $< > $@ 57 $(Verb) $(RM) temp.sed 58 $(Verb) cat $(FinalLibDeps) >> $@ 59 $(Verb) chmod +x $@ 60 61else 62# We don't have perl, just generate a dummy llvm-config 63$(ToolDir)/llvm-config: 64 $(Echo) "Building place holder llvm-config script." 65 $(Verb) $(ECHO) 'echo llvm-config: Perl not found so llvm-config could not be generated' >> $@ 66 $(Verb) chmod +x $@ 67 68endif 69# Hook into the standard Makefile rules. 70all-local:: $(ToolDir)/llvm-config 71clean-local:: 72 $(Verb) $(RM) -f $(ToolDir)/llvm-config llvm-config.in $(FinalLibDeps) \ 73 $(LibDeps) GenLibDeps.out 74install-local:: all-local 75 $(Echo) Installing llvm-config 76 $(Verb) $(MKDIR) $(PROJ_bindir) 77 $(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(PROJ_bindir) 78 79