Makefile revision d7fc4f6f7e16a1b214bb8f7f1fb2baa8a1a51a4b
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_CFLAGS = ${CPP.BaseFlags} ${C.Flags} 24SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags} 25 26# This is blank for now. We need to be careful about adding stuff here: 27# LDFLAGS tend not to be portable, and we don't currently require the 28# user to use libtool when linking against LLVM. 29SUB_LDFLAGS = 30 31FinalLibDeps = $(PROJ_OBJ_DIR)/FinalLibDeps.txt 32LibDeps = $(PROJ_OBJ_DIR)/LibDeps.txt 33LibDepsTemp = $(PROJ_OBJ_DIR)/LibDeps.txt.tmp 34GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl 35 36$(LibDepsTemp): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o) 37 $(Echo) "Regenerating LibDeps.txt.tmp" 38 $(Verb) $(PERL) $(GenLibDeps) -flat $(LibDir) $(NM_PATH) > $(LibDepsTemp) 39 40$(LibDeps): $(LibDepsTemp) 41 $(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \ 42 $(EchoCmd) Updated LibDeps.txt because dependencies changed ) 43 44# Find all the cyclic dependencies between various LLVM libraries, so we 45# don't have to process them at runtime. 46$(FinalLibDeps): find-cycles.pl $(LibDeps) 47 $(Echo) "Checking for cyclic dependencies between LLVM libraries." 48 $(Verb) $(PERL) $< < $(LibDeps) > $@ || rm -f $@ 49 50# Rerun our configure substitutions as needed. 51ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in 52llvm-config.in: $(ConfigInIn) $(ConfigStatusScript) 53 $(Verb) cd $(PROJ_OBJ_ROOT) ; \ 54 $(ConfigStatusScript) tools/llvm-config/llvm-config.in 55 56# Build our final script. 57$(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps) 58 $(Echo) "Building llvm-config script." 59 $(Verb) $(ECHO) 's,@LLVM_CFLAGS@,$(SUB_CFLAGS),' > temp.sed 60 $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' >> temp.sed 61 $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed 62 $(Verb) $(ECHO) 's,@LLVM_BUILDMODE@,$(BuildMode),' >> temp.sed 63 $(Verb) $(SED) -f temp.sed < $< > $@ 64 $(Verb) $(RM) temp.sed 65 $(Verb) cat $(FinalLibDeps) >> $@ 66 $(Verb) chmod +x $@ 67 68else 69# We don't have perl, just generate a dummy llvm-config 70$(ToolDir)/llvm-config: 71 $(Echo) "Building place holder llvm-config script." 72 $(Verb) $(ECHO) 'echo llvm-config: Perl not found so llvm-config could not be generated' >> $@ 73 $(Verb) chmod +x $@ 74 75endif 76# Hook into the standard Makefile rules. 77all-local:: $(ToolDir)/llvm-config 78clean-local:: 79 $(Verb) $(RM) -f $(ToolDir)/llvm-config llvm-config.in $(FinalLibDeps) \ 80 $(LibDeps) GenLibDeps.out 81install-local:: all-local 82 $(Echo) Installing llvm-config 83 $(Verb) $(MKDIR) $(PROJ_bindir) 84 $(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(PROJ_bindir) 85 86