hp-ux needs this to get through the System/Support libs
[oota-llvm.git] / Makefile.rules
1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
2 #
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
7
8 #===------------------------------------------------------------------------===#
9 #
10 # This file is included by all of the LLVM makefiles.  For details on how to use
11 # it properly, please see the document MakefileGuide.html in the docs directory.
12 #
13 #===-----------------------------------------------------------------------====
14
15 ################################################################################
16 # TARGETS: Define standard targets that can be invoked
17 ################################################################################
18
19 #--------------------------------------------------------------------
20 # Define the various target sets
21 #--------------------------------------------------------------------
22 RecursiveTargets := all clean clean-all install uninstall install-bytecode
23 LocalTargets     := all-local clean-local clean-all-local check-local \
24                     install-local printvars uninstall-local \
25                     install-bytecode-local
26 TopLevelTargets  := check dist dist-check dist-clean tags dist-gzip dist-bzip2 \
27                     dist-zip
28 UserTargets      := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
29 InternalTargets  := preconditions distdir dist-hook
30
31 ################################################################################
32 # INITIALIZATION: Basic things the makefile needs
33 ################################################################################
34
35 #--------------------------------------------------------------------
36 # Set the VPATH so that we can find source files.
37 #--------------------------------------------------------------------
38 VPATH=$(PROJ_SRC_DIR)
39
40 #--------------------------------------------------------------------
41 # Reset the list of suffixes we know how to build
42 #--------------------------------------------------------------------
43 .SUFFIXES:
44 .SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot 
45 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
46
47 #--------------------------------------------------------------------
48 # Mark all of these targets as phony to avoid implicit rule search
49 #--------------------------------------------------------------------
50 .PHONY: $(UserTargets) $(InternalTargets)
51
52 #--------------------------------------------------------------------
53 # Make sure all the user-target rules are double colon rules and 
54 # they are defined first.
55 #--------------------------------------------------------------------
56
57 $(UserTargets)::
58
59 ################################################################################
60 # PRECONDITIONS: that which must be built/checked first
61 ################################################################################
62
63 SrcMakefiles       := $(filter %Makefile %Makefile.tests,\
64                       $(wildcard $(PROJ_SRC_DIR)/Makefile*))
65 ObjMakefiles       := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
66 ConfigureScript    := $(PROJ_SRC_ROOT)/configure
67 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
68 MakefileConfigIn   := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
69 MakefileCommonIn   := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
70 MakefileConfig     := $(PROJ_OBJ_ROOT)/Makefile.config
71 MakefileCommon     := $(PROJ_OBJ_ROOT)/Makefile.common
72 PreConditions      := $(ConfigStatusScript) $(ObjMakefiles)
73 ifneq ($(MakefileCommonIn),)
74 PreConditions      += $(MakefileCommon)
75 endif
76 ifneq ($(MakefileConfigIn),)
77 PreConditions      += $(MakefileConfig)
78 endif
79
80 preconditions : $(PreConditions)
81
82 #------------------------------------------------------------------------
83 # Make sure the BUILT_SOURCES are built first
84 #------------------------------------------------------------------------
85 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
86
87 clean-local::
88 ifneq ($(strip $(BUILT_SOURCES)),)
89         -$(Verb) $(RM) -f $(BUILT_SOURCES)
90 endif
91
92 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
93 spotless:
94         $(Verb) if test -x config.status ; then \
95           $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
96           $(MKDIR) .spotless.save ; \
97           $(MV) config.status .spotless.save ; \
98           $(MV) mklib  .spotless.save ; \
99           $(MV) projects  .spotless.save ; \
100           $(RM) -rf * ; \
101           $(MV) .spotless.save/config.status . ; \
102           $(MV) .spotless.save/mklib . ; \
103           $(MV) .spotless.save/projects . ; \
104           $(RM) -rf .spotless.save ; \
105           $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
106           $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
107           $(ConfigStatusScript) ; \
108         else \
109           $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
110         fi
111 endif
112
113 $(BUILT_SOURCES) : $(ObjMakefiles)
114
115 #------------------------------------------------------------------------
116 # Make sure we're not using a stale configuration
117 #------------------------------------------------------------------------
118 reconfigure:
119         $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
120         $(Verb) cd $(PROJ_OBJ_ROOT) && \
121           if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
122             $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
123           fi ; \
124           $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
125           $(ConfigStatusScript)
126
127 .PRECIOUS: $(ConfigStatusScript)
128 $(ConfigStatusScript): $(ConfigureScript)
129         $(Echo) Reconfiguring with $<
130         $(Verb) cd $(PROJ_OBJ_ROOT) && \
131           if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
132             $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
133           fi ; \
134           $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
135           $(ConfigStatusScript)
136
137 #------------------------------------------------------------------------
138 # Make sure the configuration makefile is up to date
139 #------------------------------------------------------------------------
140 ifneq ($(MakefileConfigIn),)
141 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
142         $(Echo) Regenerating $@
143         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
144 endif
145
146 ifneq ($(MakefileCommonIn),)
147 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
148         $(Echo) Regenerating $@
149         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
150 endif
151
152 #------------------------------------------------------------------------
153 # If the Makefile in the source tree has been updated, copy it over into the
154 # build tree. But, only do this if the source and object makefiles differ
155 #------------------------------------------------------------------------
156 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
157
158 Makefile: $(PROJ_SRC_DIR)/Makefile
159         $(Echo) "Updating Makefile"
160         $(Verb) $(MKDIR) $(@D)
161         $(Verb) $(CP) -f $< $@
162
163 # Copy the Makefile.* files unless we're in the root directory which avoids
164 # the copying of Makefile.config.in or other things that should be explicitly
165 # taken care of.
166 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile%
167         @case '$?' in \
168           *Makefile.rules) ;; \
169           *.in) ;; \
170           *) $(Echo) "Updating $(@F)" ; \
171              $(MKDIR) $(@D) ; \
172              $(CP) -f $< $@ ;; \
173         esac
174          
175 endif
176
177 #------------------------------------------------------------------------
178 # Set up the basic dependencies
179 #------------------------------------------------------------------------
180 $(UserTargets):: $(PreConditions)
181
182 all:: all-local
183 clean:: clean-local 
184 clean-all:: clean-local clean-all-local
185 install:: install-local
186 uninstall:: uninstall-local
187 install-local:: all-local 
188 install-bytecode:: install-bytecode-local
189
190 ###############################################################################
191 # VARIABLES: Set up various variables based on configuration data
192 ###############################################################################
193
194 #--------------------------------------------------------------------
195 # Variables derived from configuration we are building
196 #--------------------------------------------------------------------
197
198
199 ifdef ENABLE_PROFILING
200   BuildMode := Profile
201   CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
202   C.Flags   := -O3 -DNDEBUG -pg
203   LD.Flags  := -O3 -DNDEBUG -pg 
204 else
205   ifdef ENABLE_OPTIMIZED
206     BuildMode := Release
207     # Don't use -fomit-frame-pointer on FreeBSD
208     ifneq ($(OS),FreeBSD)
209       OmitFramePointer := -fomit-frame-pointer
210     endif
211     CXX.Flags  := -O3 -DNDEBUG -finline-functions -felide-constructors \
212                   $(OmitFramePointer)
213     C.Flags    := -O3 -DNDEBUG $(OmitFramePointer)
214     LD.Flags   := -O3 -DNDEBUG 
215   else
216     BuildMode := Debug
217     CXX.Flags := -g -D_DEBUG
218     C.Flags   := -g -D_DEBUG
219     LD.Flags  := -g -D_DEBUG 
220     KEEP_SYMBOLS := 1
221   endif
222 endif
223
224 CXX.Flags += $(CXXFLAGS)
225 C.Flags   += $(CFLAGS)
226 CPP.Flags += $(CPPFLAGS)
227 LD.Flags  += $(LDFLAGS)
228 AR.Flags  := cru
229 LibTool.Flags := --tag=CXX
230
231 #Make Floating point ieee complient on alpha
232 ifeq ($(ARCH),Alpha)
233   CXX.Flags += -mieee
234   CPP.Flags += -mieee
235 endif
236
237 #--------------------------------------------------------------------
238 # Directory locations
239 #--------------------------------------------------------------------
240 ObjDir      := $(PROJ_OBJ_DIR)/$(BuildMode)
241 LibDir      := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
242 ToolDir     := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
243 ExmplDir    := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
244 LLVMLibDir  := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
245 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
246 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
247 CFERuntimeLibDir := $(LLVMGCCDIR)/lib
248
249 #--------------------------------------------------------------------
250 # Full Paths To Compiled Tools and Utilities
251 #--------------------------------------------------------------------
252 EchoCmd  = $(ECHO) llvm[$(MAKELEVEL)]:
253 Echo     = @$(EchoCmd)
254 ifndef LIBTOOL
255 LIBTOOL  := $(LLVM_OBJ_ROOT)/mklib
256 endif
257 ifndef LLVMAS
258 LLVMAS   := $(LLVMToolDir)/llvm-as$(EXEEXT)
259 endif
260 ifndef BURG
261 BURG     := $(LLVMToolDir)/burg$(EXEEXT)
262 endif
263 ifndef TBLGEN
264 TBLGEN   := $(LLVMToolDir)/tblgen$(EXEEXT)
265 endif
266 ifndef GCCAS
267 GCCAS    := $(LLVMToolDir)/gccas$(EXEEXT)
268 endif
269 ifndef GCCLD
270 GCCLD    := $(LLVMToolDir)/gccld$(EXEEXT)
271 endif
272 ifndef LDIS
273 LLVMDIS  := $(LLVMToolDir)/llvm-dis$(EXEEXT)
274 endif
275 ifndef LLI
276 LLI      := $(LLVMToolDir)/lli$(EXEEXT)
277 endif
278 ifndef LLC
279 LLC      := $(LLVMToolDir)/llc$(EXEEXT)
280 endif
281 ifndef LOPT
282 LOPT     := $(LLVMToolDir)/opt$(EXEEXT)
283 endif
284 ifndef LBUGPOINT
285 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
286 endif
287
288 LLVMGCCWITHPATH  := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
289 LLVMGXXWITHPATH  := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
290
291 #--------------------------------------------------------------------
292 # Adjust to user's request
293 #--------------------------------------------------------------------
294
295 # Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
296 # to be built. Note that if LOADABLE_MODULE is specified then the resulting
297 # shared library can be opened with dlopen
298 ifdef SHARED_LIBRARY
299   LD.Flags += -rpath $(LibDir)
300   ifdef LOADABLE_MODULE
301     LD.Flags += -module
302   endif
303 else
304   LibTool.Flags += --tag=disable-shared
305 endif
306
307 ifdef TOOL_VERBOSE
308   C.Flags += -v
309   CXX.Flags += -v
310   LD.Flags += -v
311   VERBOSE := 1
312 endif
313
314 # Adjust settings for verbose mode
315 ifndef VERBOSE
316   Verb := @
317   LibTool.Flags += --silent
318   AR.Flags += >/dev/null 2>/dev/null
319   ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
320 else
321   ConfigureScriptFLAGS := 
322 endif
323
324 # By default, strip symbol information from executable
325 ifndef KEEP_SYMBOLS
326   Strip := $(PLATFORMSTRIPOPTS)
327   StripWarnMsg := "(without symbols)"
328   Install.StripFlag += -s
329 endif
330
331 # Adjust linker flags for building an executable
332 ifdef TOOLNAME
333 ifdef EXAMPLE_TOOL
334   LD.Flags += -rpath $(ExmplDir) -export-dynamic
335 else
336   LD.Flags += -rpath $(ToolDir) -export-dynamic
337 endif
338 endif
339
340 #----------------------------------------------------------
341 # Options To Invoke Tools
342 #----------------------------------------------------------
343
344 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
345
346 ifeq ($(OS),HP-UX)
347   CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE
348 endif
349
350 LD.Flags  += -L$(LibDir) -L$(LLVMLibDir) 
351 CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
352              -I$(PROJ_OBJ_ROOT)/include \
353              -I$(PROJ_SRC_ROOT)/include \
354              -I$(LLVM_OBJ_ROOT)/include \
355              -I$(LLVM_SRC_ROOT)/include \
356              -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
357
358 Compile.C     = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
359 LTCompile.C   = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
360 BCCompile.C   = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
361                 $(C.Flags) -c
362 Compile.CXX   = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
363 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
364 BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
365                 $(CXX.Flags) -c
366 Link          = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
367                 $(CompileCommonOpts) $(LD.Flags) $(Strip)
368 Relink        = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
369                 $(CompileCommonOpts)
370 LTInstall     = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
371                 $(Install.Flags)
372 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755 
373 DataInstall   = $(INSTALL) -m 0644
374 Burg          = $(BURG) -I $(PROJ_SRC_DIR)
375 TableGen      = $(TBLGEN) -I $(PROJ_SRC_DIR)
376 Archive       = $(AR) $(AR.Flags)
377 LArchive      = $(LLVMToolDir)/llvm-ar rcsf
378 ifdef RANLIB
379 Ranlib        = $(RANLIB)
380 else
381 Ranlib        = ranlib
382 endif
383
384 #----------------------------------------------------------
385 # Get the list of source files and compute object file 
386 # names from them. 
387 #----------------------------------------------------------
388 ifdef FAKE_SOURCES
389   Sources :=
390   FakeSources := $(FAKE_SOURCES)
391   ifdef BUILT_SOURCES
392   FakeSources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
393   endif
394   BaseNameSources := $(sort $(basename $(FakeSources)))
395   ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
396   ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
397   ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
398 else
399   ifndef SOURCES
400     Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
401                $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
402                $(PROJ_SRC_DIR)/*.l))
403   else
404     Sources := $(SOURCES)
405   endif 
406
407   ifdef BUILT_SOURCES
408   Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
409   endif
410
411   BaseNameSources := $(sort $(basename $(Sources)))
412   ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
413   ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
414   ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
415 endif
416
417 ###############################################################################
418 # DIRECTORIES: Handle recursive descent of directory structure
419 ###############################################################################
420
421 #---------------------------------------------------------
422 # Provide rules to make install dirs. This must be early
423 # in the file so they get built before dependencies
424 #---------------------------------------------------------
425
426 $(PROJ_bindir):
427         $(Verb) $(MKDIR) $(PROJ_bindir)
428
429 $(PROJ_libdir):
430         $(Verb) $(MKDIR) $(PROJ_libdir)
431
432 $(PROJ_includedir):
433         $(Verb) $(MKDIR) $(PROJ_includedir)
434
435 $(PROJ_etcdir):
436         $(Verb) $(MKDIR) $(PROJ_etcdir)
437
438 # To create other directories, as needed, and timestamp their creation
439 %/.dir:
440         $(Verb) $(MKDIR) $* > /dev/null
441         $(Verb) $(DATE) > $@
442
443 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
444 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
445
446 #---------------------------------------------------------
447 # Handle the DIRS options for sequential construction
448 #---------------------------------------------------------
449
450 SubDirs := 
451 ifdef DIRS
452 SubDirs += $(DIRS)
453 $(RecursiveTargets)::
454         $(Verb) for dir in $(DIRS); do \
455           if [ ! -f $$dir/Makefile ]; then \
456             $(MKDIR) $$dir; \
457             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
458           fi; \
459           if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
460             ($(MAKE) -C $$dir $@ ) || exit 1; \
461           fi ; \
462         done
463 endif
464
465 #---------------------------------------------------------
466 # Handle the EXPERIMENTAL_DIRS options ensuring success
467 # after each directory is built.
468 #---------------------------------------------------------
469 ifdef EXPERIMENTAL_DIRS
470 $(RecursiveTargets)::
471         $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
472           if [ ! -f $$dir/Makefile ]; then \
473             $(MKDIR) $$dir; \
474             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
475           fi; \
476           if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
477             ($(MAKE) -C $$dir $@ ) || exit 0; \
478           fi ; \
479         done
480 endif
481
482 #---------------------------------------------------------
483 # Handle the PARALLEL_DIRS options for parallel construction
484 #---------------------------------------------------------
485 ifdef PARALLEL_DIRS
486
487 SubDirs += $(PARALLEL_DIRS)
488
489 # Unfortunately, this list must be maintained if new recursive targets are added
490 all      :: $(addsuffix /.makeall      ,$(PARALLEL_DIRS))
491 clean    :: $(addsuffix /.makeclean    ,$(PARALLEL_DIRS))
492 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
493 install  :: $(addsuffix /.makeinstall  ,$(PARALLEL_DIRS))
494 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
495 install-bytecode  :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
496
497 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
498
499 $(ParallelTargets) :
500         $(Verb) if [ ! -f $(@D)/Makefile ]; then \
501           $(MKDIR) $(@D); \
502           $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
503         fi; \
504         if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
505           $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) ; \
506         fi
507 endif
508
509 #---------------------------------------------------------
510 # Handle the OPTIONAL_DIRS options for directores that may
511 # or may not exist.
512 #---------------------------------------------------------
513 ifdef OPTIONAL_DIRS
514
515 SubDirs += $(OPTIONAL_DIRS)
516
517 $(RecursiveTargets)::
518         $(Verb) for dir in $(OPTIONAL_DIRS); do \
519           if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
520             if [ ! -f $$dir/Makefile ]; then \
521               $(MKDIR) $$dir; \
522               $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
523             fi; \
524             if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
525               ($(MAKE) -C$$dir $@ ) || exit 1; \
526             fi ; \
527           fi \
528         done
529 endif
530
531 #---------------------------------------------------------
532 # Handle the CONFIG_FILES options
533 #---------------------------------------------------------
534 ifdef CONFIG_FILES
535
536 install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
537         $(Echo) Installing Configuration Files To $(PROJ_etcdir)
538         $(Verb)for file in $(CONFIG_FILES); do \
539           if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
540             $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
541           elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
542             $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
543           else \
544             $(ECHO) Error: cannot find config file $${file}. ; \
545           fi \
546         done
547
548 uninstall-local::
549         $(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
550         $(Verb)for file in $(CONFIG_FILES); do \
551           $(RM) -f $(PROJ_etcdir)/$${file} ; \
552         done
553
554 endif
555
556 ###############################################################################
557 # Library Build Rules: Four ways to build a library
558 ###############################################################################
559
560 #---------------------------------------------------------
561 # Bytecode Module Targets:
562 #   If the user set MODULE_NAME then they want to build a
563 #   bytecode module from the sources. We compile all the
564 #   sources and link it together into a single bytecode
565 #   module.
566 #---------------------------------------------------------
567
568 ifdef MODULE_NAME
569 ifeq ($(strip $(LLVMGCC)),)
570 $(warning Modules require llvm-gcc but no llvm-gcc is available ****)
571 else
572
573 Module     := $(LibDir)/$(MODULE_NAME).bc
574 LinkModule := $(LLVMGCCWITHPATH) -shared -nostdlib
575
576 ifdef EXPORTED_SYMBOL_FILE
577 LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
578 endif
579
580 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
581         $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
582         $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
583
584 all-local:: $(Module)
585
586 clean-local::
587 ifneq ($(strip $(Module)),)
588         -$(Verb) $(RM) -f $(Module)
589 endif
590
591 ifdef BYTECODE_DESTINATION
592 ModuleDestDir := $(BYTECODE_DESTINATION)
593 else
594 ModuleDestDir := $(PROJ_libdir)
595 endif
596
597 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
598
599 install-module:: $(DestModule)
600 install-local:: $(DestModule)
601
602 $(DestModule): $(ModuleDestDir) $(Module) 
603         $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
604         $(Verb) $(DataInstall) $(Module) $(DestModule)
605
606 uninstall-local::
607         $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
608         -$(Verb) $(RM) -f $(DestModule)
609
610 endif
611 endif
612
613 # if we're building a library ...
614 ifdef LIBRARYNAME
615
616 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
617 LIBRARYNAME := $(strip $(LIBRARYNAME))
618 ifdef LOADABLE_MODULE
619 LibName.LA := $(LibDir)/$(LIBRARYNAME).la
620 else
621 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
622 endif
623 LibName.A  := $(LibDir)/lib$(LIBRARYNAME).a
624 LibName.O  := $(LibDir)/$(LIBRARYNAME).o
625 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
626
627 #---------------------------------------------------------
628 # Shared Library Targets:
629 #   If the user asked for a shared library to be built
630 #   with the SHARED_LIBRARY variable, then we provide
631 #   targets for building them.
632 #---------------------------------------------------------
633 ifdef SHARED_LIBRARY
634
635 all-local:: $(LibName.LA)
636
637 $(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
638         $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
639         $(Verb) $(Link) -o $@ $(ObjectsLO)
640         $(Verb) $(LTInstall) $@ $(LibDir)
641
642 clean-local::
643 ifneq ($(strip $(LibName.LA)),)
644         -$(Verb) $(RM) -f $(LibName.LA)
645 endif
646
647 DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
648
649 install-local:: $(DestSharedLib)
650
651 $(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
652         $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
653         $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
654         $(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
655
656 uninstall-local:: 
657         $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
658         -$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
659
660 endif
661
662 #---------------------------------------------------------
663 # Bytecode Library Targets:
664 #   If the user asked for a bytecode library to be built
665 #   with the BYTECODE_LIBRARY variable, then we provide 
666 #   targets for building them.
667 #---------------------------------------------------------
668 ifdef BYTECODE_LIBRARY
669 ifeq ($(strip $(LLVMGCC)),)
670 $(warning Bytecode libraries require llvm-gcc which could not be found ****)
671 else
672
673 # make the C and C++ compilers strip debug info out of bytecode libraries.
674 BCCompile.C += -Wa,-strip-debug
675 BCCompile.CXX += -Wa,-strip-debug
676
677 all-local:: $(LibName.BCA)
678
679 ifdef EXPORTED_SYMBOL_FILE
680 BCLinkLib = $(LLVMGCCWITHPATH) -shared -nostdlib -Xlinker \
681             -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
682
683 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(GCCLD) \
684                 $(LLVMToolDir)/llvm-ar
685         $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
686           "(internalize)"
687         $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
688         $(Verb) $(RM) -f $@
689         $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
690 else
691 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
692                 $(LLVMToolDir)/llvm-ar
693         $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
694         $(Verb) $(RM) -f $@
695         $(Verb) $(LArchive) $@ $(ObjectsBC)
696
697 endif
698
699 clean-local::
700 ifneq ($(strip $(LibName.BCA)),)
701         -$(Verb) $(RM) -f $(LibName.BCA)
702 endif
703
704 ifdef BYTECODE_DESTINATION
705 BytecodeDestDir := $(BYTECODE_DESTINATION)
706 else
707 BytecodeDestDir := $(PROJ_libdir)
708 endif
709
710 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a
711
712 install-bytecode-local:: $(DestBytecodeLib)
713
714 install-local:: $(DestBytecodeLib)
715
716 $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA) 
717         $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
718         $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
719
720 uninstall-local::
721         $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
722         -$(Verb) $(RM) -f $(DestBytecodeLib)
723
724 endif
725 endif
726
727 #---------------------------------------------------------
728 # ReLinked Library Targets:
729 #   If the user didn't explicitly forbid building a 
730 #   relinked then we provide targets for building them.
731 #---------------------------------------------------------
732 ifndef DONT_BUILD_RELINKED
733
734 all-local:: $(LibName.O)
735
736 $(LibName.O): $(ObjectsO) $(LibDir)/.dir
737         $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
738         $(Verb) $(Relink) -o $@ $(ObjectsO)
739
740 clean-local::
741 ifneq ($(strip $(LibName.O)),)
742         -$(Verb) $(RM) -f $(LibName.O)
743 endif
744
745 DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
746
747 install-local:: $(DestRelinkedLib)
748
749 $(DestRelinkedLib): $(PROJ_libdir) $(LibName.O)
750         $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
751         $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
752
753 uninstall-local::
754         $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
755         -$(Verb) $(RM) -f $(DestRelinkedLib)
756
757 endif
758
759 #---------------------------------------------------------
760 # Archive Library Targets:
761 #   If the user wanted a regular archive library built, 
762 #   then we provide targets for building them.
763 #---------------------------------------------------------
764 ifdef BUILD_ARCHIVE
765
766 all-local:: $(LibName.A)
767
768 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
769         $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
770         -$(Verb) $(RM) -f $@
771         $(Verb) $(Archive) $@ $(ObjectsO)
772         $(Verb) $(Ranlib) $@
773
774 clean-local::
775 ifneq ($(strip $(LibName.A)),)
776         -$(Verb) $(RM) -f $(LibName.A)
777 endif
778
779 DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
780
781 install-local:: $(DestArchiveLib)
782
783 $(DestArchiveLib): $(PROJ_libdir) $(LibName.A)
784         $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
785         $(Verb) $(MKDIR) $(PROJ_libdir)
786         $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
787
788 uninstall-local::
789         $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
790         -$(Verb) $(RM) -f $(DestArchiveLib)
791
792 endif
793
794 # endif LIBRARYNAME
795 endif 
796
797 ###############################################################################
798 # Tool Build Rules: Build executable tool based on TOOLNAME option
799 ###############################################################################
800
801 ifdef TOOLNAME
802
803 #---------------------------------------------------------
804 # Handle the special "JIT" value for LLVM_LIBS which is a
805 # shorthand for a bunch of libraries that get the correct
806 # JIT support for a tool that runs JIT.
807 #---------------------------------------------------------
808 ifeq ($(LLVMLIBS),JIT)
809
810 # Make sure we can get our own symbols in the tool
811 Link += -dlopen self
812
813 # Generic JIT libraries
814 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
815
816 # You can enable the X86 JIT on a non-X86 host by setting the flag
817 # ENABLE_X86_JIT on the make command line. If not, it will still be
818 # enabled automagically on an X86 host.
819 ifeq ($(ARCH), x86)
820   ENABLE_X86_JIT = 1
821 endif
822
823 # What the X86 JIT requires
824 ifdef ENABLE_X86_JIT
825   JIT_LIBS += LLVMX86 LLVMSelectionDAG
826 endif
827
828 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
829 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
830 # enabled automagically on an SparcV9 host.
831 ifeq ($(ARCH), Sparc)
832   ENABLE_SPARCV9_JIT = 1
833 endif
834
835 # What the Sparc JIT requires
836 ifdef ENABLE_SPARCV9_JIT
837   JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
838               LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
839               LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
840               LLVMDataStructure.a LLVMSparcV9RegAlloc
841 endif
842
843 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
844 # ENABLE_PPC_JIT on the make command line. If not, it will still be
845 # enabled automagically on an PowerPC host.
846 ifeq ($(ARCH), PowerPC)
847   ENABLE_PPC_JIT = 1
848 endif
849
850 # What the PowerPC JIT requires
851 ifdef ENABLE_PPC_JIT
852   JIT_LIBS += LLVMPowerPC LLVMSelectionDAG
853 endif
854
855 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
856             LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
857             LLVMSystem.a $(PLATFORMLIBDL)
858 endif
859
860 #---------------------------------------------------------
861 # Set up variables for building a tool.
862 #---------------------------------------------------------
863 ifdef EXAMPLE_TOOL
864 ToolBuildPath   := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
865 else
866 ToolBuildPath   := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
867 endif
868 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
869 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o,  $(ProjLibsOptions))
870 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
871 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
872 ProjUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
873 LLVMUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
874 ProjLibsPaths   := $(addprefix $(LibDir)/,$(ProjUsedLibs))
875 LLVMLibsPaths   := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
876
877 #---------------------------------------------------------
878 # Tell make that we need to rebuild subdirectories before 
879 # we can link the tool. This affects things like LLI which 
880 # has library subdirectories.
881 #---------------------------------------------------------
882 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
883
884 #---------------------------------------------------------
885 # Provide targets for building the tools
886 #---------------------------------------------------------
887 all-local:: $(ToolBuildPath)
888
889 clean-local::
890 ifneq ($(strip $(ToolBuildPath)),)
891         -$(Verb) $(RM) -f $(ToolBuildPath)
892 endif
893
894 ifdef EXAMPLE_TOOL
895 $(ToolBuildPath): $(ExmplDir)/.dir
896 else
897 $(ToolBuildPath): $(ToolDir)/.dir
898 endif
899
900 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
901         $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
902         $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
903           $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
904         $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg) 
905
906 DestTool = $(PROJ_bindir)/$(TOOLNAME)
907
908 install-local:: $(DestTool)
909
910 $(DestTool): $(PROJ_bindir) $(ToolBuildPath)
911         $(Echo) Installing $(BuildMode) $(DestTool)
912         $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
913
914 uninstall-local::
915         $(Echo) Uninstalling $(BuildMode) $(DestTool)
916         -$(Verb) $(RM) -f $(DestTool)
917
918 endif
919
920 ###############################################################################
921 # Object Build Rules: Build object files based on sources 
922 ###############################################################################
923
924 # Provide rule sets for when dependency generation is enabled
925 ifndef DISABLE_AUTO_DEPENDENCIES
926
927 #---------------------------------------------------------
928 # Create .lo files in the ObjDir directory from the .cpp and .c files...
929 #---------------------------------------------------------
930 ifdef SHARED_LIBRARY
931
932 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
933         $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
934         $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
935         then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
936         else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
937
938 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
939         $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
940         $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
941         then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
942         else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
943
944 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
945         $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
946         $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
947         then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
948         else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
949
950 #---------------------------------------------------------
951 # Create .o files in the ObjDir directory from the .cpp and .c files...
952 #---------------------------------------------------------
953 else
954
955 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
956         $(Echo) "Compiling $*.cpp for $(BuildMode) build"
957         $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
958         then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
959         else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
960
961 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
962         $(Echo) "Compiling $*.cc for $(BuildMode) build"
963         $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
964         then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
965         else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
966
967 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
968         $(Echo) "Compiling $*.c for $(BuildMode) build"
969         $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
970         then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
971         else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
972
973 endif
974
975 #---------------------------------------------------------
976 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
977 #---------------------------------------------------------
978 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
979         $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
980         $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
981         then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
982         else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
983
984 $(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
985         $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
986         $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
987         then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
988         else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
989
990 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
991         $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
992         $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
993         then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
994         else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
995
996 # Provide alternate rule sets if dependencies are disabled
997 else
998
999 ifdef SHARED_LIBRARY
1000
1001 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1002         $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
1003         $(LTCompile.CXX) $< -o $@ 
1004
1005 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1006         $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
1007         $(LTCompile.CXX) $< -o $@ 
1008
1009 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1010         $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
1011         $(LTCompile.C) $< -o $@ 
1012
1013 else
1014
1015 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1016         $(Echo) "Compiling $*.cpp for $(BuildMode) build"
1017         $(Compile.CXX) $< -o $@ 
1018
1019 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1020         $(Echo) "Compiling $*.cc for $(BuildMode) build"
1021         $(Compile.CXX) $< -o $@ 
1022
1023 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1024         $(Echo) "Compiling $*.c for $(BuildMode) build"
1025         $(Compile.C) $< -o $@ 
1026 endif
1027
1028 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1029         $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1030         $(BCCompile.CXX) $< -o $@ 
1031
1032 $(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1033         $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1034         $(BCCompile.CXX) $< -o $@ 
1035
1036 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1037         $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1038         $(BCCompile.C) $< -o $@
1039
1040 endif
1041
1042 #---------------------------------------------------------
1043 # Provide rule to build .bc files from .ll sources,
1044 # regardless of dependencies
1045 #---------------------------------------------------------
1046 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1047         $(Echo) "Compiling $*.ll for $(BuildMode) build"
1048         $(Verb) $(LLVMAS) $< -f -o $@
1049
1050 ###############################################################################
1051 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1052 ###############################################################################
1053
1054 ifdef TARGET
1055
1056 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
1057 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1058 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1059 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1060
1061 # All of these files depend on tblgen and the .td files.
1062 $(INCTMPFiles) : $(TBLGEN) $(TDFiles)
1063
1064 # INCFiles rule: All of the tblgen generated files are emitted to 
1065 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc.  This allows
1066 # us to only "touch" the real file if the contents of it change.  IOW, if
1067 # tblgen is modified, all of the .inc.tmp files are regereated, but no
1068 # dependencies of the .inc files are, unless the contents of the .inc file
1069 # changes.
1070 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1071         $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1072
1073 $(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
1074 $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
1075         $(Echo) "Building $(<F) register names with tblgen"
1076         $(Verb) $(TableGen) -gen-register-enums -o $@ $<
1077
1078 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
1079 $(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
1080         $(Echo) "Building $(<F) register information header with tblgen"
1081         $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
1082
1083 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1084 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
1085         $(Echo) "Building $(<F) register info implementation with tblgen"
1086         $(Verb) $(TableGen) -gen-register-desc -o $@ $<
1087
1088 $(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
1089 $(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
1090         $(Echo) "Building $(<F) instruction names with tblgen"
1091         $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
1092
1093 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1094 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
1095         $(Echo) "Building $(<F) instruction information with tblgen"
1096         $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
1097
1098 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1099 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
1100         $(Echo) "Building $(<F) assembly writer with tblgen"
1101         $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
1102
1103 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1104 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
1105         $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1106         $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $< 
1107
1108 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1109 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
1110         $(Echo) "Building $(<F) code emitter with tblgen"
1111         $(Verb) $(TableGen) -gen-emitter -o $@ $<
1112
1113 clean-local::
1114         -$(Verb) $(RM) -f $(INCFiles)
1115
1116 endif
1117
1118 ###############################################################################
1119 # LEX AND YACC: Provide rules for generating sources with lex and yacc
1120 ###############################################################################
1121
1122 #---------------------------------------------------------
1123 # Provide rules for generating a .cpp source file from 
1124 # (f)lex input sources. 
1125 #---------------------------------------------------------
1126
1127 LexFiles  := $(filter %.l,$(Sources))
1128
1129 ifneq ($(LexFiles),)
1130
1131 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
1132
1133 .PRECIOUS: $(LexOutput)
1134
1135 # Note the extra sed filtering here, used to cut down on the warnings emited 
1136 # by GCC.  The last line is a gross hack to work around flex aparently not 
1137 # being able to resize the buffer on a large token input.  Currently, for 
1138 # uninitialized string buffers in LLVM we can generate very long tokens, so 
1139 # this is a hack around it.
1140 # FIXME.  (f.e. char Buffer[10000] )
1141 %.cpp: %.l
1142         $(Echo) Flexing $*.l
1143         $(Verb) $(FLEX) -t $< | \
1144         $(SED) 's/void yyunput/inline void yyunput/' | \
1145         $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
1146         $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
1147           > $@
1148
1149 clean-local::
1150         -$(Verb) $(RM) -f $(LexOutput)
1151         $(Verb) $(RM) -f $(LexOutput)
1152
1153 endif
1154
1155 #---------------------------------------------------------
1156 # Provide rules for generating a .cpp and .h source files 
1157 # from yacc (bison) input sources.
1158 #---------------------------------------------------------
1159
1160 YaccFiles  := $(filter %.y,$(Sources))
1161 ifneq ($(YaccFiles),)
1162 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
1163
1164 .PRECIOUS: $(YaccOutput)
1165
1166 # Cancel built-in rules for yacc
1167 %.c: %.y 
1168 %.cpp: %.y
1169 %.h: %.y
1170
1171 # Rule for building the bison parsers...
1172 %.cpp %.h : %.y
1173         $(Echo) "Bisoning $*.y"
1174         $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c  $<
1175         $(Verb) $(MV) -f $*.tab.c $*.cpp
1176         $(Verb) $(MV) -f $*.tab.h $*.h
1177
1178 clean-local::
1179         -$(Verb) $(RM) -f $(YaccOutput)
1180         $(Verb) $(RM) -f $(YaccOutput)
1181 endif
1182
1183 ###############################################################################
1184 # OTHER RULES: Other rules needed
1185 ###############################################################################
1186
1187 # To create postscript files from dot files...
1188 ifneq ($(DOT),false)
1189 %.ps: %.dot
1190         $(DOT) -Tps < $< > $@
1191 else
1192 %.ps: %.dot
1193         $(Echo) "Cannot build $@: The program dot is not installed"
1194 endif
1195
1196 # This rules ensures that header files that are removed still have a rule for
1197 # which they can be "generated."  This allows make to ignore them and
1198 # reproduce the dependency lists.
1199 %.h:: ;
1200 %.hpp:: ;
1201
1202 # Define clean-local to clean the current directory. Note that this uses a
1203 # very conservative approach ensuring that empty variables do not cause 
1204 # errors or disastrous removal.
1205 clean-local::
1206 ifneq ($(strip $(ObjDir)),)
1207         -$(Verb) $(RM) -rf $(ObjDir)
1208 endif
1209         -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1210 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1211         -$(Verb) $(RM) -f *$(SHLIBEXT)
1212 endif
1213
1214 clean-all-local::
1215         -$(Verb) $(RM) -rf Debug Release Profile
1216
1217 # Build tags database for Emacs/Xemacs:
1218 tags:: TAGS CTAGS
1219
1220 TAGS: 
1221         find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1222           $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1223           $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1224           $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
1225         -name '*.cpp' -o -name '*.h' | \
1226         $(ETAGS) $(ETAGSFLAGS) -
1227
1228 CTAGS:
1229         find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1230           $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1231           $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1232           $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
1233           \( -name '*.cpp' -o -name '*.h' \) -print | \
1234           ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L -
1235
1236
1237 ###############################################################################
1238 # DEPENDENCIES: Include the dependency files if we should
1239 ###############################################################################
1240 ifndef DISABLE_AUTO_DEPENDENCIES
1241
1242 # If its not one of the cleaning targets
1243 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1244
1245 # Get the list of dependency files
1246 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1247 DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1248
1249 -include /dev/null $(DependFiles)
1250
1251 endif
1252
1253 endif 
1254
1255 ###############################################################################
1256 # CHECK: Running the test suite
1257 ###############################################################################
1258
1259 check::
1260         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1261           if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1262             $(EchoCmd) Running test suite ; \
1263             $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1264               TESTSUITE=$(TESTSUITE) ; \
1265           else \
1266             $(EchoCmd) No Makefile in test directory ; \
1267           fi ; \
1268         else \
1269           $(EchoCmd) No test directory ; \
1270         fi
1271
1272 ###############################################################################
1273 # DISTRIBUTION: Handle construction of a distribution tarball
1274 ###############################################################################
1275
1276 #------------------------------------------------------------------------
1277 # Define distribution related variables
1278 #------------------------------------------------------------------------
1279 DistName    := $(PROJECT_NAME)-$(PROJ_VERSION)
1280 DistDir     := $(PROJ_OBJ_ROOT)/$(DistName)
1281 TopDistDir  := $(PROJ_OBJ_ROOT)/$(DistName)
1282 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1283 DistZip     := $(PROJ_OBJ_ROOT)/$(DistName).zip
1284 DistTarBZ2  := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1285 DistAlways  := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1286                ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1287                Makefile.config.in configure autoconf
1288 DistOther   := $(notdir $(wildcard \
1289                $(PROJ_SRC_DIR)/*.h \
1290                $(PROJ_SRC_DIR)/*.td \
1291                $(PROJ_SRC_DIR)/*.def \
1292                $(PROJ_SRC_DIR)/*.ll \
1293                $(PROJ_SRC_DIR)/*.in))
1294 DistSubDirs := $(SubDirs)
1295 DistSources  = $(Sources) $(EXTRA_DIST)
1296 DistFiles    = $(DistAlways) $(DistSources) $(DistOther)
1297
1298 #------------------------------------------------------------------------
1299 # We MUST build distribution with OBJ_DIR != SRC_DIR
1300 #------------------------------------------------------------------------
1301 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1302 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1303         $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1304
1305 else
1306
1307 #------------------------------------------------------------------------
1308 # Prevent attempt to run dist targets from anywhere but the top level
1309 #------------------------------------------------------------------------
1310 ifneq ($(LEVEL),.)
1311 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1312         $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1313 else
1314
1315 #------------------------------------------------------------------------
1316 # Provide the top level targets
1317 #------------------------------------------------------------------------
1318
1319 dist-gzip:: $(DistTarGZip)
1320
1321 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1322         $(Echo) Packing gzipped distribution tar file.
1323         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1324           $(GZIP) -c > "$(DistTarGZip)"
1325
1326 dist-bzip2:: $(DistTarBZ2)
1327
1328 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1329         $(Echo) Packing bzipped distribution tar file.
1330         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1331           $(BZIP2) -c >$(DistTarBZ2)
1332
1333 dist-zip:: $(DistZip)
1334
1335 $(DistZip) : $(TopDistDir)/.makedistdir
1336         $(Echo) Packing zipped distribution file.
1337         $(Verb) rm -f $(DistZip)
1338         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1339
1340 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip) 
1341         $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1342
1343 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1344
1345 dist-check:: $(DistTarGZip)
1346         $(Echo) Checking distribution tar file.
1347         $(Verb) if test -d $(DistCheckDir) ; then \
1348           $(RM) -rf $(DistCheckDir) ; \
1349         fi
1350         $(Verb) $(MKDIR) $(DistCheckDir)
1351         $(Verb) cd $(DistCheckDir) && \
1352           $(MKDIR) $(DistCheckDir)/build && \
1353           $(MKDIR) $(DistCheckDir)/install && \
1354           gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1355           cd build && \
1356           ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1357             --srcdir=../$(DistName) && \
1358           $(MAKE) all && \
1359           $(MAKE) check && \
1360           $(MAKE) install && \
1361           $(MAKE) uninstall && \
1362           $(MAKE) dist && \
1363           $(MAKE) clean && \
1364           $(MAKE) dist-clean && \
1365           $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1366
1367 dist-clean::
1368         $(Echo) Cleaning distribution files
1369         -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1370           $(DistCheckDir)
1371
1372 endif
1373
1374 #------------------------------------------------------------------------
1375 # Provide the recursive distdir target for building the distribution directory
1376 #------------------------------------------------------------------------
1377 distdir: $(DistDir)/.makedistdir
1378 $(DistDir)/.makedistdir: $(DistSources)
1379         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1380           if test -d "$(DistDir)" ; then \
1381             find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';'  || \
1382               exit 1 ; \
1383           fi ; \
1384           $(EchoCmd) Removing old $(DistDir) ; \
1385           $(RM) -rf $(DistDir); \
1386           $(EchoCmd) Making 'all' to verify build ; \
1387           $(MAKE) all ; \
1388         fi
1389         $(Echo) Building Distribution Directory $(DistDir)
1390         $(Verb) $(MKDIR) $(DistDir) 
1391         $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1392         srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
1393         for file in $(DistFiles) ; do \
1394           case "$$file" in \
1395             $(PROJ_SRC_DIR)/*) \
1396               file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1397               ;; \
1398             $(PROJ_SRC_ROOT)/*) \
1399               file=`echo "$$file" | \
1400                 sed "s#^$$srcrootstrip/##"` \
1401               ;; \
1402           esac; \
1403           if test -f "$(PROJ_SRC_DIR)/$$file" || \
1404              test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1405             from_dir="$(PROJ_SRC_DIR)" ; \
1406           elif test -f "$$file" || test -d "$$file" ; then \
1407             from_dir=. ; \
1408           fi ; \
1409           to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1410           if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1411             to_dir="$(DistDir)/$$dir"; \
1412             $(MKDIR) "$$to_dir" ; \
1413           else \
1414             to_dir="$(DistDir)"; \
1415           fi; \
1416           mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1417           if test -n "$$mid_dir" ; then \
1418             $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1419           fi ; \
1420           if test -d "$$from_dir/$$file"; then \
1421             if test -d "$(PROJ_SRC_DIR)/$$file" && \
1422                test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1423               $(CP) -pR "$(PROJ_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1424             fi; \
1425             $(CP) -pR $$from_dir/$$file $$to_dir || exit 1; \
1426           elif test -f "$$from_dir/$$file" ; then \
1427             $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1428           elif test -L "$$from_dir/$$file" ; then \
1429             $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1430           elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1431             $(EchoCmd) "===== WARNING: Distribution Source " \
1432               "$$from_dir/$$file Not Found!" ; \
1433           elif test "$(Verb)" != '@' ; then \
1434             $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1435           fi; \
1436         done
1437         $(Verb) for subdir in $(DistSubDirs) ; do \
1438           if test "$$subdir" \!= "." ; then \
1439             new_distdir="$(DistDir)/$$subdir" ; \
1440             test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1441             ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || \
1442             exit 1; \
1443           fi; \
1444         done
1445         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1446           $(EchoCmd) Eliminating CVS directories from distribution ; \
1447           $(RM) -rf `find $(TopDistDir) -type d -name CVS -print` ;\
1448           $(MAKE) dist-hook ; \
1449           $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1450             -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1451             -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1452             -o ! -type d ! -perm -444 -exec \
1453               $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1454             || chmod -R a+r $(DistDir) ; \
1455         fi
1456
1457 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1458 # defined by user.
1459 dist-hook::
1460
1461 endif
1462
1463 ###############################################################################
1464 # TOP LEVEL - targets only to apply at the top level directory
1465 ###############################################################################
1466
1467 ifeq ($(LEVEL),.)
1468
1469 #------------------------------------------------------------------------
1470 # Install support for the project's include files:
1471 #------------------------------------------------------------------------
1472 install-local::
1473         $(Echo) Installing include files
1474         $(Verb) $(MKDIR) $(PROJ_includedir)
1475         $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
1476           cd $(PROJ_SRC_ROOT)/include && \
1477           for  hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
1478               -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \
1479             instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
1480             if test \! -d "$$instdir" ; then \
1481               $(EchoCmd) Making install directory $$instdir ; \
1482               $(MKDIR) $$instdir ;\
1483             fi ; \
1484             $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
1485           done ; \
1486         fi
1487         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
1488           cd $(PROJ_OBJ_ROOT)/include && \
1489           for hdr in `find . -type f -print` ; do \
1490             $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
1491           done ; \
1492         fi
1493
1494 uninstall-local::
1495         $(Echo) Uninstalling include files
1496         $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1497           cd $(PROJ_SRC_ROOT)/include && \
1498             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1499               '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \
1500               -print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
1501           cd $(PROJ_SRC_ROOT)/include && \
1502             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \
1503             | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
1504         fi
1505
1506 endif
1507
1508 #------------------------------------------------------------------------
1509 # Print out the directories used for building
1510 #------------------------------------------------------------------------
1511 printvars::
1512         $(Echo) "BuildMode    : " '$(BuildMode)'
1513         $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1514         $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1515         $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1516         $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1517         $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1518         $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1519         $(Echo) "PROJ_prefix  : " '$(PROJ_prefix)'
1520         $(Echo) "PROJ_bindir  : " '$(PROJ_bindir)'
1521         $(Echo) "PROJ_libdir  : " '$(PROJ_libdir)'
1522         $(Echo) "PROJ_etcdir  : " '$(PROJ_etcdir)'
1523         $(Echo) "PROJ_includedir  : " '$(PROJ_includedir)'
1524         $(Echo) "UserTargets  : " '$(UserTargets)'
1525         $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1526         $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1527         $(Echo) "ObjDir       : " '$(ObjDir)'
1528         $(Echo) "LibDir       : " '$(LibDir)'
1529         $(Echo) "ToolDir      : " '$(ToolDir)'
1530         $(Echo) "ExmplDir     : " '$(ExmplDir)'
1531         $(Echo) "Sources      : " '$(Sources)'
1532         $(Echo) "TDFiles      : " '$(TDFiles)'
1533         $(Echo) "INCFiles     : " '$(INCFiles)'
1534         $(Echo) "INCTMPFiles  : " '$(INCTMPFiles)'
1535         $(Echo) "PreConditions: " '$(PreConditions)'
1536         $(Echo) "Compile.CXX  : " '$(Compile.CXX)'
1537         $(Echo) "Compile.C    : " '$(Compile.C)'
1538         $(Echo) "Archive      : " '$(Archive)'
1539         $(Echo) "YaccFiles    : " '$(YaccFiles)'
1540         $(Echo) "LexFiles     : " '$(LexFiles)'
1541         $(Echo) "Module       : " '$(Module)'