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