1 ##===- tools/llvm-config/Makefile --------------------------*- Makefile -*-===##
3 # The LLVM Compiler Infrastructure
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.
8 ##===----------------------------------------------------------------------===##
12 EXTRA_DIST = LibDeps.txt llvm-config.in.in find-cycles.pl
14 include $(LEVEL)/Makefile.common
16 # Combine preprocessor flags (except for -I) and CXX flags.
17 SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
19 # This is blank for now. We need to be careful about adding stuff here:
20 # LDFLAGS tend not to be portable, and we don't currently require the
21 # user to use libtool when linking against LLVM.
24 FinalLibDeps = $(PROJ_SRC_DIR)/FinalLibDeps.txt
27 LibDeps = $(PROJ_SRC_DIR)/LibDeps.txt
28 GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl
29 # MANUAL USE ONLY! GenLibDeps.pl is very non-portable, so LibDeps.txt
30 # should only be re-built manually. No other rule in this file should
31 # depend on LibDeps.txt.
32 $(LibDeps): $(GenLibDeps) $(LibDir)
33 $(Echo) "Regenerating LibDeps.txt"
34 $(Verb) $(GenLibDeps) -flat $(LibDir) | sort > $(LibDeps)
36 # Find all the cyclic dependencies between various LLVM libraries, so we
37 # don't have to process them at runtime.
38 $(FinalLibDeps): find-cycles.pl $(LibDeps)
39 $(Echo) "Finding cyclic dependencies between LLVM libraries."
40 $(Verb) $(PERL) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@
44 # Rerun our configure substitutions as needed.
45 ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in
46 llvm-config.in: $(ConfigInIn) $(ConfigStatusScript)
47 $(Verb) cd $(PROJ_OBJ_ROOT) ; \
48 $(ConfigStatusScript) tools/llvm-config/llvm-config.in
50 # Build our final script.
51 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,@CORE_IS_ARCHIVE@,$(CORE_IS_ARCHIVE),' >> temp.sed
56 $(Verb) $(SED) -f temp.sed < $< > $@
57 $(Verb) $(RM) temp.sed
58 $(Verb) cat $(FinalLibDeps) >> $@
59 $(Verb) chmod +x llvm-config
61 # Hook into the standard Makefile rules.
62 all-local:: llvm-config
64 $(Verb) $(RM) -f llvm-config llvm-config.in
65 install-local:: all-local
66 $(Echo) Installing llvm-config
67 $(Verb) $(MKDIR) $(PROJ_bindir)
68 $(Verb) $(ScriptInstall) llvm-config $(PROJ_bindir)