Some minor adjustments for the 1.5 release.
[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 LD.Flags  += -L$(LibDir) -L$(LLVMLibDir) 
347 CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
348              -I$(PROJ_OBJ_ROOT)/include \
349              -I$(PROJ_SRC_ROOT)/include \
350              -I$(LLVM_OBJ_ROOT)/include \
351              -I$(LLVM_SRC_ROOT)/include \
352              -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
353
354 Compile.C     = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
355 LTCompile.C   = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
356 BCCompile.C   = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
357                 $(C.Flags) -c
358 Compile.CXX   = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
359 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
360 BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
361                 $(CXX.Flags) -c
362 Link          = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
363                 $(CompileCommonOpts) $(LD.Flags) $(Strip)
364 Relink        = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
365                 $(CompileCommonOpts)
366 LTInstall     = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
367                 $(Install.Flags)
368 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755 
369 DataInstall   = $(INSTALL) -m 0644
370 Burg          = $(BURG) -I $(PROJ_SRC_DIR)
371 TableGen      = $(TBLGEN) -I $(PROJ_SRC_DIR)
372 Archive       = $(AR) $(AR.Flags)
373 LArchive      = $(LLVMToolDir)/llvm-ar rcsf
374 ifdef RANLIB
375 Ranlib        = $(RANLIB)
376 else
377 Ranlib        = ranlib
378 endif
379
380 #----------------------------------------------------------
381 # Get the list of source files and compute object file 
382 # names from them. 
383 #----------------------------------------------------------
384 ifdef FAKE_SOURCES
385   Sources :=
386   FakeSources := $(FAKE_SOURCES)
387   ifdef BUILT_SOURCES
388   FakeSources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
389   endif
390   BaseNameSources := $(sort $(basename $(FakeSources)))
391   ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
392   ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
393   ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
394 else
395   ifndef SOURCES
396     Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
397                $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
398                $(PROJ_SRC_DIR)/*.l))
399   else
400     Sources := $(SOURCES)
401   endif 
402
403   ifdef BUILT_SOURCES
404   Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
405   endif
406
407   BaseNameSources := $(sort $(basename $(Sources)))
408   ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
409   ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
410   ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
411 endif
412
413 ###############################################################################
414 # DIRECTORIES: Handle recursive descent of directory structure
415 ###############################################################################
416
417 #---------------------------------------------------------
418 # Provide rules to make install dirs. This must be early
419 # in the file so they get built before dependencies
420 #---------------------------------------------------------
421
422 $(PROJ_bindir):
423         $(Verb) $(MKDIR) $(PROJ_bindir)
424
425 $(PROJ_libdir):
426         $(Verb) $(MKDIR) $(PROJ_libdir)
427
428 $(PROJ_includedir):
429         $(Verb) $(MKDIR) $(PROJ_includedir)
430
431 $(PROJ_etcdir):
432         $(Verb) $(MKDIR) $(PROJ_etcdir)
433
434 # To create other directories, as needed, and timestamp their creation
435 %/.dir:
436         $(Verb) $(MKDIR) $* > /dev/null
437         $(Verb) $(DATE) > $@
438
439 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
440 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
441
442 #---------------------------------------------------------
443 # Handle the DIRS options for sequential construction
444 #---------------------------------------------------------
445
446 SubDirs := 
447 ifdef DIRS
448 SubDirs += $(DIRS)
449 $(RecursiveTargets)::
450         $(Verb) for dir in $(DIRS); do \
451           if [ ! -f $$dir/Makefile ]; then \
452             $(MKDIR) $$dir; \
453             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
454           fi; \
455           if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
456             ($(MAKE) -C $$dir $@ ) || exit 1; \
457           fi ; \
458         done
459 endif
460
461 #---------------------------------------------------------
462 # Handle the EXPERIMENTAL_DIRS options ensuring success
463 # after each directory is built.
464 #---------------------------------------------------------
465 ifdef EXPERIMENTAL_DIRS
466 $(RecursiveTargets)::
467         $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
468           if [ ! -f $$dir/Makefile ]; then \
469             $(MKDIR) $$dir; \
470             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
471           fi; \
472           if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
473             ($(MAKE) -C $$dir $@ ) || exit 0; \
474           fi ; \
475         done
476 endif
477
478 #---------------------------------------------------------
479 # Handle the PARALLEL_DIRS options for parallel construction
480 #---------------------------------------------------------
481 ifdef PARALLEL_DIRS
482
483 SubDirs += $(PARALLEL_DIRS)
484
485 # Unfortunately, this list must be maintained if new recursive targets are added
486 all      :: $(addsuffix /.makeall      ,$(PARALLEL_DIRS))
487 clean    :: $(addsuffix /.makeclean    ,$(PARALLEL_DIRS))
488 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
489 install  :: $(addsuffix /.makeinstall  ,$(PARALLEL_DIRS))
490 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
491 install-bytecode  :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
492
493 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
494
495 $(ParallelTargets) :
496         $(Verb) if [ ! -f $(@D)/Makefile ]; then \
497           $(MKDIR) $(@D); \
498           $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
499         fi; \
500         if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
501           $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) ; \
502         fi
503 endif
504
505 #---------------------------------------------------------
506 # Handle the OPTIONAL_DIRS options for directores that may
507 # or may not exist.
508 #---------------------------------------------------------
509 ifdef OPTIONAL_DIRS
510
511 SubDirs += $(OPTIONAL_DIRS)
512
513 $(RecursiveTargets)::
514         $(Verb) for dir in $(OPTIONAL_DIRS); do \
515           if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
516             if [ ! -f $$dir/Makefile ]; then \
517               $(MKDIR) $$dir; \
518               $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
519             fi; \
520             if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
521               ($(MAKE) -C$$dir $@ ) || exit 1; \
522             fi ; \
523           fi \
524         done
525 endif
526
527 #---------------------------------------------------------
528 # Handle the CONFIG_FILES options
529 #---------------------------------------------------------
530 ifdef CONFIG_FILES
531
532 install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
533         $(Echo) Installing Configuration Files To $(PROJ_etcdir)
534         $(Verb)for file in $(CONFIG_FILES); do \
535           if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
536             $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
537           elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
538             $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
539           else \
540             $(ECHO) Error: cannot find config file $${file}. ; \
541           fi \
542         done
543
544 uninstall-local::
545         $(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
546         $(Verb)for file in $(CONFIG_FILES); do \
547           $(RM) -f $(PROJ_etcdir)/$${file} ; \
548         done
549
550 endif
551
552 ###############################################################################
553 # Library Build Rules: Four ways to build a library
554 ###############################################################################
555
556 #---------------------------------------------------------
557 # Bytecode Module Targets:
558 #   If the user set MODULE_NAME then they want to build a
559 #   bytecode module from the sources. We compile all the
560 #   sources and link it together into a single bytecode
561 #   module.
562 #---------------------------------------------------------
563
564 ifdef MODULE_NAME
565 ifeq ($(strip $(LLVMGCC)),)
566 $(warning Modules require llvm-gcc but no llvm-gcc is available ****)
567 else
568
569 Module     := $(LibDir)/$(MODULE_NAME).bc
570 LinkModule := $(LLVMGCCWITHPATH) -shared -nostdlib
571
572 ifdef EXPORTED_SYMBOL_FILE
573 LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
574 endif
575
576 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
577         $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
578         $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
579
580 all-local:: $(Module)
581
582 clean-local::
583 ifneq ($(strip $(Module)),)
584         -$(Verb) $(RM) -f $(Module)
585 endif
586
587 ifdef BYTECODE_DESTINATION
588 ModuleDestDir := $(BYTECODE_DESTINATION)
589 else
590 ModuleDestDir := $(PROJ_libdir)
591 endif
592
593 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
594
595 install-module:: $(DestModule)
596 install-local:: $(DestModule)
597
598 $(DestModule): $(ModuleDestDir) $(Module) 
599         $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
600         $(Verb) $(DataInstall) $(Module) $(DestModule)
601
602 uninstall-local::
603         $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
604         -$(Verb) $(RM) -f $(DestModule)
605
606 endif
607 endif
608
609 # if we're building a library ...
610 ifdef LIBRARYNAME
611
612 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
613 LIBRARYNAME := $(strip $(LIBRARYNAME))
614 ifdef LOADABLE_MODULE
615 LibName.LA := $(LibDir)/$(LIBRARYNAME).la
616 else
617 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
618 endif
619 LibName.A  := $(LibDir)/lib$(LIBRARYNAME).a
620 LibName.O  := $(LibDir)/$(LIBRARYNAME).o
621 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
622
623 #---------------------------------------------------------
624 # Shared Library Targets:
625 #   If the user asked for a shared library to be built
626 #   with the SHARED_LIBRARY variable, then we provide
627 #   targets for building them.
628 #---------------------------------------------------------
629 ifdef SHARED_LIBRARY
630
631 all-local:: $(LibName.LA)
632
633 $(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
634         $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
635         $(Verb) $(Link) -o $@ $(ObjectsLO)
636         $(Verb) $(LTInstall) $@ $(LibDir)
637
638 clean-local::
639 ifneq ($(strip $(LibName.LA)),)
640         -$(Verb) $(RM) -f $(LibName.LA)
641 endif
642
643 DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
644
645 install-local:: $(DestSharedLib)
646
647 $(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
648         $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
649         $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
650         $(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
651
652 uninstall-local:: 
653         $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
654         -$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
655
656 endif
657
658 #---------------------------------------------------------
659 # Bytecode Library Targets:
660 #   If the user asked for a bytecode library to be built
661 #   with the BYTECODE_LIBRARY variable, then we provide 
662 #   targets for building them.
663 #---------------------------------------------------------
664 ifdef BYTECODE_LIBRARY
665 ifeq ($(strip $(LLVMGCC)),)
666 $(warning Bytecode libraries require llvm-gcc which could not be found ****)
667 else
668
669 # make the C and C++ compilers strip debug info out of bytecode libraries.
670 BCCompile.C += -Wa,-strip-debug
671 BCCompile.CXX += -Wa,-strip-debug
672
673 all-local:: $(LibName.BCA)
674
675 ifdef EXPORTED_SYMBOL_FILE
676 BCLinkLib = $(LLVMGCCWITHPATH) -shared -nostdlib -Xlinker \
677             -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
678
679 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(GCCLD) \
680                 $(LLVMToolDir)/llvm-ar
681         $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
682           "(internalize)"
683         $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
684         $(Verb) $(RM) -f $@
685         $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
686 else
687 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
688                 $(LLVMToolDir)/llvm-ar
689         $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
690         $(Verb) $(RM) -f $@
691         $(Verb) $(LArchive) $@ $(ObjectsBC)
692
693 endif
694
695 clean-local::
696 ifneq ($(strip $(LibName.BCA)),)
697         -$(Verb) $(RM) -f $(LibName.BCA)
698 endif
699
700 ifdef BYTECODE_DESTINATION
701 BytecodeDestDir := $(BYTECODE_DESTINATION)
702 else
703 BytecodeDestDir := $(PROJ_libdir)
704 endif
705
706 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a
707
708 install-bytecode-local:: $(DestBytecodeLib)
709
710 install-local:: $(DestBytecodeLib)
711
712 $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA) 
713         $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
714         $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
715
716 uninstall-local::
717         $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
718         -$(Verb) $(RM) -f $(DestBytecodeLib)
719
720 endif
721 endif
722
723 #---------------------------------------------------------
724 # ReLinked Library Targets:
725 #   If the user didn't explicitly forbid building a 
726 #   relinked then we provide targets for building them.
727 #---------------------------------------------------------
728 ifndef DONT_BUILD_RELINKED
729
730 all-local:: $(LibName.O)
731
732 $(LibName.O): $(ObjectsO) $(LibDir)/.dir
733         $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
734         $(Verb) $(Relink) -o $@ $(ObjectsO)
735
736 clean-local::
737 ifneq ($(strip $(LibName.O)),)
738         -$(Verb) $(RM) -f $(LibName.O)
739 endif
740
741 DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
742
743 install-local:: $(DestRelinkedLib)
744
745 $(DestRelinkedLib): $(PROJ_libdir) $(LibName.O)
746         $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
747         $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
748
749 uninstall-local::
750         $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
751         -$(Verb) $(RM) -f $(DestRelinkedLib)
752
753 endif
754
755 #---------------------------------------------------------
756 # Archive Library Targets:
757 #   If the user wanted a regular archive library built, 
758 #   then we provide targets for building them.
759 #---------------------------------------------------------
760 ifdef BUILD_ARCHIVE
761
762 all-local:: $(LibName.A)
763
764 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
765         $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
766         -$(Verb) $(RM) -f $@
767         $(Verb) $(Archive) $@ $(ObjectsO)
768         $(Verb) $(Ranlib) $@
769
770 clean-local::
771 ifneq ($(strip $(LibName.A)),)
772         -$(Verb) $(RM) -f $(LibName.A)
773 endif
774
775 DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
776
777 install-local:: $(DestArchiveLib)
778
779 $(DestArchiveLib): $(PROJ_libdir) $(LibName.A)
780         $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
781         $(Verb) $(MKDIR) $(PROJ_libdir)
782         $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
783
784 uninstall-local::
785         $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
786         -$(Verb) $(RM) -f $(DestArchiveLib)
787
788 endif
789
790 # endif LIBRARYNAME
791 endif 
792
793 ###############################################################################
794 # Tool Build Rules: Build executable tool based on TOOLNAME option
795 ###############################################################################
796
797 ifdef TOOLNAME
798
799 #---------------------------------------------------------
800 # Handle the special "JIT" value for LLVM_LIBS which is a
801 # shorthand for a bunch of libraries that get the correct
802 # JIT support for a tool that runs JIT.
803 #---------------------------------------------------------
804 ifeq ($(LLVMLIBS),JIT)
805
806 # Make sure we can get our own symbols in the tool
807 Link += -dlopen self
808
809 # Generic JIT libraries
810 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
811
812 # You can enable the X86 JIT on a non-X86 host by setting the flag
813 # ENABLE_X86_JIT on the make command line. If not, it will still be
814 # enabled automagically on an X86 host.
815 ifeq ($(ARCH), x86)
816   ENABLE_X86_JIT = 1
817 endif
818
819 # What the X86 JIT requires
820 ifdef ENABLE_X86_JIT
821   JIT_LIBS += LLVMX86 LLVMSelectionDAG
822 endif
823
824 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
825 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
826 # enabled automagically on an SparcV9 host.
827 ifeq ($(ARCH), Sparc)
828   ENABLE_SPARCV9_JIT = 1
829 endif
830
831 # What the Sparc JIT requires
832 ifdef ENABLE_SPARCV9_JIT
833   JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
834               LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
835               LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
836               LLVMDataStructure.a LLVMSparcV9RegAlloc
837 endif
838
839 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
840 # ENABLE_PPC_JIT on the make command line. If not, it will still be
841 # enabled automagically on an PowerPC host.
842 ifeq ($(ARCH), PowerPC)
843   ENABLE_PPC_JIT = 1
844 endif
845
846 # What the PowerPC JIT requires
847 ifdef ENABLE_PPC_JIT
848   JIT_LIBS += LLVMPowerPC LLVMSelectionDAG
849 endif
850
851 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
852             LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
853             LLVMSystem.a $(PLATFORMLIBDL)
854 endif
855
856 #---------------------------------------------------------
857 # Set up variables for building a tool.
858 #---------------------------------------------------------
859 ifdef EXAMPLE_TOOL
860 ToolBuildPath   := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
861 else
862 ToolBuildPath   := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
863 endif
864 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
865 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o,  $(ProjLibsOptions))
866 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
867 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
868 ProjUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
869 LLVMUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
870 ProjLibsPaths   := $(addprefix $(LibDir)/,$(ProjUsedLibs))
871 LLVMLibsPaths   := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
872
873 #---------------------------------------------------------
874 # Tell make that we need to rebuild subdirectories before 
875 # we can link the tool. This affects things like LLI which 
876 # has library subdirectories.
877 #---------------------------------------------------------
878 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
879
880 #---------------------------------------------------------
881 # Provide targets for building the tools
882 #---------------------------------------------------------
883 all-local:: $(ToolBuildPath)
884
885 clean-local::
886 ifneq ($(strip $(ToolBuildPath)),)
887         -$(Verb) $(RM) -f $(ToolBuildPath)
888 endif
889
890 ifdef EXAMPLE_TOOL
891 $(ToolBuildPath): $(ExmplDir)/.dir
892 else
893 $(ToolBuildPath): $(ToolDir)/.dir
894 endif
895
896 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
897         $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
898         $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
899           $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
900         $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg) 
901
902 DestTool = $(PROJ_bindir)/$(TOOLNAME)
903
904 install-local:: $(DestTool)
905
906 $(DestTool): $(PROJ_bindir) $(ToolBuildPath)
907         $(Echo) Installing $(BuildMode) $(DestTool)
908         $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
909
910 uninstall-local::
911         $(Echo) Uninstalling $(BuildMode) $(DestTool)
912         -$(Verb) $(RM) -f $(DestTool)
913
914 endif
915
916 ###############################################################################
917 # Object Build Rules: Build object files based on sources 
918 ###############################################################################
919
920 # Provide rule sets for when dependency generation is enabled
921 ifndef DISABLE_AUTO_DEPENDENCIES
922
923 #---------------------------------------------------------
924 # Create .lo files in the ObjDir directory from the .cpp and .c files...
925 #---------------------------------------------------------
926 ifdef SHARED_LIBRARY
927
928 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
929         $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
930         $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
931         then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
932         else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
933
934 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
935         $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
936         $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
937         then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
938         else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
939
940 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
941         $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
942         $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
943         then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
944         else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
945
946 #---------------------------------------------------------
947 # Create .o files in the ObjDir directory from the .cpp and .c files...
948 #---------------------------------------------------------
949 else
950
951 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
952         $(Echo) "Compiling $*.cpp for $(BuildMode) build"
953         $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
954         then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
955         else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
956
957 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
958         $(Echo) "Compiling $*.cc for $(BuildMode) build"
959         $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
960         then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
961         else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
962
963 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
964         $(Echo) "Compiling $*.c for $(BuildMode) build"
965         $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
966         then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
967         else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
968
969 endif
970
971 #---------------------------------------------------------
972 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
973 #---------------------------------------------------------
974 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
975         $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
976         $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
977         then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
978         else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
979
980 $(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
981         $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
982         $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
983         then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
984         else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
985
986 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
987         $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
988         $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
989         then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
990         else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
991
992 # Provide alternate rule sets if dependencies are disabled
993 else
994
995 ifdef SHARED_LIBRARY
996
997 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
998         $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
999         $(LTCompile.CXX) $< -o $@ 
1000
1001 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1002         $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
1003         $(LTCompile.CXX) $< -o $@ 
1004
1005 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1006         $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
1007         $(LTCompile.C) $< -o $@ 
1008
1009 else
1010
1011 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1012         $(Echo) "Compiling $*.cpp for $(BuildMode) build"
1013         $(Compile.CXX) $< -o $@ 
1014
1015 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1016         $(Echo) "Compiling $*.cc for $(BuildMode) build"
1017         $(Compile.CXX) $< -o $@ 
1018
1019 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1020         $(Echo) "Compiling $*.c for $(BuildMode) build"
1021         $(Compile.C) $< -o $@ 
1022 endif
1023
1024 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1025         $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1026         $(BCCompile.CXX) $< -o $@ 
1027
1028 $(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1029         $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1030         $(BCCompile.CXX) $< -o $@ 
1031
1032 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1033         $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1034         $(BCCompile.C) $< -o $@
1035
1036 endif
1037
1038 #---------------------------------------------------------
1039 # Provide rule to build .bc files from .ll sources,
1040 # regardless of dependencies
1041 #---------------------------------------------------------
1042 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1043         $(Echo) "Compiling $*.ll for $(BuildMode) build"
1044         $(Verb) $(LLVMAS) $< -f -o $@
1045
1046 ###############################################################################
1047 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1048 ###############################################################################
1049
1050 ifdef TARGET
1051
1052 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
1053 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1054 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1055 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1056
1057 # All of these files depend on tblgen and the .td files.
1058 $(INCTMPFiles) : $(TBLGEN) $(TDFiles)
1059
1060 # INCFiles rule: All of the tblgen generated files are emitted to 
1061 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc.  This allows
1062 # us to only "touch" the real file if the contents of it change.  IOW, if
1063 # tblgen is modified, all of the .inc.tmp files are regereated, but no
1064 # dependencies of the .inc files are, unless the contents of the .inc file
1065 # changes.
1066 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1067         $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1068
1069 $(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
1070 $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
1071         $(Echo) "Building $(<F) register names with tblgen"
1072         $(Verb) $(TableGen) -gen-register-enums -o $@ $<
1073
1074 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
1075 $(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
1076         $(Echo) "Building $(<F) register information header with tblgen"
1077         $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
1078
1079 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1080 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
1081         $(Echo) "Building $(<F) register info implementation with tblgen"
1082         $(Verb) $(TableGen) -gen-register-desc -o $@ $<
1083
1084 $(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
1085 $(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
1086         $(Echo) "Building $(<F) instruction names with tblgen"
1087         $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
1088
1089 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1090 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
1091         $(Echo) "Building $(<F) instruction information with tblgen"
1092         $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
1093
1094 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1095 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
1096         $(Echo) "Building $(<F) assembly writer with tblgen"
1097         $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
1098
1099 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1100 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
1101         $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1102         $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $< 
1103
1104 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1105 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
1106         $(Echo) "Building $(<F) code emitter with tblgen"
1107         $(Verb) $(TableGen) -gen-emitter -o $@ $<
1108
1109 clean-local::
1110         -$(Verb) $(RM) -f $(INCFiles)
1111
1112 endif
1113
1114 ###############################################################################
1115 # LEX AND YACC: Provide rules for generating sources with lex and yacc
1116 ###############################################################################
1117
1118 #---------------------------------------------------------
1119 # Provide rules for generating a .cpp source file from 
1120 # (f)lex input sources. 
1121 #---------------------------------------------------------
1122
1123 LexFiles  := $(filter %.l,$(Sources))
1124
1125 ifneq ($(LexFiles),)
1126
1127 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
1128
1129 .PRECIOUS: $(LexOutput)
1130
1131 # Note the extra sed filtering here, used to cut down on the warnings emited 
1132 # by GCC.  The last line is a gross hack to work around flex aparently not 
1133 # being able to resize the buffer on a large token input.  Currently, for 
1134 # uninitialized string buffers in LLVM we can generate very long tokens, so 
1135 # this is a hack around it.
1136 # FIXME.  (f.e. char Buffer[10000] )
1137 %.cpp: %.l
1138         $(Echo) Flexing $*.l
1139         $(Verb) $(FLEX) -t $< | \
1140         $(SED) 's/void yyunput/inline void yyunput/' | \
1141         $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
1142         $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
1143           > $@
1144
1145 clean-local::
1146         -$(Verb) $(RM) -f $(LexOutput)
1147         $(Verb) $(RM) -f $(LexOutput)
1148
1149 endif
1150
1151 #---------------------------------------------------------
1152 # Provide rules for generating a .cpp and .h source files 
1153 # from yacc (bison) input sources.
1154 #---------------------------------------------------------
1155
1156 YaccFiles  := $(filter %.y,$(Sources))
1157 ifneq ($(YaccFiles),)
1158 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
1159
1160 .PRECIOUS: $(YaccOutput)
1161
1162 # Cancel built-in rules for yacc
1163 %.c: %.y 
1164 %.cpp: %.y
1165 %.h: %.y
1166
1167 # Rule for building the bison parsers...
1168 %.cpp %.h : %.y
1169         $(Echo) "Bisoning $*.y"
1170         $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c  $<
1171         $(Verb) $(MV) -f $*.tab.c $*.cpp
1172         $(Verb) $(MV) -f $*.tab.h $*.h
1173
1174 clean-local::
1175         -$(Verb) $(RM) -f $(YaccOutput)
1176         $(Verb) $(RM) -f $(YaccOutput)
1177 endif
1178
1179 ###############################################################################
1180 # OTHER RULES: Other rules needed
1181 ###############################################################################
1182
1183 # To create postscript files from dot files...
1184 ifneq ($(DOT),false)
1185 %.ps: %.dot
1186         $(DOT) -Tps < $< > $@
1187 else
1188 %.ps: %.dot
1189         $(Echo) "Cannot build $@: The program dot is not installed"
1190 endif
1191
1192 # This rules ensures that header files that are removed still have a rule for
1193 # which they can be "generated."  This allows make to ignore them and
1194 # reproduce the dependency lists.
1195 %.h:: ;
1196 %.hpp:: ;
1197
1198 # Define clean-local to clean the current directory. Note that this uses a
1199 # very conservative approach ensuring that empty variables do not cause 
1200 # errors or disastrous removal.
1201 clean-local::
1202 ifneq ($(strip $(ObjDir)),)
1203         -$(Verb) $(RM) -rf $(ObjDir)
1204 endif
1205         -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1206 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1207         -$(Verb) $(RM) -f *$(SHLIBEXT)
1208 endif
1209
1210 clean-all-local::
1211         -$(Verb) $(RM) -rf Debug Release Profile
1212
1213 # Build tags database for Emacs/Xemacs:
1214 tags:: TAGS CTAGS
1215
1216 TAGS: 
1217         find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1218           $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1219           $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1220           $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
1221         -name '*.cpp' -o -name '*.h' | \
1222         $(ETAGS) $(ETAGSFLAGS) -
1223
1224 CTAGS:
1225         find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1226           $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1227           $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1228           $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
1229           \( -name '*.cpp' -o -name '*.h' \) -print | \
1230           ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L -
1231
1232
1233 ###############################################################################
1234 # DEPENDENCIES: Include the dependency files if we should
1235 ###############################################################################
1236 ifndef DISABLE_AUTO_DEPENDENCIES
1237
1238 # If its not one of the cleaning targets
1239 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1240
1241 # Get the list of dependency files
1242 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1243 DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1244
1245 -include /dev/null $(DependFiles)
1246
1247 endif
1248
1249 endif 
1250
1251 ###############################################################################
1252 # CHECK: Running the test suite
1253 ###############################################################################
1254
1255 check::
1256         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1257           if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1258             $(EchoCmd) Running test suite ; \
1259             $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1260               TESTSUITE=$(TESTSUITE) ; \
1261           else \
1262             $(EchoCmd) No Makefile in test directory ; \
1263           fi ; \
1264         else \
1265           $(EchoCmd) No test directory ; \
1266         fi
1267
1268 ###############################################################################
1269 # DISTRIBUTION: Handle construction of a distribution tarball
1270 ###############################################################################
1271
1272 #------------------------------------------------------------------------
1273 # Define distribution related variables
1274 #------------------------------------------------------------------------
1275 DistName    := $(PROJECT_NAME)-$(PROJ_VERSION)
1276 DistDir     := $(PROJ_OBJ_ROOT)/$(DistName)
1277 TopDistDir  := $(PROJ_OBJ_ROOT)/$(DistName)
1278 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1279 DistZip     := $(PROJ_OBJ_ROOT)/$(DistName).zip
1280 DistTarBZ2  := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1281 DistAlways  := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1282                ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1283                Makefile.config.in configure autoconf
1284 DistOther   := $(notdir $(wildcard \
1285                $(PROJ_SRC_DIR)/*.h \
1286                $(PROJ_SRC_DIR)/*.td \
1287                $(PROJ_SRC_DIR)/*.def \
1288                $(PROJ_SRC_DIR)/*.ll \
1289                $(PROJ_SRC_DIR)/*.in))
1290 DistSubDirs := $(SubDirs)
1291 DistSources  = $(Sources) $(EXTRA_DIST)
1292 DistFiles    = $(DistAlways) $(DistSources) $(DistOther)
1293
1294 #------------------------------------------------------------------------
1295 # We MUST build distribution with OBJ_DIR != SRC_DIR
1296 #------------------------------------------------------------------------
1297 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1298 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1299         $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1300
1301 else
1302
1303 #------------------------------------------------------------------------
1304 # Prevent attempt to run dist targets from anywhere but the top level
1305 #------------------------------------------------------------------------
1306 ifneq ($(LEVEL),.)
1307 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1308         $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1309 else
1310
1311 #------------------------------------------------------------------------
1312 # Provide the top level targets
1313 #------------------------------------------------------------------------
1314
1315 dist-gzip:: $(DistTarGZip)
1316
1317 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1318         $(Echo) Packing gzipped distribution tar file.
1319         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1320           $(GZIP) -c > "$(DistTarGZip)"
1321
1322 dist-bzip2:: $(DistTarBZ2)
1323
1324 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1325         $(Echo) Packing bzipped distribution tar file.
1326         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1327           $(BZIP2) -c >$(DistTarBZ2)
1328
1329 dist-zip:: $(DistZip)
1330
1331 $(DistZip) : $(TopDistDir)/.makedistdir
1332         $(Echo) Packing zipped distribution file.
1333         $(Verb) rm -f $(DistZip)
1334         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1335
1336 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip) 
1337         $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1338
1339 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1340
1341 dist-check:: $(DistTarGZip)
1342         $(Echo) Checking distribution tar file.
1343         $(Verb) if test -d $(DistCheckDir) ; then \
1344           $(RM) -rf $(DistCheckDir) ; \
1345         fi
1346         $(Verb) $(MKDIR) $(DistCheckDir)
1347         $(Verb) cd $(DistCheckDir) && \
1348           $(MKDIR) $(DistCheckDir)/build && \
1349           $(MKDIR) $(DistCheckDir)/install && \
1350           gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1351           cd build && \
1352           ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1353             --srcdir=../$(DistName) && \
1354           $(MAKE) all && \
1355           $(MAKE) check && \
1356           $(MAKE) install && \
1357           $(MAKE) uninstall && \
1358           $(MAKE) dist && \
1359           $(MAKE) clean && \
1360           $(MAKE) dist-clean && \
1361           $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1362
1363 dist-clean::
1364         $(Echo) Cleaning distribution files
1365         -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1366           $(DistCheckDir)
1367
1368 endif
1369
1370 #------------------------------------------------------------------------
1371 # Provide the recursive distdir target for building the distribution directory
1372 #------------------------------------------------------------------------
1373 distdir: $(DistDir)/.makedistdir
1374 $(DistDir)/.makedistdir: $(DistSources)
1375         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1376           if test -d "$(DistDir)" ; then \
1377             find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';'  || \
1378               exit 1 ; \
1379           fi ; \
1380           $(EchoCmd) Removing old $(DistDir) ; \
1381           $(RM) -rf $(DistDir); \
1382           $(EchoCmd) Making 'all' to verify build ; \
1383           $(MAKE) all ; \
1384         fi
1385         $(Echo) Building Distribution Directory $(DistDir)
1386         $(Verb) $(MKDIR) $(DistDir) 
1387         $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1388         srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
1389         for file in $(DistFiles) ; do \
1390           case "$$file" in \
1391             $(PROJ_SRC_DIR)/*) \
1392               file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1393               ;; \
1394             $(PROJ_SRC_ROOT)/*) \
1395               file=`echo "$$file" | \
1396                 sed "s#^$$srcrootstrip/##"` \
1397               ;; \
1398           esac; \
1399           if test -f "$(PROJ_SRC_DIR)/$$file" || \
1400              test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1401             from_dir="$(PROJ_SRC_DIR)" ; \
1402           elif test -f "$$file" || test -d "$$file" ; then \
1403             from_dir=. ; \
1404           fi ; \
1405           to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1406           if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1407             to_dir="$(DistDir)/$$dir"; \
1408             $(MKDIR) "$$to_dir" ; \
1409           else \
1410             to_dir="$(DistDir)"; \
1411           fi; \
1412           mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1413           if test -n "$$mid_dir" ; then \
1414             $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1415           fi ; \
1416           if test -d "$$from_dir/$$file"; then \
1417             if test -d "$(PROJ_SRC_DIR)/$$file" && \
1418                test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1419               $(CP) -pR "$(PROJ_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1420             fi; \
1421             $(CP) -pR $$from_dir/$$file $$to_dir || exit 1; \
1422           elif test -f "$$from_dir/$$file" ; then \
1423             $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1424           elif test -L "$$from_dir/$$file" ; then \
1425             $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1426           elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1427             $(EchoCmd) "===== WARNING: Distribution Source " \
1428               "$$from_dir/$$file Not Found!" ; \
1429           elif test "$(Verb)" != '@' ; then \
1430             $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1431           fi; \
1432         done
1433         $(Verb) for subdir in $(DistSubDirs) ; do \
1434           if test "$$subdir" \!= "." ; then \
1435             new_distdir="$(DistDir)/$$subdir" ; \
1436             test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1437             ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || \
1438             exit 1; \
1439           fi; \
1440         done
1441         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1442           $(EchoCmd) Eliminating CVS directories from distribution ; \
1443           $(RM) -rf `find $(TopDistDir) -type d -name CVS -print` ;\
1444           $(MAKE) dist-hook ; \
1445           $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1446             -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1447             -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1448             -o ! -type d ! -perm -444 -exec \
1449               $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1450             || chmod -R a+r $(DistDir) ; \
1451         fi
1452
1453 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1454 # defined by user.
1455 dist-hook::
1456
1457 endif
1458
1459 ###############################################################################
1460 # TOP LEVEL - targets only to apply at the top level directory
1461 ###############################################################################
1462
1463 ifeq ($(LEVEL),.)
1464
1465 #------------------------------------------------------------------------
1466 # Install support for the project's include files:
1467 #------------------------------------------------------------------------
1468 install-local::
1469         $(Echo) Installing include files
1470         $(Verb) $(MKDIR) $(PROJ_includedir)
1471         $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
1472           cd $(PROJ_SRC_ROOT)/include && \
1473           for  hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
1474               -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \
1475             instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
1476             if test \! -d "$$instdir" ; then \
1477               $(EchoCmd) Making install directory $$instdir ; \
1478               $(MKDIR) $$instdir ;\
1479             fi ; \
1480             $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
1481           done ; \
1482         fi
1483         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
1484           cd $(PROJ_OBJ_ROOT)/include && \
1485           for hdr in `find . -type f -print` ; do \
1486             $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
1487           done ; \
1488         fi
1489
1490 uninstall-local::
1491         $(Echo) Uninstalling include files
1492         $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1493           cd $(PROJ_SRC_ROOT)/include && \
1494             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1495               '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \
1496               -print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
1497           cd $(PROJ_SRC_ROOT)/include && \
1498             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \
1499             | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
1500         fi
1501
1502 endif
1503
1504 #------------------------------------------------------------------------
1505 # Print out the directories used for building
1506 #------------------------------------------------------------------------
1507 printvars::
1508         $(Echo) "BuildMode    : " '$(BuildMode)'
1509         $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1510         $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1511         $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1512         $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1513         $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1514         $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1515         $(Echo) "PROJ_prefix  : " '$(PROJ_prefix)'
1516         $(Echo) "PROJ_bindir  : " '$(PROJ_bindir)'
1517         $(Echo) "PROJ_libdir  : " '$(PROJ_libdir)'
1518         $(Echo) "PROJ_etcdir  : " '$(PROJ_etcdir)'
1519         $(Echo) "PROJ_includedir  : " '$(PROJ_includedir)'
1520         $(Echo) "UserTargets  : " '$(UserTargets)'
1521         $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1522         $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1523         $(Echo) "ObjDir       : " '$(ObjDir)'
1524         $(Echo) "LibDir       : " '$(LibDir)'
1525         $(Echo) "ToolDir      : " '$(ToolDir)'
1526         $(Echo) "ExmplDir     : " '$(ExmplDir)'
1527         $(Echo) "Sources      : " '$(Sources)'
1528         $(Echo) "TDFiles      : " '$(TDFiles)'
1529         $(Echo) "INCFiles     : " '$(INCFiles)'
1530         $(Echo) "INCTMPFiles  : " '$(INCTMPFiles)'
1531         $(Echo) "PreConditions: " '$(PreConditions)'
1532         $(Echo) "Compile.CXX  : " '$(Compile.CXX)'
1533         $(Echo) "Compile.C    : " '$(Compile.C)'
1534         $(Echo) "Archive      : " '$(Archive)'
1535         $(Echo) "YaccFiles    : " '$(YaccFiles)'
1536         $(Echo) "LexFiles     : " '$(LexFiles)'
1537         $(Echo) "Module       : " '$(Module)'