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