MCDwarf: Remove unused parameter
[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 # Adjust linker flags for building an executable
538 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
539   ifndef TOOL_NO_EXPORTS
540     LD.Flags += $(RDYNAMIC)
541   endif
542 ifneq ($(HOST_OS), Darwin)
543 ifdef TOOLNAME
544   LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
545   ifdef EXAMPLE_TOOL
546     LD.Flags += $(RPATH) -Wl,$(ExmplDir)
547   else
548     LD.Flags += $(RPATH) -Wl,$(ToolDir)
549   endif
550 endif
551 else
552 ifneq ($(DARWIN_MAJVERS),4)
553   LD.Flags += $(RPATH) -Wl,@executable_path/../lib
554 endif
555 endif
556 endif
557
558
559 #----------------------------------------------------------
560 # Options To Invoke Tools
561 #----------------------------------------------------------
562
563 ifdef EXTRA_LD_OPTIONS
564 LD.Flags += $(EXTRA_LD_OPTIONS)
565 endif
566
567 ifndef NO_PEDANTIC
568 CompileCommonOpts += -pedantic -Wno-long-long
569 endif
570 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
571                      $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
572 # Enable cast-qual for C++; the workaround is to use const_cast.
573 CXX.Flags += -Wcast-qual
574
575 ifeq ($(HOST_OS),HP-UX)
576   CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
577 endif
578
579 # If we are building a universal binary on Mac OS X, pass extra options.  This
580 # is useful to people that want to link the LLVM libraries into their universal
581 # apps.
582 #
583 # The following can be optionally specified:
584 #   UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
585 #      For Mac OS X 10.4 Intel machines, the traditional one is:
586 #      UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
587 #   UNIVERSAL_ARCH can be optionally specified to be a list of architectures
588 #      to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64".  This defaults to
589 #      i386/ppc only.
590 ifdef UNIVERSAL
591   ifndef UNIVERSAL_ARCH
592     UNIVERSAL_ARCH := i386 ppc
593   endif
594   UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
595   CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
596   ifdef UNIVERSAL_SDK_PATH
597     CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
598   endif
599
600   # Building universal cannot compute dependencies automatically.
601   DISABLE_AUTO_DEPENDENCIES=1
602 else
603   ifeq ($(TARGET_OS),Darwin)
604     ifeq ($(ARCH),x86_64)
605       TargetCommonOpts = -m64
606     else
607       ifeq ($(ARCH),x86)
608         TargetCommonOpts = -m32
609       endif
610     endif
611   endif
612 endif
613
614 ifeq ($(HOST_OS),SunOS)
615 CPP.BaseFlags += -include llvm/Support/Solaris.h
616 endif
617
618 ifeq ($(HOST_OS),AuroraUX)
619 CPP.BaseFlags += -include llvm/Support/Solaris.h
620 endif # !HOST_OS - AuroraUX.
621
622 LD.Flags      += -L$(LibDir) -L$(LLVMLibDir)
623 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
624 # All -I flags should go here, so that they don't confuse llvm-config.
625 CPP.Flags     += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
626                  $(patsubst %,-I%/include,\
627                  $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
628                  $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
629                  $(CPP.BaseFlags)
630
631 # SHOW_DIAGNOSTICS support.
632 ifeq ($(SHOW_DIAGNOSTICS),1)
633   Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
634                           CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
635 else
636   Compile.Wrapper :=
637 endif
638
639 ifeq ($(BUILD_COMPONENT), 1)
640   Compile.C     = $(Compile.Wrapper) \
641                   $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
642                   $(TargetCommonOpts) $(CompileCommonOpts) -c
643   Compile.CXX   = $(Compile.Wrapper) \
644                   $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
645                   $(CPPFLAGS) \
646                   $(TargetCommonOpts) $(CompileCommonOpts) -c
647   Preprocess.CXX= $(Compile.Wrapper) \
648                   $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
649                   $(CompileCommonOpts) $(CXX.Flags) -E
650   Link          = $(Compile.Wrapper) \
651                   $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
652                   $(LD.Flags) $(LDFLAGS) \
653                   $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
654 else
655   Compile.C     = $(Compile.Wrapper) \
656                   $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
657                   $(TargetCommonOpts) $(CompileCommonOpts) -c
658   Compile.CXX   = $(Compile.Wrapper) \
659                   $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
660                   $(TargetCommonOpts) $(CompileCommonOpts) -c
661   Preprocess.CXX= $(Compile.Wrapper) \
662                   $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
663                   $(CompileCommonOpts) $(CXX.Flags) -E
664   Link          = $(Compile.Wrapper) \
665                   $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
666                   $(LDFLAGS) $(TargetCommonOpts)  $(CompileCommonOpts) $(Strip)
667 endif
668
669 Preprocess.C  = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
670                 $(TargetCommonOpts) $(CompileCommonOpts) -E
671
672 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755
673 ScriptInstall = $(INSTALL) -m 0755
674 DataInstall   = $(INSTALL) -m 0644
675
676 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
677 # paths. In this case, the SYSPATH function (defined in
678 # Makefile.config) transforms Unix paths into Windows paths.
679 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
680                 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
681                 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
682                 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
683 LLVMTableGen  = $(LLVM_TBLGEN) $(TableGen.Flags)
684
685 Archive       = $(AR) $(AR.Flags)
686 ifdef RANLIB
687 Ranlib        = $(RANLIB)
688 else
689 Ranlib        = ranlib
690 endif
691
692 AliasTool     = ln -s
693
694 #----------------------------------------------------------
695 # Get the list of source files and compute object file
696 # names from them.
697 #----------------------------------------------------------
698
699 ifndef SOURCES
700   Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
701              $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
702 else
703   Sources := $(SOURCES)
704 endif
705
706 ifdef BUILT_SOURCES
707 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
708 endif
709
710 BaseNameSources := $(sort $(basename $(Sources)))
711
712 ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
713
714 #----------------------------------------------------------
715 # For Mingw MSYS bash and Python/w32:
716 #
717 # $(ECHOPATH) prints DOSish pathstring.
718 #   ex) $(ECHOPATH) /include/sys/types.h
719 #   --> C:/mingw/include/sys/types.h
720 # built-in "echo" does not transform path to DOSish path.
721 #
722 # FIXME: It would not be needed when MSYS's python
723 # were provided.
724 #----------------------------------------------------------
725
726 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
727   ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
728 else
729   ECHOPATH := $(Verb)$(ECHO)
730 endif
731
732 ###############################################################################
733 # DIRECTORIES: Handle recursive descent of directory structure
734 ###############################################################################
735
736 #---------------------------------------------------------
737 # Provide rules to make install dirs. This must be early
738 # in the file so they get built before dependencies
739 #---------------------------------------------------------
740
741 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
742         $(Verb) $(MKDIR) $@
743
744 # To create other directories, as needed, and timestamp their creation
745 %/.dir:
746         $(Verb) $(MKDIR) $* > /dev/null
747         $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
748
749 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
750 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
751
752 #---------------------------------------------------------
753 # Handle the DIRS options for sequential construction
754 #---------------------------------------------------------
755
756 SubDirs :=
757 ifdef DIRS
758 SubDirs += $(DIRS)
759
760 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
761 $(RecursiveTargets)::
762         $(Verb) for dir in $(DIRS); do \
763           if ([ ! -f $$dir/Makefile ] || \
764               command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
765             $(MKDIR) $$dir; \
766             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
767           fi; \
768           ($(MAKE) -C $$dir $@ ) || exit 1; \
769         done
770 else
771 $(RecursiveTargets)::
772         $(Verb) for dir in $(DIRS); do \
773           ($(MAKE) -C $$dir $@ ) || exit 1; \
774         done
775 endif
776
777 endif
778
779 #---------------------------------------------------------
780 # Handle the EXPERIMENTAL_DIRS options ensuring success
781 # after each directory is built.
782 #---------------------------------------------------------
783 ifdef EXPERIMENTAL_DIRS
784 $(RecursiveTargets)::
785         $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
786           if ([ ! -f $$dir/Makefile ] || \
787               command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
788             $(MKDIR) $$dir; \
789             $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
790           fi; \
791           ($(MAKE) -C $$dir $@ ) || exit 0; \
792         done
793 endif
794
795 #-----------------------------------------------------------
796 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
797 #-----------------------------------------------------------
798 ifdef OPTIONAL_PARALLEL_DIRS
799   PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)"))
800 endif
801
802 #-----------------------------------------------------------
803 # Handle the PARALLEL_DIRS options for parallel construction
804 #-----------------------------------------------------------
805 ifdef PARALLEL_DIRS
806
807 SubDirs += $(PARALLEL_DIRS)
808
809 # Unfortunately, this list must be maintained if new recursive targets are added
810 all      :: $(addsuffix /.makeall      ,$(PARALLEL_DIRS))
811 clean    :: $(addsuffix /.makeclean    ,$(PARALLEL_DIRS))
812 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
813 install  :: $(addsuffix /.makeinstall  ,$(PARALLEL_DIRS))
814 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
815 install-bytecode  :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
816 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
817
818 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
819
820 $(ParallelTargets) :
821         $(Verb) if ([ ! -f $(@D)/Makefile ] || \
822                     command test $(@D)/Makefile -ot \
823                       $(PROJ_SRC_DIR)/$(@D)/Makefile ); then \
824           $(MKDIR) $(@D); \
825           $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
826         fi; \
827         $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
828 endif
829
830 #---------------------------------------------------------
831 # Handle the OPTIONAL_DIRS options for directores that may
832 # or may not exist.
833 #---------------------------------------------------------
834 ifdef OPTIONAL_DIRS
835
836 SubDirs += $(OPTIONAL_DIRS)
837
838 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
839 $(RecursiveTargets)::
840         $(Verb) for dir in $(OPTIONAL_DIRS); do \
841           if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
842             if ([ ! -f $$dir/Makefile ] || \
843                 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
844               $(MKDIR) $$dir; \
845               $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
846             fi; \
847             ($(MAKE) -C$$dir $@ ) || exit 1; \
848           fi \
849         done
850 else
851 $(RecursiveTargets)::
852         $(Verb) for dir in $(OPTIONAL_DIRS); do \
853           if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
854             ($(MAKE) -C$$dir $@ ) || exit 1; \
855           fi \
856         done
857 endif
858 endif
859
860 #---------------------------------------------------------
861 # Handle the CONFIG_FILES options
862 #---------------------------------------------------------
863 ifdef CONFIG_FILES
864
865 ifdef NO_INSTALL
866 install-local::
867         $(Echo) Install circumvented with NO_INSTALL
868 uninstall-local::
869         $(Echo) UnInstall circumvented with NO_INSTALL
870 else
871 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
872         $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
873         $(Verb)for file in $(CONFIG_FILES); do \
874           if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
875             $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
876           elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
877             $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
878           else \
879             $(ECHO) Error: cannot find config file $${file}. ; \
880           fi \
881         done
882
883 uninstall-local::
884         $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
885         $(Verb)for file in $(CONFIG_FILES); do \
886           $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
887         done
888 endif
889
890 endif
891
892 ###############################################################################
893 # Set up variables for building libraries
894 ###############################################################################
895
896 #---------------------------------------------------------
897 # Define various command line options pertaining to the
898 # libraries needed when linking. There are "Proj" libs
899 # (defined by the user's project) and "LLVM" libs (defined
900 # by the LLVM project).
901 #---------------------------------------------------------
902
903 ifdef USEDLIBS
904 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
905 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o,  $(ProjLibsOptions))
906 ProjUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
907 ProjLibsPaths   := $(addprefix $(LibDir)/,$(ProjUsedLibs))
908 endif
909
910 ifdef LLVMLIBS
911 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
912 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
913 LLVMUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
914 LLVMLibsPaths   := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
915 endif
916
917 # Loadable module for Win32 requires all symbols resolved for linking.
918 # Then all symbols in LLVM.dll will be available.
919 ifeq ($(ENABLE_SHARED),1)
920   ifdef LOADABLE_MODULE
921     ifneq (,$(filter $(HOST_OS),Cygwin MingW))
922       LINK_COMPONENTS += all
923     endif
924   endif
925 endif
926
927 ifndef IS_CLEANING_TARGET
928 ifdef LINK_COMPONENTS
929
930 # If LLVM_CONFIG doesn't exist, build it.  This can happen if you do a make
931 # clean in tools, then do a make in tools (instead of at the top level).
932 $(LLVM_CONFIG):
933         @echo "*** llvm-config doesn't exist - rebuilding it."
934         @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
935
936 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
937
938 ifeq ($(ENABLE_SHARED), 1)
939 # We can take the "auto-import" feature to get rid of using dllimport.
940 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
941 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
942                    -L $(SharedLibDir)
943 endif
944 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
945 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
946 else
947
948 ifndef NO_LLVM_CONFIG
949 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
950 ifeq ($(LLVMConfigLibs),Error)
951 $(error llvm-config --libs failed)
952 endif
953 LLVMLibsOptions += $(LLVMConfigLibs)
954 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
955 ifeq ($(LLVMConfigLibfiles),Error)
956 $(error llvm-config --libfiles failed)
957 endif
958 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
959 endif
960
961 endif
962 endif
963 endif
964
965 # Set up the library exports file.
966 ifdef EXPORTED_SYMBOL_FILE
967
968 # First, set up the native export file, which may differ from the source
969 # export file.
970
971 ifeq ($(HOST_OS),Darwin)
972 # Darwin convention prefixes symbols with underscores.
973 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
974 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
975         $(Verb) sed -e 's/^/_/' < $< > $@
976 clean-local::
977         -$(Verb) $(RM) -f $(NativeExportsFile)
978 else
979 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
980 # Gold and BFD ld require a version script rather than a plain list.
981 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
982 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
983         $(Verb) echo "{" > $@
984         $(Verb) grep -q "\<" $< && echo "  global:" >> $@ || :
985         $(Verb) sed -e 's/$$/;/' -e 's/^/    /' < $< >> $@
986 ifneq ($(HOST_OS),OpenBSD)
987         $(Verb) echo "  local: *;" >> $@
988 endif
989         $(Verb) echo "};" >> $@
990 clean-local::
991         -$(Verb) $(RM) -f $(NativeExportsFile)
992 else
993 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
994 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
995 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
996 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
997         $(Echo) Generating $(notdir $@)
998         $(Verb) $(ECHO) "EXPORTS" > $@
999         $(Verb) $(CAT) $< >> $@
1000 clean-local::
1001         -$(Verb) $(RM) -f $(NativeExportsFile)
1002 else
1003 # Default behavior: just use the exports file verbatim.
1004 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1005 endif
1006 endif
1007 endif
1008
1009 # Now add the linker command-line options to use the native export file.
1010
1011 # Darwin
1012 ifeq ($(HOST_OS),Darwin)
1013 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1014 endif
1015
1016 # gold, bfd ld, etc.
1017 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1018 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1019 endif
1020
1021 # Windows
1022 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1023 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1024 SharedLinkOptions += $(NativeExportsFile)
1025 endif
1026
1027 endif
1028
1029 ###############################################################################
1030 # Library Build Rules: Four ways to build a library
1031 ###############################################################################
1032
1033 # if we're building a library ...
1034 ifdef LIBRARYNAME
1035
1036 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1037 LIBRARYNAME := $(strip $(LIBRARYNAME))
1038 ifdef LOADABLE_MODULE
1039 BaseLibName.A  := $(LIBRARYNAME).a
1040 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1041 else
1042 BaseLibName.A  := lib$(LIBRARYNAME).a
1043 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1044 endif
1045 LibName.A  := $(LibDir)/$(BaseLibName.A)
1046 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1047 LibName.O  := $(LibDir)/$(LIBRARYNAME).o
1048
1049 #---------------------------------------------------------
1050 # Shared Library Targets:
1051 #   If the user asked for a shared library to be built
1052 #   with the SHARED_LIBRARY variable, then we provide
1053 #   targets for building them.
1054 #---------------------------------------------------------
1055 ifdef SHARED_LIBRARY
1056
1057 all-local:: $(LibName.SO)
1058
1059 ifdef EXPORTED_SYMBOL_FILE
1060 $(LibName.SO): $(NativeExportsFile)
1061 endif
1062
1063 ifdef LINK_LIBS_IN_SHARED
1064 ifdef LOADABLE_MODULE
1065 SharedLibKindMessage := "Loadable Module"
1066 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1067 else
1068 SharedLibKindMessage := "Shared Library"
1069 endif
1070 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1071         $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1072           $(notdir $@)
1073         $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1074           $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1075 else
1076 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1077         $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1078         $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1079 endif
1080
1081 clean-local::
1082 ifneq ($(strip $(LibName.SO)),)
1083         -$(Verb) $(RM) -f $(LibName.SO)
1084 endif
1085
1086 ifdef NO_INSTALL
1087 install-local::
1088         $(Echo) Install circumvented with NO_INSTALL
1089 uninstall-local::
1090         $(Echo) Uninstall circumvented with NO_INSTALL
1091 else
1092
1093 # Win32.DLL prefers to be located on the "PATH" of binaries.
1094 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1095 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1096 else
1097 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1098 endif
1099 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1100
1101 install-local:: $(DestSharedLib)
1102
1103 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1104         $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1105         $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1106
1107 uninstall-local::
1108         $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1109         -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1110 endif
1111 endif
1112
1113 #---------------------------------------------------------
1114 # Library Targets:
1115 #   If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1116 #   building an archive.
1117 #---------------------------------------------------------
1118 ifndef NO_BUILD_ARCHIVE
1119 ifndef BUILD_ARCHIVE
1120 ifndef LOADABLE_MODULE
1121 BUILD_ARCHIVE = 1
1122 endif
1123 endif
1124 endif
1125
1126 #---------------------------------------------------------
1127 # Archive Library Targets:
1128 #   If the user wanted a regular archive library built,
1129 #   then we provide targets for building them.
1130 #---------------------------------------------------------
1131 ifdef BUILD_ARCHIVE
1132
1133 all-local:: $(LibName.A)
1134
1135 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1136         $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1137         -$(Verb) $(RM) -f $@
1138         $(Verb) $(Archive) $@ $(ObjectsO)
1139         $(Verb) $(Ranlib) $@
1140
1141 clean-local::
1142 ifneq ($(strip $(LibName.A)),)
1143         -$(Verb) $(RM) -f $(LibName.A)
1144 endif
1145
1146 ifdef NO_INSTALL
1147 install-local::
1148         $(Echo) Install circumvented with NO_INSTALL
1149 uninstall-local::
1150         $(Echo) Uninstall circumvented with NO_INSTALL
1151 else
1152 ifdef NO_INSTALL_ARCHIVES
1153 install-local::
1154         $(Echo) Install circumvented with NO_INSTALL
1155 uninstall-local::
1156         $(Echo) Uninstall circumvented with NO_INSTALL
1157 else
1158 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1159
1160 install-local:: $(DestArchiveLib)
1161
1162 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1163         $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1164         $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1165         $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1166
1167 uninstall-local::
1168         $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1169         -$(Verb) $(RM) -f $(DestArchiveLib)
1170 endif
1171 endif
1172 endif
1173
1174 # endif LIBRARYNAME
1175 endif
1176
1177 ###############################################################################
1178 # Tool Build Rules: Build executable tool based on TOOLNAME option
1179 ###############################################################################
1180
1181 ifdef TOOLNAME
1182
1183 #---------------------------------------------------------
1184 # Set up variables for building a tool.
1185 #---------------------------------------------------------
1186 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1187 ifdef EXAMPLE_TOOL
1188 ToolBuildPath   := $(ExmplDir)/$(TOOLEXENAME)
1189 else
1190 ToolBuildPath   := $(ToolDir)/$(TOOLEXENAME)
1191 endif
1192
1193 # TOOLALIAS is a name to symlink (or copy) the tool to.
1194 ifdef TOOLALIAS
1195 ifdef EXAMPLE_TOOL
1196 ToolAliasBuildPath   := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1197 else
1198 ToolAliasBuildPath   := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1199 endif
1200 endif
1201
1202 #---------------------------------------------------------
1203 # Prune Exports
1204 #---------------------------------------------------------
1205
1206 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1207 # not exporting all of the weak symbols from the binary.  This reduces dyld
1208 # startup time by 4x on darwin in some cases.
1209 ifdef TOOL_NO_EXPORTS
1210 ifeq ($(HOST_OS),Darwin)
1211
1212 # Tiger tools don't support this.
1213 ifneq ($(DARWIN_MAJVERS),4)
1214 LD.Flags += -Wl,-exported_symbol,_main
1215 endif
1216 endif
1217
1218 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU/kFreeBSD))
1219 ifneq ($(ARCH), Mips)
1220   LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map
1221 endif
1222 endif
1223 endif
1224
1225 #---------------------------------------------------------
1226 # Tool Order File Support
1227 #---------------------------------------------------------
1228
1229 ifeq ($(HOST_OS),Darwin)
1230 ifdef TOOL_ORDER_FILE
1231
1232 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1233
1234 endif
1235 endif
1236
1237 #---------------------------------------------------------
1238 # Tool Version Info Support
1239 #---------------------------------------------------------
1240
1241 ifeq ($(HOST_OS),Darwin)
1242 ifdef TOOL_INFO_PLIST
1243
1244 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1245
1246 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1247
1248 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1249         $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1250         $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1251                    -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1252                    -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1253                  -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1254                    $< > $@
1255
1256 endif
1257 endif
1258
1259 #---------------------------------------------------------
1260 # Provide targets for building the tools
1261 #---------------------------------------------------------
1262 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1263
1264 clean-local::
1265 ifneq ($(strip $(ToolBuildPath)),)
1266         -$(Verb) $(RM) -f $(ToolBuildPath)
1267 endif
1268 ifneq ($(strip $(ToolAliasBuildPath)),)
1269         -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1270 endif
1271
1272 ifdef EXAMPLE_TOOL
1273 $(ToolBuildPath): $(ExmplDir)/.dir
1274 else
1275 $(ToolBuildPath): $(ToolDir)/.dir
1276 endif
1277
1278 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1279         $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1280         $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1281         $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1282         $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1283           $(StripWarnMsg)
1284
1285 ifneq ($(strip $(ToolAliasBuildPath)),)
1286 $(ToolAliasBuildPath): $(ToolBuildPath)
1287         $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1288         $(Verb) $(RM) -f $(ToolAliasBuildPath)
1289         $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1290         $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1291           $(StripWarnMsg)
1292 endif
1293
1294 ifdef NO_INSTALL
1295 install-local::
1296         $(Echo) Install circumvented with NO_INSTALL
1297 uninstall-local::
1298         $(Echo) Uninstall circumvented with NO_INSTALL
1299 else
1300 DestTool = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLEXENAME)
1301
1302 install-local:: $(DestTool)
1303
1304 $(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir)
1305         $(Echo) Installing $(BuildMode) $(DestTool)
1306         $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1307
1308 uninstall-local::
1309         $(Echo) Uninstalling $(BuildMode) $(DestTool)
1310         -$(Verb) $(RM) -f $(DestTool)
1311
1312 # TOOLALIAS install.
1313 ifdef TOOLALIAS
1314 DestToolAlias = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1315
1316 install-local:: $(DestToolAlias)
1317
1318 $(DestToolAlias): $(DestTool)
1319         $(Echo) Installing $(BuildMode) $(DestToolAlias)
1320         $(Verb) $(RM) -f $(DestToolAlias)
1321         $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1322
1323 uninstall-local::
1324         $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1325         -$(Verb) $(RM) -f $(DestToolAlias)
1326 endif
1327
1328 endif
1329 endif
1330
1331 ###############################################################################
1332 # Object Build Rules: Build object files based on sources
1333 ###############################################################################
1334
1335 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1336 ifeq ($(HOST_OS),HP-UX)
1337   DISABLE_AUTO_DEPENDENCIES=1
1338 endif
1339
1340 # Provide rule sets for when dependency generation is enabled
1341 ifndef DISABLE_AUTO_DEPENDENCIES
1342
1343 #---------------------------------------------------------
1344 # Create .o files in the ObjDir directory from the .cpp and .c files...
1345 #---------------------------------------------------------
1346
1347 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1348          -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1349
1350 # If the build succeeded, move the dependency file over, otherwise
1351 # remove it.
1352 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1353                   else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1354
1355 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1356         $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1357         $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1358                 $(DEPEND_MOVEFILE)
1359
1360 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1361         $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1362         $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1363                 $(DEPEND_MOVEFILE)
1364
1365 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1366         $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1367         $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1368                 $(DEPEND_MOVEFILE)
1369
1370 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1371         $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1372         $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1373                 $(DEPEND_MOVEFILE)
1374
1375 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1376         $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1377         $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1378                 $(DEPEND_MOVEFILE)
1379
1380 # Provide alternate rule sets if dependencies are disabled
1381 else
1382
1383 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1384         $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1385         $(Compile.CXX) $< -o $@
1386
1387 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1388         $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1389         $(Compile.CXX) $< -o $@
1390
1391 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1392         $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1393         $(Compile.CXX) $< -o $@
1394
1395 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1396         $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1397         $(Compile.C) $< -o $@
1398
1399 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1400         $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1401         $(Compile.C) $< -o $@
1402 endif
1403
1404
1405 ## Rules for building preprocessed (.i/.ii) outputs.
1406 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1407         $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1408         $(Verb) $(Preprocess.CXX) $< -o $@
1409
1410 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1411         $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1412         $(Verb) $(Preprocess.CXX) $< -o $@
1413
1414 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1415         $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1416         $(Verb) $(Preprocess.CXX) $< -o $@
1417
1418 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1419         $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1420         $(Verb) $(Preprocess.C) $< -o $@
1421
1422 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1423         $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1424         $(Verb) $(Preprocess.C) $< -o $@
1425
1426
1427 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1428         $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1429         $(Compile.CXX) $< -o $@ -S
1430
1431 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1432         $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1433         $(Compile.CXX) $< -o $@ -S
1434
1435 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1436         $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1437         $(Compile.CXX) $< -o $@ -S
1438
1439 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1440         $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1441         $(Compile.C) $< -o $@ -S
1442
1443 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1444         $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1445         $(Compile.C) $< -o $@ -S
1446
1447 ###############################################################################
1448 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1449 ###############################################################################
1450
1451 ifdef TARGET
1452 TABLEGEN_INC_FILES_COMMON = 1
1453 endif
1454
1455 ifdef TABLEGEN_INC_FILES_COMMON
1456
1457 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1458 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1459 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1460
1461 # INCFiles rule: All of the tblgen generated files are emitted to
1462 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc.  This allows
1463 # us to only "touch" the real file if the contents of it change.  IOW, if
1464 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1465 # dependencies of the .inc files are, unless the contents of the .inc file
1466 # changes.
1467 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1468         $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1469
1470 endif # TABLEGEN_INC_FILES_COMMON
1471
1472 ifdef TARGET
1473
1474 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1475            $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1476            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1477            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1478            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1479            $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1480            $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1481
1482 # All .inc.tmp files depend on the .td files.
1483 $(INCTMPFiles) : $(TDFiles)
1484
1485 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1486 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1487         $(Echo) "Building $(<F) register info implementation with tblgen"
1488         $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1489
1490 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1491 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1492         $(Echo) "Building $(<F) instruction information with tblgen"
1493         $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1494
1495 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1496 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1497         $(Echo) "Building $(<F) assembly writer with tblgen"
1498         $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1499
1500 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1501 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1502         $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1503         $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1504
1505 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1506 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1507         $(Echo) "Building $(<F) assembly matcher with tblgen"
1508         $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1509
1510 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1511 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1512         $(Echo) "Building $(<F) MC code emitter with tblgen"
1513         $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1514
1515 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1516 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1517         $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1518         $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1519
1520 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1521 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1522         $(Echo) "Building $(<F) code emitter with tblgen"
1523         $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1524
1525 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1526 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1527         $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1528         $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1529
1530 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1531 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1532         $(Echo) "Building $(<F) disassembly tables with tblgen"
1533         $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1534
1535 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1536 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1537         $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
1538         $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1539
1540 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1541 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1542         $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1543         $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1544
1545 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1546 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1547         $(Echo) "Building $(<F) subtarget information with tblgen"
1548         $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1549
1550 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1551 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1552         $(Echo) "Building $(<F) calling convention information with tblgen"
1553         $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1554
1555 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1556 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1557         $(Echo) "Building $(<F) intrinsics information with tblgen"
1558         $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1559
1560 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1561         $(Echo) "Building $(<F) decoder tables with tblgen"
1562         $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1563
1564
1565 clean-local::
1566         -$(Verb) $(RM) -f $(INCFiles)
1567
1568 endif # TARGET
1569
1570 ###############################################################################
1571 # OTHER RULES: Other rules needed
1572 ###############################################################################
1573
1574 # To create postscript files from dot files...
1575 ifneq ($(DOT),false)
1576 %.ps: %.dot
1577         $(DOT) -Tps < $< > $@
1578 else
1579 %.ps: %.dot
1580         $(Echo) "Cannot build $@: The program dot is not installed"
1581 endif
1582
1583 # This rules ensures that header files that are removed still have a rule for
1584 # which they can be "generated."  This allows make to ignore them and
1585 # reproduce the dependency lists.
1586 %.h:: ;
1587 %.hpp:: ;
1588
1589 # Define clean-local to clean the current directory. Note that this uses a
1590 # very conservative approach ensuring that empty variables do not cause
1591 # errors or disastrous removal.
1592 clean-local::
1593 ifneq ($(strip $(ObjRootDir)),)
1594         -$(Verb) $(RM) -rf $(ObjRootDir)
1595 endif
1596         -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1597 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1598         -$(Verb) $(RM) -f *$(SHLIBEXT)
1599 endif
1600
1601 clean-all-local::
1602         -$(Verb) $(RM) -rf Debug Release Profile
1603
1604
1605 ###############################################################################
1606 # DEPENDENCIES: Include the dependency files if we should
1607 ###############################################################################
1608 ifndef DISABLE_AUTO_DEPENDENCIES
1609
1610 # If its not one of the cleaning targets
1611 ifndef IS_CLEANING_TARGET
1612
1613 # Get the list of dependency files
1614 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1615 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1616
1617 -include $(DependFiles) ""
1618
1619 endif
1620
1621 endif
1622
1623 ###############################################################################
1624 # CHECK: Running the test suite
1625 ###############################################################################
1626
1627 check::
1628         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1629           if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1630             $(EchoCmd) Running test suite ; \
1631             $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1632               TESTSUITE=$(TESTSUITE) ; \
1633           else \
1634             $(EchoCmd) No Makefile in test directory ; \
1635           fi ; \
1636         else \
1637           $(EchoCmd) No test directory ; \
1638         fi
1639
1640 # An alias dating from when both lit and DejaGNU test runners were used.
1641 check-lit:: check
1642
1643 check-all::
1644         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1645           if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1646             $(EchoCmd) Running test suite ; \
1647             $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1648           else \
1649             $(EchoCmd) No Makefile in test directory ; \
1650           fi ; \
1651         else \
1652           $(EchoCmd) No test directory ; \
1653         fi
1654
1655 ###############################################################################
1656 # UNITTESTS: Running the unittests test suite
1657 ###############################################################################
1658
1659 unittests::
1660         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1661           if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1662             $(EchoCmd) Running unittests test suite ; \
1663             $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1664           else \
1665             $(EchoCmd) No Makefile in unittests directory ; \
1666           fi ; \
1667         else \
1668           $(EchoCmd) No unittests directory ; \
1669         fi
1670
1671 ###############################################################################
1672 # DISTRIBUTION: Handle construction of a distribution tarball
1673 ###############################################################################
1674
1675 #------------------------------------------------------------------------
1676 # Define distribution related variables
1677 #------------------------------------------------------------------------
1678 DistName    := $(PROJECT_NAME)-$(PROJ_VERSION)
1679 DistDir     := $(PROJ_OBJ_ROOT)/$(DistName)
1680 TopDistDir  := $(PROJ_OBJ_ROOT)/$(DistName)
1681 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1682 DistZip     := $(PROJ_OBJ_ROOT)/$(DistName).zip
1683 DistTarBZ2  := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1684 DistAlways  := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1685                ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1686                Makefile.config.in configure autoconf
1687 DistOther   := $(notdir $(wildcard \
1688                $(PROJ_SRC_DIR)/*.h \
1689                $(PROJ_SRC_DIR)/*.td \
1690                $(PROJ_SRC_DIR)/*.def \
1691                $(PROJ_SRC_DIR)/*.ll \
1692                $(PROJ_SRC_DIR)/*.in))
1693 DistSubDirs := $(SubDirs)
1694 DistSources  = $(Sources) $(EXTRA_DIST)
1695 DistFiles    = $(DistAlways) $(DistSources) $(DistOther)
1696
1697 #------------------------------------------------------------------------
1698 # We MUST build distribution with OBJ_DIR != SRC_DIR
1699 #------------------------------------------------------------------------
1700 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1701 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1702         $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1703
1704 else
1705
1706 #------------------------------------------------------------------------
1707 # Prevent attempt to run dist targets from anywhere but the top level
1708 #------------------------------------------------------------------------
1709 ifneq ($(LEVEL),.)
1710 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1711         $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1712 else
1713
1714 #------------------------------------------------------------------------
1715 # Provide the top level targets
1716 #------------------------------------------------------------------------
1717
1718 dist-gzip:: $(DistTarGZip)
1719
1720 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1721         $(Echo) Packing gzipped distribution tar file.
1722         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1723           $(GZIP) -c > "$(DistTarGZip)"
1724
1725 dist-bzip2:: $(DistTarBZ2)
1726
1727 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1728         $(Echo) Packing bzipped distribution tar file.
1729         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1730           $(BZIP2) -c >$(DistTarBZ2)
1731
1732 dist-zip:: $(DistZip)
1733
1734 $(DistZip) : $(TopDistDir)/.makedistdir
1735         $(Echo) Packing zipped distribution file.
1736         $(Verb) rm -f $(DistZip)
1737         $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1738
1739 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1740         $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
1741
1742 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1743
1744 dist-check:: $(DistTarGZip)
1745         $(Echo) Checking distribution tar file.
1746         $(Verb) if test -d $(DistCheckDir) ; then \
1747           $(RM) -rf $(DistCheckDir) ; \
1748         fi
1749         $(Verb) $(MKDIR) $(DistCheckDir)
1750         $(Verb) cd $(DistCheckDir) && \
1751           $(MKDIR) $(DistCheckDir)/build && \
1752           $(MKDIR) $(DistCheckDir)/install && \
1753           gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1754           cd build && \
1755           ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1756             --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
1757           $(MAKE) all && \
1758           $(MAKE) check && \
1759           $(MAKE) unittests && \
1760           $(MAKE) install && \
1761           $(MAKE) uninstall && \
1762           $(MAKE) dist-clean && \
1763           $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1764
1765 dist-clean::
1766         $(Echo) Cleaning distribution files
1767         -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1768           $(DistCheckDir)
1769
1770 endif
1771
1772 #------------------------------------------------------------------------
1773 # Provide the recursive distdir target for building the distribution directory
1774 #------------------------------------------------------------------------
1775 distdir: $(DistDir)/.makedistdir
1776 $(DistDir)/.makedistdir: $(DistSources)
1777         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1778           if test -d "$(DistDir)" ; then \
1779             find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';'  || \
1780               exit 1 ; \
1781           fi ; \
1782           $(EchoCmd) Removing old $(DistDir) ; \
1783           $(RM) -rf $(DistDir); \
1784           $(EchoCmd) Making 'all' to verify build ; \
1785           $(MAKE) ENABLE_OPTIMIZED=1 all ; \
1786         fi
1787         $(Echo) Building Distribution Directory $(DistDir)
1788         $(Verb) $(MKDIR) $(DistDir)
1789         $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1790         srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
1791         for file in $(DistFiles) ; do \
1792           case "$$file" in \
1793             $(PROJ_SRC_DIR)/*) \
1794               file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1795               ;; \
1796             $(PROJ_SRC_ROOT)/*) \
1797               file=`echo "$$file" | \
1798                 sed "s#^$$srcrootstrip/##"` \
1799               ;; \
1800           esac; \
1801           if test -f "$(PROJ_SRC_DIR)/$$file" || \
1802              test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1803             from_dir="$(PROJ_SRC_DIR)" ; \
1804           elif test -f "$$file" || test -d "$$file" ; then \
1805             from_dir=. ; \
1806           fi ; \
1807           to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1808           if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1809             to_dir="$(DistDir)/$$dir"; \
1810             $(MKDIR) "$$to_dir" ; \
1811           else \
1812             to_dir="$(DistDir)"; \
1813           fi; \
1814           mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1815           if test -n "$$mid_dir" ; then \
1816             $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1817           fi ; \
1818           if test -d "$$from_dir/$$file"; then \
1819             if test -d "$(PROJ_SRC_DIR)/$$file" && \
1820                test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1821                cd $(PROJ_SRC_DIR) ; \
1822                $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1823                  ( cd $$to_dir ; $(TAR) xf - ) ; \
1824                cd $(PROJ_OBJ_DIR) ; \
1825             else \
1826                cd $$from_dir ; \
1827                $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1828                  ( cd $$to_dir ; $(TAR) xf - ) ; \
1829                cd $(PROJ_OBJ_DIR) ; \
1830             fi; \
1831           elif test -f "$$from_dir/$$file" ; then \
1832             $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1833           elif test -L "$$from_dir/$$file" ; then \
1834             $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1835           elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1836             $(EchoCmd) "===== WARNING: Distribution Source " \
1837               "$$from_dir/$$file Not Found!" ; \
1838           elif test "$(Verb)" != '@' ; then \
1839             $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1840           fi; \
1841         done
1842         $(Verb) for subdir in $(DistSubDirs) ; do \
1843           if test "$$subdir" \!= "." ; then \
1844             new_distdir="$(DistDir)/$$subdir" ; \
1845             test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1846             ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
1847               DistDir="$$new_distdir" distdir ) || exit 1; \
1848           fi; \
1849         done
1850         $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1851           $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
1852           $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
1853                                   -name .svn \) -print` ;\
1854           $(MAKE) dist-hook ; \
1855           $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1856             -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1857             -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1858             -o ! -type d ! -perm -444 -exec \
1859               $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1860             || chmod -R a+r $(DistDir) ; \
1861         fi
1862
1863 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1864 # defined by user.
1865 dist-hook::
1866
1867 endif
1868
1869 ###############################################################################
1870 # TOP LEVEL - targets only to apply at the top level directory
1871 ###############################################################################
1872
1873 ifeq ($(LEVEL),.)
1874
1875 #------------------------------------------------------------------------
1876 # Install support for the project's include files:
1877 #------------------------------------------------------------------------
1878 ifdef NO_INSTALL
1879 install-local::
1880         $(Echo) Install circumvented with NO_INSTALL
1881 uninstall-local::
1882         $(Echo) Uninstall circumvented with NO_INSTALL
1883 else
1884 install-local::
1885         $(Echo) Installing include files
1886         $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
1887         $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
1888           cd $(PROJ_SRC_ROOT)/include && \
1889           for hdr in `find . -type f \
1890               '(' -name LICENSE.TXT \
1891                -o -name '*.def' \
1892                -o -name '*.h' \
1893                -o -name '*.inc' \
1894                -o -name '*.td' \
1895               ')' -print | grep -v CVS | \
1896               grep -v .svn` ; do \
1897             instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
1898             if test \! -d "$$instdir" ; then \
1899               $(EchoCmd) Making install directory $$instdir ; \
1900               $(MKDIR) $$instdir ;\
1901             fi ; \
1902             $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
1903           done ; \
1904         fi
1905 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
1906         $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
1907           cd $(PROJ_OBJ_ROOT)/include && \
1908           for hdr in `find . -type f \
1909               '(' -name LICENSE.TXT \
1910                -o -name '*.def' \
1911                -o -name '*.h' \
1912                -o -name '*.inc' \
1913                -o -name '*.td' \
1914               ')' -print | grep -v CVS | \
1915               grep -v .svn` ; do \
1916             instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
1917             if test \! -d "$$instdir" ; then \
1918               $(EchoCmd) Making install directory $$instdir ; \
1919               $(MKDIR) $$instdir ;\
1920             fi ; \
1921             $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
1922           done ; \
1923         fi
1924 endif
1925
1926 uninstall-local::
1927         $(Echo) Uninstalling include files
1928         $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1929           cd $(PROJ_SRC_ROOT)/include && \
1930             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1931               '!' '(' -name '*~' -o -name '.#*' \
1932         -o -name '*.in' ')' -print ')' | \
1933         grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
1934           cd $(PROJ_SRC_ROOT)/include && \
1935             $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
1936       -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
1937         fi
1938 endif
1939 endif
1940
1941 check-line-length:
1942         @echo searching for overlength lines in files: $(Sources)
1943         @echo
1944         @echo
1945         egrep -n '.{81}' $(Sources) /dev/null
1946
1947 check-for-tabs:
1948         @echo searching for tabs in files: $(Sources)
1949         @echo
1950         @echo
1951         egrep -n '      ' $(Sources) /dev/null
1952
1953 check-footprint:
1954         @ls -l $(LibDir) | awk '\
1955           BEGIN { sum = 0; } \
1956                 { sum += $$5; } \
1957           END   { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1958         @ls -l $(ToolDir) | awk '\
1959           BEGIN { sum = 0; } \
1960                 { sum += $$5; } \
1961           END   { printf("Programs:  %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1962 #------------------------------------------------------------------------
1963 # Print out the directories used for building
1964 #------------------------------------------------------------------------
1965 printvars::
1966         $(Echo) "BuildMode    : " '$(BuildMode)'
1967         $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1968         $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1969         $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1970         $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1971         $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1972         $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1973         $(Echo) "PROJ_prefix  : " '$(PROJ_prefix)'
1974         $(Echo) "PROJ_bindir  : " '$(PROJ_bindir)'
1975         $(Echo) "PROJ_libdir  : " '$(PROJ_libdir)'
1976         $(Echo) "PROJ_etcdir  : " '$(PROJ_etcdir)'
1977         $(Echo) "PROJ_includedir  : " '$(PROJ_includedir)'
1978         $(Echo) "UserTargets  : " '$(UserTargets)'
1979         $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1980         $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1981         $(Echo) "ObjDir       : " '$(ObjDir)'
1982         $(Echo) "LibDir       : " '$(LibDir)'
1983         $(Echo) "ToolDir      : " '$(ToolDir)'
1984         $(Echo) "ExmplDir     : " '$(ExmplDir)'
1985         $(Echo) "Sources      : " '$(Sources)'
1986         $(Echo) "TDFiles      : " '$(TDFiles)'
1987         $(Echo) "INCFiles     : " '$(INCFiles)'
1988         $(Echo) "INCTMPFiles  : " '$(INCTMPFiles)'
1989         $(Echo) "PreConditions: " '$(PreConditions)'
1990         $(Echo) "Compile.CXX  : " '$(Compile.CXX)'
1991         $(Echo) "Compile.C    : " '$(Compile.C)'
1992         $(Echo) "Archive      : " '$(Archive)'
1993         $(Echo) "YaccFiles    : " '$(YaccFiles)'
1994         $(Echo) "LexFiles     : " '$(LexFiles)'
1995         $(Echo) "Module       : " '$(Module)'
1996         $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
1997         $(Echo) "SubDirs      : " '$(SubDirs)'
1998         $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
1999         $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2000
2001 ###
2002 # Debugging
2003
2004 # General debugging rule, use 'make dbg-print-XXX' to print the
2005 # definition, value and origin of XXX.
2006 make-print-%:
2007         $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))