Remove dead code from the makefile build system.
[oota-llvm.git] / projects / sample / Makefile.llvm.rules
1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
2 #
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file is distributed under the University of Illinois Open Source
6 # 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                     unitcheck
24 LocalTargets     := all-local clean-local clean-all-local check-local \
25                     install-local printvars uninstall-local \
26                     install-bytecode-local
27 TopLevelTargets  := check dist dist-check dist-clean dist-gzip dist-bzip2 \
28                     dist-zip unittests
29 UserTargets      := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
30 InternalTargets  := preconditions distdir dist-hook
31
32 ################################################################################
33 # INITIALIZATION: Basic things the makefile needs
34 ################################################################################
35
36 #--------------------------------------------------------------------
37 # Set the VPATH so that we can find source files.
38 #--------------------------------------------------------------------
39 VPATH=$(PROJ_SRC_DIR)
40
41 #--------------------------------------------------------------------
42 # Reset the list of suffixes we know how to build.
43 #--------------------------------------------------------------------
44 .SUFFIXES:
45 .SUFFIXES: .c .cpp .cc .h .hpp .o .a .td .ps .dot .m .mm
46 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
47
48 #--------------------------------------------------------------------
49 # Mark all of these targets as phony to avoid implicit rule search
50 #--------------------------------------------------------------------
51 .PHONY: $(UserTargets) $(InternalTargets)
52
53 #--------------------------------------------------------------------
54 # Make sure all the user-target rules are double colon rules and
55 # they are defined first.
56 #--------------------------------------------------------------------
57
58 $(UserTargets)::
59
60 ################################################################################
61 # PRECONDITIONS: that which must be built/checked first
62 ################################################################################
63
64 SrcMakefiles       := $(filter %Makefile %Makefile.tests,\
65                       $(wildcard $(PROJ_SRC_DIR)/Makefile*))
66 ObjMakefiles       := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
67 ConfigureScript    := $(PROJ_SRC_ROOT)/configure
68 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
69 MakefileConfigIn   := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
70 MakefileCommonIn   := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
71 MakefileConfig     := $(PROJ_OBJ_ROOT)/Makefile.config
72 MakefileCommon     := $(PROJ_OBJ_ROOT)/Makefile.common
73 PreConditions      := $(ConfigStatusScript) $(ObjMakefiles)
74 ifneq ($(MakefileCommonIn),)
75 PreConditions      += $(MakefileCommon)
76 endif
77
78 ifneq ($(MakefileConfigIn),)
79 PreConditions      += $(MakefileConfig)
80 endif
81
82 preconditions: $(PreConditions)
83
84 #------------------------------------------------------------------------
85 # Make sure the BUILT_SOURCES are built first
86 #------------------------------------------------------------------------
87 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
88
89 clean-all-local::
90 ifneq ($(strip $(BUILT_SOURCES)),)
91         -$(Verb) $(RM) -f $(BUILT_SOURCES)
92 endif
93
94 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
95 spotless:
96         $(Verb) if test -x config.status ; then \
97           $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
98           $(MKDIR) .spotless.save ; \
99           $(MV) config.status .spotless.save ; \
100           $(MV) mklib  .spotless.save ; \
101           $(MV) projects  .spotless.save ; \
102           $(RM) -rf * ; \
103           $(MV) .spotless.save/config.status . ; \
104           $(MV) .spotless.save/mklib . ; \
105           $(MV) .spotless.save/projects . ; \
106           $(RM) -rf .spotless.save ; \
107           $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
108           $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
109           $(ConfigStatusScript) ; \
110         else \
111           $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
112         fi
113 else
114 spotless:
115         $(EchoCmd) "spotless target not supported for objdir == srcdir"
116 endif
117
118 $(BUILT_SOURCES) : $(ObjMakefiles)
119
120 #------------------------------------------------------------------------
121 # Make sure we're not using a stale configuration
122 #------------------------------------------------------------------------
123 reconfigure:
124         $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
125         $(Verb) cd $(PROJ_OBJ_ROOT) && \
126           $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
127           $(ConfigStatusScript)
128
129 .PRECIOUS: $(ConfigStatusScript)
130 $(ConfigStatusScript): $(ConfigureScript)
131         $(Echo) Reconfiguring with $<
132         $(Verb) cd $(PROJ_OBJ_ROOT) && \
133           $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
134           $(ConfigStatusScript)
135
136 #------------------------------------------------------------------------
137 # Make sure the configuration makefile is up to date
138 #------------------------------------------------------------------------
139 ifneq ($(MakefileConfigIn),)
140 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
141         $(Echo) Regenerating $@
142         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
143 endif
144
145 ifneq ($(MakefileCommonIn),)
146 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
147         $(Echo) Regenerating $@
148         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
149 endif
150
151 #------------------------------------------------------------------------
152 # If the Makefile in the source tree has been updated, copy it over into the
153 # build tree. But, only do this if the source and object makefiles differ
154 #------------------------------------------------------------------------
155 ifndef PROJ_MAKEFILE
156 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
157 endif
158
159 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
160
161 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
162         $(Echo) "Updating Makefile"
163         $(Verb) $(MKDIR) $(@D)
164         $(Verb) $(CP) -f $< $@
165
166 # Copy the Makefile.* files unless we're in the root directory which avoids
167 # the copying of Makefile.config.in or other things that should be explicitly
168 # taken care of.
169 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
170         @case '$?' in \
171           *Makefile.rules) ;; \
172           *.in) ;; \
173           *) $(EchoCmd) "Updating $(@F)" ; \
174              $(MKDIR) $(@D) ; \
175              $(CP) -f $< $@ ;; \
176         esac
177
178 endif
179
180 #------------------------------------------------------------------------
181 # Set up the basic dependencies
182 #------------------------------------------------------------------------
183 $(UserTargets):: $(PreConditions)
184
185 all:: all-local
186 clean:: clean-local
187 clean-all:: clean-local clean-all-local
188 install:: install-local
189 uninstall:: uninstall-local
190 install-local:: all-local
191 install-bytecode:: install-bytecode-local
192
193 ###############################################################################
194 # VARIABLES: Set up various variables based on configuration data
195 ###############################################################################
196
197 # Variable for if this make is for a "cleaning" target
198 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
199   IS_CLEANING_TARGET=1
200 endif
201
202 #--------------------------------------------------------------------
203 # Variables derived from configuration we are building
204 #--------------------------------------------------------------------
205
206 CPP.Defines :=
207 ifeq ($(ENABLE_OPTIMIZED),1)
208   BuildMode := Release
209   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
210   ifneq ($(HOST_OS),FreeBSD)
211   ifneq ($(HOST_OS),GNU/kFreeBSD)
212   ifneq ($(HOST_OS),Darwin)
213     OmitFramePointer := -fomit-frame-pointer
214   endif
215   endif
216   endif
217
218   # Darwin requires -fstrict-aliasing to be explicitly enabled.
219   # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
220   # with -fstrict-aliasing and ipa-type-escape radr://6756684
221   #ifeq ($(HOST_OS),Darwin)
222   #  EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
223   #endif
224   CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
225   C.Flags   += $(OPTIMIZE_OPTION) $(OmitFramePointer)
226   LD.Flags  += $(OPTIMIZE_OPTION)
227   ifdef DEBUG_SYMBOLS
228     BuildMode := $(BuildMode)+Debug
229     CXX.Flags += -g
230     C.Flags   += -g
231     LD.Flags  += -g
232     KEEP_SYMBOLS := 1
233   endif
234 else
235   ifdef NO_DEBUG_SYMBOLS
236     BuildMode := Unoptimized
237     CXX.Flags +=
238     C.Flags   +=
239     LD.Flags  +=
240     KEEP_SYMBOLS := 1
241   else
242     BuildMode := Debug
243     CXX.Flags += -g
244     C.Flags   += -g
245     LD.Flags  += -g
246     KEEP_SYMBOLS := 1
247   endif
248 endif
249
250 ifeq ($(ENABLE_LIBCPP),1)
251   CXX.Flags +=  -stdlib=libc++
252   LD.Flags +=  -stdlib=libc++
253 endif
254
255 ifeq ($(ENABLE_CXX11),1)
256   CXX.Flags += -std=c++11
257 endif
258
259 ifeq ($(ENABLE_WERROR),1)
260   CXX.Flags += -Werror
261   C.Flags += -Werror
262 endif
263
264 ifeq ($(ENABLE_PROFILING),1)
265   BuildMode := $(BuildMode)+Profile
266   CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
267   C.Flags   := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
268   LD.Flags  := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
269   KEEP_SYMBOLS := 1
270 endif
271
272 #ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
273 #    CXX.Flags += -fvisibility-inlines-hidden
274 #endif
275
276 ifdef ENABLE_EXPENSIVE_CHECKS
277   # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
278   # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
279   REQUIRES_RTTI := 1
280 endif
281
282 # IF REQUIRES_EH=1 is specified then don't disable exceptions
283 ifndef REQUIRES_EH
284   CXX.Flags += -fno-exceptions
285 else
286   # If the library requires EH, it also requires RTTI.
287   REQUIRES_RTTI := 1
288 endif
289
290 ifdef REQUIRES_FRAME_POINTER
291   CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
292   C.Flags   := $(filter-out -fomit-frame-pointer,$(C.Flags))
293   LD.Flags  := $(filter-out -fomit-frame-pointer,$(LD.Flags))
294 endif
295
296 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
297 ifneq ($(REQUIRES_RTTI), 1)
298   CXX.Flags += -fno-rtti
299 endif
300
301 ifeq ($(ENABLE_COVERAGE),1)
302   BuildMode := $(BuildMode)+Coverage
303   CXX.Flags += -ftest-coverage -fprofile-arcs
304   C.Flags   += -ftest-coverage -fprofile-arcs
305 endif
306
307 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
308 # then disable assertions by defining the appropriate preprocessor symbols.
309 ifeq ($(DISABLE_ASSERTIONS),1)
310   CPP.Defines += -DNDEBUG
311 else
312   BuildMode := $(BuildMode)+Asserts
313   CPP.Defines += -D_DEBUG
314 endif
315
316 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
317 # configured), then enable expensive checks by defining the
318 # appropriate preprocessor symbols.
319 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
320   BuildMode := $(BuildMode)+Checks
321   CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
322 endif
323
324 # LOADABLE_MODULE implies several other things so we force them to be
325 # defined/on.
326 ifdef LOADABLE_MODULE
327   SHARED_LIBRARY := 1
328   LINK_LIBS_IN_SHARED := 1
329 endif
330
331 ifdef SHARED_LIBRARY
332   ENABLE_PIC := 1
333   PIC_FLAG = "(PIC)"
334 endif
335
336 ifeq ($(ENABLE_PIC),1)
337   ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
338     # Nothing. Win32 defaults to PIC and warns when given -fPIC
339   else
340     ifeq ($(HOST_OS),Darwin)
341       # Common symbols not allowed in dylib files
342       CXX.Flags += -fno-common
343       C.Flags   += -fno-common
344     else
345       # Linux and others; pass -fPIC
346       CXX.Flags += -fPIC
347       C.Flags   += -fPIC
348     endif
349   endif
350 else
351   ifeq ($(HOST_OS),Darwin)
352       CXX.Flags += -mdynamic-no-pic
353       C.Flags   += -mdynamic-no-pic
354   endif
355 endif
356
357 # Support makefile variable to disable any kind of timestamp/non-deterministic
358 # info from being used in the build.
359 ifeq ($(ENABLE_TIMESTAMPS),1)
360   DOTDIR_TIMESTAMP_COMMAND := $(DATE)
361 else
362   DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
363 endif
364
365 ifeq ($(HOST_OS),MingW)
366   # Work around PR4957
367   CPP.Defines += -D__NO_CTYPE_INLINE
368   ifeq ($(LLVM_CROSS_COMPILING),1)
369     # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
370     ifdef TOOLNAME
371       LD.Flags += -Wl,--allow-multiple-definition
372     endif
373   endif
374 endif
375
376 CXX.Flags     += -Woverloaded-virtual
377 CPP.BaseFlags += $(CPP.Defines)
378 AR.Flags      := cru
379
380 # Make Floating point IEEE compliant on Alpha.
381 ifeq ($(ARCH),Alpha)
382   CXX.Flags     += -mieee
383   CPP.BaseFlags += -mieee
384 ifeq ($(ENABLE_PIC),0)
385   CXX.Flags     += -fPIC
386   CPP.BaseFlags += -fPIC
387 endif
388
389   LD.Flags += -Wl,--no-relax
390 endif
391
392 # GNU ld/PECOFF accepts but ignores them below;
393 #   --version-script
394 #   --export-dynamic
395 #   --rpath
396 # FIXME: autoconf should be aware of them.
397 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
398   HAVE_LINK_VERSION_SCRIPT := 0
399   RPATH :=
400   RDYNAMIC := -Wl,--export-all-symbols
401 endif
402
403 #--------------------------------------------------------------------
404 # Directory locations
405 #--------------------------------------------------------------------
406 TargetMode :=
407 ifeq ($(LLVM_CROSS_COMPILING),1)
408   BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
409 endif
410
411 ObjRootDir  := $(PROJ_OBJ_DIR)/$(BuildMode)
412 ObjDir      := $(ObjRootDir)
413 LibDir      := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
414 ToolDir     := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
415 ExmplDir    := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
416 LLVMLibDir  := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
417 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
418 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
419
420 #--------------------------------------------------------------------
421 # Locations of shared libraries
422 #--------------------------------------------------------------------
423
424 SharedPrefix     := lib
425 SharedLibDir     := $(LibDir)
426 LLVMSharedLibDir := $(LLVMLibDir)
427
428 # Win32.DLL prefers to be located on the "PATH" of binaries.
429 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
430   SharedLibDir     := $(ToolDir)
431   LLVMSharedLibDir := $(LLVMToolDir)
432
433   ifeq ($(HOST_OS),Cygwin)
434     SharedPrefix  := cyg
435   else
436     SharedPrefix  :=
437   endif
438 endif
439
440 #--------------------------------------------------------------------
441 # Full Paths To Compiled Tools and Utilities
442 #--------------------------------------------------------------------
443 EchoCmd  = $(ECHO) llvm[$(MAKELEVEL)]:
444 Echo     = @$(EchoCmd)
445 ifndef LLVMAS
446 LLVMAS   := $(LLVMToolDir)/llvm-as$(EXEEXT)
447 endif
448 ifndef LLVM_TBLGEN
449   ifeq ($(LLVM_CROSS_COMPILING),1)
450     LLVM_TBLGEN   := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
451   else
452     LLVM_TBLGEN   := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
453   endif
454 endif
455 LLVM_CONFIG := $(LLVMToolDir)/llvm-config
456 ifndef LLVMDIS
457 LLVMDIS  := $(LLVMToolDir)/llvm-dis$(EXEEXT)
458 endif
459 ifndef LLI
460 LLI      := $(LLVMToolDir)/lli$(EXEEXT)
461 endif
462 ifndef LLC
463 LLC      := $(LLVMToolDir)/llc$(EXEEXT)
464 endif
465 ifndef LOPT
466 LOPT     := $(LLVMToolDir)/opt$(EXEEXT)
467 endif
468 ifndef LBUGPOINT
469 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
470 endif
471
472 #--------------------------------------------------------------------
473 # Adjust to user's request
474 #--------------------------------------------------------------------
475
476 ifeq ($(HOST_OS),Darwin)
477   DARWIN_VERSION := `sw_vers -productVersion`
478   # Strip a number like 10.4.7 to 10.4
479   DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
480   # Get "4" out of 10.4 for later pieces in the makefile.
481   DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
482
483   LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
484   SharedLinkOptions := -dynamiclib
485   ifdef DEPLOYMENT_TARGET
486     SharedLinkOptions += $(DEPLOYMENT_TARGET)
487   else
488     ifneq ($(ARCH),ARM)
489       SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
490     endif
491   endif
492 else
493   SharedLinkOptions=-shared
494 endif
495
496 ifeq ($(TARGET_OS),Darwin)
497   ifdef DEPLOYMENT_TARGET
498     TargetCommonOpts += $(DEPLOYMENT_TARGET)
499   else
500     ifneq ($(ARCH),ARM)
501       TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
502     endif
503   endif
504 endif
505
506 ifdef SHARED_LIBRARY
507 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
508 ifneq ($(HOST_OS),Darwin)
509   LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
510 endif
511 endif
512 endif
513
514 ifdef TOOL_VERBOSE
515   C.Flags += -v
516   CXX.Flags += -v
517   LD.Flags += -v
518   VERBOSE := 1
519 endif
520
521 # Adjust settings for verbose mode
522 ifndef VERBOSE
523   Verb := @
524   AR.Flags += >/dev/null 2>/dev/null
525   ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
526 else
527   ConfigureScriptFLAGS :=
528 endif
529
530 # By default, strip symbol information from executable
531 ifndef KEEP_SYMBOLS
532   Strip := $(PLATFORMSTRIPOPTS)
533   StripWarnMsg := "(without symbols)"
534   Install.StripFlag += -s
535 endif
536
537 ifdef TOOL_NO_EXPORTS
538   DynamicFlags :=
539 else
540   DynamicFlag := $(RDYNAMIC)
541 endif
542
543 # Adjust linker flags for building an executable
544 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
545 ifneq ($(HOST_OS), Darwin)
546 ifdef TOOLNAME
547   LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
548   ifdef EXAMPLE_TOOL
549     LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
550   else
551     LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
552   endif
553 endif
554 else
555 ifneq ($(DARWIN_MAJVERS),4)
556   LD.Flags += $(RPATH) -Wl,@executable_path/../lib
557 endif
558 endif
559 endif
560
561
562 #----------------------------------------------------------
563 # Options To Invoke Tools
564 #----------------------------------------------------------
565
566 ifdef EXTRA_LD_OPTIONS
567 LD.Flags += $(EXTRA_LD_OPTIONS)
568 endif
569
570 ifndef NO_PEDANTIC
571 CompileCommonOpts += -pedantic -Wno-long-long
572 endif
573 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
574                      $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
575 # Enable cast-qual for C++; the workaround is to use const_cast.
576 CXX.Flags += -Wcast-qual
577
578 ifeq ($(HOST_OS),HP-UX)
579   CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
580 endif
581
582 # If we are building a universal binary on Mac OS/X, pass extra options.  This
583 # is useful to people that want to link the LLVM libraries into their universal
584 # apps.
585 #
586 # The following can be optionally specified:
587 #   UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
588 #      For Mac OS/X 10.4 Intel machines, the traditional one is:
589 #      UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
590 #   UNIVERSAL_ARCH can be optionally specified to be a list of architectures
591 #      to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64".  This defaults to
592 #      i386/ppc only.
593 ifdef UNIVERSAL
594   ifndef UNIVERSAL_ARCH
595     UNIVERSAL_ARCH := i386 ppc
596   endif
597   UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
598   CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
599   ifdef UNIVERSAL_SDK_PATH
600     CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
601   endif
602
603   # Building universal cannot compute dependencies automatically.
604   DISABLE_AUTO_DEPENDENCIES=1
605 else
606   ifeq ($(TARGET_OS),Darwin)
607     ifeq ($(ARCH),x86_64)
608       TargetCommonOpts = -m64
609     else
610       ifeq ($(ARCH),x86)
611         TargetCommonOpts = -m32
612       endif
613     endif
614   endif
615 endif
616
617 ifeq ($(HOST_OS),SunOS)
618 CPP.BaseFlags += -include llvm/Support/Solaris.h
619 endif
620
621 ifeq ($(HOST_OS),AuroraUX)
622 CPP.BaseFlags += -include llvm/Support/Solaris.h
623 endif # !HOST_OS - AuroraUX.
624
625 LD.Flags      += -L$(LibDir) -L$(LLVMLibDir)
626 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
627 # All -I flags should go here, so that they don't confuse llvm-config.
628 CPP.Flags     += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
629                  $(patsubst %,-I%/include,\
630                  $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
631                  $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
632                  $(CPP.BaseFlags)
633
634 # SHOW_DIAGNOSTICS support.
635 ifeq ($(SHOW_DIAGNOSTICS),1)
636   Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
637                           CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
638 else
639   Compile.Wrapper :=
640 endif
641
642 ifeq ($(BUILD_COMPONENT), 1)
643   Compile.C     = $(Compile.Wrapper) \
644                   $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
645                   $(TargetCommonOpts) $(CompileCommonOpts) -c
646   Compile.CXX   = $(Compile.Wrapper) \
647                   $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
648                   $(CPPFLAGS) \
649                   $(TargetCommonOpts) $(CompileCommonOpts) -c
650   Preprocess.CXX= $(Compile.Wrapper) \
651                   $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
652                   $(CompileCommonOpts) $(CXX.Flags) -E
653   Link          = $(Compile.Wrapper) \
654                   $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
655                   $(LD.Flags) $(LDFLAGS) \
656                   $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
657 else
658   Compile.C     = $(Compile.Wrapper) \
659                   $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
660                   $(TargetCommonOpts) $(CompileCommonOpts) -c
661   Compile.CXX   = $(Compile.Wrapper) \
662                   $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
663                   $(TargetCommonOpts) $(CompileCommonOpts) -c
664   Preprocess.CXX= $(Compile.Wrapper) \
665                   $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
666                   $(CompileCommonOpts) $(CXX.Flags) -E
667   Link          = $(Compile.Wrapper) \
668                   $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
669                   $(LDFLAGS) $(TargetCommonOpts)  $(CompileCommonOpts) $(Strip)
670 endif
671
672 Preprocess.C  = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
673                 $(TargetCommonOpts) $(CompileCommonOpts) -E
674
675 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755
676 ScriptInstall = $(INSTALL) -m 0755
677 DataInstall   = $(INSTALL) -m 0644
678
679 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
680 # paths. In this case, the SYSPATH function (defined in
681 # Makefile.config) transforms Unix paths into Windows paths.
682 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
683                 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
684                 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
685                 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
686 LLVMTableGen  = $(LLVM_TBLGEN) $(TableGen.Flags)
687
688 Archive       = $(AR) $(AR.Flags)
689 ifdef RANLIB
690 Ranlib        = $(RANLIB)
691 else
692 Ranlib        = ranlib
693 endif
694
695 AliasTool     = ln -s
696
697 #----------------------------------------------------------
698 # Get the list of source files and compute object file
699 # names from them.
700 #----------------------------------------------------------
701
702 ifndef SOURCES
703   Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
704              $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
705 else
706   Sources := $(SOURCES)
707 endif
708
709 ifdef BUILT_SOURCES
710 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
711 endif
712
713 BaseNameSources := $(sort $(basename $(Sources)))
714
715 ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
716
717 #----------------------------------------------------------
718 # For Mingw MSYS bash and Python/w32:
719 #
720 # $(ECHOPATH) prints DOSish pathstring.
721 #   ex) $(ECHOPATH) /include/sys/types.h
722 #   --> C:/mingw/include/sys/types.h
723 # built-in "echo" does not transform path to DOSish path.
724 #
725 # FIXME: It would not be needed when MSYS's python
726 # were provided.
727 #----------------------------------------------------------
728
729 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
730   ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
731 else
732   ECHOPATH := $(Verb)$(ECHO)
733 endif
734
735 ###############################################################################
736 # DIRECTORIES: Handle recursive descent of directory structure
737 ###############################################################################
738
739 #---------------------------------------------------------
740 # Provide rules to make install dirs. This must be early
741 # in the file so they get built before dependencies
742 #---------------------------------------------------------
743
744 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
745         $(Verb) $(MKDIR) $@
746
747 # To create other directories, as needed, and timestamp their creation
748 %/.dir:
749         $(Verb) $(MKDIR) $* > /dev/null
750         $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
751
752 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
753 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
754
755 #---------------------------------------------------------
756 # Handle the DIRS options for sequential construction
757 #---------------------------------------------------------
758
759 SubDirs :=
760 ifdef DIRS
761 SubDirs += $(DIRS)
762
763 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
764 $(RecursiveTargets)::
765         $(Verb) for dir in $(DIRS); do \
766           if ([ ! -f $$dir/Makefile ] || \
767               command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
768             $(MKDIR) $$dir; \
769             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
770           fi; \
771           ($(MAKE) -C $$dir $@ ) || exit 1; \
772         done
773 else
774 $(RecursiveTargets)::
775         $(Verb) for dir in $(DIRS); do \
776           ($(MAKE) -C $$dir $@ ) || exit 1; \
777         done
778 endif
779
780 endif
781
782 #---------------------------------------------------------
783 # Handle the EXPERIMENTAL_DIRS options ensuring success
784 # after each directory is built.
785 #---------------------------------------------------------
786 ifdef EXPERIMENTAL_DIRS
787 $(RecursiveTargets)::
788         $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
789           if ([ ! -f $$dir/Makefile ] || \
790               command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
791             $(MKDIR) $$dir; \
792             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
793           fi; \
794           ($(MAKE) -C $$dir $@ ) || exit 0; \
795         done
796 endif
797
798 #-----------------------------------------------------------
799 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
800 #-----------------------------------------------------------
801 ifdef OPTIONAL_PARALLEL_DIRS
802   PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)"))
803 endif
804
805 #-----------------------------------------------------------
806 # Handle the PARALLEL_DIRS options for parallel construction
807 #-----------------------------------------------------------
808 ifdef PARALLEL_DIRS
809
810 SubDirs += $(PARALLEL_DIRS)
811
812 # Unfortunately, this list must be maintained if new recursive targets are added
813 all      :: $(addsuffix /.makeall      ,$(PARALLEL_DIRS))
814 clean    :: $(addsuffix /.makeclean    ,$(PARALLEL_DIRS))
815 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
816 install  :: $(addsuffix /.makeinstall  ,$(PARALLEL_DIRS))
817 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
818 install-bytecode  :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
819 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
820
821 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
822
823 $(ParallelTargets) :
824         $(Verb) if ([ ! -f $(@D)/Makefile ] || \
825                     command test $(@D)/Makefile -ot \
826                       $(PROJ_SRC_DIR)/$(@D)/Makefile ); then \
827           $(MKDIR) $(@D); \
828           $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
829         fi; \
830         $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
831 endif
832
833 #---------------------------------------------------------
834 # Handle the OPTIONAL_DIRS options for directores that may
835 # or may not exist.
836 #---------------------------------------------------------
837 ifdef OPTIONAL_DIRS
838
839 SubDirs += $(OPTIONAL_DIRS)
840
841 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
842 $(RecursiveTargets)::
843         $(Verb) for dir in $(OPTIONAL_DIRS); do \
844           if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
845             if ([ ! -f $$dir/Makefile ] || \
846                 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
847               $(MKDIR) $$dir; \
848               $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
849             fi; \
850             ($(MAKE) -C$$dir $@ ) || exit 1; \
851           fi \
852         done
853 else
854 $(RecursiveTargets)::
855         $(Verb) for dir in $(OPTIONAL_DIRS); do \
856           if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
857             ($(MAKE) -C$$dir $@ ) || exit 1; \
858           fi \
859         done
860 endif
861 endif
862
863 #---------------------------------------------------------
864 # Handle the CONFIG_FILES options
865 #---------------------------------------------------------
866 ifdef CONFIG_FILES
867
868 ifdef NO_INSTALL
869 install-local::
870         $(Echo) Install circumvented with NO_INSTALL
871 uninstall-local::
872         $(Echo) UnInstall circumvented with NO_INSTALL
873 else
874 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
875         $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
876         $(Verb)for file in $(CONFIG_FILES); do \
877           if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
878             $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
879           elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
880             $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
881           else \
882             $(ECHO) Error: cannot find config file $${file}. ; \
883           fi \
884         done
885
886 uninstall-local::
887         $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
888         $(Verb)for file in $(CONFIG_FILES); do \
889           $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
890         done
891 endif
892
893 endif
894
895 ###############################################################################
896 # Set up variables for building libraries
897 ###############################################################################
898
899 #---------------------------------------------------------
900 # Define various command line options pertaining to the
901 # libraries needed when linking. There are "Proj" libs
902 # (defined by the user's project) and "LLVM" libs (defined
903 # by the LLVM project).
904 #---------------------------------------------------------
905
906 ifdef USEDLIBS
907 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
908 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o,  $(ProjLibsOptions))
909 ProjUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
910 ProjLibsPaths   := $(addprefix $(LibDir)/,$(ProjUsedLibs))
911 endif
912
913 ifdef LLVMLIBS
914 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
915 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
916 LLVMUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
917 LLVMLibsPaths   := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
918 endif
919
920 # Loadable module for Win32 requires all symbols resolved for linking.
921 # Then all symbols in LLVM.dll will be available.
922 ifeq ($(ENABLE_SHARED),1)
923   ifdef LOADABLE_MODULE
924     ifneq (,$(filter $(HOST_OS),Cygwin MingW))
925       LINK_COMPONENTS += all
926     endif
927   endif
928 endif
929
930 ifndef IS_CLEANING_TARGET
931 ifdef LINK_COMPONENTS
932
933 # If LLVM_CONFIG doesn't exist, build it.  This can happen if you do a make
934 # clean in tools, then do a make in tools (instead of at the top level).
935 $(LLVM_CONFIG):
936         @echo "*** llvm-config doesn't exist - rebuilding it."
937         @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
938
939 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
940
941 ifeq ($(ENABLE_SHARED), 1)
942 # We can take the "auto-import" feature to get rid of using dllimport.
943 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
944 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
945                    -L $(SharedLibDir)
946 endif
947 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
948 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
949 else
950
951 ifndef NO_LLVM_CONFIG
952 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
953 ifeq ($(LLVMConfigLibs),Error)
954 $(error llvm-config --libs failed)
955 endif
956 LLVMLibsOptions += $(LLVMConfigLibs)
957 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
958 ifeq ($(LLVMConfigLibfiles),Error)
959 $(error llvm-config --libfiles failed)
960 endif
961 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
962 endif
963
964 endif
965 endif
966 endif
967
968 # Set up the library exports file.
969 ifdef EXPORTED_SYMBOL_FILE
970
971 # First, set up the native export file, which may differ from the source
972 # export file.
973
974 ifeq ($(HOST_OS),Darwin)
975 # Darwin convention prefixes symbols with underscores.
976 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
977 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
978         $(Verb) sed -e 's/^/_/' < $< > $@
979 clean-local::
980         -$(Verb) $(RM) -f $(NativeExportsFile)
981 else
982 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
983 # Gold and BFD ld require a version script rather than a plain list.
984 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
985 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
986         $(Verb) echo "{" > $@
987         $(Verb) grep -q "\<" $< && echo "  global:" >> $@ || :
988         $(Verb) sed -e 's/$$/;/' -e 's/^/    /' < $< >> $@
989 ifneq ($(HOST_OS),OpenBSD)
990         $(Verb) echo "  local: *;" >> $@
991 endif
992         $(Verb) echo "};" >> $@
993 clean-local::
994         -$(Verb) $(RM) -f $(NativeExportsFile)
995 else
996 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
997 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
998 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
999 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1000         $(Echo) Generating $(notdir $@)
1001         $(Verb) $(ECHO) "EXPORTS" > $@
1002         $(Verb) $(CAT) $< >> $@
1003 clean-local::
1004         -$(Verb) $(RM) -f $(NativeExportsFile)
1005 else
1006 # Default behavior: just use the exports file verbatim.
1007 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1008 endif
1009 endif
1010 endif
1011
1012 # Now add the linker command-line options to use the native export file.
1013
1014 # Darwin
1015 ifeq ($(HOST_OS),Darwin)
1016 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1017 endif
1018
1019 # gold, bfd ld, etc.
1020 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1021 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1022 endif
1023
1024 # Windows
1025 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1026 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1027 SharedLinkOptions += $(NativeExportsFile)
1028 endif
1029
1030 endif
1031
1032 ###############################################################################
1033 # Library Build Rules: Four ways to build a library
1034 ###############################################################################
1035
1036 # if we're building a library ...
1037 ifdef LIBRARYNAME
1038
1039 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1040 LIBRARYNAME := $(strip $(LIBRARYNAME))
1041 ifdef LOADABLE_MODULE
1042 BaseLibName.A  := $(LIBRARYNAME).a
1043 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1044 else
1045 BaseLibName.A  := lib$(LIBRARYNAME).a
1046 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1047 endif
1048 LibName.A  := $(LibDir)/$(BaseLibName.A)
1049 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1050 LibName.O  := $(LibDir)/$(LIBRARYNAME).o
1051
1052 #---------------------------------------------------------
1053 # Shared Library Targets:
1054 #   If the user asked for a shared library to be built
1055 #   with the SHARED_LIBRARY variable, then we provide
1056 #   targets for building them.
1057 #---------------------------------------------------------
1058 ifdef SHARED_LIBRARY
1059
1060 all-local:: $(LibName.SO)
1061
1062 ifdef EXPORTED_SYMBOL_FILE
1063 $(LibName.SO): $(NativeExportsFile)
1064 endif
1065
1066 ifdef LINK_LIBS_IN_SHARED
1067 ifdef LOADABLE_MODULE
1068 SharedLibKindMessage := "Loadable Module"
1069 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1070 else
1071 SharedLibKindMessage := "Shared Library"
1072 endif
1073 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1074         $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1075           $(notdir $@)
1076         $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1077           $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1078 else
1079 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1080         $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1081         $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1082 endif
1083
1084 clean-local::
1085 ifneq ($(strip $(LibName.SO)),)
1086         -$(Verb) $(RM) -f $(LibName.SO)
1087 endif
1088
1089 ifdef NO_INSTALL
1090 install-local::
1091         $(Echo) Install circumvented with NO_INSTALL
1092 uninstall-local::
1093         $(Echo) Uninstall circumvented with NO_INSTALL
1094 else
1095
1096 # Win32.DLL prefers to be located on the "PATH" of binaries.
1097 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1098 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1099 else
1100 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1101 endif
1102 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1103
1104 install-local:: $(DestSharedLib)
1105
1106 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1107         $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1108         $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1109
1110 uninstall-local::
1111         $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1112         -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1113 endif
1114 endif
1115
1116 #---------------------------------------------------------
1117 # Library Targets:
1118 #   If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1119 #   building an archive.
1120 #---------------------------------------------------------
1121 ifndef NO_BUILD_ARCHIVE
1122 ifndef BUILD_ARCHIVE
1123 ifndef LOADABLE_MODULE
1124 BUILD_ARCHIVE = 1
1125 endif
1126 endif
1127 endif
1128
1129 #---------------------------------------------------------
1130 # Archive Library Targets:
1131 #   If the user wanted a regular archive library built,
1132 #   then we provide targets for building them.
1133 #---------------------------------------------------------
1134 ifdef BUILD_ARCHIVE
1135
1136 all-local:: $(LibName.A)
1137
1138 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1139         $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1140         -$(Verb) $(RM) -f $@
1141         $(Verb) $(Archive) $@ $(ObjectsO)
1142         $(Verb) $(Ranlib) $@
1143
1144 clean-local::
1145 ifneq ($(strip $(LibName.A)),)
1146         -$(Verb) $(RM) -f $(LibName.A)
1147 endif
1148
1149 ifdef NO_INSTALL
1150 install-local::
1151         $(Echo) Install circumvented with NO_INSTALL
1152 uninstall-local::
1153         $(Echo) Uninstall circumvented with NO_INSTALL
1154 else
1155 ifdef NO_INSTALL_ARCHIVES
1156 install-local::
1157         $(Echo) Install circumvented with NO_INSTALL
1158 uninstall-local::
1159         $(Echo) Uninstall circumvented with NO_INSTALL
1160 else
1161 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1162
1163 install-local:: $(DestArchiveLib)
1164
1165 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1166         $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1167         $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1168         $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1169
1170 uninstall-local::
1171         $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1172         -$(Verb) $(RM) -f $(DestArchiveLib)
1173 endif
1174 endif
1175 endif
1176
1177 # endif LIBRARYNAME
1178 endif
1179
1180 ###############################################################################
1181 # Tool Build Rules: Build executable tool based on TOOLNAME option
1182 ###############################################################################
1183
1184 ifdef TOOLNAME
1185
1186 #---------------------------------------------------------
1187 # Set up variables for building a tool.
1188 #---------------------------------------------------------
1189 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1190 ifdef EXAMPLE_TOOL
1191 ToolBuildPath   := $(ExmplDir)/$(TOOLEXENAME)
1192 else
1193 ToolBuildPath   := $(ToolDir)/$(TOOLEXENAME)
1194 endif
1195
1196 # TOOLALIAS is a name to symlink (or copy) the tool to.
1197 ifdef TOOLALIAS
1198 ifdef EXAMPLE_TOOL
1199 ToolAliasBuildPath   := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1200 else
1201 ToolAliasBuildPath   := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1202 endif
1203 endif
1204
1205 #---------------------------------------------------------
1206 # Prune Exports
1207 #---------------------------------------------------------
1208
1209 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1210 # not exporting all of the weak symbols from the binary.  This reduces dyld
1211 # startup time by 4x on darwin in some cases.
1212 ifdef TOOL_NO_EXPORTS
1213 ifeq ($(HOST_OS),Darwin)
1214
1215 # Tiger tools don't support this.
1216 ifneq ($(DARWIN_MAJVERS),4)
1217 LD.Flags += -Wl,-exported_symbol,_main
1218 endif
1219 endif
1220
1221 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU/kFreeBSD))
1222 ifneq ($(ARCH), Mips)
1223   LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map
1224 endif
1225 endif
1226 endif
1227
1228 #---------------------------------------------------------
1229 # Tool Order File Support
1230 #---------------------------------------------------------
1231
1232 ifeq ($(HOST_OS),Darwin)
1233 ifdef TOOL_ORDER_FILE
1234
1235 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1236
1237 endif
1238 endif
1239
1240 #---------------------------------------------------------
1241 # Tool Version Info Support
1242 #---------------------------------------------------------
1243
1244 ifeq ($(HOST_OS),Darwin)
1245 ifdef TOOL_INFO_PLIST
1246
1247 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1248
1249 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1250
1251 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1252         $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1253         $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1254                    -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1255                    -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1256                  -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1257                    $< > $@
1258
1259 endif
1260 endif
1261
1262 #---------------------------------------------------------
1263 # Provide targets for building the tools
1264 #---------------------------------------------------------
1265 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1266
1267 clean-local::
1268 ifneq ($(strip $(ToolBuildPath)),)
1269         -$(Verb) $(RM) -f $(ToolBuildPath)
1270 endif
1271 ifneq ($(strip $(ToolAliasBuildPath)),)
1272         -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1273 endif
1274
1275 ifdef EXAMPLE_TOOL
1276 $(ToolBuildPath): $(ExmplDir)/.dir
1277 else
1278 $(ToolBuildPath): $(ToolDir)/.dir
1279 endif
1280
1281 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1282         $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1283         $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1284         $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1285         $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1286           $(StripWarnMsg)
1287
1288 ifneq ($(strip $(ToolAliasBuildPath)),)
1289 $(ToolAliasBuildPath): $(ToolBuildPath)
1290         $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1291         $(Verb) $(RM) -f $(ToolAliasBuildPath)
1292         $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1293         $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1294           $(StripWarnMsg)
1295 endif
1296
1297 ifdef NO_INSTALL
1298 install-local::
1299         $(Echo) Install circumvented with NO_INSTALL
1300 uninstall-local::
1301         $(Echo) Uninstall circumvented with NO_INSTALL
1302 else
1303 DestTool = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLEXENAME)
1304
1305 install-local:: $(DestTool)
1306
1307 $(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir)
1308         $(Echo) Installing $(BuildMode) $(DestTool)
1309         $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1310
1311 uninstall-local::
1312         $(Echo) Uninstalling $(BuildMode) $(DestTool)
1313         -$(Verb) $(RM) -f $(DestTool)
1314
1315 # TOOLALIAS install.
1316 ifdef TOOLALIAS
1317 DestToolAlias = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1318
1319 install-local:: $(DestToolAlias)
1320
1321 $(DestToolAlias): $(DestTool)
1322         $(Echo) Installing $(BuildMode) $(DestToolAlias)
1323         $(Verb) $(RM) -f $(DestToolAlias)
1324         $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1325
1326 uninstall-local::
1327         $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1328         -$(Verb) $(RM) -f $(DestToolAlias)
1329 endif
1330
1331 endif
1332 endif
1333
1334 ###############################################################################
1335 # Object Build Rules: Build object files based on sources
1336 ###############################################################################
1337
1338 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1339 ifeq ($(HOST_OS),HP-UX)
1340   DISABLE_AUTO_DEPENDENCIES=1
1341 endif
1342
1343 # Provide rule sets for when dependency generation is enabled
1344 ifndef DISABLE_AUTO_DEPENDENCIES
1345
1346 #---------------------------------------------------------
1347 # Create .o files in the ObjDir directory from the .cpp and .c files...
1348 #---------------------------------------------------------
1349
1350 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1351          -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1352
1353 # If the build succeeded, move the dependency file over, otherwise
1354 # remove it.
1355 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1356                   else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1357
1358 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1359         $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1360         $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1361                 $(DEPEND_MOVEFILE)
1362
1363 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1364         $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1365         $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1366                 $(DEPEND_MOVEFILE)
1367
1368 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1369         $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1370         $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1371                 $(DEPEND_MOVEFILE)
1372
1373 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1374         $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1375         $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1376                 $(DEPEND_MOVEFILE)
1377
1378 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1379         $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1380         $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1381                 $(DEPEND_MOVEFILE)
1382
1383 # Provide alternate rule sets if dependencies are disabled
1384 else
1385
1386 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1387         $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1388         $(Compile.CXX) $< -o $@
1389
1390 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1391         $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1392         $(Compile.CXX) $< -o $@
1393
1394 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1395         $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1396         $(Compile.CXX) $< -o $@
1397
1398 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1399         $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1400         $(Compile.C) $< -o $@
1401
1402 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1403         $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1404         $(Compile.C) $< -o $@
1405 endif
1406
1407
1408 ## Rules for building preprocessed (.i/.ii) outputs.
1409 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1410         $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1411         $(Verb) $(Preprocess.CXX) $< -o $@
1412
1413 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1414         $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1415         $(Verb) $(Preprocess.CXX) $< -o $@
1416
1417 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1418         $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1419         $(Verb) $(Preprocess.CXX) $< -o $@
1420
1421 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1422         $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1423         $(Verb) $(Preprocess.C) $< -o $@
1424
1425 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1426         $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1427         $(Verb) $(Preprocess.C) $< -o $@
1428
1429
1430 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1431         $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1432         $(Compile.CXX) $< -o $@ -S
1433
1434 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1435         $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1436         $(Compile.CXX) $< -o $@ -S
1437
1438 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1439         $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1440         $(Compile.CXX) $< -o $@ -S
1441
1442 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1443         $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1444         $(Compile.C) $< -o $@ -S
1445
1446 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1447         $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1448         $(Compile.C) $< -o $@ -S
1449
1450 ###############################################################################
1451 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1452 ###############################################################################
1453
1454 ifdef TARGET
1455 TABLEGEN_INC_FILES_COMMON = 1
1456 endif
1457
1458 ifdef TABLEGEN_INC_FILES_COMMON
1459
1460 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1461 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1462 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1463
1464 # INCFiles rule: All of the tblgen generated files are emitted to
1465 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc.  This allows
1466 # us to only "touch" the real file if the contents of it change.  IOW, if
1467 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1468 # dependencies of the .inc files are, unless the contents of the .inc file
1469 # changes.
1470 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1471         $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1472
1473 endif # TABLEGEN_INC_FILES_COMMON
1474
1475 ifdef TARGET
1476
1477 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1478            $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1479            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1480            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1481            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1482            $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1483            $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1484
1485 # All .inc.tmp files depend on the .td files.
1486 $(INCTMPFiles) : $(TDFiles)
1487
1488 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1489 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1490         $(Echo) "Building $(<F) register info implementation with tblgen"
1491         $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1492
1493 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1494 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1495         $(Echo) "Building $(<F) instruction information with tblgen"
1496         $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1497
1498 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1499 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1500         $(Echo) "Building $(<F) assembly writer with tblgen"
1501         $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1502
1503 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1504 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1505         $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1506         $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1507
1508 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1509 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1510         $(Echo) "Building $(<F) assembly matcher with tblgen"
1511         $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1512
1513 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1514 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1515         $(Echo) "Building $(<F) MC code emitter with tblgen"
1516         $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1517
1518 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1519 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1520         $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1521         $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1522
1523 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1524 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1525         $(Echo) "Building $(<F) code emitter with tblgen"
1526         $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1527
1528 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1529 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1530         $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1531         $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1532
1533 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1534 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1535         $(Echo) "Building $(<F) disassembly tables with tblgen"
1536         $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1537
1538 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1539 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1540         $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
1541         $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1542
1543 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1544 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1545         $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1546         $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1547
1548 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1549 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1550         $(Echo) "Building $(<F) subtarget information with tblgen"
1551         $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1552
1553 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1554 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1555         $(Echo) "Building $(<F) calling convention information with tblgen"
1556         $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1557
1558 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1559 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1560         $(Echo) "Building $(<F) intrinsics information with tblgen"
1561         $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1562
1563 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1564         $(Echo) "Building $(<F) decoder tables with tblgen"
1565         $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1566
1567
1568 clean-local::
1569         -$(Verb) $(RM) -f $(INCFiles)
1570
1571 endif # TARGET
1572
1573 ###############################################################################
1574 # OTHER RULES: Other rules needed
1575 ###############################################################################
1576
1577 # To create postscript files from dot files...
1578 ifneq ($(DOT),false)
1579 %.ps: %.dot
1580         $(DOT) -Tps < $< > $@
1581 else
1582 %.ps: %.dot
1583         $(Echo) "Cannot build $@: The program dot is not installed"
1584 endif
1585
1586 # This rules ensures that header files that are removed still have a rule for
1587 # which they can be "generated."  This allows make to ignore them and
1588 # reproduce the dependency lists.
1589 %.h:: ;
1590 %.hpp:: ;
1591
1592 # Define clean-local to clean the current directory. Note that this uses a
1593 # very conservative approach ensuring that empty variables do not cause
1594 # errors or disastrous removal.
1595 clean-local::
1596 ifneq ($(strip $(ObjRootDir)),)
1597         -$(Verb) $(RM) -rf $(ObjRootDir)
1598 endif
1599         -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1600 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1601         -$(Verb) $(RM) -f *$(SHLIBEXT)
1602 endif
1603
1604 clean-all-local::
1605         -$(Verb) $(RM) -rf Debug Release Profile
1606
1607
1608 ###############################################################################
1609 # DEPENDENCIES: Include the dependency files if we should
1610 ###############################################################################
1611 ifndef DISABLE_AUTO_DEPENDENCIES
1612
1613 # If its not one of the cleaning targets
1614 ifndef IS_CLEANING_TARGET
1615
1616 # Get the list of dependency files
1617 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1618 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1619
1620 -include $(DependFiles) ""
1621
1622 endif
1623
1624 endif
1625
1626 ###############################################################################
1627 # CHECK: Running the test suite
1628 ###############################################################################
1629
1630 check::
1631         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1632           if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1633             $(EchoCmd) Running test suite ; \
1634             $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1635               TESTSUITE=$(TESTSUITE) ; \
1636           else \
1637             $(EchoCmd) No Makefile in test directory ; \
1638           fi ; \
1639         else \
1640           $(EchoCmd) No test directory ; \
1641         fi
1642
1643 # An alias dating from when both lit and DejaGNU test runners were used.
1644 check-lit:: check
1645
1646 check-all::
1647         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1648           if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1649             $(EchoCmd) Running test suite ; \
1650             $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1651           else \
1652             $(EchoCmd) No Makefile in test directory ; \
1653           fi ; \
1654         else \
1655           $(EchoCmd) No test directory ; \
1656         fi
1657
1658 ###############################################################################
1659 # UNITTESTS: Running the unittests test suite
1660 ###############################################################################
1661
1662 unittests::
1663         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1664           if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1665             $(EchoCmd) Running unittests test suite ; \
1666             $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1667           else \
1668             $(EchoCmd) No Makefile in unittests directory ; \
1669           fi ; \
1670         else \
1671           $(EchoCmd) No unittests directory ; \
1672         fi
1673
1674 ###############################################################################
1675 # DISTRIBUTION: Handle construction of a distribution tarball
1676 ###############################################################################
1677
1678 #------------------------------------------------------------------------
1679 # Define distribution related variables
1680 #------------------------------------------------------------------------
1681 DistName    := $(PROJECT_NAME)-$(PROJ_VERSION)
1682 DistDir     := $(PROJ_OBJ_ROOT)/$(DistName)
1683 TopDistDir  := $(PROJ_OBJ_ROOT)/$(DistName)
1684 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1685 DistZip     := $(PROJ_OBJ_ROOT)/$(DistName).zip
1686 DistTarBZ2  := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1687 DistAlways  := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1688                ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1689                Makefile.config.in configure autoconf
1690 DistOther   := $(notdir $(wildcard \
1691                $(PROJ_SRC_DIR)/*.h \
1692                $(PROJ_SRC_DIR)/*.td \
1693                $(PROJ_SRC_DIR)/*.def \
1694                $(PROJ_SRC_DIR)/*.ll \
1695                $(PROJ_SRC_DIR)/*.in))
1696 DistSubDirs := $(SubDirs)
1697 DistSources  = $(Sources) $(EXTRA_DIST)
1698 DistFiles    = $(DistAlways) $(DistSources) $(DistOther)
1699
1700 #------------------------------------------------------------------------
1701 # We MUST build distribution with OBJ_DIR != SRC_DIR
1702 #------------------------------------------------------------------------
1703 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1704 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1705         $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1706
1707 else
1708
1709 #------------------------------------------------------------------------
1710 # Prevent attempt to run dist targets from anywhere but the top level
1711 #------------------------------------------------------------------------
1712 ifneq ($(LEVEL),.)
1713 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1714         $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1715 else
1716
1717 #------------------------------------------------------------------------
1718 # Provide the top level targets
1719 #------------------------------------------------------------------------
1720
1721 dist-gzip:: $(DistTarGZip)
1722
1723 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1724         $(Echo) Packing gzipped distribution tar file.
1725         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1726           $(GZIP) -c > "$(DistTarGZip)"
1727
1728 dist-bzip2:: $(DistTarBZ2)
1729
1730 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1731         $(Echo) Packing bzipped distribution tar file.
1732         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1733           $(BZIP2) -c >$(DistTarBZ2)
1734
1735 dist-zip:: $(DistZip)
1736
1737 $(DistZip) : $(TopDistDir)/.makedistdir
1738         $(Echo) Packing zipped distribution file.
1739         $(Verb) rm -f $(DistZip)
1740         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1741
1742 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1743         $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
1744
1745 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1746
1747 dist-check:: $(DistTarGZip)
1748         $(Echo) Checking distribution tar file.
1749         $(Verb) if test -d $(DistCheckDir) ; then \
1750           $(RM) -rf $(DistCheckDir) ; \
1751         fi
1752         $(Verb) $(MKDIR) $(DistCheckDir)
1753         $(Verb) cd $(DistCheckDir) && \
1754           $(MKDIR) $(DistCheckDir)/build && \
1755           $(MKDIR) $(DistCheckDir)/install && \
1756           gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1757           cd build && \
1758           ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1759             --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
1760           $(MAKE) all && \
1761           $(MAKE) check && \
1762           $(MAKE) unittests && \
1763           $(MAKE) install && \
1764           $(MAKE) uninstall && \
1765           $(MAKE) dist-clean && \
1766           $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1767
1768 dist-clean::
1769         $(Echo) Cleaning distribution files
1770         -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1771           $(DistCheckDir)
1772
1773 endif
1774
1775 #------------------------------------------------------------------------
1776 # Provide the recursive distdir target for building the distribution directory
1777 #------------------------------------------------------------------------
1778 distdir: $(DistDir)/.makedistdir
1779 $(DistDir)/.makedistdir: $(DistSources)
1780         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1781           if test -d "$(DistDir)" ; then \
1782             find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';'  || \
1783               exit 1 ; \
1784           fi ; \
1785           $(EchoCmd) Removing old $(DistDir) ; \
1786           $(RM) -rf $(DistDir); \
1787           $(EchoCmd) Making 'all' to verify build ; \
1788           $(MAKE) ENABLE_OPTIMIZED=1 all ; \
1789         fi
1790         $(Echo) Building Distribution Directory $(DistDir)
1791         $(Verb) $(MKDIR) $(DistDir)
1792         $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1793         srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
1794         for file in $(DistFiles) ; do \
1795           case "$$file" in \
1796             $(PROJ_SRC_DIR)/*) \
1797               file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1798               ;; \
1799             $(PROJ_SRC_ROOT)/*) \
1800               file=`echo "$$file" | \
1801                 sed "s#^$$srcrootstrip/##"` \
1802               ;; \
1803           esac; \
1804           if test -f "$(PROJ_SRC_DIR)/$$file" || \
1805              test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1806             from_dir="$(PROJ_SRC_DIR)" ; \
1807           elif test -f "$$file" || test -d "$$file" ; then \
1808             from_dir=. ; \
1809           fi ; \
1810           to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1811           if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1812             to_dir="$(DistDir)/$$dir"; \
1813             $(MKDIR) "$$to_dir" ; \
1814           else \
1815             to_dir="$(DistDir)"; \
1816           fi; \
1817           mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1818           if test -n "$$mid_dir" ; then \
1819             $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1820           fi ; \
1821           if test -d "$$from_dir/$$file"; then \
1822             if test -d "$(PROJ_SRC_DIR)/$$file" && \
1823                test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1824                cd $(PROJ_SRC_DIR) ; \
1825                $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1826                  ( cd $$to_dir ; $(TAR) xf - ) ; \
1827                cd $(PROJ_OBJ_DIR) ; \
1828             else \
1829                cd $$from_dir ; \
1830                $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1831                  ( cd $$to_dir ; $(TAR) xf - ) ; \
1832                cd $(PROJ_OBJ_DIR) ; \
1833             fi; \
1834           elif test -f "$$from_dir/$$file" ; then \
1835             $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1836           elif test -L "$$from_dir/$$file" ; then \
1837             $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1838           elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1839             $(EchoCmd) "===== WARNING: Distribution Source " \
1840               "$$from_dir/$$file Not Found!" ; \
1841           elif test "$(Verb)" != '@' ; then \
1842             $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1843           fi; \
1844         done
1845         $(Verb) for subdir in $(DistSubDirs) ; do \
1846           if test "$$subdir" \!= "." ; then \
1847             new_distdir="$(DistDir)/$$subdir" ; \
1848             test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1849             ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
1850               DistDir="$$new_distdir" distdir ) || exit 1; \
1851           fi; \
1852         done
1853         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1854           $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
1855           $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
1856                                   -name .svn \) -print` ;\
1857           $(MAKE) dist-hook ; \
1858           $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1859             -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1860             -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1861             -o ! -type d ! -perm -444 -exec \
1862               $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1863             || chmod -R a+r $(DistDir) ; \
1864         fi
1865
1866 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1867 # defined by user.
1868 dist-hook::
1869
1870 endif
1871
1872 ###############################################################################
1873 # TOP LEVEL - targets only to apply at the top level directory
1874 ###############################################################################
1875
1876 ifeq ($(LEVEL),.)
1877
1878 #------------------------------------------------------------------------
1879 # Install support for the project's include files:
1880 #------------------------------------------------------------------------
1881 ifdef NO_INSTALL
1882 install-local::
1883         $(Echo) Install circumvented with NO_INSTALL
1884 uninstall-local::
1885         $(Echo) Uninstall circumvented with NO_INSTALL
1886 else
1887 install-local::
1888         $(Echo) Installing include files
1889         $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
1890         $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
1891           cd $(PROJ_SRC_ROOT)/include && \
1892           for hdr in `find . -type f \
1893               '(' -name LICENSE.TXT \
1894                -o -name '*.def' \
1895                -o -name '*.h' \
1896                -o -name '*.inc' \
1897                -o -name '*.td' \
1898               ')' -print | grep -v CVS | \
1899               grep -v .svn` ; do \
1900             instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
1901             if test \! -d "$$instdir" ; then \
1902               $(EchoCmd) Making install directory $$instdir ; \
1903               $(MKDIR) $$instdir ;\
1904             fi ; \
1905             $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
1906           done ; \
1907         fi
1908 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
1909         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
1910           cd $(PROJ_OBJ_ROOT)/include && \
1911           for hdr in `find . -type f \
1912               '(' -name LICENSE.TXT \
1913                -o -name '*.def' \
1914                -o -name '*.h' \
1915                -o -name '*.inc' \
1916                -o -name '*.td' \
1917               ')' -print | grep -v CVS | \
1918               grep -v .svn` ; do \
1919             instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
1920             if test \! -d "$$instdir" ; then \
1921               $(EchoCmd) Making install directory $$instdir ; \
1922               $(MKDIR) $$instdir ;\
1923             fi ; \
1924             $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
1925           done ; \
1926         fi
1927 endif
1928
1929 uninstall-local::
1930         $(Echo) Uninstalling include files
1931         $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1932           cd $(PROJ_SRC_ROOT)/include && \
1933             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1934               '!' '(' -name '*~' -o -name '.#*' \
1935         -o -name '*.in' ')' -print ')' | \
1936         grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
1937           cd $(PROJ_SRC_ROOT)/include && \
1938             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
1939       -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
1940         fi
1941 endif
1942 endif
1943
1944 check-line-length:
1945         @echo searching for overlength lines in files: $(Sources)
1946         @echo
1947         @echo
1948         egrep -n '.{81}' $(Sources) /dev/null
1949
1950 check-for-tabs:
1951         @echo searching for tabs in files: $(Sources)
1952         @echo
1953         @echo
1954         egrep -n '      ' $(Sources) /dev/null
1955
1956 check-footprint:
1957         @ls -l $(LibDir) | awk '\
1958           BEGIN { sum = 0; } \
1959                 { sum += $$5; } \
1960           END   { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1961         @ls -l $(ToolDir) | awk '\
1962           BEGIN { sum = 0; } \
1963                 { sum += $$5; } \
1964           END   { printf("Programs:  %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1965 #------------------------------------------------------------------------
1966 # Print out the directories used for building
1967 #------------------------------------------------------------------------
1968 printvars::
1969         $(Echo) "BuildMode    : " '$(BuildMode)'
1970         $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1971         $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1972         $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1973         $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1974         $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1975         $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1976         $(Echo) "PROJ_prefix  : " '$(PROJ_prefix)'
1977         $(Echo) "PROJ_bindir  : " '$(PROJ_bindir)'
1978         $(Echo) "PROJ_libdir  : " '$(PROJ_libdir)'
1979         $(Echo) "PROJ_etcdir  : " '$(PROJ_etcdir)'
1980         $(Echo) "PROJ_includedir  : " '$(PROJ_includedir)'
1981         $(Echo) "UserTargets  : " '$(UserTargets)'
1982         $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1983         $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1984         $(Echo) "ObjDir       : " '$(ObjDir)'
1985         $(Echo) "LibDir       : " '$(LibDir)'
1986         $(Echo) "ToolDir      : " '$(ToolDir)'
1987         $(Echo) "ExmplDir     : " '$(ExmplDir)'
1988         $(Echo) "Sources      : " '$(Sources)'
1989         $(Echo) "TDFiles      : " '$(TDFiles)'
1990         $(Echo) "INCFiles     : " '$(INCFiles)'
1991         $(Echo) "INCTMPFiles  : " '$(INCTMPFiles)'
1992         $(Echo) "PreConditions: " '$(PreConditions)'
1993         $(Echo) "Compile.CXX  : " '$(Compile.CXX)'
1994         $(Echo) "Compile.C    : " '$(Compile.C)'
1995         $(Echo) "Archive      : " '$(Archive)'
1996         $(Echo) "YaccFiles    : " '$(YaccFiles)'
1997         $(Echo) "LexFiles     : " '$(LexFiles)'
1998         $(Echo) "Module       : " '$(Module)'
1999         $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2000         $(Echo) "SubDirs      : " '$(SubDirs)'
2001         $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2002         $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2003
2004 ###
2005 # Debugging
2006
2007 # General debugging rule, use 'make dbg-print-XXX' to print the
2008 # definition, value and origin of XXX.
2009 make-print-%:
2010         $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))