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