llvm.org GIT mirror llvm / cc2d1e2
Internalize variable names to prevent recursive assignment. Cleanup docs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17359 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 14 years ago
9 changed file(s) with 611 addition(s) and 530 deletion(s). Raw diff Collapse all Expand all
1919 include $(LEVEL)/Makefile.common
2020
2121 dist-hook::
22 @$(ECHO) Eliminating CVS directories from distribution
23 $(VERB) rm -rf `find $(TopDistDir) -type d -name CVS -print`
24 @$(ECHO) Eliminating files constructed by configure
25 $(VERB) rm -f \
22 $(Echo) Eliminating CVS directories from distribution
23 $(Verb) $(RM) -rf `find $(TopDistDir) -type d -name CVS -print`
24 $(Echo) Eliminating files constructed by configure
25 $(Verb) $(RM) -f \
2626 $(TopDistDir)/include/llvm/ADT/hash_map \
2727 $(TopDistDir)/include/llvm/ADT/hash_set \
2828 $(TopDistDir)/include/llvm/ADT/iterator \
3030 $(TopDistDir)/include/llvm/Support/DataTypes.h \
3131 $(TopDistDir)/include/llvm/Support/ThreadSupport.h
3232
33 test :: all
34 cd test; $(MAKE)
33 check ::
34 cd test; $(MAKE)
3535
3636 tools-only: all
5353 RPWD = pwd
5454 SED = sed
5555 RM = rm
56 ECHO = echo "llvm["$(MAKELEVEL)"]:"
56 ECHO = echo
5757 MKDIR = @abs_top_srcdir@/autoconf/mkinstalldirs
5858 INSTALL_SH = $(BUILD_SRC_ROOT)/autoconf/install-sh
5959 DATE = date
1111 #
1212 #===-----------------------------------------------------------------------====
1313
14 #
14 ################################################################################
15 # TARGETS: Define standard targets that can be invoked
16 ################################################################################
17
18 #--------------------------------------------------------------------
19 # Define the various target sets
20 #--------------------------------------------------------------------
21 RecursiveTargets := all clean check install uninstall
22 LocalTargets := all-local clean-local check-local install-local printvars \
23 uninstall-local
24 TopLevelTargets := dist dist-check dist-clean tags dist-gzip dist-bzip2 \
25 dist-zip
26 UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
27 InternalTargets := preconditions distdir dist-hook
28
29 ################################################################################
30 # INITIALIZATION: Basic things the makefile needs
31 ################################################################################
32
33 #--------------------------------------------------------------------
1534 # Set the VPATH so that we can find source files.
16 #
35 #--------------------------------------------------------------------
1736 VPATH=$(BUILD_SRC_DIR)
1837
19 ###############################################################################
20 # TARGETS: Define standard targets that can be invoked
21 ###############################################################################
22
23 #--------------------------------------------------------------------
24 # Define the various target sets
25 #--------------------------------------------------------------------
26 RECURSIVE_TARGETS := all clean check install uninstall
27 LOCAL_TARGETS := all-local clean-local check-local install-local \
28 printvars uninstall-local
29 TOPLEV_TARGETS := dist dist-check dist-clean tags
30 USER_TARGETS := $(RECURSIVE_TARGETS) $(LOCAL_TARGETS) $(TOPLEV_TARGETS)
31 INTERNAL_TARGETS := preconditions
32
33 ###############################################################################
34 # INITIALIZATION: Basic things the makefile needs
35 ###############################################################################
36
3738 #--------------------------------------------------------------------
3839 # Reset the list of suffixes we know how to build
3940 #--------------------------------------------------------------------
4041 .SUFFIXES:
41 .SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a $(SHLIBEXT) .bc .td .ps .dot $(SUFFIXES)
42 .SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot
43 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
4244
4345 #--------------------------------------------------------------------
4446 # Mark all of these targets as phony to avoid implicit rule search
4547 #--------------------------------------------------------------------
46 .PHONY: $(USER_TARGETS) $(INTERNAL_TARGETS)
48 .PHONY: $(UserTargets) $(InternalTargets)
4749
4850 #--------------------------------------------------------------------
4951 # Make sure all the user-target rules are double colon rules and
5052 # they are defined first.
5153 #--------------------------------------------------------------------
5254
53 $(USER_TARGETS)::
55 $(UserTargets)::
5456
5557 ################################################################################
5658 # PRECONDITIONS: that which must be built/checked first
5759 ################################################################################
5860
59 SRCMKFILES := $(filter %Makefile %Makefile.rules %Makefile.tests \
60 %Makefile.JIT,$(wildcard $(BUILD_SRC_DIR)/Makefile*))
61 OBJMKFILES := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SRCMKFILES))
62 CONFIGURE := $(LLVM_SRC_ROOT)/configure
63 CONFIG_STATUS := $(LLVM_OBJ_ROOT)/config.status
64 MAKE_CONFIG_IN:= $(LLVM_SRC_ROOT)/Makefile.config.in
65 MAKE_CONFIG := $(LLVM_OBJ_ROOT)/Makefile.config
66 PRECONDITIONS := $(CONFIG_STATUS) $(MAKE_CONFIG) $(OBJMKFILES)
67
68 preconditions : $(PRECONDITIONS)
61 SrcMakefiles := $(filter %Makefile %Makefile.rules %Makefile.tests \
62 %Makefile.JIT,$(wildcard $(BUILD_SRC_DIR)/Makefile*))
63 ObjMakefiles := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SrcMakefiles))
64 ConfigureScript := $(LLVM_SRC_ROOT)/configure
65 ConfigStatusScript := $(LLVM_OBJ_ROOT)/config.status
66 MakefileConfigIn := $(LLVM_SRC_ROOT)/Makefile.config.in
67 MakefileConfig := $(LLVM_OBJ_ROOT)/Makefile.config
68 PreConditions := $(ConfigStatusScript) $(MakefileConfig) $(ObjMakefiles)
69
70 preconditions : $(PreConditions)
6971
7072 #------------------------------------------------------------------------
7173 # Make sure the BUILT_SOURCES are built first
7274 #------------------------------------------------------------------------
73 $(filter-out clean clean-local,USER_TARGETS):: $(BUILT_SOURCES)
75 $(filter-out clean clean-local,UserTargets):: $(BUILT_SOURCES)
7476
7577 clean-local::
7678 ifneq ($(strip $(BUILT_SOURCES)),)
77 $(VERB) $(RM) -f $(BUILT_SOURCES)
78 endif
79
80 $(BUILT_SOURCES) : $(BUILD_OBJ_ROOT)/Makefile
79 $(Verb) $(RM) -f $(BUILT_SOURCES)
80 endif
81
82 $(BUILT_SOURCES) : $(ObjMakefiles)
8183
8284 #------------------------------------------------------------------------
8385 # Make sure we're not using a stale configuration
8486 #------------------------------------------------------------------------
85 .PRECIOUS: $(CONFIG_STATUS)
86 $(CONFIG_STATUS): $(CONFIGURE)
87 @$(ECHO) Reconfiguring with $<
88 $(VERB) $(CONFIG_STATUS) --recheck $(CONFIGUREFLAGS)
89 $(VERB) $(CONFIG_STATUS)
87 .PRECIOUS: $(ConfigStatusScript)
88 $(ConfigStatusScript): $(ConfigureScript)
89 $(Echo) Reconfiguring with $<
90 $(Verb) $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS)
91 $(Verb) $(ConfigStatusScript)
9092
9193 #------------------------------------------------------------------------
9294 # Make sure the configuration makefile is up to date
9395 #------------------------------------------------------------------------
94 $(MAKE_CONFIG): $(MAKE_CONFIG_IN) $(CONFIG_STATUS)
95 @$(ECHO) Regenerating $@
96 $(VERB) cd $(LLVM_OBJ_ROOT) ; $(CONFIG_STATUS) Makefile.config
96 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
97 $(Echo) Regenerating $@
98 $(Verb) cd $(LLVM_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
9799
98100 #------------------------------------------------------------------------
99101 # If the Makefile in the source tree has been updated, copy it over into the
102104 ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR))
103105
104106 $(BUILD_OBJ_DIR)/Makefile : $(BUILD_SRC_DIR)/Makefile
105 @$(ECHO) "Updating Makefile"
106 $(VERB) $(MKDIR) $(@D)
107 $(VERB) cp -f $< $@
107 $(Echo) "Updating Makefile"
108 $(Verb) $(MKDIR) $(@D)
109 $(Verb) cp -f $< $@
108110
109111 # Copy the Makefile.* files unless we're in the root directory which avoids
110112 # the copying of Makefile.config.in or other things that should be explicitly
113115 @case '$?' in \
114116 *Makefile.rules) ;; \
115117 *.in) ;; \
116 *) $(ECHO) "Updating $(@F)" ; \
118 *) $(Echo) "Updating $(@F)" ; \
117119 $(MKDIR) $(@D) ; \
118120 cp -f $< $@ ;; \
119121 esac
123125 #------------------------------------------------------------------------
124126 # Set up the basic dependencies
125127 #------------------------------------------------------------------------
126 $(USER_TARGETS):: $(PRECONDITIONS)
128 $(UserTargets):: $(PreConditions)
127129
128130 all:: all-local
129131 check:: check-local
142144 #--------------------------------------------------------------------
143145
144146 ifdef ENABLE_PROFILING
145 CONFIGURATION := Profile
146 LLVMCXXFLAGS := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
147 LLVMCFLAGS := -O3 -DNDEBUG -pg
148 LLVMLDFLAGS := -O3 -DNDEBUG -pg
147 Configuration := Profile
148 CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
149 C.Flags := -O3 -DNDEBUG -pg
150 LD.Flags := -O3 -DNDEBUG -pg
149151 else
150152 ifdef ENABLE_OPTIMIZED
151 CONFIGURATION := Release
152 LLVMCXXFLAGS := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
153 LLVMCFLAGS := -O3 -DNDEBUG -fomit-frame-pointer
154 LLVMLDFLAGS := -O3 -DNDEBUG
153 Configuration := Release
154 CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
155 C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
156 LD.Flags := -O3 -DNDEBUG
155157 else
156 CONFIGURATION := Debug
157 LLVMCXXFLAGS := -g -D_DEBUG
158 LLVMCFLAGS := -g -D_DEBUG
159 LLVMLDFLAGS := -g -D_DEBUG
158 Configuration := Debug
159 CXX.Flags := -g -D_DEBUG
160 C.Flags := -g -D_DEBUG
161 LD.Flags := -g -D_DEBUG
160162 KEEP_SYMBOLS := 1
161163 endif
162164 endif
163165
164 LLVMCXXFLAGS += $(CXXFLAGS)
165 LLVMCFLAGS += $(CFLAGS)
166 LLVMCPPFLAGS += $(CPPFLAGS)
167 LLVMLDFLAGS += $(LDFLAGS)
168 LLVMARFLAGS := cru
166 CXX.Flags += $(CXXFLAGS)
167 C.Flags += $(CFLAGS)
168 CPP.Flags += $(CPPFLAGS)
169 LD.Flags += $(LDFLAGS)
170 AR.Flags := cru
171 LibTool.Flags := --tag=CXX
169172
170173 #--------------------------------------------------------------------
171174 # Directory locations
172175 #--------------------------------------------------------------------
173 OBJDIR := $(BUILD_OBJ_DIR)/$(CONFIGURATION)
174 LIBDIR := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION)
175 TOOLDIR := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)
176 LLVMLIBDIR := $(LLVM_OBJ_ROOT)/lib/$(CONFIGURATION)
177 LLVMTOOLDIR := $(LLVM_OBJ_ROOT)/tools/$(CONFIGURATION)
176 ObjDir := $(BUILD_OBJ_DIR)/$(Configuration)
177 LibDir := $(BUILD_OBJ_ROOT)/lib/$(Configuration)
178 ToolDir := $(BUILD_OBJ_ROOT)/tools/$(Configuration)
179 LLVMLibDir := $(LLVM_OBJ_ROOT)/lib/$(Configuration)
180 LLVMToolDir := $(LLVM_OBJ_ROOT)/tools/$(Configuration)
178181
179182 #--------------------------------------------------------------------
180183 # Full Paths To Compiled Tools and Utilities
181184 #--------------------------------------------------------------------
185 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
186 Echo := @$(EchoCmd)
187 ifndef LIBTOOL
182188 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
183 LLVMAS := $(LLVMTOOLDIR)/llvm-as$(EXEEXT)
184 BURG := $(LLVMTOOLDIR)/burg$(EXEEXT)
185 TBLGEN := $(LLVMTOOLDIR)/tblgen$(EXEEXT)
186 GCCLD := $(LLVMTOOLDIR)/gccld$(EXEEXT)
187 LLVMGCC := PATH=$(LLVMTOOLDIR):$(PATH) $(LLVMGCCDIR)/bin/gcc
188 LLVMGXX := PATH=$(LLVMTOOLDIR):$(PATH) $(LLVMGCCDIR)/bin/g++
189 endif
190 ifndef LLVMAS
191 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
192 endif
193 ifndef BURG
194 BURG := $(LLVMToolDir)/burg$(EXEEXT)
195 endif
196 ifndef TBLGEN
197 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
198 endif
199 ifndef GCCLD
200 GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
201 endif
202 ifndef LLVMGCC
203 LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
204 endif
205 ifndef LLVMGXX
206 LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
207 endif
189208
190209 # Need a better way to compute this.
191 LLVMGCCLIBDIR := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
210 LLVMGCCLibDir := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
192211
193212 #--------------------------------------------------------------------
194213 # Adjust to user's request
195214 #--------------------------------------------------------------------
196215
197 # Adjust LIBTOOL options for shared libraries, or not.
216 # Adjust LIBTOOL flags for shared libraries, or not.
198217 ifndef SHARED_LIBRARY
199 LIBTOOL += --tag=disable-shared
218 LibTool.Flags += --tag=disable-shared
200219 else
201 LLVMLDFLAGS += -rpath $(LIBDIR)
220 LD.Flags += -rpath $(LibDir)
202221 endif
203222
204223 # Adjust settings for verbose mode
205224 ifndef VERBOSE
206 VERB := @
207 LIBTOOL += --silent
208 AR += >/dev/null 2>/dev/null
209 CONFIGUREFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
225 Verb := @
226 LibTool.Flags += --silent
227 AR.Flags += >/dev/null 2>/dev/null
228 ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
210229 else
211 CONFIGUREFLAGS :=
230 ConfigureScriptFLAGS :=
212231 endif
213232
214233 # By default, strip symbol information from executable
215234 ifndef KEEP_SYMBOLS
216 STRIP = $(PLATFORMSTRIPOPTS)
217 STRIP_WARN_MSG = "(without symbols)"
235 Strip := $(PLATFORMSTRIPOPTS)
236 StripWarnMsg := "(without symbols)"
218237 endif
219238
220239 # Adjust linker flags for building an executable
221240 ifdef TOOLNAME
222 LLVMLDFLAGS += -rpath $(TOOLDIR) -export-dynamic
241 LD.Flags += -rpath $(ToolDir) -export-dynamic
223242 endif
224243
225244 #----------------------------------------------------------
228247
229248 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
230249
231 LLVMLDFLAGS += -L$(LIBDIR) -L$(LLVMLIBDIR)
232 LLVMCPPFLAGS += -I$(BUILD_OBJ_DIR) \
250 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
251 CPP.Flags += -I$(BUILD_OBJ_DIR) \
233252 -I$(BUILD_SRC_DIR) \
234253 -I$(BUILD_SRC_ROOT)/include \
235254 -I$(BUILD_OBJ_ROOT)/include \
237256 -I$(LLVM_SRC_ROOT)/include \
238257 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
239258
240 Compile.C = $(CC) $(LLVMCPPFLAGS) $(CompileCommonOpts) -c $(LLVMCFLAGS)
241 LTCompile.C = $(LIBTOOL) --mode=compile $(Compile.C)
242 BCCompile.C = $(LLVMGCC) $(LLVMCPPFLAGS) $(CompileCommonOpts) $(LLVMCFLAGS) -c
243 Compile.CXX = $(CXX) $(LLVMCPPFLAGS) $(CompileCommonOpts) $(LLVMCXXFLAGS) -c
244 LTCompile.CXX = $(LIBTOOL) --tag=CXX --mode=compile $(Compile.CXX)
245 BCCompile.CXX = $(LLVMGXX) $(LLVMCPPFLAGS) $(CompileCommonOpts) $(LLVMCXXFLAGS) -c
246 Link = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(LLVMCPPFLAGS) \
247 $(CompileCommonOpts) $(LLVMLDFLAGS) $(STRIP)
248 Relink = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(LLVMCPPFLAGS) \
259 Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
260 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
261 BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
262 Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
263 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
264 BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
265 Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
266 $(CompileCommonOpts) $(LD.Flags) $(Strip)
267 Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
249268 $(CompileCommonOpts)
250269 BCLinkLib = $(LLVMGCC) -shared -nostdlib
270 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
251271 Burg = $(BURG) -I $(BUILD_SRC_DIR)
252272 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
253 Archive = $(AR) $(LLVMARFLAGS)
273 Archive = $(AR) $(AR.Flags)
254274 ifdef RANLIB
255275 Ranlib = $(RANLIB)
256276 else
261281 # Get the list of source files
262282 #----------------------------------------------------------
263283 ifndef SOURCES
264 SOURCES := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
265 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
266 $(BUILD_SRC_DIR)/*.l))
284 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
285 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
286 $(BUILD_SRC_DIR)/*.l))
287 else
288 Sources := $(SOURCES)
267289 endif
268290
269291 ifdef BUILT_SOURCES
270 SOURCES += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
292 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
271293 endif
272294
273295 #----------------------------------------------------------
274296 # Types of objects that can be built from sources
275297 #----------------------------------------------------------
276 BASENAME_SOURCES := $(sort $(basename $(SOURCES)))
277 ObjectsO := $(BASENAME_SOURCES:%=$(OBJDIR)/%.o)
278 ObjectsLO := $(BASENAME_SOURCES:%=$(OBJDIR)/%.lo)
279 ObjectsBC := $(BASENAME_SOURCES:%=$(OBJDIR)/%.bc)
280
298 BaseNameSources := $(sort $(basename $(Sources)))
299 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
300 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
301 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
281302
282303 ###############################################################################
283304 # DIRECTORIES: Handle recursive descent of directory structure
289310 #---------------------------------------------------------
290311
291312 $(bindir):
292 $(VERB) $(MKDIR) $(bindir)
313 $(Verb) $(MKDIR) $(bindir)
293314
294315 $(libdir):
295 $(VERB) $(MKDIR) $(libdir)
316 $(Verb) $(MKDIR) $(libdir)
296317
297318 $(bytecode_libdir):
298 $(VERB) $(MKDIR) $(bytecode_libdir)
319 $(Verb) $(MKDIR) $(bytecode_libdir)
299320
300321 $(sysconfdir):
301 $(VERB) $(MKDIR) $(sysconfdir)
302
322 $(Verb) $(MKDIR) $(sysconfdir)
323
324 # To create other directories, as needed, and timestamp their creation
325 %/.dir:
326 $(Verb) $(MKDIR) $* > /dev/null
327 @$(DATE) > $@
328
329 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(LLVMLibDir)/.dir
330 .PRECIOUS: $(LLVMToolDir)/.dir
303331
304332 #---------------------------------------------------------
305333 # Handle the DIRS options for sequential construction
306334 #---------------------------------------------------------
307335
308 SUBDIRS :=
336 SubDirs :=
309337 ifdef DIRS
310 SUBDIRS += $(DIRS)
311 $(RECURSIVE_TARGETS)::
312 $(VERB) for dir in $(DIRS); do \
338 SubDirs += $(DIRS)
339 $(RecursiveTargets)::
340 $(Verb) for dir in $(DIRS); do \
313341 if [ ! -f $$dir/Makefile ]; then \
314342 $(MKDIR) $$dir; \
315343 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
323351 # after each directory is built.
324352 #---------------------------------------------------------
325353 ifdef EXPERIMENTAL_DIRS
326 $(RECURSIVE_TARGETS)::
327 $(VERB) for dir in $(EXPERIMENTAL_DIRS); do \
354 $(RecursiveTargets)::
355 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
328356 if [ ! -f $$dir/Makefile ]; then \
329357 $(MKDIR) $$dir; \
330358 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
338366 #---------------------------------------------------------
339367 ifdef PARALLEL_DIRS
340368
341 SUBDIRS += $(PARALLEL_DIRS)
369 SubDirs += $(PARALLEL_DIRS)
370
342371 # Unfortunately, this list must be maintained if new
343372 # recursive targets are added.
344 all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
345 clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS))
346 check :: $(addsuffix /.makecheck , $(PARALLEL_DIRS))
347 install :: $(addsuffix /.makeinstall , $(PARALLEL_DIRS))
373 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
374 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
375 check :: $(addsuffix /.makecheck ,$(PARALLEL_DIRS))
376 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
348377 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
349378
350 Parallel_Targets := $(foreach T,$(RECURSIVE_TARGETS),%/.make$(T))
379 Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
351380
352381 $(Parallel_Targets) :
353 $(VERB) if [ ! -f $(@D)/Makefile ]; then \
382 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
354383 $(MKDIR) $(@D); \
355384 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
356385 fi; \
363392 #---------------------------------------------------------
364393 ifdef OPTIONAL_DIRS
365394
366 SUBDIRS += $(OPTIONAL_DIRS)
367
368 $(RECURSIVE_TARGETS)::
369 $(VERB) for dir in $(OPTIONAL_DIRS); do \
395 SubDirs += $(OPTIONAL_DIRS)
396
397 $(RecursiveTargets)::
398 $(Verb) for dir in $(OPTIONAL_DIRS); do \
370399 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
371400 if [ ! -f $$dir/Makefile ]; then \
372401 $(MKDIR) $$dir; \
383412 ifdef CONFIG_FILES
384413
385414 install-local:: $(sysconfdir) $(CONFIG_FILES)
386 $(VERB)$(ECHO) Installing Configuration Files To $(sysconfdir)
387 $(VERB)for file in $(CONFIG_FILES); do \
415 $(Echo) Installing Configuration Files To $(sysconfdir)
416 $(Verb)for file in $(CONFIG_FILES); do \
388417 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
389418 done
390419
391420 uninstall-local::
392 $(VERB)$(ECHO) Uninstalling Configuration Files From $(sysconfdir)
393 $(VERB)for file in $(CONFIG_FILES); do \
421 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
422 $(Verb)for file in $(CONFIG_FILES); do \
394423 $(RM) -f $(sysconfdir)/$${file} ; \
395424 done
396425
406435
407436 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
408437 LIBRARYNAME := $(strip $(LIBRARYNAME))
409 LIBNAME_LA := $(LIBDIR)/lib$(LIBRARYNAME).la
410 LIBNAME_A := $(LIBDIR)/lib$(LIBRARYNAME).a
411 LIBNAME_O := $(LIBDIR)/$(LIBRARYNAME).o
412 LIBNAME_BC := $(LIBDIR)/lib$(LIBRARYNAME).bc
438 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
439 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
440 LibName.O := $(LibDir)/$(LIBRARYNAME).o
441 LibName.BC := $(LibDir)/lib$(LIBRARYNAME).bc
413442
414443 #---------------------------------------------------------
415444 # Shared Library Targets:
419448 #---------------------------------------------------------
420449 ifdef SHARED_LIBRARY
421450
422 all-local:: $(LIBNAME_LA)
423
424 $(LIBNAME_LA): $(BUILT_SOURCES) $(ObjectsLO) $(LIBDIR)/.dir
425 @$(ECHO) Linking $(CONFIGURATION) Shared Library $(notdir $@)
426 $(VERB) $(Link) -o $@ $(ObjectsLO)
427 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $@ $(LIBDIR)
451 all-local:: $(LibName.LA)
452
453 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
454 $(Echo) Linking $(Configuration) Shared Library $(notdir $@)
455 $(Verb) $(Link) -o $@ $(ObjectsLO)
456 $(Verb) $(LTInstall) $@ $(LibDir)
428457
429458 clean-local::
430 ifneq ($(strip $(LIBNAME_LA)),)
431 $(VERB) $(RM) -f $(LIBNAME_LA)
459 ifneq ($(strip $(LibName.LA)),)
460 $(Verb) $(RM) -f $(LibName.LA)
432461 endif
433462
434463 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
435464
436465 install-local:: $(DestSharedLib)
437466
438 $(DestSharedLib): $(libdir) $(LIBNAME_LA)
439 @$(ECHO) Installing $(CONFIGURATION) Shared Library $(DestSharedLib)
440 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_LA) $(DestSharedLib)
441 $(VERB) $(LIBTOOL) --finish $(libdir)
467 $(DestSharedLib): $(libdir) $(LibName.LA)
468 $(Echo) Installing $(Configuration) Shared Library $(DestSharedLib)
469 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
470 $(Verb) $(LIBTOOL) --finish $(libdir)
442471
443472 uninstall-local::
444 @$(ECHO) Uninstalling $(CONFIGURATION) Shared Library $(DestSharedLib)
445 $(VERB) $(RM) -f $(DestSharedLib)
473 $(Echo) Uninstalling $(Configuration) Shared Library $(DestSharedLib)
474 $(Verb) $(RM) -f $(DestSharedLib)
446475
447476 endif
448477
464493 endif
465494 endif
466495
467 all-local:: $(LIBNAME_BC)
468
469 $(LIBNAME_BC): $(BUILT_SOURCES) $(ObjectsBC) $(LIBDIR)/.dir
470 @$(ECHO) Linking $(CONFIGURATION) Bytecode Library $(notdir $@)
471 $(VERB) $(BCLinkLib) -o $@ $(ObjectsBC)
496 all-local:: $(LibName.BC)
497
498 $(LibName.BC): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir
499 $(Echo) Linking $(Configuration) Bytecode Library $(notdir $@)
500 $(Verb) $(BCLinkLib) -o $@ $(ObjectsBC)
472501
473502 clean-local::
474 ifneq ($(strip $(LIBNAME_BC)),)
475 $(VERB) $(RM) -f $(LIBNAME_BC)
503 ifneq ($(strip $(LibName.BC)),)
504 $(Verb) $(RM) -f $(LibName.BC)
476505 endif
477506
478507 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).bc
479508
480509 install-local:: $(DestBytecodeLib)
481510
482 $(DestBytecodeLib): $(bytecode_libdir) $(LIBNAME_BC)
483 @$(ECHO) Installing $(CONFIGURATION) Bytecode Library $(DestBytecodeLib)
484 $(VERB) $(INSTALL) $(LIBNAME_BC) $@
511 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BC)
512 $(Echo) Installing $(Configuration) Bytecode Library $(DestBytecodeLib)
513 $(Verb) $(INSTALL) $(LibName.BC) $@
485514
486515 uninstall-local::
487 @$(ECHO) Uninstalling $(CONFIGURATION) Bytecode Library $(DestBytecodeLib)
488 $(VERB) $(RM) -f $(DestBytecodeLib)
489
490 endif
491
492 # Does the library want a .o version built?
516 $(Echo) Uninstalling $(Configuration) Bytecode Library $(DestBytecodeLib)
517 $(Verb) $(RM) -f $(DestBytecodeLib)
518
519 endif
520
521 #---------------------------------------------------------
522 # ReLinked Library Targets:
523 # If the user didn't explicitly forbid building a
524 # relinked then we provide targets for building them.
525 #---------------------------------------------------------
493526 ifndef DONT_BUILD_RELINKED
494 all-local:: $(LIBNAME_O)
495
496 $(LIBNAME_O): $(BUILT_SOURCES) $(ObjectsO) $(LIBDIR)/.dir
497 @$(ECHO) Linking $(CONFIGURATION) Object Library $(notdir $@)
498 $(VERB) $(Relink) -o $@ $(ObjectsO)
527
528 all-local:: $(LibName.O)
529
530 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
531 $(Echo) Linking $(Configuration) Object Library $(notdir $@)
532 $(Verb) $(Relink) -o $@ $(ObjectsO)
499533
500534 clean-local::
501 ifneq ($(strip $(LIBNAME_O)),)
502 $(VERB) $(RM) -f $(LIBNAME_O)
535 ifneq ($(strip $(LibName.O)),)
536 $(Verb) $(RM) -f $(LibName.O)
503537 endif
504538
505539 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
506540
507541 install-local:: $(DestRelinkedLib)
508542
509 $(DestRelinkedLib): $(libdir) $(LIBNAME_O)
510 @$(ECHO) Installing $(CONFIGURATION) Object Library $(DestRelinkedLib)
511 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_O) $(DestRelinkedLib)
543 $(DestRelinkedLib): $(libdir) $(LibName.O)
544 $(Echo) Installing $(Configuration) Object Library $(DestRelinkedLib)
545 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
512546
513547 uninstall-local::
514 @$(ECHO) Uninstalling $(CONFIGURATION) Object Library $(DestRelinkedLib)
515 $(VERB) $(RM) -f $(DestRelinkedLib)
516
517 endif
518
519 # Does the library want an archive version built?
548 $(Echo) Uninstalling $(Configuration) Object Library $(DestRelinkedLib)
549 $(Verb) $(RM) -f $(DestRelinkedLib)
550
551 endif
552
553 #---------------------------------------------------------
554 # Archive Library Targets:
555 # If the user wanted a regular archive library built,
556 # then we provide targets for building them.
557 #---------------------------------------------------------
520558 ifdef BUILD_ARCHIVE
521 all-local:: $(LIBNAME_A)
522
523 $(LIBNAME_A): $(BUILT_SOURCES) $(ObjectsO) $(LIBDIR)/.dir
524 @$(ECHO) Building $(CONFIGURATION) Archive Library $(notdir $@)
525 $(VERB)$(RM) -f $@
526 $(VERB) $(Archive) $@ $(ObjectsO)
527 $(VERB) $(Ranlib) $@
559
560 all-local:: $(LibName.A)
561
562 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
563 $(Echo) Building $(Configuration) Archive Library $(notdir $@)
564 $(Verb)$(RM) -f $@
565 $(Verb) $(Archive) $@ $(ObjectsO)
566 $(Verb) $(Ranlib) $@
528567
529568 clean-local::
530 ifneq ($(strip $(LIBNAME_A)),)
531 $(VERB) $(RM) -f $(LIBNAME_A)
569 ifneq ($(strip $(LibName.A)),)
570 $(Verb) $(RM) -f $(LibName.A)
532571 endif
533572
534573 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
535574
536575 install-local:: $(DestArchiveLib)
537576
538 $(DestArchiveLib): $(libdir) $(LIBNAME_A)
539 @$(ECHO) Installing $(CONFIGURATION) Archive Library $(DestArchiveLib)
540 $(VERB) $(MKDIR) $(libdir)
541 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_A) $(DestArchiveLib)
577 $(DestArchiveLib): $(libdir) $(LibName.A)
578 $(Echo) Installing $(Configuration) Archive Library $(DestArchiveLib)
579 $(Verb) $(MKDIR) $(libdir)
580 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
542581
543582 uninstall-local::
544 @$(ECHO) Uninstalling $(CONFIGURATION) Archive Library $(DestArchiveLib)
545 $(VERB) $(RM) -f $(DestArchiveLib)
583 $(Echo) Uninstalling $(Configuration) Archive Library $(DestArchiveLib)
584 $(Verb) $(RM) -f $(DestArchiveLib)
546585
547586 endif
548587
555594
556595 ifdef TOOLNAME
557596
558 # TOOLEXENAME - This is the output filenames to generate
559 TOOLEXENAME := $(TOOLDIR)/$(TOOLNAME)
560
561 # LIBS_OPTIONS - Compute the options lines that add -llib1 -llib2, etc.
562 PROJ_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
563 PROJ_LIBS_OPTIONS := $(patsubst %.o, $(LIBDIR)/%.o, $(PROJ_LIBS_OPTIONS))
564 LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
565 LLVM_LIBS_OPTIONS := $(patsubst %.o, $(LLVMLIBDIR)/%.o, $(LLVM_LIBS_OPTIONS))
566
567 # USED_LIBS/LIBS_PATHS - Compute dependent library file paths
568 PROJ_USED_LIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
569 LLVM_USED_LIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
570 PROJ_LIBS_PATHS := $(addprefix $(LIBDIR)/,$(PROJ_USED_LIBS))
571 LLVM_LIBS_PATHS := $(addprefix $(LLVMLIBDIR)/,$(LLVM_USED_LIBS))
572
573 # Handle compression libraries automatically
597 #---------------------------------------------------------
598 # Set up variables for building a tool.
599 #---------------------------------------------------------
600 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
601 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
602 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
603 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
604 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
605 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
606 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
607 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
608 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
609
610 #---------------------------------------------------------
611 # Handle optional compression libraries automatically
612 #---------------------------------------------------------
613 ExtraLibs := $(LIBS)
574614 ifeq ($(HAVE_BZIP2),1)
575 LIBS += -lbz2
615 ExtraLibs += -lbz2
576616 endif
577617 ifeq ($(HAVE_ZLIB),1)
578 LIBS += -lz
579 endif
580
581 # Tell make that we need to rebuild subdirectories before we can link the tool.
582 # This affects things like LLI which has library subdirectories.
583 $(TOOLEXENAME): $(addsuffix /.makeall, $(PARALLEL_DIRS))
584
585 all-local:: $(TOOLEXENAME)
618 ExtraLibs += -lz
619 endif
620
621 #---------------------------------------------------------
622 # Tell make that we need to rebuild subdirectories before
623 # we can link the tool. This affects things like LLI which
624 # has library subdirectories.
625 #---------------------------------------------------------
626 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
627
628 #---------------------------------------------------------
629 # Provide targets for building the tools
630 #---------------------------------------------------------
631 all-local:: $(ToolBuildPath)
586632
587633 clean-local::
588 ifneq ($(strip $(TOOLEXENAME)),)
589 $(VERB) $(RM) -f $(TOOLEXENAME)
590 endif
591
592 $(TOOLEXENAME): $(BUILT_SOURCES) $(ObjectsO) $(PROJ_LIBS_PATHS) $(LLVM_LIBS_PATHS) $(TOOLDIR)/.dir
593 @$(ECHO) Linking $(CONFIGURATION) executable $(TOOLNAME) $(STRIP_WARN_MSG)
594 $(VERB) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(PROJ_LIBS_OPTIONS) \
595 $(LLVM_LIBS_OPTIONS) $(LIBS) $(TOOLLINKOPTSB)
596 @$(ECHO) ======= Finished Linking $(CONFIGURATION) Executable $(TOOLNAME) $(STRIP_WARN_MSG)
634 ifneq ($(strip $(ToolBuildPath)),)
635 $(Verb) $(RM) -f $(ToolBuildPath)
636 endif
637
638 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)\
639 $(ToolDir)/.dir
640 $(Echo) Linking $(Configuration) executable $(TOOLNAME) $(StripWarnMsg)
641 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
642 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
643 $(Echo) ======= Finished Linking $(Configuration) Executable $(TOOLNAME) $(StripWarnMsg)
597644
598645 DestTool = $(bindir)/$(TOOLNAME)
599646
600647 install-local:: $(DestTool)
601648
602 $(DestTool): $(bindir) $(TOOLEXENAME)
603 @$(ECHO) Installing $(CONFIGURATION) $(DestTool)
604 $(VERB) $(INSTALL) $(TOOLEXENAME) $(DestTool)
649 $(DestTool): $(bindir) $(ToolBuildPath)
650 $(Echo) Installing $(Configuration) $(DestTool)
651 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
605652
606653 uninstall-local::
607 @$(ECHO) Uninstalling $(CONFIGURATION) $(DestTool)
608 $(VERB) $(RM) -f $(DestTool)
609
610 endif
611
654 $(Echo) Uninstalling $(Configuration) $(DestTool)
655 $(Verb) $(RM) -f $(DestTool)
656
657 endif
658
659 ###############################################################################
660 # Object Build Rules: Build object files based on sources
661 ###############################################################################
662
663 # Provide rule sets for when dependency generation is enabled
612664 ifndef DISABLE_AUTO_DEPENDENCIES
613665
614 # Create .lo files in the OBJDIR directory from the .cpp and .c files...
666 #---------------------------------------------------------
667 # Create .lo files in the ObjDir directory from the .cpp and .c files...
668 #---------------------------------------------------------
615669 ifdef SHARED_LIBRARY
616670
617 $(OBJDIR)/%.lo $(OBJDIR)/%.o: %.cpp $(OBJDIR)/.dir
618 @$(ECHO) "Compiling $*.cpp (PIC)"
619 $(VERB) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(OBJDIR)/$*.LACXXd $< -o $@ ; \
620 then $(MV) -f "$(OBJDIR)/$*.LACXXd" "$(OBJDIR)/$*.d"; \
621 else $(RM) -f "$(OBJDIR)/$*.LACXXd"; exit 1; fi
622
623 $(OBJDIR)/%.lo $(OBJDIR)/%.o: %.c $(OBJDIR)/.dir
624 @$(ECHO) "Compiling $*.c (PIC)"
625 $(VERB) if $(LTCompile.C) -MD -MT $@ -MP -MF $(OBJDIR)/$*.LACd $< -o $@ ; \
626 then $(MV) -f "$(OBJDIR)/$*.LACd" "$(OBJDIR)/$*.d"; \
627 else $(RM) -f "$(OBJDIR)/$*.LACd"; exit 1; fi
628
671 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
672 $(Echo) "Compiling $*.cpp (PIC)"
673 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
674 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
675 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
676
677 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
678 $(Echo) "Compiling $*.c (PIC)"
679 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
680 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
681 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
682
683 #---------------------------------------------------------
684 # Create .o files in the ObjDir directory from the .cpp and .c files...
685 #---------------------------------------------------------
629686 else
630687
631 $(OBJDIR)/%.o: %.cpp $(OBJDIR)/.dir
632 @$(ECHO) "Compiling $*.cpp"
633 $(VERB) if $(Compile.CXX) -MD -MT $@ -MP -MF $(OBJDIR)/$*.CXXd $< -o $@ ; \
634 then $(MV) -f "$(OBJDIR)/$*.CXXd" "$(OBJDIR)/$*.d"; \
635 else $(RM) -f "$(OBJDIR)/$*.CXXd"; exit 1; fi
636
637 $(OBJDIR)/%.o: %.c $(OBJDIR)/.dir
638 @$(ECHO) "Compiling $*.c"
639 $(VERB) if $(Compile.C) -MD -MT $@ -MP -MF $(OBJDIR)/$*.Cd $< -o $@ ; \
640 then $(MV) -f "$(OBJDIR)/$*.Cd" "$(OBJDIR)/$*.d"; \
641 else $(RM) -f "$(OBJDIR)/$*.Cd"; exit 1; fi
642
643 endif
644
645 # Create .bc files in the OBJDIR directory from .cpp and .c files...
646 $(OBJDIR)/%.bc: %.cpp $(OBJDIR)/.dir
647 @$(ECHO) "Compiling $*.cpp (bytecode)"
648 $(VERB) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(OBJDIR)/$*.BCCXXd" $< -o $@ ; \
649 then $(MV) -f "$(OBJDIR)/$*.BCCXXd" "$(OBJDIR)/$*.d"; \
650 else $(RM) -f "$(OBJDIR)/$*.BCCXXd"; exit 1; fi
651
652 $(OBJDIR)/%.bc: %.c $(OBJDIR)/.dir
653 @$(ECHO) "Compiling $*.c (bytecode)"
654 $(VERB) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(OBJDIR)/$*.BCCd" $< -o $@ ; \
655 then $(MV) -f "$(OBJDIR)/$*.BCCd" "$(OBJDIR)/$*.d"; \
656 else $(RM) -f "$(OBJDIR)/$*.BCCd"; exit 1; fi
657
688 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
689 $(Echo) "Compiling $*.cpp"
690 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
691 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
692 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
693
694 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
695 $(Echo) "Compiling $*.c"
696 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
697 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
698 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
699
700 endif
701
702 #---------------------------------------------------------
703 # Create .bc files in the ObjDir directory from .cpp and .c files...
704 #---------------------------------------------------------
705 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
706 $(Echo) "Compiling $*.cpp (bytecode)"
707 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
708 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
709 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
710
711 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir
712 $(Echo) "Compiling $*.c (bytecode)"
713 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
714 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
715 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
716
717 # Provide alternate rule sets if dependencies are disabled
658718 else
659719
660720 ifdef SHARED_LIBRARY
661721
662 $(OBJDIR)/%.lo $(OBJDIR)/%.o: %.cpp $(OBJDIR)/.dir
663 @$(ECHO) "Compiling $*.cpp (PIC)"
722 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
723 $(Echo) "Compiling $*.cpp (PIC)"
664724 $(LTCompile.CXX) $< -o $@
665725
666 $(OBJDIR)/%.lo $(OBJDIR)/%.o: %.c $(OBJDIR)/.dir
667 @$(ECHO) "Compiling $*.cpp (PIC)"
726 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
727 $(Echo) "Compiling $*.cpp (PIC)"
668728 $(LTCompile.C) $< -o $@
669729
670730 else
671731
672 $(OBJDIR)/%.o: %.cpp $(OBJDIR)/.dir
673 @$(ECHO) "Compiling $*.cpp"
732 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
733 $(Echo) "Compiling $*.cpp"
674734 $(Compile.CXX) $< -o $@
675735
676 $(OBJDIR)/%.o: %.c $(OBJDIR)/.dir
677 @$(ECHO) "Compiling $*.cpp"
736 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
737 $(Echo) "Compiling $*.cpp"
678738 $(Compile.C) $< -o $@
679739 endif
680740
681 # Create .bc files in the OBJDIR directory from .cpp and .c files...
682 $(OBJDIR)/%.bc: %.cpp $(OBJDIR)/.dir
683 @$(ECHO) "Compiling $*.cpp (bytecode)"
741 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
742 $(Echo) "Compiling $*.cpp (bytecode)"
684743 $(BCCompileCPP) $< -o $@
685744
686 $(OBJDIR)/%.bc: %.c $(OBJDIR)/.dir
687 @$(ECHO) "Compiling $*.c (bytecode)"
745 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir
746 $(Echo) "Compiling $*.c (bytecode)"
688747 $(BCCompileC) $< -o $@
689748
690749 endif
691750
692 $(OBJDIR)/%.bc: %.ll $(OBJDIR)/.dir $(LLVMAS)
693 @$(ECHO) "Compiling $*.ll"
694 $(VERB) $(LLVMAS) $< -f -o $@
751 #---------------------------------------------------------
752 # Provide rule to build .bc files from .ll sources,
753 # regardless of dependencies
754 #---------------------------------------------------------
755 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
756 $(Echo) "Compiling $*.ll"
757 $(Verb) $(LLVMAS) $< -f -o $@
758
759 ###############################################################################
760 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
761 ###############################################################################
695762
696763 ifdef TARGET
697764
698 TDFILES := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
699 INCFILES := $(filter %.inc,$(BUILT_SOURCES))
700
701 $(INCFILES) : $(TBLGEN) $(TDFILES)
765 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
766 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
767
768 $(INCFiles) : $(TBLGEN) $(TDFiles)
702769
703770 %GenRegisterNames.inc : %.td
704 @$(ECHO) "Building $(
705 $(VERB) $(TableGen) -gen-register-enums -o $@ $<
771 $(Echo) "Building $(
772 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
706773
707774 %GenRegisterInfo.h.inc : %.td
708 @$(ECHO) "Building $(
709 $(VERB) $(TableGen) -gen-register-desc-header -o $@ $<
775 $(Echo) "Building $(
776 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
710777
711778 %GenRegisterInfo.inc : %.td
712 @$(ECHO) "Building $(
713 $(VERB) $(TableGen) -gen-register-desc -o $@ $<
779 $(Echo) "Building $(
780 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
714781
715782 %GenInstrNames.inc : %.td
716 @$(ECHO) "Building $(
717 $(VERB) $(TableGen) -gen-instr-enums -o $@ $<
783 $(Echo) "Building $(
784 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
718785
719786 %GenInstrInfo.inc : %.td
720 @$(ECHO) "Building $(
721 $(VERB) $(TableGen) -gen-instr-desc -o $@ $<
787 $(Echo) "Building $(
788 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
722789
723790 %GenAsmWriter.inc : %.td
724 @$(ECHO) "Building $(
725 $(VERB) $(TableGen) -gen-asm-writer -o $@ $<
791 $(Echo) "Building $(
792 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
726793
727794 %GenATTAsmWriter.inc : %.td
728 @$(ECHO) "Building $(
729 $(VERB) $(TableGen) -gen-asm-writer -o $@ $<
795 $(Echo) "Building $(
796 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
730797
731798 %GenIntelAsmWriter.inc : %.td
732 @$(ECHO) "Building $(
733 $(VERB) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
799 $(Echo) "Building $(
800 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
734801
735802 %GenInstrSelector.inc: %.td
736 @$(ECHO) "Building $(
737 $(VERB) $(TableGen) -gen-instr-selector -o $@ $<
803 $(Echo) "Building $(
804 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
738805
739806 %GenCodeEmitter.inc:: %.td
740 @$(ECHO) "Building $(
741 $(VERB) $(TableGen) -gen-emitter -o $@ $<
807 $(Echo) "Building $(
808 $(Verb) $(TableGen) -gen-emitter -o $@ $<
742809
743810 clean-local::
744 $(VERB) rm -f *.inc
745
746 endif
747
748 #
749 # Rules for building lex/yacc files
750 #
751 LEX_FILES = $(filter %.l, $(SOURCES))
752 LEX_OUTPUT = $(LEX_FILES:%.l=%.cpp)
753 YACC_FILES = $(filter %.y, $(SOURCES))
754 YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
755 .PRECIOUS: $(LEX_OUTPUT) $(YACC_OUTPUT)
756
757 # Create a .cpp source file from a flex input file... this uses sed to cut down
758 # on the warnings emited by GCC...
759 #
760 # The last line is a gross hack to work around flex aparently not being able to
761 # resize the buffer on a large token input. Currently, for uninitialized string
762 # buffers in LLVM we can generate very long tokens, so this is a hack around it.
811 $(Verb) $(RM) -f $(INCFiles)
812
813 endif
814
815 ###############################################################################
816 # LEX AND YACC: Provide rules for generating sources with lex and yacc
817 ###############################################################################
818
819 #---------------------------------------------------------
820 # Provide rules for generating a .cpp source file from
821 # (f)lex input sources.
822 #---------------------------------------------------------
823
824 LexOutput := $(strip $(subst %.l,%.cpp,$(filter %.l,$(Sources))))
825
826 ifneq ($(LexOutput),)
827
828 .PRECIOUS: $(LexOutput)
829
830 # Note the extra sed filtering here, used to cut down on the warnings emited
831 # by GCC. The last line is a gross hack to work around flex aparently not
832 # being able to resize the buffer on a large token input. Currently, for
833 # uninitialized string buffers in LLVM we can generate very long tokens, so
834 # this is a hack around it.
763835 # FIXME. (f.e. char Buffer[10000] )
764 #
765836 %.cpp: %.l
766 @$(ECHO) Flexing $<
767 $(VERB) $(FLEX) -t $< | \
837 $(Echo) Flexing $<
838 $(Verb) $(FLEX) -t $< | \
768839 $(SED) 's/void yyunput/inline void yyunput/' | \
769840 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
770841 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
771842 > $@
772843
844 endif
845
846 #---------------------------------------------------------
847 # Provide rules for generating a .cpp and .h source files
848 # from yacc (bison) input sources.
849 #---------------------------------------------------------
850
851 YaccOutput := $(strip $(addprefix $(subst %.y,%,$(filter %.y,$(Sources))),\
852 .h .cpp .output))
853
854 ifneq ($(YaccOutput),)
855
856 .PRECIOUS: $(YaccOutput)
857
858 # Cancel built-in rules for yacc
859 %.c: %.y
860 %.cpp: %.y
861 %.h: %.y
862
773863 # Rule for building the bison parsers...
774 %.c: %.y # Cancel built-in rules for yacc
775 %.cpp: %.y # Cancel built-in rules for yacc
776 %.h: %.y # Cancel built-in rules for yacc
777864 %.cpp %.h : %.y
778 @$(ECHO) "Bisoning $*.y"
779 $(VERB) $(BISON) -v -d -p $(
780 $(VERB) $(MV) -f $*.tab.c $*.cpp
781 $(VERB) $(MV) -f $*.tab.h $*.h
782
783 # To create the directories...
784 %/.dir:
785 $(VERB) $(MKDIR) $* > /dev/null
786 @$(DATE) > $@
787
788 .PRECIOUS: $(OBJDIR)/.dir $(LIBDIR)/.dir $(TOOLDIR)/.dir $(LLVMLIBDIR)/.dir
789 .PRECIOUS: $(LLVMTOOLDIR)/.dir
865 $(Echo) "Bisoning $*.y"
866 $(Verb) $(BISON) -v -d -p $(
867 $(Verb) $(MV) -f $*.tab.c $*.cpp
868 $(Verb) $(MV) -f $*.tab.h $*.h
869
870 endif
871
872 ###############################################################################
873 # OTHER RULES: Other rules needed
874 ###############################################################################
790875
791876 # To create postscript files from dot files...
792877 ifneq ($(DOT),false)
794879 $(DOT) -Tps < $< > $@
795880 else
796881 %.ps: %.dot
797 $(ECHO) "Cannot build $@: The program dot is not installed"
798 endif
799
800 #
882 $(Echo) "Cannot build $@: The program dot is not installed"
883 endif
884
801885 # This rules ensures that header files that are removed still have a rule for
802886 # which they can be "generated." This allows make to ignore them and
803887 # reproduce the dependency lists.
804 #
805888 %.h:: ;
806889
807 # 'make clean' nukes the tree
890 # Define clean-local to clean the current directory. Note that this uses a
891 # very conservative approach ensuring that empty variables do not cause
892 # errors or disastrous removal.
808893 clean-local::
809 ifneq ($(strip $(OBJDIR)),)
810 $(VERB) $(RM) -rf $(OBJDIR)
811 endif
812 $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
894 ifneq ($(strip $(ObjDir)),)
895 $(Verb) $(RM) -rf $(ObjDir)
896 endif
897 $(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
813898 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
814 $(VERB) $(RM) -f *$(SHLIBEXT)
815 endif
816 ifneq ($(strip $(LEX_OUTPUT)),)
817 $(VERB) $(RM) -f $(LEX_OUTPUT)
818 endif
819 ifneq ($(strip $(YACC_OUTPUT)),)
820 $(VERB) $(RM) -f $(YACC_OUTPUT)
821 endif
899 $(Verb) $(RM) -f *$(SHLIBEXT)
900 endif
901 ifneq ($(strip $(LexOutput)),)
902 $(Verb) $(RM) -f $(LexOutput)
903 endif
904 ifneq ($(strip $(YaccOutput)),)
905 $(Verb) $(RM) -f $(YaccOutput)
906 endif
907
908 # Build tags database for Emacs/Xemacs:
909 tags:: TAGS
910 TAGS:
911 find include lib tools examples -name '*.cpp' -o -name '*.h' | \
912 $(ETAGS) $(ETAGSFLAGS) -
822913
823914 ###############################################################################
824915 # DEPENDENCIES: Include the dependency files if we should
826917 ifndef DISABLE_AUTO_DEPENDENCIES
827918
828919 # If its not one of the cleaning targets
829 ifneq ($strip($(filter-out clean clean-local dist-clean, $(MAKECMDGOALS))),)
920 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
830921
831922 # Get the list of dependency files
832 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(SOURCES)))
833 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(CONFIGURATION)/%.d,$(DependFiles))
923 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
924 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(Configuration)/%.d,$(DependFiles))
834925
835926 -include /dev/null $(DependFiles)
836927
837928 endif
838929
839 endif # ifndef DISABLE_AUTO_DEPENDENCIES
840
841 ###############################################################################
842 # Handle construction of a distribution tarball
843 ###############################################################################
844
845 .PHONY: dist dist-chck dist-clean distdir dist-gzip dist-bzip2 dist-zip
930 endif
931
932 ###############################################################################
933 # DISTRIBUTION: Handle construction of a distribution tarball
934 ###############################################################################
846935
847936 #------------------------------------------------------------------------
848937 # Define distribution related variables
862951 $(BUILD_SRC_DIR)/*.def \
863952 $(BUILD_SRC_DIR)/*.ll \
864953 $(BUILD_SRC_DIR)/*.in))
865 DistSources := $(SOURCES) $(EXTRA_DIST)
866 DistSubDirs := $(SUBDIRS)
954 DistSources := $(Sources) $(EXTRA_DIST)
955 DistSubDirs := $(SubDirs)
867956 DistFiles := $(DistAlways) $(DistSources) $(DistOther)
868
869957
870958 #------------------------------------------------------------------------
871959 # We MUST build distribution with OBJ_DIR != SRC_DIR
872960 #------------------------------------------------------------------------
873961 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
874962 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
875 @$(ECHO) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
963 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
876964
877965 DistCheckTop :=
878966 else
879967
880968 DistCheckTop := check
969
881970 #------------------------------------------------------------------------
882971 # Prevent catastrophic remove
883972 #------------------------------------------------------------------------
891980 ifneq ($(LEVEL),.)
892981
893982 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
894 @$(ECHO) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
983 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
895984
896985 else
897986
899988 # Provide the top level targets
900989 #------------------------------------------------------------------------
901990
902 dist-gzip: $(DistTarGZip)
991 dist-gzip:: $(DistTarGZip)
903992
904993 $(DistTarGZip) : distdir
905 @$(ECHO) Packing gzipped distribution tar file.
906 $(VERB) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | gzip -c > "$(DistTarGZip)"
907
908 dist-bzip2: $(DistTarBZ2)
994 $(Echo) Packing gzipped distribution tar file.
995 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | gzip -c > "$(DistTarGZip)"
996
997 dist-bzip2:: $(DistTarBZ2)
909998
910999 $(DistTarBZ2) : distdir
911 @$(ECHO) Packing bzipped distribution tar file.
912 $(VERB) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | $(BZIP2) -c >$(DistTarBZ2)
913
914 dist-zip: $(DistZip)
1000 $(Echo) Packing bzipped distribution tar file.
1001 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | $(BZIP2) -c >$(DistTarBZ2)
1002
1003 dist-zip:: $(DistZip)
9151004
9161005 $(DistZip) : distdir
917 @$(ECHO) Packing zipped distribution file.
918 $(VERB) rm -f $(DistZip)
919 $(VERB) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1006 $(Echo) Packing zipped distribution file.
1007 $(Verb) rm -f $(DistZip)
1008 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
9201009
9211010 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
922 @$(ECHO) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1011 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
9231012
9241013 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
9251014
9261015 dist-check:: $(DistCheckTop) $(DistTarGZip)
927 @$(ECHO) Checking distribution tar file.
928 $(VERB) if test -d $(DistCheckDir) ; then \
1016 $(Echo) Checking distribution tar file.
1017 $(Verb) if test -d $(DistCheckDir) ; then \
9291018 $(RM) -rf $(DistCheckDir) ; \
9301019 fi
931 $(VERB) $(MKDIR) $(DistCheckDir)
932 $(VERB) cd $(DistCheckDir) && \
1020 $(Verb) $(MKDIR) $(DistCheckDir)
1021 $(Verb) cd $(DistCheckDir) && \
9331022 $(MKDIR) $(DistCheckDir)/build && \
9341023 $(MKDIR) $(DistCheckDir)/install && \
9351024 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
9421031 $(MAKE) dist && \
9431032 $(MAKE) clean && \
9441033 $(MAKE) dist-clean && \
945 $(ECHO) ===== $(DistTarGZip) Ready For Distribution =====
1034 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
9461035
9471036 dist-clean::
948 @$(ECHO) Cleaning distribution files
949 $(VERB) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1037 $(Echo) Cleaning distribution files
1038 $(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
9501039
9511040 endif
9521041
9541043 # Provide the recursive distdir target for building the distribution directory
9551044 #------------------------------------------------------------------------
9561045 distdir : $(DistSources)
957 @$(ECHO) Building Distribution Directory $(DistDir)
958 $(VERB) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1046 $(Echo) Building Distribution Directory $(DistDir)
1047 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
9591048 if test -d "$(DistDir)" ; then \
9601049 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
9611050 exit 1 ; \
9621051 fi ; \
963 $(ECHO) Removing $(DistDir) ; \
1052 $(EchoCmd) Removing $(DistDir) ; \
9641053 $(RM) -rf $(DistDir); \
9651054 fi
966 $(VERB) $(MKDIR) $(DistDir)
967 $(VERB) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1055 $(Verb) $(MKDIR) $(DistDir)
1056 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
9681057 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
9691058 for file in $(DistFiles) ; do \
9701059 case "$$file" in \
9981087 elif test -L "$$from_dir/$$file" ; then \
9991088 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
10001089 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1001 $(ECHO) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1002 elif test "$(VERB)" != '@' ; then \
1003 $(ECHO) "Skipping non-existent $$from_dir/$$file" ; \
1090 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1091 elif test "$(Verb)" != '@' ; then \
1092 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
10041093 fi; \
10051094 done
1006 $(VERB) for subdir in $(DistSubDirs) ; do \
1095 $(Verb) for subdir in $(DistSubDirs) ; do \
10071096 if test "$$subdir" \!= "." ; then \
10081097 new_distdir="$(DistDir)/$$subdir" ; \
10091098 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
10101099 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
10111100 fi; \
10121101 done
1013 $(VERB) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1014 -$(VERB) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1102 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1103 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
10151104 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
10161105 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
10171106 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
10181107 || chmod -R a+r $(DistDir)
10191108
1109 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1110 # defined by user.
10201111 dist-hook::
10211112
1022
10231113 endif
10241114
10251115 ###############################################################################
10321122 # Install support for project's include files:
10331123 #------------------------------------------------------------------------
10341124 install-local::
1035 @$(ECHO) Installing include files
1036 $(VERB) $(MKDIR) $(includedir)
1037 $(VERB) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1125 $(Echo) Installing include files
1126 $(Verb) $(MKDIR) $(includedir)
1127 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
10381128 cd $(BUILD_SRC_ROOT)/include && \
10391129 find . -path '*/Internal' -prune -o '(' -type f \
10401130 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
10421132 fi
10431133
10441134 uninstall-local::
1045 @$(ECHO) Uninstalling include files
1046 $(VERB) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1135 $(Echo) Uninstalling include files
1136 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
10471137 cd $(BUILD_SRC_ROOT)/include && \
10481138 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
10491139 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
10501140 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
10511141 fi
10521142
1053 #------------------------------------------------------------------------
1054 # Build tags database for Emacs/Xemacs:
1055 #------------------------------------------------------------------------
1056 tags:: TAGS
1057
1058 TAGS:
1059 find include lib tools examples -name '*.cpp' -o -name '*.h' | $(ETAGS) $(ETAGSFLAGS) -
1060
1061 endif
1062
1063 ###############################################################################
1064 # MISCELLANEOUS - utility targets
1065 ###############################################################################
1143 endif
10661144
10671145 #------------------------------------------------------------------------
10681146 # Print out the directories used for building
1147 #------------------------------------------------------------------------
10691148 printvars::
1070 @$(ECHO) "CONFIGURATION : " '$(CONFIGURATION)'
1071 @$(ECHO) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1072 @$(ECHO) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1073 @$(ECHO) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1074 @$(ECHO) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1075 @$(ECHO) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1076 @$(ECHO) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1077 @$(ECHO) "libdir : " '$(libdir)'
1078 @$(ECHO) "bindir : " '$(bindir)'
1079 @$(ECHO) "sysconfdir : " '$(sysconfdir)'
1080 @$(ECHO) "bytecode_libdir: " '$(bytecode_libdir)'
1081 @$(ECHO) "USER_TARGETS : " '$(USER_TARGETS)'
1082 @$(ECHO) "OBJMKFILES : " '$(OBJMKFILES)'
1083 @$(ECHO) "SRCMKFILES : " '$(SRCMKFILES)'
1084 @$(ECHO) "OBJDIR : " '$(OBJDIR)'
1085 @$(ECHO) "LIBDIR : " '$(LIBDIR)'
1086 @$(ECHO) "TOOLDIR : " '$(TOOLDIR)'
1087 @$(ECHO) "TDFILES : " '$(TDFILES)'
1088 @$(ECHO) "Compile.CXX : " '$(Compile.CXX)'
1089 @$(ECHO) "Compile.C : " '$(Compile.C)'
1090 @$(ECHO) "Archive : " '$(Archive)'
1091
1149 $(Echo) "Configuration : " '$(Configuration)'
1150 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1151 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1152 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1153 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1154 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1155 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1156 $(Echo) "libdir : " '$(libdir)'
1157 $(Echo) "bindir : " '$(bindir)'
1158 $(Echo) "sysconfdir : " '$(sysconfdir)'
1159 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1160 $(Echo) "UserTargets : " '$(UserTargets)'
1161 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1162 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1163 $(Echo) "ObjDir : " '$(ObjDir)'
1164 $(Echo) "LibDir : " '$(LibDir)'
1165 $(Echo) "ToolDir : " '$(ToolDir)'
1166 $(Echo) "TDFiles : " '$(TDFiles)'
1167 $(Echo) "INCFiles : " '$(INCFiles)'
1168 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1169 $(Echo) "Compile.C : " '$(Compile.C)'
1170 $(Echo) "Archive : " '$(Archive)'
1616 include $(LEVEL)/Makefile.common
1717
1818 SparcV9.burg.in1 : $(BUILD_SRC_DIR)/SparcV9.burg.in
19 @$(ECHO) Pre-processing SparcV9.burg.in
20 $(VERB) $(CXX) -E $(CPPFLAGS) -x c++ $< | $(SED) '/^#/d' | $(SED) 's/Ydefine/#define/' > $@
19 $(Echo) Pre-processing SparcV9.burg.in
20 $(Verb) $(CXX) -E $(CPP.Flags) -x c++ $< | $(SED) '/^#/d' | $(SED) 's/Ydefine/#define/' > $@
2121
2222 SparcV9.burm : SparcV9.burg.in1
23 @$(ECHO) Pre-processing SparcV9.burg.in
24 $(VERB) $(CXX) -E $(CPPFLAGS) -x c++ $< | $(SED) '/^#/d' | $(SED) 's/^Xinclude/#include/' | $(SED) 's/^Xdefine/#define/' > $@
23 $(Echo) Pre-processing SparcV9.burg.in
24 $(Verb) $(CXX) -E $(CPP.Flags) -x c++ $< | $(SED) '/^#/d' | $(SED) 's/^Xinclude/#include/' | $(SED) 's/^Xdefine/#define/' > $@
2525
2626 SparcV9.burm.cpp: SparcV9.burm
27 @$(ECHO) "Burging `basename $<`"
28 $(VERB) $(BURG) -I $< -o $@
27 $(Echo) "Burging `basename $<`"
28 $(Verb) $(BURG) -I $< -o $@
2929
30 TABLEGEN_FILES := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.td))
31
32 SparcV9CodeEmitter.inc: $(BUILD_SRC_DIR)/SparcV9.td $(TABLEGEN_FILES) $(TBLGEN)
33 @$(ECHO) "Running tblgen on SparcV9.td"
34 $(VERB) $(TableGen) -gen-emitter -o $@ $<
30 SparcV9CodeEmitter.inc: $(BUILD_SRC_DIR)/SparcV9.td $(TDFiles) $(TBLGEN)
31 $(Echo) "Running tblgen on SparcV9.td"
32 $(Verb) $(TableGen) -gen-emitter -o $@ $<
3533
3634 clean::
37 $(VERB) $(RM) -f SparcV9CodeEmitter.inc SparcV9.burg.in1 SparcV9.burm SparcV9.burm.cpp
35 $(Verb) $(RM) -f SparcV9CodeEmitter.inc SparcV9.burg.in1 SparcV9.burm SparcV9.burm.cpp
3836
2727 include $(LEVEL)/Makefile.common
2828
2929 # CRTEND_A - The result of making 'all' - the final archive file.
30 CRTEND_A = $(LIBDIR)/libcrtend.a
30 CRTEND_A = $(LibDir)/libcrtend.a
3131 all:: $(CRTEND_A)
3232
3333 # Installation simply requires copying the archive to it's new home.
3434 $(bytecode_libdir)/libcrtend.a: $(CRTEND_A) $(bytecode_libdir)
35 @$(ECHO) Installing $(CRTEND_A)
36 $(VERB) $(INSTALL) $(CRTEND_A) $(bytecode_libdir)
35 $(Echo) Installing $(CRTEND_A)
36 $(Verb) $(INSTALL) $(CRTEND_A) $(bytecode_libdir)
3737
3838 install:: $(DESTDIR)$(bytecode_libdir)/libcrtend.a
3939 install-bytecode:: $(DESTDIR)$(bytecode_libdir)/libcrtend.a
4040
4141
42 # The four components described in the README
42 # The three components described in the README
4343 Components := main genericeh sjljeh
44 ComponentLibs := $(Components:%=$(OBJDIR)/comp_%.bc)
44 ComponentLibs := $(Components:%=$(ObjDir)/comp_%.bc)
4545
4646
4747 # We build libcrtend.a from the four components described in the README.
48 $(CRTEND_A) : $(ComponentLibs) $(LIBDIR)/.dir
49 @$(ECHO) Building final libcrtend.a file from components
50 $(VERB) $(Archive) $@ $(ComponentLibs)
48 $(CRTEND_A) : $(ComponentLibs) $(LibDir)/.dir
49 $(Echo) Building final libcrtend.a file from components
50 $(Verb) $(Archive) $@ $(ComponentLibs)
5151
52 MainObj := $(OBJDIR)/crtend.bc $(OBJDIR)/listend.bc
53 GenericEHObj := $(OBJDIR)/Exception.bc
54 SJLJEHObj := $(OBJDIR)/SJLJ-Exception.bc
52 MainObj := $(ObjDir)/crtend.bc $(ObjDir)/listend.bc
53 GenericEHObj := $(ObjDir)/Exception.bc
54 SJLJEHObj := $(ObjDir)/SJLJ-Exception.bc
5555
5656 # __main and ctor/dtor support component
57 $(OBJDIR)/comp_main.bc: $(MainObj)
58 @$(ECHO) Linking $(notdir $@) component...
59 $(VERB) $(GCCLD) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_main.lst $(MainObj) -o $@
57 $(ObjDir)/comp_main.bc: $(MainObj)
58 $(Echo) Linking $(notdir $@) component...
59 $(Verb) $(GCCLD) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_main.lst $(MainObj) -o $@
6060
6161 # Generic exception handling support runtime.
62 $(OBJDIR)/comp_genericeh.bc: $(GenericEHObj)
63 @$(ECHO) Linking $(notdir $@) component...
64 $(VERB) $(GCCLD) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_genericeh.lst $(GenericEHObj) -o $@
62 $(ObjDir)/comp_genericeh.bc: $(GenericEHObj)
63 $(Echo) Linking $(notdir $@) component...
64 $(Verb) $(GCCLD) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_genericeh.lst $(GenericEHObj) -o $@
6565
6666 # setjmp/longjmp exception handling support runtime.
67 $(OBJDIR)/comp_sjljeh.bc: $(SJLJEHObj)
68 @$(ECHO) Linking $(notdir $@) component...
69 $(VERB) $(GCCLD) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_sjljeh.lst $(SJLJEHObj) -o $@
67 $(ObjDir)/comp_sjljeh.bc: $(SJLJEHObj)
68 $(Echo) Linking $(notdir $@) component...
69 $(Verb) $(GCCLD) -link-as-library -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_sjljeh.lst $(SJLJEHObj) -o $@
4343 #
4444 CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \
4545 -c "buildroot=$(LLVM_OBJ_ROOT)" \
46 -c "buildtype=$(CONFIGURATION)" \
46 -c "buildtype=$(Configuration)" \
4747 -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \
4848 -c "coresize=0" \
4949 -c "cc=$(CC)" \
88 LEVEL = ../..
99 LIBRARYNAME = LLVMexecve
1010 SHARED_LIBRARY = 1
11 DONT_BUILD_RELINKED = 1
1112 include $(LEVEL)/Makefile.common
1213
1314 all:: llee
1415
15 llee: $(TOOLDIR)/llee
16 llee: $(ToolDir)/llee
1617
17 $(TOOLDIR)/llee: Makefile
18 @$(ECHO) Constructing llee shell script
19 $(VERB) echo exec env LD_PRELOAD=$(LIBDIR)/libLLVMexecve$(SHLIBEXT) $$\* > $@
20 $(VERB) chmod u+x $@
18 $(ToolDir)/llee: Makefile
19 $(Echo) Constructing llee shell script
20 $(Verb) echo exec env LD_PRELOAD=$(LibDir)/libexecve$(SHLIBEXT) $$\* > $@
21 $(Verb) chmod u+x $@
2122
2223 clean::
23 $(VERB) rm -f $(TOOLDIR)/llee
24 $(Verb) rm -f $(ToolDir)/llee
77 ##===----------------------------------------------------------------------===##
88 LEVEL = ../..
99 TOOLNAME = burg
10 BUILT_SOURCES = gram.tab.c
10 BUILT_SOURCES = gram.tab.c gram.tab.h
1111
1212 EXTRA_DIST = gram.yc gram.tab.c gram.tab.h sample.gr
1313
1414 include $(LEVEL)/Makefile.common
1515
1616 gram.tab.c gram.tab.h: gram.yc
17 $(VERB) $(BISON) -o gram.tab.c -d $<
17 $(Verb) $(BISON) -o gram.tab.c -d $<
1818
19 $(OBJDIR)/lex.o : gram.tab.h
19 $(ObjDir)/lex.o : gram.tab.h
2020
2121 clean::
22 $(VERB) $(RM) -rf gram.tab.h gram.tab.c core* *.aux *.log *.dvi sample sample.c tmp
23
24 #$(BUILD_OBJ_DIR)/Release/lex.o $(BUILD_OBJ_DIR)/Profile/lex.o $(BUILD_OBJ_DIR)/Debug/lex.o: gram.tab.h
22 $(Verb) $(RM) -rf gram.tab.h gram.tab.c core* *.aux *.log *.dvi sample sample.c tmp
2523
2624 doc.dvi: doc.tex
27 $(VERB) latex doc; latex doc
25 $(Verb) latex doc; latex doc
2826
29
30 test:: $(TOOLEXENAME_G) sample.gr
31 $(TOOLEXENAME_G) -I sample.c && $(CC) $(CFLAGS) -o sample sample.c && ./sample
32 $(TOOLEXENAME_G) -I sample.gr >tmp && cmp tmp sample.c
33 $(TOOLEXENAME_G) -I
34 $(TOOLEXENAME_G) -I sample.gr -o tmp && cmp tmp sample.c
35 $(TOOLEXENAME_G) -I -O0 tmp && cmp tmp sample.c
36 $(TOOLEXENAME_G) -I -= tmp && cmp tmp sample.c
27 check:: $(ToolBuildPath) $(BUILD_SRC_DIR)/sample.gr
28 $(ToolBuildPath) -I <$(BUILD_SRC_DIR)/sample.gr >sample.c \
29 && $(CC) $(CFLAGS) -o sample sample.c && ./sample
30 $(ToolBuildPath) -I $(BUILD_SRC_DIR)/sample.gr >tmp \
31 && cmp tmp sample.c
32 $(ToolBuildPath) -I <$(BUILD_SRC_DIR)/sample.gr -o tmp \
33 && cmp tmp sample.c
34 $(ToolBuildPath) -I $(BUILD_SRC_DIR)/sample.gr -o tmp \
35 && cmp tmp sample.c
36 $(ToolBuildPath) -I -O0 <$(BUILD_SRC_DIR)/sample.gr >tmp \
37 && cmp tmp sample.c
38 $(ToolBuildPath) -I -= <$(BUILD_SRC_DIR)/sample.gr >tmp \
39 && cmp tmp sample.c
3740 $(RM) -f tmp sample.c
1919 FileLexer.cpp: FileParser.h
2020
2121 clean::
22 $(VERB) $(RM) -f FileParser.cpp FileParser.h FileLexer.cpp CommandLine.cpp
23 $(VERB) $(RM) -f FileParser.output
22 $(Verb) $(RM) -f FileParser.cpp FileParser.h FileLexer.cpp CommandLine.cpp
23 $(Verb) $(RM) -f FileParser.output