blob: 3fdae66c413e716c6242cc68ae049e94e091eabe [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001#===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
2#
3# The LLVM Compiler Infrastructure
4#
Chris Lattner3876aa72007-12-29 20:11:13 +00005# This file is distributed under the University of Illinois Open Source
6# License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007#
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#--------------------------------------------------------------------
22RecursiveTargets := all clean clean-all install uninstall install-bytecode
23LocalTargets := all-local clean-local clean-all-local check-local \
24 install-local printvars uninstall-local \
25 install-bytecode-local
Chris Lattner42596062007-09-26 06:10:47 +000026TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \
Dan Gohmanf17a25c2007-07-18 16:29:46 +000027 dist-zip
28UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
29InternalTargets := preconditions distdir dist-hook
30
31################################################################################
32# INITIALIZATION: Basic things the makefile needs
33################################################################################
34
35#--------------------------------------------------------------------
36# Set the VPATH so that we can find source files.
37#--------------------------------------------------------------------
38VPATH=$(PROJ_SRC_DIR)
39
40#--------------------------------------------------------------------
41# Reset the list of suffixes we know how to build.
42#--------------------------------------------------------------------
43.SUFFIXES:
44.SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot .ll
45.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
46
47#--------------------------------------------------------------------
48# Mark all of these targets as phony to avoid implicit rule search
49#--------------------------------------------------------------------
50.PHONY: $(UserTargets) $(InternalTargets)
51
52#--------------------------------------------------------------------
53# Make sure all the user-target rules are double colon rules and
54# they are defined first.
55#--------------------------------------------------------------------
56
57$(UserTargets)::
58
59################################################################################
60# PRECONDITIONS: that which must be built/checked first
61################################################################################
62
63SrcMakefiles := $(filter %Makefile %Makefile.tests,\
64 $(wildcard $(PROJ_SRC_DIR)/Makefile*))
65ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
66ConfigureScript := $(PROJ_SRC_ROOT)/configure
67ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
68MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
69MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
70MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
71MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
72PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
73ifneq ($(MakefileCommonIn),)
74PreConditions += $(MakefileCommon)
75endif
76
77ifneq ($(MakefileConfigIn),)
78PreConditions += $(MakefileConfig)
79endif
80
81preconditions: $(PreConditions)
82
83#------------------------------------------------------------------------
84# Make sure the BUILT_SOURCES are built first
85#------------------------------------------------------------------------
86$(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
87
88clean-all-local::
89ifneq ($(strip $(BUILT_SOURCES)),)
90 -$(Verb) $(RM) -f $(BUILT_SOURCES)
91endif
92
93ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
94spotless:
95 $(Verb) if test -x config.status ; then \
96 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
97 $(MKDIR) .spotless.save ; \
98 $(MV) config.status .spotless.save ; \
99 $(MV) mklib .spotless.save ; \
100 $(MV) projects .spotless.save ; \
101 $(RM) -rf * ; \
102 $(MV) .spotless.save/config.status . ; \
103 $(MV) .spotless.save/mklib . ; \
104 $(MV) .spotless.save/projects . ; \
105 $(RM) -rf .spotless.save ; \
106 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
107 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
108 $(ConfigStatusScript) ; \
109 else \
110 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
111 fi
112else
113spotless:
114 $(EchoCmd) "spotless target not supported for objdir == srcdir"
115endif
116
117$(BUILT_SOURCES) : $(ObjMakefiles)
118
119#------------------------------------------------------------------------
120# Make sure we're not using a stale configuration
121#------------------------------------------------------------------------
122reconfigure:
123 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
124 $(Verb) cd $(PROJ_OBJ_ROOT) && \
125 if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
126 $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
127 fi ; \
128 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
129 $(ConfigStatusScript)
130
131.PRECIOUS: $(ConfigStatusScript)
132$(ConfigStatusScript): $(ConfigureScript)
133 $(Echo) Reconfiguring with $<
134 $(Verb) cd $(PROJ_OBJ_ROOT) && \
135 if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
136 $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
137 fi ; \
138 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
139 $(ConfigStatusScript)
140
141#------------------------------------------------------------------------
142# Make sure the configuration makefile is up to date
143#------------------------------------------------------------------------
144ifneq ($(MakefileConfigIn),)
145$(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
146 $(Echo) Regenerating $@
147 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
148endif
149
150ifneq ($(MakefileCommonIn),)
151$(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
152 $(Echo) Regenerating $@
153 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
154endif
155
156#------------------------------------------------------------------------
157# If the Makefile in the source tree has been updated, copy it over into the
158# build tree. But, only do this if the source and object makefiles differ
159#------------------------------------------------------------------------
160ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
161
Gordon Henriksen4290f662008-03-10 15:58:40 +0000162Makefile: $(PROJ_SRC_DIR)/Makefile $(ExtraMakefiles)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000163 $(Echo) "Updating Makefile"
164 $(Verb) $(MKDIR) $(@D)
165 $(Verb) $(CP) -f $< $@
166
167# Copy the Makefile.* files unless we're in the root directory which avoids
168# the copying of Makefile.config.in or other things that should be explicitly
169# taken care of.
170$(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile%
171 @case '$?' in \
172 *Makefile.rules) ;; \
173 *.in) ;; \
Gordon Henriksen4290f662008-03-10 15:58:40 +0000174 *) $(EchoCmd) "Updating $(@F)" ; \
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000175 $(MKDIR) $(@D) ; \
176 $(CP) -f $< $@ ;; \
177 esac
Gabor Greif14c4c8e2008-02-27 13:34:15 +0000178
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000179endif
180
181#------------------------------------------------------------------------
182# Set up the basic dependencies
183#------------------------------------------------------------------------
184$(UserTargets):: $(PreConditions)
185
186all:: all-local
187clean:: clean-local
188clean-all:: clean-local clean-all-local
189install:: install-local
190uninstall:: uninstall-local
191install-local:: all-local
192install-bytecode:: install-bytecode-local
193
194###############################################################################
195# VARIABLES: Set up various variables based on configuration data
196###############################################################################
197
Daniel Dunbara89194e2008-10-03 19:11:19 +0000198# Variable for if this make is for a "cleaning" target
199ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
200 IS_CLEANING_TARGET=1
201endif
202
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000203#--------------------------------------------------------------------
204# Variables derived from configuration we are building
205#--------------------------------------------------------------------
206
207CPP.Defines :=
208# OPTIMIZE_OPTION - The optimization level option we want to build LLVM with
209# this can be overridden on the make command line.
210ifneq ($(OS),MingW)
211 OPTIMIZE_OPTION := -O3
212else
213 OPTIMIZE_OPTION := -O2
214endif
215
216ifdef ENABLE_PROFILING
217 BuildMode := Profile
Gordon Henriksen09968862008-01-06 21:54:35 +0000218 CXX.Flags += $(OPTIMIZE_OPTION) -pg -g
219 C.Flags += $(OPTIMIZE_OPTION) -pg -g
220 LD.Flags += $(OPTIMIZE_OPTION) -pg -g
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000221 KEEP_SYMBOLS := 1
222else
223 ifeq ($(ENABLE_OPTIMIZED),1)
224 BuildMode := Release
225 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
226 ifneq ($(OS),FreeBSD)
227 ifneq ($(OS),Darwin)
228 OmitFramePointer := -fomit-frame-pointer
229 endif
230 endif
231
232 # Darwin requires -fstrict-aliasing to be explicitly enabled.
233 ifeq ($(OS),Darwin)
Evan Cheng1bde8892008-06-05 23:00:08 +0000234 EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000235 endif
236
Gordon Henriksen09968862008-01-06 21:54:35 +0000237 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
238 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
239 LD.Flags += $(OPTIMIZE_OPTION)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000240 else
241 BuildMode := Debug
Gordon Henriksen09968862008-01-06 21:54:35 +0000242 CXX.Flags += -g
243 C.Flags += -g
244 LD.Flags += -g
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000245 KEEP_SYMBOLS := 1
246 endif
247endif
248
Daniel Dunbar886e1832008-09-02 17:35:16 +0000249#ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
250# CXX.Flags += -fvisibility-inlines-hidden
251#endif
252
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000253# IF REQUIRES_EH=1 is specified then don't disable exceptions
254ifndef REQUIRES_EH
255 CXX.Flags += -fno-exceptions
256endif
257
258# IF REQUIRES_RTTI=1 is specified then don't disable run-time type id
259ifndef REQUIRES_RTTI
260# CXX.Flags += -fno-rtti
261endif
262
263# If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
264# then disable assertions by defining the appropriate preprocessor symbols.
265ifdef DISABLE_ASSERTIONS
266 BuildMode := $(BuildMode)-Asserts
267 CPP.Defines += -DNDEBUG
268else
269 CPP.Defines += -D_DEBUG
270endif
271
272# If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
273# configured), then enable expensive checks by defining the
274# appropriate preprocessor symbols.
275ifdef ENABLE_EXPENSIVE_CHECKS
276 BuildMode := $(BuildMode)+Checks
277 CPP.Defines += -D_GLIBCXX_DEBUG
278endif
279
280ifeq ($(ENABLE_PIC),1)
281 CXX.Flags += -fPIC
282 C.Flags += -fPIC
283endif
284
285CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
286C.Flags += $(CFLAGS)
287CPP.Defines += $(CPPFLAGS)
288CPP.BaseFlags += $(CPP.Defines)
289LD.Flags += $(LDFLAGS)
290AR.Flags := cru
291LibTool.Flags := --tag=CXX
292
293# Make Floating point IEEE compliant on Alpha.
294ifeq ($(ARCH),Alpha)
295 CXX.Flags += -mieee
296 CPP.BaseFlags += -mieee
297ifeq ($(ENABLE_PIC),0)
298 CXX.Flags += -fPIC
299 CPP.BaseFlags += -fPIC
300endif
301endif
302
303ifeq ($(ARCH),Alpha)
304 LD.Flags += -Wl,--no-relax
305endif
306
307#--------------------------------------------------------------------
308# Directory locations
309#--------------------------------------------------------------------
Jim Grosbache4c032e2008-10-02 22:56:44 +0000310TargetMode :=
311ifeq ($(LLVM_CROSS_COMPILING),1)
312 ifeq ($(BUILD_COMPONENT),1)
313 TargetMode := Build
314 else
315 TargetMode := Host
316 endif
317 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/Build/bin
318endif
319
320ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
Daniel Dunbarfb6e3ee2008-10-03 21:24:52 +0000321# It is very important that ObjDir not have an extra trailing
322# slash. This ends up changing the rules so that dependency file (.d)
323# information is not used at all!
324ifeq ($(TargetMode),)
325 ObjDir := $(ObjRootDir)
326else
327 ObjDir := $(ObjRootDir)/$(TargetMode)
328endif
Jim Grosbache4c032e2008-10-02 22:56:44 +0000329LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/lib
330ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/bin
331ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/examples
332LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/lib
333LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/bin
334LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/examples
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000335CFERuntimeLibDir := $(LLVMGCCDIR)/lib
336
337#--------------------------------------------------------------------
338# Full Paths To Compiled Tools and Utilities
339#--------------------------------------------------------------------
340EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
341Echo = @$(EchoCmd)
342ifndef LIBTOOL
343LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
344endif
345ifndef LLVMAS
346LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
347endif
348ifndef TBLGEN
349 ifeq ($(LLVM_CROSS_COMPILING),1)
Jim Grosbache4c032e2008-10-02 22:56:44 +0000350 TBLGEN := $(BuildLLVMToolDir)/tblgen$(EXEEXT)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000351 else
352 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
353 endif
354endif
355LLVM_CONFIG := $(LLVMToolDir)/llvm-config
356ifndef LLVMLD
357LLVMLD := $(LLVMToolDir)/llvm-ld$(EXEEXT)
358endif
359ifndef LLVMDIS
360LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
361endif
362ifndef LLI
363LLI := $(LLVMToolDir)/lli$(EXEEXT)
364endif
365ifndef LLC
366LLC := $(LLVMToolDir)/llc$(EXEEXT)
367endif
368ifndef LOPT
369LOPT := $(LLVMToolDir)/opt$(EXEEXT)
370endif
371ifndef LBUGPOINT
372LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
373endif
374ifndef LUPGRADE
375LUPGRADE := $(LLVMToolDir)/llvm-upgrade$(EXEEXT)
376endif
377ifeq ($(LLVMGCC_MAJVERS),3)
378UPGRADE_MSG = $(Echo) "Upgrading $(1) assembly to latest."
379UPGRADE_LL = $(Verb)$(LUPGRADE) $(1) -o $(1).up.tmp -f ; $(MV) $(1).up.tmp $(1)
380LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
381LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
382else
383UPGRADE_MSG =
384UPGRADE_LL =
385LLVMGCCWITHPATH := $(LLVMGCC)
386LLVMGXXWITHPATH := $(LLVMGXX)
387endif
388
389#--------------------------------------------------------------------
390# Adjust to user's request
391#--------------------------------------------------------------------
392
393# Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
394# to be built. Note that if LOADABLE_MODULE is specified then the resulting
395# shared library can be opened with dlopen. Also, LOADABLE_MODULE implies
396# several other things so we force them to be defined/on.
397ifdef LOADABLE_MODULE
398 SHARED_LIBRARY := 1
399 DONT_BUILD_RELINKED := 1
400 LINK_LIBS_IN_SHARED := 1
401 LD.Flags += -module
402endif
403
404ifdef SHARED_LIBRARY
405 LD.Flags += -rpath $(LibDir)
406else
407 LibTool.Flags += --tag=disable-shared
408endif
409
410ifdef TOOL_VERBOSE
411 C.Flags += -v
412 CXX.Flags += -v
413 LD.Flags += -v
414 VERBOSE := 1
415endif
416
417# Adjust settings for verbose mode
418ifndef VERBOSE
419 Verb := @
420 LibTool.Flags += --silent
Reid Spencerdfb3d5b2007-07-23 08:20:46 +0000421 AR.Flags += >/dev/null 2>/dev/null
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000422 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
423else
424 ConfigureScriptFLAGS :=
425endif
426
427# By default, strip symbol information from executable
428ifndef KEEP_SYMBOLS
429 Strip := $(PLATFORMSTRIPOPTS)
430 StripWarnMsg := "(without symbols)"
431 Install.StripFlag += -s
432endif
433
434# Adjust linker flags for building an executable
435ifdef TOOLNAME
436ifdef EXAMPLE_TOOL
437 LD.Flags += -rpath $(ExmplDir) -export-dynamic
438else
439 LD.Flags += -rpath $(ToolDir) -export-dynamic
440endif
441endif
442
443#----------------------------------------------------------
444# Options To Invoke Tools
445#----------------------------------------------------------
446
447CompileCommonOpts := -pedantic -Wall -W -Wwrite-strings -Wno-long-long \
448 -Wunused -Wno-unused-parameter $(EXTRA_OPTIONS)
449
450ifeq ($(OS),HP-UX)
451 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
452endif
453
454# If we are building a universal binary on Mac OS/X, pass extra options. This
455# is useful to people that want to link the LLVM libraries into their universal
456# apps.
457#
458# The following can be optionally specified:
459# UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
460# For Mac OS/X 10.4 Intel machines, the traditional one is:
461# UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
462# UNIVERSAL_ARCH can be optionally specified to be a list of architectures
463# to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
464# i386/ppc only.
465ifdef UNIVERSAL
466 ifndef UNIVERSAL_ARCH
467 UNIVERSAL_ARCH := i386 ppc
468 endif
469 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
470 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
471 Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS:%=-XCClinker %)
472 ifdef UNIVERSAL_SDK_PATH
473 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
474 Relink.Flags += -XCClinker -isysroot -XCClinker $(UNIVERSAL_SDK_PATH)
475 endif
476
477 # Building universal cannot compute dependencies automatically.
478 DISABLE_AUTO_DEPENDENCIES=1
479endif
480
Chris Lattner35c997c2008-06-24 17:44:42 +0000481ifeq ($(OS),SunOS)
482CPP.BaseFlags += -include llvm/System/Solaris.h
483endif
484
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000485LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
Dan Gohman5a5e6e92008-10-17 01:33:43 +0000486CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000487# All -I flags should go here, so that they don't confuse llvm-config.
Duncan Sands3b960292008-01-28 17:38:30 +0000488CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
489 $(patsubst %,-I%/include,\
Chris Lattner6ee48752008-01-28 04:18:41 +0000490 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
491 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
492 $(CPP.BaseFlags)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000493
Jim Grosbache4c032e2008-10-02 22:56:44 +0000494 ifeq ($(BUILD_COMPONENT), 1)
495 Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c
496 Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c
497 Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
498 Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
499 $(LD.Flags) $(Strip)
500 Relink = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
501 $(Relink.Flags)
502else
503 Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c
504 Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c
505 Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
506 Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
507 $(LD.Flags) $(Strip)
508 Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
509 $(Relink.Flags)
510endif
511
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000512LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
513BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts)
514Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -E
515
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000516LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
517BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \
518 $(CompileCommonOpts)
519
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000520LTLink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Link)
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000521LTRelink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Relink)
522LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
523 $(Install.Flags)
524ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
525ScriptInstall = $(INSTALL) -m 0755
526DataInstall = $(INSTALL) -m 0644
Chris Lattner1b0a3a12008-01-15 23:27:40 +0000527
528# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
529# paths. In this case, the SYSPATH function (defined in
530# Makefile.config) transforms Unix paths into Windows paths.
531TableGen = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
532 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
533 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
534
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000535Archive = $(AR) $(AR.Flags)
536LArchive = $(LLVMToolDir)/llvm-ar rcsf
537ifdef RANLIB
538Ranlib = $(RANLIB)
539else
540Ranlib = ranlib
541endif
542
543#----------------------------------------------------------
544# Get the list of source files and compute object file
545# names from them.
546#----------------------------------------------------------
547
548ifndef SOURCES
549 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
550 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
551 $(PROJ_SRC_DIR)/*.l))
552else
553 Sources := $(SOURCES)
554endif
555
556ifdef BUILT_SOURCES
557Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
558endif
559
560BaseNameSources := $(sort $(basename $(Sources)))
561
562ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
563ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
564ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
565
566###############################################################################
567# DIRECTORIES: Handle recursive descent of directory structure
568###############################################################################
569
570#---------------------------------------------------------
571# Provide rules to make install dirs. This must be early
572# in the file so they get built before dependencies
573#---------------------------------------------------------
574
575$(PROJ_bindir): $(PROJ_bindir)/.dir
576$(PROJ_libdir): $(PROJ_libdir)/.dir
577$(PROJ_includedir): $(PROJ_includedir)/.dir
578$(PROJ_etcdir): $(PROJ_etcdir)/.dir
579
580# To create other directories, as needed, and timestamp their creation
581%/.dir:
582 $(Verb) $(MKDIR) $* > /dev/null
583 $(Verb) $(DATE) > $@
584
585.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
586.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
587
588#---------------------------------------------------------
589# Handle the DIRS options for sequential construction
590#---------------------------------------------------------
591
592SubDirs :=
593ifdef DIRS
594SubDirs += $(DIRS)
595
596ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
Jim Grosbache4c032e2008-10-02 22:56:44 +0000597ifdef BUILD_TARGET_DIRS
598$(RecursiveTargets)::
599 $(Verb) for dir in $(BUILD_TARGET_DIRS); do \
600 if [ ! -f $$dir/Makefile ]; then \
601 $(MKDIR) $$dir; \
602 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
603 fi; \
604 ($(MAKE) -C $$dir $@ BUILD_COMPONENT=1 NO_INSTALL=1 ) || exit 1; \
605 done
606endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000607$(RecursiveTargets)::
608 $(Verb) for dir in $(DIRS); do \
609 if [ ! -f $$dir/Makefile ]; then \
610 $(MKDIR) $$dir; \
611 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
612 fi; \
613 ($(MAKE) -C $$dir $@ ) || exit 1; \
614 done
615else
Jim Grosbache4c032e2008-10-02 22:56:44 +0000616ifdef BUILD_TARGET_DIRS
617$(RecursiveTargets)::
618 $(Verb) for dir in $(BUILD_TARGET_DIRS); do \
619 ($(MAKE) -C $$dir $@ BUILD_COMPONENT=1 NO_INSTALL=1 ) || exit 1; \
620 done
621endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000622$(RecursiveTargets)::
623 $(Verb) for dir in $(DIRS); do \
624 ($(MAKE) -C $$dir $@ ) || exit 1; \
625 done
626endif
627
628endif
629
630#---------------------------------------------------------
631# Handle the EXPERIMENTAL_DIRS options ensuring success
632# after each directory is built.
633#---------------------------------------------------------
634ifdef EXPERIMENTAL_DIRS
635$(RecursiveTargets)::
636 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
637 if [ ! -f $$dir/Makefile ]; then \
638 $(MKDIR) $$dir; \
639 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
640 fi; \
641 ($(MAKE) -C $$dir $@ ) || exit 0; \
642 done
643endif
644
645#-----------------------------------------------------------
646# Handle the PARALLEL_DIRS options for parallel construction
647#-----------------------------------------------------------
648ifdef PARALLEL_DIRS
649
650SubDirs += $(PARALLEL_DIRS)
651
652# Unfortunately, this list must be maintained if new recursive targets are added
653all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
654clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
655clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
656install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
657uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
658install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
659
660ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
661
662$(ParallelTargets) :
663 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
664 $(MKDIR) $(@D); \
665 $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
666 fi; \
667 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
668endif
669
670#---------------------------------------------------------
671# Handle the OPTIONAL_DIRS options for directores that may
672# or may not exist.
673#---------------------------------------------------------
674ifdef OPTIONAL_DIRS
675
676SubDirs += $(OPTIONAL_DIRS)
677
678ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
679$(RecursiveTargets)::
680 $(Verb) for dir in $(OPTIONAL_DIRS); do \
681 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
682 if [ ! -f $$dir/Makefile ]; then \
683 $(MKDIR) $$dir; \
684 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
685 fi; \
686 ($(MAKE) -C$$dir $@ ) || exit 1; \
687 fi \
688 done
689else
690$(RecursiveTargets)::
691 $(Verb) for dir in $(OPTIONAL_DIRS); do \
692 ($(MAKE) -C$$dir $@ ) || exit 1; \
693 done
694endif
695endif
696
697#---------------------------------------------------------
698# Handle the CONFIG_FILES options
699#---------------------------------------------------------
700ifdef CONFIG_FILES
701
702ifdef NO_INSTALL
703install-local::
704 $(Echo) Install circumvented with NO_INSTALL
705uninstall-local::
706 $(Echo) UnInstall circumvented with NO_INSTALL
707else
708install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
709 $(Echo) Installing Configuration Files To $(PROJ_etcdir)
710 $(Verb)for file in $(CONFIG_FILES); do \
711 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
712 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
713 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
714 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
715 else \
716 $(ECHO) Error: cannot find config file $${file}. ; \
717 fi \
718 done
719
720uninstall-local::
721 $(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
722 $(Verb)for file in $(CONFIG_FILES); do \
723 $(RM) -f $(PROJ_etcdir)/$${file} ; \
724 done
725endif
726
727endif
728
729###############################################################################
730# Set up variables for building libararies
731###############################################################################
732
733#---------------------------------------------------------
734# Define various command line options pertaining to the
735# libraries needed when linking. There are "Proj" libs
736# (defined by the user's project) and "LLVM" libs (defined
737# by the LLVM project).
738#---------------------------------------------------------
739
740ifdef USEDLIBS
741ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
742ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
743ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
744ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
745endif
746
747ifdef LLVMLIBS
748LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
749LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
750LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
751LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
752endif
753
Daniel Dunbara89194e2008-10-03 19:11:19 +0000754ifndef IS_CLEANING_TARGET
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000755ifdef LINK_COMPONENTS
756
757# If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
758# clean in tools, then do a make in tools (instead of at the top level).
759$(LLVM_CONFIG):
760 @echo "*** llvm-config doesn't exist - rebuilding it."
761 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
Gabor Greif14c4c8e2008-02-27 13:34:15 +0000762
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000763$(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
764
765ProjLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS))
766ProjLibsPaths += $(LLVM_CONFIG) \
767 $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
768endif
769endif
770
771###############################################################################
772# Library Build Rules: Four ways to build a library
773###############################################################################
774
775#---------------------------------------------------------
776# Bytecode Module Targets:
777# If the user set MODULE_NAME then they want to build a
778# bytecode module from the sources. We compile all the
779# sources and link it together into a single bytecode
780# module.
781#---------------------------------------------------------
782
783ifdef MODULE_NAME
784ifeq ($(strip $(LLVMGCC)),)
785$(warning Modules require llvm-gcc but no llvm-gcc is available ****)
786else
787
788Module := $(LibDir)/$(MODULE_NAME).bc
Andrew Lenharthd0020772008-02-25 22:41:55 +0000789LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir) -r
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000790
791
792ifdef EXPORTED_SYMBOL_FILE
793LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
794endif
795
796$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
797 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
798 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
799
800all-local:: $(Module)
801
802clean-local::
803ifneq ($(strip $(Module)),)
804 -$(Verb) $(RM) -f $(Module)
805endif
806
807ifdef BYTECODE_DESTINATION
808ModuleDestDir := $(BYTECODE_DESTINATION)
809else
810ModuleDestDir := $(PROJ_libdir)
811endif
812
813ifdef NO_INSTALL
814install-local::
815 $(Echo) Install circumvented with NO_INSTALL
816uninstall-local::
817 $(Echo) Uninstall circumvented with NO_INSTALL
818else
819DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
820
821install-module:: $(DestModule)
822install-local:: $(DestModule)
823
824$(DestModule): $(ModuleDestDir) $(Module)
825 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
826 $(Verb) $(DataInstall) $(Module) $(DestModule)
827
828uninstall-local::
829 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
830 -$(Verb) $(RM) -f $(DestModule)
831endif
832
833endif
834endif
835
836# if we're building a library ...
837ifdef LIBRARYNAME
838
839# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
840LIBRARYNAME := $(strip $(LIBRARYNAME))
841ifdef LOADABLE_MODULE
842LibName.LA := $(LibDir)/$(LIBRARYNAME).la
843else
844LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
845endif
846LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
847LibName.O := $(LibDir)/$(LIBRARYNAME).o
848LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
849
850#---------------------------------------------------------
851# Shared Library Targets:
852# If the user asked for a shared library to be built
853# with the SHARED_LIBRARY variable, then we provide
854# targets for building them.
855#---------------------------------------------------------
856ifdef SHARED_LIBRARY
857
858all-local:: $(LibName.LA)
859
860ifdef LINK_LIBS_IN_SHARED
861ifdef LOADABLE_MODULE
862SharedLibKindMessage := "Loadable Module"
863else
864SharedLibKindMessage := "Shared Library"
865endif
Chris Lattner94adbf92008-02-05 19:43:40 +0000866$(LibName.LA): $(ObjectsLO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000867 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
868 $(LIBRARYNAME)$(SHLIBEXT)
869 $(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) \
870 $(LLVMLibsOptions)
871 $(Verb) $(LTInstall) $@ $(LibDir)
872else
873$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
874 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
875 $(Verb) $(LTLink) -o $@ $(ObjectsLO)
876 $(Verb) $(LTInstall) $@ $(LibDir)
877endif
878
879clean-local::
880ifneq ($(strip $(LibName.LA)),)
881 -$(Verb) $(RM) -f $(LibName.LA)
882endif
883
884ifdef NO_INSTALL
885install-local::
886 $(Echo) Install circumvented with NO_INSTALL
887uninstall-local::
888 $(Echo) Uninstall circumvented with NO_INSTALL
889else
890DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
891
892install-local:: $(DestSharedLib)
893
894$(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
895 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
896 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
897 $(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
898
899uninstall-local::
900 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
901 -$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
902endif
903endif
904
905#---------------------------------------------------------
906# Bytecode Library Targets:
907# If the user asked for a bytecode library to be built
908# with the BYTECODE_LIBRARY variable, then we provide
909# targets for building them.
910#---------------------------------------------------------
911ifdef BYTECODE_LIBRARY
912ifeq ($(strip $(LLVMGCC)),)
913$(warning Bytecode libraries require llvm-gcc which could not be found ****)
914else
915
916all-local:: $(LibName.BCA)
917
918ifdef EXPORTED_SYMBOL_FILE
919BCLinkLib = $(LLVMLD) -L$(CFERuntimeLibDir) \
920 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
921
922$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
923 $(LLVMToolDir)/llvm-ar
924 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
925 "(internalize)"
926 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
927 $(Verb) $(RM) -f $@
928 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
929else
930$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
931 $(LLVMToolDir)/llvm-ar
932 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
933 $(Verb) $(RM) -f $@
934 $(Verb) $(LArchive) $@ $(ObjectsBC)
935
936endif
937
938clean-local::
939ifneq ($(strip $(LibName.BCA)),)
940 -$(Verb) $(RM) -f $(LibName.BCA)
941endif
942
943ifdef BYTECODE_DESTINATION
944BytecodeDestDir := $(BYTECODE_DESTINATION)
945else
946BytecodeDestDir := $(PROJ_libdir)
947endif
948
949DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a
950
951install-bytecode-local:: $(DestBytecodeLib)
952
953ifdef NO_INSTALL
954install-local::
955 $(Echo) Install circumvented with NO_INSTALL
956uninstall-local::
957 $(Echo) Uninstall circumvented with NO_INSTALL
958else
959install-local:: $(DestBytecodeLib)
960
961$(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
962 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
963 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
964
965uninstall-local::
966 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
967 -$(Verb) $(RM) -f $(DestBytecodeLib)
968endif
969endif
970endif
971
972#---------------------------------------------------------
973# ReLinked Library Targets:
974# If the user explicitly requests a relinked library with
975# BUILD_RELINKED, provide it. Otherwise, if they specify
976# neither of BUILD_ARCHIVE or DONT_BUILD_RELINKED, give
977# them one.
978#---------------------------------------------------------
979ifndef BUILD_ARCHIVE
980ifndef DONT_BUILD_RELINKED
981BUILD_RELINKED = 1
982endif
983endif
984
985ifdef BUILD_RELINKED
986
987all-local:: $(LibName.O)
988
989$(LibName.O): $(ObjectsO) $(LibDir)/.dir
990 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
991 $(Verb) $(LTRelink) -o $@ $(ObjectsO)
992
993clean-local::
994ifneq ($(strip $(LibName.O)),)
995 -$(Verb) $(RM) -f $(LibName.O)
996endif
997
998ifdef NO_INSTALL
999install-local::
1000 $(Echo) Install circumvented with NO_INSTALL
1001uninstall-local::
1002 $(Echo) Uninstall circumvented with NO_INSTALL
1003else
1004DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
1005
1006install-local:: $(DestRelinkedLib)
1007
1008$(DestRelinkedLib): $(PROJ_libdir) $(LibName.O)
1009 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
1010 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
1011
1012uninstall-local::
1013 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
1014 -$(Verb) $(RM) -f $(DestRelinkedLib)
1015endif
1016endif
1017
1018#---------------------------------------------------------
1019# Archive Library Targets:
1020# If the user wanted a regular archive library built,
1021# then we provide targets for building them.
1022#---------------------------------------------------------
1023ifdef BUILD_ARCHIVE
1024
1025all-local:: $(LibName.A)
1026
1027$(LibName.A): $(ObjectsO) $(LibDir)/.dir
1028 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1029 -$(Verb) $(RM) -f $@
1030 $(Verb) $(Archive) $@ $(ObjectsO)
1031 $(Verb) $(Ranlib) $@
1032
1033clean-local::
1034ifneq ($(strip $(LibName.A)),)
1035 -$(Verb) $(RM) -f $(LibName.A)
1036endif
1037
1038ifdef NO_INSTALL
1039install-local::
1040 $(Echo) Install circumvented with NO_INSTALL
1041uninstall-local::
1042 $(Echo) Uninstall circumvented with NO_INSTALL
1043else
1044DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
1045
1046install-local:: $(DestArchiveLib)
1047
1048$(DestArchiveLib): $(PROJ_libdir) $(LibName.A)
1049 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1050 $(Verb) $(MKDIR) $(PROJ_libdir)
1051 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
1052
1053uninstall-local::
1054 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1055 -$(Verb) $(RM) -f $(DestArchiveLib)
1056endif
1057endif
1058
1059# endif LIBRARYNAME
1060endif
1061
1062###############################################################################
1063# Tool Build Rules: Build executable tool based on TOOLNAME option
1064###############################################################################
1065
1066ifdef TOOLNAME
1067
1068#---------------------------------------------------------
1069# Set up variables for building a tool.
1070#---------------------------------------------------------
1071ifdef EXAMPLE_TOOL
1072ToolBuildPath := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT)
1073else
1074ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT)
1075endif
1076
1077#---------------------------------------------------------
1078# Provide targets for building the tools
1079#---------------------------------------------------------
1080all-local:: $(ToolBuildPath)
1081
1082clean-local::
1083ifneq ($(strip $(ToolBuildPath)),)
1084 -$(Verb) $(RM) -f $(ToolBuildPath)
1085endif
1086
1087ifdef EXAMPLE_TOOL
1088$(ToolBuildPath): $(ExmplDir)/.dir
1089else
1090$(ToolBuildPath): $(ToolDir)/.dir
1091endif
1092
1093$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1094 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1095 $(Verb) $(LTLink) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1096 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1097 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1098 $(StripWarnMsg)
1099
1100ifdef NO_INSTALL
1101install-local::
1102 $(Echo) Install circumvented with NO_INSTALL
1103uninstall-local::
1104 $(Echo) Uninstall circumvented with NO_INSTALL
1105else
1106DestTool = $(PROJ_bindir)/$(TOOLNAME)
1107
1108install-local:: $(DestTool)
1109
1110$(DestTool): $(PROJ_bindir) $(ToolBuildPath)
1111 $(Echo) Installing $(BuildMode) $(DestTool)
1112 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1113
1114uninstall-local::
1115 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1116 -$(Verb) $(RM) -f $(DestTool)
1117endif
1118endif
1119
1120###############################################################################
1121# Object Build Rules: Build object files based on sources
1122###############################################################################
1123
1124# FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1125ifeq ($(OS),HP-UX)
1126 DISABLE_AUTO_DEPENDENCIES=1
1127endif
1128
1129ifdef SHARED_LIBRARY
1130PIC_FLAG = "(PIC)"
1131MAYBE_PIC_Compile.CXX = $(LTCompile.CXX)
1132MAYBE_PIC_Compile.C = $(LTCompile.C)
1133else
1134MAYBE_PIC_Compile.CXX = $(Compile.CXX)
1135MAYBE_PIC_Compile.C = $(Compile.C)
1136endif
1137
1138# Provide rule sets for when dependency generation is enabled
1139ifndef DISABLE_AUTO_DEPENDENCIES
1140
1141#---------------------------------------------------------
1142# Create .lo files in the ObjDir directory from the .cpp and .c files...
1143#---------------------------------------------------------
1144
Chris Lattner87fd1ec2007-12-31 23:58:31 +00001145DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1146 -MT "$(ObjDir)/$*.lo" -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
Gabor Greif14c4c8e2008-02-27 13:34:15 +00001147
Chris Lattner87fd1ec2007-12-31 23:58:31 +00001148# If the build succeeded, move the dependency file over. If it failed, put an
1149# empty file there.
1150DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1151 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1152
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001153$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1154 $(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG)
Chris Lattner87fd1ec2007-12-31 23:58:31 +00001155 $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1156 $(DEPEND_MOVEFILE)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001157
1158$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1159 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
Chris Lattner87fd1ec2007-12-31 23:58:31 +00001160 $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1161 $(DEPEND_MOVEFILE)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001162
1163$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1164 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
Chris Lattner87fd1ec2007-12-31 23:58:31 +00001165 $(Verb) if $(MAYBE_PIC_Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1166 $(DEPEND_MOVEFILE)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001167
1168#---------------------------------------------------------
1169# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1170#---------------------------------------------------------
1171
1172$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
1173 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1174 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \
1175 $< -o $@ -S -emit-llvm ; \
1176 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
1177 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
1178 $(call UPGRADE_MSG,$@)
1179 $(call UPGRADE_LL,$@)
1180
1181$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
1182 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1183 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \
1184 $< -o $@ -S -emit-llvm ; \
1185 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
1186 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
1187 $(call UPGRADE_MSG,$@)
1188 $(call UPGRADE_LL,$@)
1189
1190$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
1191 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1192 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" \
1193 $< -o $@ -S -emit-llvm ; \
1194 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
1195 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
1196 $(call UPGRADE_MSG,$@)
1197 $(call UPGRADE_LL,$@)
1198
1199# Provide alternate rule sets if dependencies are disabled
1200else
1201
1202$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1203 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1204 $(MAYBE_PIC_Compile.CXX) $< -o $@
1205
1206$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1207 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1208 $(MAYBE_PIC_Compile.CXX) $< -o $@
1209
1210$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1211 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1212 $(MAYBE_PIC_Compile.C) $< -o $@
1213
1214$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
1215 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1216 $(BCCompile.CXX) $< -o $@ -S -emit-llvm
1217 $(call UPGRADE_MSG,$@)
1218 $(call UPGRADE_LL,$@)
1219
1220$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
1221 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1222 $(BCCompile.CXX) $< -o $@ -S -emit-llvm
1223 $(call UPGRADE_MSG,$@)
1224 $(call UPGRADE_LL,$@)
1225
1226$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
1227 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1228 $(BCCompile.C) $< -o $@ -S -emit-llvm
1229 $(call UPGRADE_MSG,@)
1230 $(call UPGRADE_LL,@)
1231
1232endif
1233
1234
1235## Rules for building preprocessed (.i/.ii) outputs.
1236$(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1237 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1238 $(Verb) $(Preprocess.CXX) $< -o $@
1239
1240$(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1241 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1242 $(Verb) $(Preprocess.CXX) $< -o $@
1243
1244$(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1245 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1246 $(Verb) $(Preprocess.C) $< -o $@
1247
1248
1249$(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1250 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1251 $(MAYBE_PIC_Compile.CXX) $< -o $@ -S
1252
1253$(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1254 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1255 $(MAYBE_PIC_Compile.CXX) $< -o $@ -S
1256
1257$(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1258 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1259 $(MAYBE_PIC_Compile.C) $< -o $@ -S
1260
1261
1262# make the C and C++ compilers strip debug info out of bytecode libraries.
1263ifdef DEBUG_RUNTIME
1264$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
1265 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1266 $(Verb) $(LLVMAS) $< -o - | $(LOPT) -std-compile-opts -o $@ -f
1267else
1268$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
1269 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1270 $(Verb) $(LLVMAS) $< -o - | \
1271 $(LOPT) -std-compile-opts -strip-debug -o $@ -f
1272endif
1273
1274
1275#---------------------------------------------------------
1276# Provide rule to build .bc files from .ll sources,
1277# regardless of dependencies
1278#---------------------------------------------------------
1279$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1280 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1281 $(Verb) $(LLVMAS) $< -f -o $@
1282
1283###############################################################################
1284# TABLEGEN: Provide rules for running tblgen to produce *.inc files
1285###############################################################################
1286
1287ifdef TARGET
1288
1289TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1290 $(LLVM_SRC_ROOT)/lib/Target/Target.td \
1291 $(LLVM_SRC_ROOT)/lib/Target/TargetCallingConv.td \
1292 $(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td \
1293 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1294 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1295INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1296INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1297.PRECIOUS: $(INCTMPFiles) $(INCFiles)
1298
1299# All of these files depend on tblgen and the .td files.
1300$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
1301
1302# INCFiles rule: All of the tblgen generated files are emitted to
1303# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1304# us to only "touch" the real file if the contents of it change. IOW, if
Daniel Dunbar90f3e7f2008-11-03 17:33:36 +00001305# tblgen is modified, all of the .inc.tmp files are regenerated, but no
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001306# dependencies of the .inc files are, unless the contents of the .inc file
1307# changes.
1308$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1309 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1310
1311$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
1312$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
1313 $(Echo) "Building $(<F) register names with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001314 $(Verb) $(TableGen) -gen-register-enums -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001315
1316$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
1317$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
1318 $(Echo) "Building $(<F) register information header with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001319 $(Verb) $(TableGen) -gen-register-desc-header -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001320
1321$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1322$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
1323 $(Echo) "Building $(<F) register info implementation with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001324 $(Verb) $(TableGen) -gen-register-desc -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001325
1326$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
1327$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
1328 $(Echo) "Building $(<F) instruction names with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001329 $(Verb) $(TableGen) -gen-instr-enums -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001330
1331$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1332$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
1333 $(Echo) "Building $(<F) instruction information with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001334 $(Verb) $(TableGen) -gen-instr-desc -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001335
1336$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1337$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
1338 $(Echo) "Building $(<F) assembly writer with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001339 $(Verb) $(TableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001340
1341$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1342$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
1343 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001344 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001345
1346$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1347$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
1348 $(Echo) "Building $(<F) code emitter with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001349 $(Verb) $(TableGen) -gen-emitter -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001350
1351$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1352$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
Dan Gohmanb75dead2008-08-13 20:19:35 +00001353 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001354 $(Verb) $(TableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001355
Dan Gohmanb75dead2008-08-13 20:19:35 +00001356$(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1357$(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir
1358 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1359 $(Verb) $(TableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1360
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001361$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
1362$(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
1363 $(Echo) "Building $(<F) subtarget information with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001364 $(Verb) $(TableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001365
1366$(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1367$(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
1368 $(Echo) "Building $(<F) calling convention information with tblgen"
Chris Lattner1b0a3a12008-01-15 23:27:40 +00001369 $(Verb) $(TableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001370
1371clean-local::
1372 -$(Verb) $(RM) -f $(INCFiles)
1373
1374endif
1375
1376###############################################################################
1377# LEX AND YACC: Provide rules for generating sources with lex and yacc
1378###############################################################################
1379
1380#---------------------------------------------------------
1381# Provide rules for generating a .cpp source file from
1382# (f)lex input sources.
1383#---------------------------------------------------------
1384
1385LexFiles := $(filter %.l,$(Sources))
1386
1387ifneq ($(LexFiles),)
1388
1389# Cancel built-in rules for lex
1390%.c: %.l
1391%.cpp: %.l
1392
1393all:: $(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs)
1394
1395# Note the extra sed filtering here, used to cut down on the warnings emited
1396# by GCC. The last line is a gross hack to work around flex aparently not
1397# being able to resize the buffer on a large token input. Currently, for
1398# uninitialized string buffers in LLVM we can generate very long tokens, so
1399# this is a hack around it.
1400# FIXME. (f.e. char Buffer[10000] )
1401$(PROJ_SRC_DIR)/%.cpp: $(PROJ_SRC_DIR)/%.l
1402 $(Echo) Flexing $*.l
1403 $(Verb) $(FLEX) -t $(PROJ_SRC_DIR)/$*.l | \
1404 $(SED) 's/void yyunput/inline void yyunput/' | \
1405 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
1406 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
1407 > $(PROJ_SRC_DIR)/$*.cpp
Gabor Greif14c4c8e2008-02-27 13:34:15 +00001408
1409# IFF the .l file has changed since it was last checked into SVN, copy the .l
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001410# file to .l.cvs and the generated .cpp file to .cpp.cvs. We use this mechanism
1411# so that people without flex can build LLVM by copying the .cvs files to the
1412# source location and building them.
1413$(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs): \
1414$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
1415 $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs || \
1416 ($(CP) $< $@; $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs)
1417
1418$(LexFiles:%.l=$(ObjDir)/%.o) : \
1419$(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
1420
1421clean-local::
1422 -$(Verb) $(RM) -f $(LexOutput)
1423
1424endif
1425
1426#---------------------------------------------------------
1427# Provide rules for generating a .cpp and .h source files
1428# from yacc (bison) input sources.
1429#---------------------------------------------------------
1430
1431YaccFiles := $(filter %.y,$(Sources))
1432ifneq ($(YaccFiles),)
1433
1434.PRECIOUS: $(YaccOutput)
1435
1436all:: $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs)
1437
1438# Cancel built-in rules for yacc
1439%.c: %.y
1440%.cpp: %.y
1441%.h: %.y
1442
1443# Rule for building the bison based parsers...
1444ifneq ($(BISON),)
1445$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
1446 $(Echo) "Bisoning $*.y"
1447 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
1448 $(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
1449 $(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
1450
Gabor Greif14c4c8e2008-02-27 13:34:15 +00001451# IFF the .y file has changed since it was last checked into SVN, copy the .y
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001452# file to .y.cvs and the generated .cpp/.h file to .cpp.cvs/.h.cvs. We use this
1453# mechanism so that people without flex can build LLVM by copying the .cvs files
1454# to the source location and building them.
1455$(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs): \
1456$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
1457 $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs || \
1458 ($(CP) $< $@; \
1459 $(CP) $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs; \
1460 $(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs)
1461
1462else
1463$(PROJ_SRC_DIR)/%.cpp : $(PROJ_SRC_DIR)/%.cpp.cvs
1464 $(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .cpp.cvs"
1465 $(Verb)$(CP) $(PROJ_SRC_DIR)/$*.cpp.cvs $(PROJ_SRC_DIR)/$*.cpp
1466
1467$(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.h.cvs
1468 $(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .h.cvs"
1469 $(Verb)$(CP) $(PROJ_SRC_DIR)/$*.h.cvs $(PROJ_SRC_DIR)/$*.h
1470endif
1471
1472
1473$(YaccFiles:%.y=$(ObjDir)/%.o): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
1474
1475YaccOutput := $(YaccFiles:%.y=%.output)
1476
1477clean-local::
1478 -$(Verb) $(RM) -f $(YaccOutput)
1479endif
1480
1481###############################################################################
1482# OTHER RULES: Other rules needed
1483###############################################################################
1484
1485# To create postscript files from dot files...
1486ifneq ($(DOT),false)
1487%.ps: %.dot
1488 $(DOT) -Tps < $< > $@
1489else
1490%.ps: %.dot
1491 $(Echo) "Cannot build $@: The program dot is not installed"
1492endif
1493
1494# This rules ensures that header files that are removed still have a rule for
1495# which they can be "generated." This allows make to ignore them and
1496# reproduce the dependency lists.
1497%.h:: ;
1498%.hpp:: ;
1499
1500# Define clean-local to clean the current directory. Note that this uses a
1501# very conservative approach ensuring that empty variables do not cause
1502# errors or disastrous removal.
1503clean-local::
Jim Grosbache4c032e2008-10-02 22:56:44 +00001504ifneq ($(strip $(ObjRootDir)),)
1505 -$(Verb) $(RM) -rf $(ObjRootDir)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001506endif
1507 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1508ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1509 -$(Verb) $(RM) -f *$(SHLIBEXT)
1510endif
1511
1512clean-all-local::
1513 -$(Verb) $(RM) -rf Debug Release Profile
1514
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001515
1516###############################################################################
1517# DEPENDENCIES: Include the dependency files if we should
1518###############################################################################
1519ifndef DISABLE_AUTO_DEPENDENCIES
1520
1521# If its not one of the cleaning targets
Daniel Dunbara89194e2008-10-03 19:11:19 +00001522ifndef IS_CLEANING_TARGET
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001523
1524# Get the list of dependency files
1525DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1526DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1527
Reid Spencerdfb3d5b2007-07-23 08:20:46 +00001528-include $(DependFiles) ""
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001529
1530endif
1531
1532endif
1533
1534###############################################################################
1535# CHECK: Running the test suite
1536###############################################################################
1537
1538check::
1539 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1540 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1541 $(EchoCmd) Running test suite ; \
1542 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1543 TESTSUITE=$(TESTSUITE) ; \
1544 else \
1545 $(EchoCmd) No Makefile in test directory ; \
1546 fi ; \
1547 else \
1548 $(EchoCmd) No test directory ; \
1549 fi
1550
1551###############################################################################
1552# DISTRIBUTION: Handle construction of a distribution tarball
1553###############################################################################
1554
1555#------------------------------------------------------------------------
1556# Define distribution related variables
1557#------------------------------------------------------------------------
1558DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
1559DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1560TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1561DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1562DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
1563DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1564DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1565 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1566 Makefile.config.in configure autoconf
1567DistOther := $(notdir $(wildcard \
1568 $(PROJ_SRC_DIR)/*.h \
1569 $(PROJ_SRC_DIR)/*.td \
1570 $(PROJ_SRC_DIR)/*.def \
1571 $(PROJ_SRC_DIR)/*.ll \
1572 $(PROJ_SRC_DIR)/*.in))
1573DistSubDirs := $(SubDirs)
1574DistSources = $(Sources) $(EXTRA_DIST)
1575DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1576
1577#------------------------------------------------------------------------
1578# We MUST build distribution with OBJ_DIR != SRC_DIR
1579#------------------------------------------------------------------------
1580ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1581dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1582 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1583
1584else
1585
1586#------------------------------------------------------------------------
1587# Prevent attempt to run dist targets from anywhere but the top level
1588#------------------------------------------------------------------------
1589ifneq ($(LEVEL),.)
1590dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1591 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1592else
1593
1594#------------------------------------------------------------------------
1595# Provide the top level targets
1596#------------------------------------------------------------------------
1597
1598dist-gzip:: $(DistTarGZip)
1599
1600$(DistTarGZip) : $(TopDistDir)/.makedistdir
1601 $(Echo) Packing gzipped distribution tar file.
1602 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1603 $(GZIP) -c > "$(DistTarGZip)"
1604
1605dist-bzip2:: $(DistTarBZ2)
1606
1607$(DistTarBZ2) : $(TopDistDir)/.makedistdir
1608 $(Echo) Packing bzipped distribution tar file.
1609 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1610 $(BZIP2) -c >$(DistTarBZ2)
1611
1612dist-zip:: $(DistZip)
1613
1614$(DistZip) : $(TopDistDir)/.makedistdir
1615 $(Echo) Packing zipped distribution file.
1616 $(Verb) rm -f $(DistZip)
1617 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1618
1619dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1620 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1621
1622DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1623
1624dist-check:: $(DistTarGZip)
1625 $(Echo) Checking distribution tar file.
1626 $(Verb) if test -d $(DistCheckDir) ; then \
1627 $(RM) -rf $(DistCheckDir) ; \
1628 fi
1629 $(Verb) $(MKDIR) $(DistCheckDir)
1630 $(Verb) cd $(DistCheckDir) && \
1631 $(MKDIR) $(DistCheckDir)/build && \
1632 $(MKDIR) $(DistCheckDir)/install && \
1633 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1634 cd build && \
1635 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1636 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
1637 $(MAKE) all && \
1638 $(MAKE) check && \
1639 $(MAKE) install && \
1640 $(MAKE) uninstall && \
1641 $(MAKE) dist-clean && \
1642 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1643
1644dist-clean::
1645 $(Echo) Cleaning distribution files
1646 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1647 $(DistCheckDir)
1648
1649endif
1650
1651#------------------------------------------------------------------------
1652# Provide the recursive distdir target for building the distribution directory
1653#------------------------------------------------------------------------
1654distdir: $(DistDir)/.makedistdir
1655$(DistDir)/.makedistdir: $(DistSources)
1656 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1657 if test -d "$(DistDir)" ; then \
1658 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1659 exit 1 ; \
1660 fi ; \
1661 $(EchoCmd) Removing old $(DistDir) ; \
1662 $(RM) -rf $(DistDir); \
1663 $(EchoCmd) Making 'all' to verify build ; \
1664 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
1665 fi
1666 $(Echo) Building Distribution Directory $(DistDir)
1667 $(Verb) $(MKDIR) $(DistDir)
1668 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1669 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
1670 for file in $(DistFiles) ; do \
1671 case "$$file" in \
1672 $(PROJ_SRC_DIR)/*) \
1673 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1674 ;; \
1675 $(PROJ_SRC_ROOT)/*) \
1676 file=`echo "$$file" | \
1677 sed "s#^$$srcrootstrip/##"` \
1678 ;; \
1679 esac; \
1680 if test -f "$(PROJ_SRC_DIR)/$$file" || \
1681 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1682 from_dir="$(PROJ_SRC_DIR)" ; \
1683 elif test -f "$$file" || test -d "$$file" ; then \
1684 from_dir=. ; \
1685 fi ; \
1686 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1687 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1688 to_dir="$(DistDir)/$$dir"; \
1689 $(MKDIR) "$$to_dir" ; \
1690 else \
1691 to_dir="$(DistDir)"; \
1692 fi; \
1693 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1694 if test -n "$$mid_dir" ; then \
1695 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1696 fi ; \
1697 if test -d "$$from_dir/$$file"; then \
1698 if test -d "$(PROJ_SRC_DIR)/$$file" && \
1699 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1700 cd $(PROJ_SRC_DIR) ; \
1701 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1702 ( cd $$to_dir ; $(TAR) xf - ) ; \
1703 cd $(PROJ_OBJ_DIR) ; \
1704 else \
1705 cd $$from_dir ; \
1706 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1707 ( cd $$to_dir ; $(TAR) xf - ) ; \
1708 cd $(PROJ_OBJ_DIR) ; \
1709 fi; \
1710 elif test -f "$$from_dir/$$file" ; then \
1711 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1712 elif test -L "$$from_dir/$$file" ; then \
1713 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1714 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1715 $(EchoCmd) "===== WARNING: Distribution Source " \
1716 "$$from_dir/$$file Not Found!" ; \
1717 elif test "$(Verb)" != '@' ; then \
1718 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1719 fi; \
1720 done
1721 $(Verb) for subdir in $(DistSubDirs) ; do \
1722 if test "$$subdir" \!= "." ; then \
1723 new_distdir="$(DistDir)/$$subdir" ; \
1724 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1725 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
1726 DistDir="$$new_distdir" distdir ) || exit 1; \
1727 fi; \
1728 done
1729 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1730 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
1731 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
1732 -name .svn \) -print` ;\
1733 $(MAKE) dist-hook ; \
1734 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1735 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1736 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1737 -o ! -type d ! -perm -444 -exec \
1738 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1739 || chmod -R a+r $(DistDir) ; \
1740 fi
1741
1742# This is invoked by distdir target, define it as a no-op to avoid errors if not
1743# defined by user.
1744dist-hook::
1745
1746endif
1747
1748###############################################################################
1749# TOP LEVEL - targets only to apply at the top level directory
1750###############################################################################
1751
1752ifeq ($(LEVEL),.)
1753
1754#------------------------------------------------------------------------
1755# Install support for the project's include files:
1756#------------------------------------------------------------------------
1757ifdef NO_INSTALL
1758install-local::
1759 $(Echo) Install circumvented with NO_INSTALL
1760uninstall-local::
1761 $(Echo) Uninstall circumvented with NO_INSTALL
1762else
1763install-local::
1764 $(Echo) Installing include files
1765 $(Verb) $(MKDIR) $(PROJ_includedir)
1766 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
1767 cd $(PROJ_SRC_ROOT)/include && \
1768 for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
1769 -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
1770 grep -v .svn` ; do \
1771 instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
1772 if test \! -d "$$instdir" ; then \
1773 $(EchoCmd) Making install directory $$instdir ; \
1774 $(MKDIR) $$instdir ;\
1775 fi ; \
1776 $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
1777 done ; \
1778 fi
1779ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
1780 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
1781 cd $(PROJ_OBJ_ROOT)/include && \
1782 for hdr in `find . -type f -print | grep -v CVS` ; do \
1783 $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
1784 done ; \
1785 fi
1786endif
1787
1788uninstall-local::
1789 $(Echo) Uninstalling include files
1790 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1791 cd $(PROJ_SRC_ROOT)/include && \
1792 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1793 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' \
1794 -o -name '*.in' ')' -print ')' | \
1795 grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
1796 cd $(PROJ_SRC_ROOT)/include && \
1797 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
1798 -print ')' | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
1799 fi
1800endif
1801endif
1802
1803check-line-length:
Gabor Greifb91ea9d2008-05-15 10:04:30 +00001804 @echo searching for overlength lines in files: $(Sources)
1805 @echo
1806 @echo
Gabor Greif3033d032008-08-28 22:32:39 +00001807 egrep -n '.{81}' $(Sources) /dev/null
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001808
1809check-for-tabs:
Gabor Greifb91ea9d2008-05-15 10:04:30 +00001810 @echo searching for tabs in files: $(Sources)
1811 @echo
1812 @echo
Gabor Greif3033d032008-08-28 22:32:39 +00001813 egrep -n ' ' $(Sources) /dev/null
Gabor Greifb91ea9d2008-05-15 10:04:30 +00001814
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001815check-footprint:
1816 @ls -l $(LibDir) | awk '\
1817 BEGIN { sum = 0; } \
1818 { sum += $$5; } \
1819 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1820 @ls -l $(ToolDir) | awk '\
1821 BEGIN { sum = 0; } \
1822 { sum += $$5; } \
1823 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1824#------------------------------------------------------------------------
1825# Print out the directories used for building
1826#------------------------------------------------------------------------
1827printvars::
1828 $(Echo) "BuildMode : " '$(BuildMode)'
1829 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1830 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1831 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1832 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1833 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1834 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1835 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
1836 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
1837 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
1838 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
1839 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
1840 $(Echo) "UserTargets : " '$(UserTargets)'
1841 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1842 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1843 $(Echo) "ObjDir : " '$(ObjDir)'
1844 $(Echo) "LibDir : " '$(LibDir)'
1845 $(Echo) "ToolDir : " '$(ToolDir)'
1846 $(Echo) "ExmplDir : " '$(ExmplDir)'
1847 $(Echo) "Sources : " '$(Sources)'
1848 $(Echo) "TDFiles : " '$(TDFiles)'
1849 $(Echo) "INCFiles : " '$(INCFiles)'
1850 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
1851 $(Echo) "PreConditions: " '$(PreConditions)'
1852 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1853 $(Echo) "Compile.C : " '$(Compile.C)'
1854 $(Echo) "Archive : " '$(Archive)'
1855 $(Echo) "YaccFiles : " '$(YaccFiles)'
1856 $(Echo) "LexFiles : " '$(LexFiles)'
1857 $(Echo) "Module : " '$(Module)'
1858 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
1859 $(Echo) "SubDirs : " '$(SubDirs)'
1860 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
1861 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'