Codegen support (stripped out) for the annotate attribute.
[llvm-complete.git] / tools / llvm-config / Makefile
blob471b5bcbd5ac1a3cfc288661dbb3d5e5346f0796
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.
7 #
8 ##===----------------------------------------------------------------------===##
10 LEVEL = ../..
12 EXTRA_DIST = LibDeps.txt FinalLibDeps.txt llvm-config.in.in find-cycles.pl
13 REQUIRES_EH := 1
15 include $(LEVEL)/Makefile.common
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.
20 ifeq ($(HAVE_PERL),1)
22 # Combine preprocessor flags (except for -I) and CXX flags.
23 SUB_CFLAGS = ${CPP.BaseFlags} ${C.Flags}
24 SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
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.
29 SUB_LDFLAGS =
31 FinalLibDeps = $(PROJ_OBJ_DIR)/FinalLibDeps.txt
32 LibDeps = $(PROJ_OBJ_DIR)/LibDeps.txt
33 LibDepsTemp = $(PROJ_OBJ_DIR)/LibDeps.txt.tmp
34 GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl
36 $(LibDepsTemp): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o)
37 $(Echo) "Regenerating LibDeps.txt.tmp"
38 $(Verb) $(PERL) $(GenLibDeps) -flat $(LibDir) $(NM_PATH) > $(LibDepsTemp)
40 $(LibDeps): $(LibDepsTemp)
41 $(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \
42 $(EchoCmd) Updated LibDeps.txt because dependencies changed )
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 $@
50 # Rerun our configure substitutions as needed.
51 ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in
52 llvm-config.in: $(ConfigInIn) $(ConfigStatusScript)
53 $(Verb) cd $(PROJ_OBJ_ROOT) ; \
54 $(ConfigStatusScript) tools/llvm-config/llvm-config.in
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 $@
68 else
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 $@
75 endif
76 # Hook into the standard Makefile rules.
77 all-local:: $(ToolDir)/llvm-config
78 clean-local::
79 $(Verb) $(RM) -f $(ToolDir)/llvm-config llvm-config.in $(FinalLibDeps) \
80 $(LibDeps) GenLibDeps.out
81 install-local:: all-local
82 $(Echo) Installing llvm-config
83 $(Verb) $(MKDIR) $(PROJ_bindir)
84 $(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(PROJ_bindir)