zpu: basic block iterator in place
[llvm/zpu.git] / tools / llvm-config / Makefile
blobc7f7b3234d64b6633f3ae2c6c2b8cabbc6e01dbf
1 ##===- tools/llvm-config/Makefile --------------------------*- Makefile -*-===##
3 # The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
7 #
8 ##===----------------------------------------------------------------------===##
10 LEVEL = ../..
12 EXTRA_DIST = LibDeps.txt FinalLibDeps.txt llvm-config.in.in find-cycles.pl
14 include $(LEVEL)/Makefile.common
16 # If we don't have Perl, we can't generate the library dependencies upon which
17 # llvm-config depends. Therefore, only if we detect perl will we do anything
18 # useful.
19 ifeq ($(HAVE_PERL),1)
21 # Combine preprocessor flags (except for -I) and CXX flags.
22 SUB_CPPFLAGS = ${CPP.BaseFlags}
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 llvm-config-perobj: llvm-config.in $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a)
57 $(Echo) "Generating llvm-config-perobj"
58 $(Verb) $(PERL) $(GenLibDeps) -perobj -flat $(LibDir) "$(NM_PATH)" >PerobjDeps.txt
59 $(Echo) "Checking for cyclic dependencies between LLVM objects."
60 $(Verb) $(PERL) $(PROJ_SRC_DIR)/find-cycles.pl < PerobjDepsIncl.txt > PerobjDepsInclFinal.txt || rm -f $@
61 $(Verb) $(ECHO) 's/@LLVM_CPPFLAGS@/$(subst /,\/,$(SUB_CPPFLAGS))/' \
62 > temp.sed
63 $(Verb) $(ECHO) 's/@LLVM_CFLAGS@/$(subst /,\/,$(SUB_CFLAGS))/' \
64 >> temp.sed
65 $(Verb) $(ECHO) 's/@LLVM_CXXFLAGS@/$(subst /,\/,$(SUB_CXXFLAGS))/' \
66 >> temp.sed
67 $(Verb) $(ECHO) 's/@LLVM_LDFLAGS@/$(subst /,\/,$(SUB_LDFLAGS))/' \
68 >> temp.sed
69 $(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
70 >> temp.sed
71 $(Verb) $(SED) -f temp.sed < $< > $@
72 $(Verb) $(RM) temp.sed
73 $(Verb) cat PerobjDepsFinal.txt >> $@
74 $(Verb) chmod +x $@
76 llvm-config-perobjincl: llvm-config.in $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a)
77 $(Echo) "Generating llvm-config-perobjincl"
78 $(Verb) $(PERL) $(GenLibDeps) -perobj -perobjincl -flat $(LibDir) "$(NM_PATH)" >PerobjDepsIncl.txt
79 $(Echo) "Checking for cyclic dependencies between LLVM objects."
80 $(Verb) $(PERL) $(PROJ_SRC_DIR)/find-cycles.pl < PerobjDepsIncl.txt > PerobjDepsInclFinal.txt
81 $(Verb) $(ECHO) 's/@LLVM_CPPFLAGS@/$(subst /,\/,$(SUB_CPPFLAGS))/' \
82 > temp.sed
83 $(Verb) $(ECHO) 's/@LLVM_CFLAGS@/$(subst /,\/,$(SUB_CFLAGS))/' \
84 >> temp.sed
85 $(Verb) $(ECHO) 's/@LLVM_CXXFLAGS@/$(subst /,\/,$(SUB_CXXFLAGS))/' \
86 >> temp.sed
87 $(Verb) $(ECHO) 's/@LLVM_LDFLAGS@/$(subst /,\/,$(SUB_LDFLAGS))/' \
88 >> temp.sed
89 $(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
90 >> temp.sed
91 $(Verb) $(SED) -f temp.sed < $< > $@
92 $(Verb) $(RM) temp.sed
93 $(Verb) cat PerobjDepsInclFinal.txt >> $@
94 $(Verb) chmod +x $@
96 # Build our final script.
97 $(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps)
98 $(Echo) "Building llvm-config script."
99 $(Verb) $(ECHO) 's/@LLVM_CPPFLAGS@/$(subst /,\/,$(SUB_CPPFLAGS))/' \
100 > temp.sed
101 $(Verb) $(ECHO) 's/@LLVM_CFLAGS@/$(subst /,\/,$(SUB_CFLAGS))/' \
102 >> temp.sed
103 $(Verb) $(ECHO) 's/@LLVM_CXXFLAGS@/$(subst /,\/,$(SUB_CXXFLAGS))/' \
104 >> temp.sed
105 $(Verb) $(ECHO) 's/@LLVM_LDFLAGS@/$(subst /,\/,$(SUB_LDFLAGS))/' \
106 >> temp.sed
107 $(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
108 >> temp.sed
109 $(Verb) $(SED) -f temp.sed < $< > $@
110 $(Verb) $(RM) temp.sed
111 $(Verb) cat $(FinalLibDeps) >> $@
112 $(Verb) chmod +x $@
114 else
115 # We don't have perl, just generate a dummy llvm-config
116 $(ToolDir)/llvm-config:
117 $(Echo) "Building place holder llvm-config script."
118 $(Verb) $(ECHO) 'echo llvm-config: Perl not found so llvm-config could not be generated' >> $@
119 $(Verb) chmod +x $@
121 endif
122 # Hook into the standard Makefile rules.
123 all-local:: $(ToolDir)/llvm-config
124 clean-local::
125 $(Verb) $(RM) -f $(ToolDir)/llvm-config llvm-config.in $(FinalLibDeps) \
126 $(LibDeps) GenLibDeps.out
127 install-local:: all-local
128 $(Echo) Installing llvm-config
129 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_bindir)
130 $(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(DESTDIR)$(PROJ_bindir)