Update to llvm-config tool, by Erik Kidd:
[oota-llvm.git] / tools / llvm-config / Makefile
1 ##===- utils/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
10 LEVEL = ../..
11
12 EXTRA_DIST = LibDeps.txt llvm-config.in.in find-cycles.pl
13
14 include $(LEVEL)/Makefile.common
15
16 # Combine preprocessor flags (except for -I) and CXX flags.
17 SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
18
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.
22 SUB_LDFLAGS = 
23
24 # MANUAL USE ONLY!  GenLibDeps.pl is very non-portable, so LibDeps.txt
25 # should only be re-built manually.  No other rule in this file should
26 # depend on LibDeps.txt.
27 LibDeps.txt: $(LEVEL)/utils/GenLibDeps.pl $(LibDir)
28         $(Echo) "Regenerating LibDeps.txt"
29         $(Verb) $(LLVM_SRC_ROOT)/utils/GenLibDeps.pl -flat $(LibDir) | \
30           sort > LibDeps.txt
31
32 # Find all the cyclic dependencies between various LLVM libraries, so we
33 # don't have to process them at runtime.
34 FinalLibDeps.txt: find-cycles.pl # LibDeps.txt deliberately omitted.
35         $(Echo) "Finding cyclic dependencies between LLVM libraries."
36         $(Verb) $(PERL) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@
37
38 # Rerun our configure substitutions as needed.
39 llvm-config.in: llvm-config.in.in $(ConfigStatusScript)
40         $(Verb) cd $(PROJ_OBJ_ROOT) ; \
41                 $(ConfigStatusScript) utils/llvm-config/llvm-config.in
42
43 # Build our final script.
44 llvm-config: llvm-config.in FinalLibDeps.txt
45         $(Echo) "Building llvm-config script."
46         $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' > temp.sed
47         $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed
48         $(Verb) $(ECHO) 's,@CORE_IS_ARCHIVE@,$(CORE_IS_ARCHIVE),' >> temp.sed
49         $(Verb) $(SED) -f temp.sed < $< > $@
50         $(Verb) $(RM) temp.sed
51         $(Verb) cat FinalLibDeps.txt >> $@
52         $(Verb) chmod +x llvm-config
53
54 # Hook into the standard Makefile rules.
55 all-local:: llvm-config
56 clean-local::
57         $(Verb) $(RM) -f FinalLibDeps.txt llvm-config llvm-config.in
58 install-local:: all-local
59         $(Echo) Installing llvm-config
60         $(Verb) $(MKDIR) $(PROJ_bindir)
61         $(Verb) $(ScriptInstall) llvm-config $(PROJ_bindir)