blob: 78cc43632cfe9096ea099e02f1ee3d5472ead859 [file] [log] [blame]
Misha Brukman6d5ab862004-04-24 00:10:56 +00001#===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
2#
John Criswelld8846c12003-10-21 14:33:46 +00003# The LLVM Compiler Infrastructure
4#
5# This file was developed by the LLVM research group and is distributed under
6# the University of Illinois Open Source License. See LICENSE.TXT for details.
7#
Misha Brukman6d5ab862004-04-24 00:10:56 +00008#===------------------------------------------------------------------------===#
Chris Lattner00950542001-06-06 20:29:01 +00009#
Reid Spencer3a561f52004-10-23 20:04:14 +000010# 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.
Chris Lattneraf06a082003-08-15 03:02:52 +000012#
Vikram S. Adved60aede2002-07-09 12:04:21 +000013#===-----------------------------------------------------------------------====
Chris Lattner00950542001-06-06 20:29:01 +000014
Reid Spencercc2d1e22004-10-30 09:19:36 +000015################################################################################
Reid Spencer3a561f52004-10-23 20:04:14 +000016# TARGETS: Define standard targets that can be invoked
Reid Spencercc2d1e22004-10-30 09:19:36 +000017################################################################################
John Criswell7a73b802003-06-30 21:59:07 +000018
Chris Lattner00950542001-06-06 20:29:01 +000019#--------------------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +000020# Define the various target sets
21#--------------------------------------------------------------------
Chris Lattner7dc02822004-12-03 21:05:57 +000022RecursiveTargets := all clean clean-all install uninstall install-bytecode
Reid Spencer9e8d54a2004-12-06 05:35:13 +000023LocalTargets := all-local clean-local clean-all-local check-local \
Reid Spencer44cb1b32004-12-03 20:08:48 +000024 install-local printvars uninstall-local \
25 install-bytecode-local
Reid Spencer9e8d54a2004-12-06 05:35:13 +000026TopLevelTargets := check dist dist-check dist-clean tags dist-gzip dist-bzip2 \
Reid Spencercc2d1e22004-10-30 09:19:36 +000027 dist-zip
28UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
29InternalTargets := preconditions distdir dist-hook
Reid Spencer3a561f52004-10-23 20:04:14 +000030
Reid Spencercc2d1e22004-10-30 09:19:36 +000031################################################################################
Reid Spencer9411c642004-10-26 22:26:33 +000032# INITIALIZATION: Basic things the makefile needs
Reid Spencercc2d1e22004-10-30 09:19:36 +000033################################################################################
34
35#--------------------------------------------------------------------
36# Set the VPATH so that we can find source files.
37#--------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +000038VPATH=$(PROJ_SRC_DIR)
Reid Spencer9411c642004-10-26 22:26:33 +000039
40#--------------------------------------------------------------------
41# Reset the list of suffixes we know how to build
42#--------------------------------------------------------------------
43.SUFFIXES:
Chris Lattnerb05a76c2005-02-04 21:28:50 +000044.SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot
Reid Spencercc2d1e22004-10-30 09:19:36 +000045.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
Reid Spencer9411c642004-10-26 22:26:33 +000046
Reid Spencer3a561f52004-10-23 20:04:14 +000047#--------------------------------------------------------------------
48# Mark all of these targets as phony to avoid implicit rule search
49#--------------------------------------------------------------------
Reid Spencercc2d1e22004-10-30 09:19:36 +000050.PHONY: $(UserTargets) $(InternalTargets)
Reid Spencer3a561f52004-10-23 20:04:14 +000051
52#--------------------------------------------------------------------
Reid Spencer9411c642004-10-26 22:26:33 +000053# Make sure all the user-target rules are double colon rules and
54# they are defined first.
Reid Spencer3a561f52004-10-23 20:04:14 +000055#--------------------------------------------------------------------
56
Reid Spencercc2d1e22004-10-30 09:19:36 +000057$(UserTargets)::
Reid Spencer151f8ba2004-10-25 08:27:37 +000058
Reid Spencer9411c642004-10-26 22:26:33 +000059################################################################################
60# PRECONDITIONS: that which must be built/checked first
61################################################################################
62
Reid Spencer44cb1b32004-12-03 20:08:48 +000063SrcMakefiles := $(filter %Makefile %Makefile.tests,\
Reid Spencer11fde542005-01-16 02:20:54 +000064 $(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
76ifneq ($(MakefileConfigIn),)
77PreConditions += $(MakefileConfig)
78endif
Reid Spencer9411c642004-10-26 22:26:33 +000079
Reid Spencercc2d1e22004-10-30 09:19:36 +000080preconditions : $(PreConditions)
Reid Spencer9411c642004-10-26 22:26:33 +000081
82#------------------------------------------------------------------------
83# Make sure the BUILT_SOURCES are built first
84#------------------------------------------------------------------------
Reid Spencer07a549a2004-12-16 07:15:16 +000085$(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
Reid Spencer9411c642004-10-26 22:26:33 +000086
87clean-local::
88ifneq ($(strip $(BUILT_SOURCES)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +000089 -$(Verb) $(RM) -f $(BUILT_SOURCES)
Reid Spencer9411c642004-10-26 22:26:33 +000090endif
91
Reid Spencer11fde542005-01-16 02:20:54 +000092ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
Reid Spencer31f95242004-12-16 08:00:46 +000093spotless:
Reid Spencer31f95242004-12-16 08:00:46 +000094 $(Verb) if test -x config.status ; then \
Reid Spencer11fde542005-01-16 02:20:54 +000095 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
Reid Spencer39b73632004-12-17 07:45:03 +000096 $(MKDIR) .spotless.save ; \
97 $(MV) config.status .spotless.save ; \
98 $(MV) mklib .spotless.save ; \
99 $(MV) projects .spotless.save ; \
Reid Spencer31f95242004-12-16 08:00:46 +0000100 $(RM) -rf * ; \
Reid Spencer39b73632004-12-17 07:45:03 +0000101 $(MV) .spotless.save/config.status . ; \
102 $(MV) .spotless.save/mklib . ; \
103 $(MV) .spotless.save/projects . ; \
104 $(RM) -rf .spotless.save ; \
Reid Spencer11fde542005-01-16 02:20:54 +0000105 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
Reid Spencer39b73632004-12-17 07:45:03 +0000106 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
107 $(ConfigStatusScript) ; \
Reid Spencer31f95242004-12-16 08:00:46 +0000108 else \
Reid Spencer11fde542005-01-16 02:20:54 +0000109 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
Reid Spencer31f95242004-12-16 08:00:46 +0000110 fi
111endif
112
Reid Spencercc2d1e22004-10-30 09:19:36 +0000113$(BUILT_SOURCES) : $(ObjMakefiles)
Reid Spencer80f0ef72004-10-28 00:41:43 +0000114
Reid Spencer9411c642004-10-26 22:26:33 +0000115#------------------------------------------------------------------------
116# Make sure we're not using a stale configuration
117#------------------------------------------------------------------------
Reid Spencerc3719842004-12-16 18:26:53 +0000118reconfigure:
Reid Spencer11fde542005-01-16 02:20:54 +0000119 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
120 $(Verb) cd $(PROJ_OBJ_ROOT) && \
121 if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
122 $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
Reid Spencer32924e02004-12-24 03:36:31 +0000123 fi ; \
Reid Spencerc3719842004-12-16 18:26:53 +0000124 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
125 $(ConfigStatusScript)
126
Reid Spencercc2d1e22004-10-30 09:19:36 +0000127.PRECIOUS: $(ConfigStatusScript)
128$(ConfigStatusScript): $(ConfigureScript)
129 $(Echo) Reconfiguring with $<
Reid Spencer11fde542005-01-16 02:20:54 +0000130 $(Verb) cd $(PROJ_OBJ_ROOT) && \
131 if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
132 $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \
Reid Spencer32924e02004-12-24 03:36:31 +0000133 fi ; \
Reid Spencer7d277002004-11-29 12:37:44 +0000134 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
135 $(ConfigStatusScript)
Reid Spencer9411c642004-10-26 22:26:33 +0000136
137#------------------------------------------------------------------------
138# Make sure the configuration makefile is up to date
139#------------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +0000140ifneq ($(MakefileConfigIn),)
141$(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000142 $(Echo) Regenerating $@
Reid Spencer11fde542005-01-16 02:20:54 +0000143 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
144endif
145
146ifneq ($(MakefileCommonIn),)
147$(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
148 $(Echo) Regenerating $@
149 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
150endif
Reid Spencer9411c642004-10-26 22:26:33 +0000151
152#------------------------------------------------------------------------
153# If the Makefile in the source tree has been updated, copy it over into the
154# build tree. But, only do this if the source and object makefiles differ
155#------------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +0000156ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
Reid Spencer9411c642004-10-26 22:26:33 +0000157
Reid Spencer11fde542005-01-16 02:20:54 +0000158Makefile: $(PROJ_SRC_DIR)/Makefile
Reid Spencercc2d1e22004-10-30 09:19:36 +0000159 $(Echo) "Updating Makefile"
160 $(Verb) $(MKDIR) $(@D)
Reid Spencerc3719842004-12-16 18:26:53 +0000161 $(Verb) $(CP) -f $< $@
Reid Spencer9411c642004-10-26 22:26:33 +0000162
163# Copy the Makefile.* files unless we're in the root directory which avoids
164# the copying of Makefile.config.in or other things that should be explicitly
165# taken care of.
Reid Spencer11fde542005-01-16 02:20:54 +0000166$(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile%
Reid Spencer86606782004-10-26 23:10:00 +0000167 @case '$?' in \
168 *Makefile.rules) ;; \
169 *.in) ;; \
Reid Spencercc2d1e22004-10-30 09:19:36 +0000170 *) $(Echo) "Updating $(@F)" ; \
Reid Spencer86606782004-10-26 23:10:00 +0000171 $(MKDIR) $(@D) ; \
Reid Spencerc3719842004-12-16 18:26:53 +0000172 $(CP) -f $< $@ ;; \
Reid Spencer86606782004-10-26 23:10:00 +0000173 esac
174
Reid Spencer9411c642004-10-26 22:26:33 +0000175endif
176
177#------------------------------------------------------------------------
178# Set up the basic dependencies
179#------------------------------------------------------------------------
Reid Spencercc2d1e22004-10-30 09:19:36 +0000180$(UserTargets):: $(PreConditions)
Reid Spencer9411c642004-10-26 22:26:33 +0000181
182all:: all-local
Reid Spencer3a561f52004-10-23 20:04:14 +0000183clean:: clean-local
Reid Spencer3d659492004-11-02 16:36:03 +0000184clean-all:: clean-local clean-all-local
Reid Spencer9411c642004-10-26 22:26:33 +0000185install:: install-local
186uninstall:: uninstall-local
Reid Spencer9411c642004-10-26 22:26:33 +0000187install-local:: all-local
Reid Spencer44cb1b32004-12-03 20:08:48 +0000188install-bytecode:: install-bytecode-local
Reid Spencer3a561f52004-10-23 20:04:14 +0000189
190###############################################################################
191# VARIABLES: Set up various variables based on configuration data
192###############################################################################
193
194#--------------------------------------------------------------------
195# Variables derived from configuration we are building
Chris Lattner00950542001-06-06 20:29:01 +0000196#--------------------------------------------------------------------
197
Reid Spencer325a87e2005-01-02 17:43:20 +0000198
Chris Lattner760da062003-03-14 20:25:22 +0000199ifdef ENABLE_PROFILING
Reid Spencer9af3b292004-11-01 07:50:27 +0000200 BuildMode := Profile
Reid Spencer519799e2004-12-08 04:34:51 +0000201 CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
Reid Spencercc2d1e22004-10-30 09:19:36 +0000202 C.Flags := -O3 -DNDEBUG -pg
203 LD.Flags := -O3 -DNDEBUG -pg
Chris Lattner760da062003-03-14 20:25:22 +0000204else
205 ifdef ENABLE_OPTIMIZED
Reid Spencer9af3b292004-11-01 07:50:27 +0000206 BuildMode := Release
Reid Spencer325a87e2005-01-02 17:43:20 +0000207 # Don't use -fomit-frame-pointer on FreeBSD
208 ifneq ($(OS),FreeBSD)
209 OmitFramePointer := -fomit-frame-pointer
210 endif
211 CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors \
212 $(OmitFramePointer)
213 C.Flags := -O3 -DNDEBUG $(OmitFramePointer)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000214 LD.Flags := -O3 -DNDEBUG
Chris Lattner760da062003-03-14 20:25:22 +0000215 else
Reid Spencer9af3b292004-11-01 07:50:27 +0000216 BuildMode := Debug
Reid Spencer519799e2004-12-08 04:34:51 +0000217 CXX.Flags := -g -D_DEBUG
Reid Spencercc2d1e22004-10-30 09:19:36 +0000218 C.Flags := -g -D_DEBUG
219 LD.Flags := -g -D_DEBUG
Reid Spencer4d71b662004-10-22 21:01:56 +0000220 KEEP_SYMBOLS := 1
Chris Lattner760da062003-03-14 20:25:22 +0000221 endif
222endif
223
Reid Spencercc2d1e22004-10-30 09:19:36 +0000224CXX.Flags += $(CXXFLAGS)
225C.Flags += $(CFLAGS)
226CPP.Flags += $(CPPFLAGS)
227LD.Flags += $(LDFLAGS)
228AR.Flags := cru
229LibTool.Flags := --tag=CXX
Reid Spencer3a561f52004-10-23 20:04:14 +0000230
Andrew Lenharth39bcf5b2005-02-13 03:41:10 +0000231#Make Floating point ieee complient on alpha
232ifeq ($(ARCH),Alpha)
233 CXX.Flags += -mieee
234 CPP.Flags += -mieee
235endif
236
Reid Spencer3a561f52004-10-23 20:04:14 +0000237#--------------------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000238# Directory locations
Reid Spencer3a561f52004-10-23 20:04:14 +0000239#--------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +0000240ObjDir := $(PROJ_OBJ_DIR)/$(BuildMode)
241LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
242ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
243ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
Reid Spencer815cbcf2004-11-18 10:03:46 +0000244LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
Reid Spencer9a5acaf2004-11-18 20:04:39 +0000245LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
Reid Spencer775bf892004-12-28 07:59:22 +0000246LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
Reid Spencer2f138e72004-12-22 05:57:21 +0000247CFERuntimeLibDir := $(LLVMGCCDIR)/lib
John Criswell7a73b802003-06-30 21:59:07 +0000248
Reid Spencer3a561f52004-10-23 20:04:14 +0000249#--------------------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000250# Full Paths To Compiled Tools and Utilities
Reid Spencer3a561f52004-10-23 20:04:14 +0000251#--------------------------------------------------------------------
Reid Spencer3ca6d8b2005-01-14 16:33:36 +0000252EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
253Echo = @$(EchoCmd)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000254ifndef LIBTOOL
Reid Spencer4d71b662004-10-22 21:01:56 +0000255LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
Reid Spencercc2d1e22004-10-30 09:19:36 +0000256endif
257ifndef LLVMAS
258LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
259endif
260ifndef BURG
261BURG := $(LLVMToolDir)/burg$(EXEEXT)
262endif
263ifndef TBLGEN
264TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
265endif
Chris Lattner478b3b42004-11-29 19:47:58 +0000266ifndef GCCAS
267GCCAS := $(LLVMToolDir)/gccas$(EXEEXT)
268endif
Reid Spencercc2d1e22004-10-30 09:19:36 +0000269ifndef GCCLD
270GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
271endif
Alkis Evlogimenos7e80cd92004-12-13 17:44:14 +0000272ifndef LDIS
273LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
274endif
275ifndef LLI
276LLI := $(LLVMToolDir)/lli$(EXEEXT)
277endif
278ifndef LOPT
Alkis Evlogimenos20d793a2004-12-13 18:08:29 +0000279LOPT := $(LLVMToolDir)/opt$(EXEEXT)
Alkis Evlogimenos7e80cd92004-12-13 17:44:14 +0000280endif
Alkis Evlogimenos270e8512005-02-02 00:40:15 +0000281ifndef LBUGPOINT
282LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
283endif
284
John Criswellf5629d02005-01-03 17:42:57 +0000285LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
286LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
Dinakar Dhurjatiffb55cd2003-05-29 16:18:20 +0000287
Reid Spencer3a561f52004-10-23 20:04:14 +0000288#--------------------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000289# Adjust to user's request
Reid Spencer3a561f52004-10-23 20:04:14 +0000290#--------------------------------------------------------------------
Dinakar Dhurjatiffb55cd2003-05-29 16:18:20 +0000291
Reid Spencer492c2932005-01-11 04:31:07 +0000292# Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
293# to be built. Note that if LOADABLE_MODULE is specified then the resulting
294# shared library can be opened with dlopen
295ifdef SHARED_LIBRARY
Reid Spencercc2d1e22004-10-30 09:19:36 +0000296 LD.Flags += -rpath $(LibDir)
Reid Spencer492c2932005-01-11 04:31:07 +0000297 ifdef LOADABLE_MODULE
298 LD.Flags += -module
299 endif
300else
301 LibTool.Flags += --tag=disable-shared
John Criswell82f4a5a2003-07-31 20:58:51 +0000302endif
303
Reid Spencercceed9f2004-11-08 17:32:12 +0000304ifdef TOOL_VERBOSE
305 C.Flags += -v
306 CXX.Flags += -v
307 LD.Flags += -v
Reid Spencercceed9f2004-11-08 17:32:12 +0000308 VERBOSE := 1
309endif
310
Reid Spencer3a561f52004-10-23 20:04:14 +0000311# Adjust settings for verbose mode
Chris Lattner760da062003-03-14 20:25:22 +0000312ifndef VERBOSE
Reid Spencercc2d1e22004-10-30 09:19:36 +0000313 Verb := @
314 LibTool.Flags += --silent
315 AR.Flags += >/dev/null 2>/dev/null
Reid Spencer11fde542005-01-16 02:20:54 +0000316 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
Reid Spencer151f8ba2004-10-25 08:27:37 +0000317else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000318 ConfigureScriptFLAGS :=
Misha Brukmanb5f096f2002-09-12 16:05:39 +0000319endif
320
Vikram S. Advefeeae582002-09-18 11:55:13 +0000321# By default, strip symbol information from executable
Chris Lattner760da062003-03-14 20:25:22 +0000322ifndef KEEP_SYMBOLS
Reid Spencercc2d1e22004-10-30 09:19:36 +0000323 Strip := $(PLATFORMSTRIPOPTS)
324 StripWarnMsg := "(without symbols)"
Vikram S. Advefeeae582002-09-18 11:55:13 +0000325endif
326
Reid Spencer3a561f52004-10-23 20:04:14 +0000327# Adjust linker flags for building an executable
Reid Spencer4d71b662004-10-22 21:01:56 +0000328ifdef TOOLNAME
Reid Spencer815cbcf2004-11-18 10:03:46 +0000329ifdef EXAMPLE_TOOL
330 LD.Flags += -rpath $(ExmplDir) -export-dynamic
331else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000332 LD.Flags += -rpath $(ToolDir) -export-dynamic
Dinakar Dhurjati87ea8aa2003-10-29 14:28:35 +0000333endif
Reid Spencer815cbcf2004-11-18 10:03:46 +0000334endif
Dinakar Dhurjati87ea8aa2003-10-29 14:28:35 +0000335
Reid Spencer3a561f52004-10-23 20:04:14 +0000336#----------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000337# Options To Invoke Tools
Reid Spencer3a561f52004-10-23 20:04:14 +0000338#----------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000339
340CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
341
Reid Spencer9a8398e2005-02-14 21:54:08 +0000342LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
Reid Spencer11fde542005-01-16 02:20:54 +0000343CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
344 -I$(PROJ_OBJ_ROOT)/include \
345 -I$(PROJ_SRC_ROOT)/include \
346 -I$(LLVM_OBJ_ROOT)/include \
347 -I$(LLVM_SRC_ROOT)/include \
348 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
Reid Spencer4d71b662004-10-22 21:01:56 +0000349
Reid Spencercc2d1e22004-10-30 09:19:36 +0000350Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
351LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
Reid Spencer2f138e72004-12-22 05:57:21 +0000352BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
353 $(C.Flags) -c
Reid Spencercc2d1e22004-10-30 09:19:36 +0000354Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
355LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
Reid Spencerbc52ad72004-12-24 14:47:34 +0000356BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
357 $(CXX.Flags) -c
Reid Spencercc2d1e22004-10-30 09:19:36 +0000358Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
359 $(CompileCommonOpts) $(LD.Flags) $(Strip)
360Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
Reid Spencera69b1ea2004-10-28 09:15:28 +0000361 $(CompileCommonOpts)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000362LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
Reid Spencer11fde542005-01-16 02:20:54 +0000363Burg = $(BURG) -I $(PROJ_SRC_DIR)
364TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000365Archive = $(AR) $(AR.Flags)
Reid Spencer9a2f1372004-12-02 09:28:21 +0000366LArchive = $(LLVMToolDir)/llvm-ar rcsf
Reid Spencer4d71b662004-10-22 21:01:56 +0000367ifdef RANLIB
Reid Spencer3a561f52004-10-23 20:04:14 +0000368Ranlib = $(RANLIB)
Reid Spencer4d71b662004-10-22 21:01:56 +0000369else
Reid Spencer3a561f52004-10-23 20:04:14 +0000370Ranlib = ranlib
John Criswell7a73b802003-06-30 21:59:07 +0000371endif
372
Chris Lattner00950542001-06-06 20:29:01 +0000373#----------------------------------------------------------
Reid Spencer345235ca2004-12-04 22:34:09 +0000374# Get the list of source files and compute object file
375# names from them.
Reid Spencer3a561f52004-10-23 20:04:14 +0000376#----------------------------------------------------------
Reid Spencer345235ca2004-12-04 22:34:09 +0000377ifdef FAKE_SOURCES
378 Sources :=
379 FakeSources := $(FAKE_SOURCES)
380 ifdef BUILT_SOURCES
381 FakeSources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
382 endif
383 BaseNameSources := $(sort $(basename $(FakeSources)))
384 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
385 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
386 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000387else
Reid Spencer345235ca2004-12-04 22:34:09 +0000388 ifndef SOURCES
Reid Spencer11fde542005-01-16 02:20:54 +0000389 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
390 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
391 $(PROJ_SRC_DIR)/*.l))
Reid Spencer345235ca2004-12-04 22:34:09 +0000392 else
393 Sources := $(SOURCES)
394 endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000395
Reid Spencer345235ca2004-12-04 22:34:09 +0000396 ifdef BUILT_SOURCES
397 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
398 endif
Vikram S. Adve112a72c2001-07-15 13:16:47 +0000399
Reid Spencer345235ca2004-12-04 22:34:09 +0000400 BaseNameSources := $(sort $(basename $(Sources)))
401 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
402 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
403 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
404endif
Reid Spencer3a561f52004-10-23 20:04:14 +0000405
406###############################################################################
407# DIRECTORIES: Handle recursive descent of directory structure
408###############################################################################
John Criswell82f4a5a2003-07-31 20:58:51 +0000409
Chris Lattner00950542001-06-06 20:29:01 +0000410#---------------------------------------------------------
Reid Spencera69b1ea2004-10-28 09:15:28 +0000411# Provide rules to make install dirs. This must be early
412# in the file so they get built before dependencies
413#---------------------------------------------------------
414
Reid Spencer11fde542005-01-16 02:20:54 +0000415$(PROJ_bindir):
416 $(Verb) $(MKDIR) $(PROJ_bindir)
Chris Lattnere4cb90f2004-11-01 06:14:59 +0000417
Reid Spencer11fde542005-01-16 02:20:54 +0000418$(PROJ_libdir):
419 $(Verb) $(MKDIR) $(PROJ_libdir)
Reid Spencera69b1ea2004-10-28 09:15:28 +0000420
Reid Spencer11fde542005-01-16 02:20:54 +0000421$(PROJ_includedir):
422 $(Verb) $(MKDIR) $(PROJ_includedir)
Reid Spencera69b1ea2004-10-28 09:15:28 +0000423
Reid Spencer11fde542005-01-16 02:20:54 +0000424$(PROJ_etcdir):
425 $(Verb) $(MKDIR) $(PROJ_etcdir)
Reid Spencera69b1ea2004-10-28 09:15:28 +0000426
Reid Spencercc2d1e22004-10-30 09:19:36 +0000427# To create other directories, as needed, and timestamp their creation
428%/.dir:
429 $(Verb) $(MKDIR) $* > /dev/null
Reid Spencerfbbf3072004-11-29 05:00:33 +0000430 $(Verb) $(DATE) > $@
Reid Spencercc2d1e22004-10-30 09:19:36 +0000431
Reid Spencer815cbcf2004-11-18 10:03:46 +0000432.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
433.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
Reid Spencera69b1ea2004-10-28 09:15:28 +0000434
435#---------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +0000436# Handle the DIRS options for sequential construction
Chris Lattner00950542001-06-06 20:29:01 +0000437#---------------------------------------------------------
438
Reid Spencercc2d1e22004-10-30 09:19:36 +0000439SubDirs :=
Anand Shukla7c7a07e2002-09-18 04:29:30 +0000440ifdef DIRS
Reid Spencercc2d1e22004-10-30 09:19:36 +0000441SubDirs += $(DIRS)
442$(RecursiveTargets)::
443 $(Verb) for dir in $(DIRS); do \
Reid Spencer4d71b662004-10-22 21:01:56 +0000444 if [ ! -f $$dir/Makefile ]; then \
445 $(MKDIR) $$dir; \
Reid Spencer11fde542005-01-16 02:20:54 +0000446 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
Reid Spencer4d71b662004-10-22 21:01:56 +0000447 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000448 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
449 ($(MAKE) -C $$dir $@ ) || exit 1; \
450 fi ; \
Chris Lattnerf1ffd992002-09-17 23:35:02 +0000451 done
Anand Shukla7c7a07e2002-09-18 04:29:30 +0000452endif
Chris Lattnera8abc222002-09-18 03:22:27 +0000453
Reid Spencer3a561f52004-10-23 20:04:14 +0000454#---------------------------------------------------------
455# Handle the EXPERIMENTAL_DIRS options ensuring success
456# after each directory is built.
457#---------------------------------------------------------
458ifdef EXPERIMENTAL_DIRS
Reid Spencercc2d1e22004-10-30 09:19:36 +0000459$(RecursiveTargets)::
460 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
Reid Spencer3a561f52004-10-23 20:04:14 +0000461 if [ ! -f $$dir/Makefile ]; then \
462 $(MKDIR) $$dir; \
Reid Spencer11fde542005-01-16 02:20:54 +0000463 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
Reid Spencer3a561f52004-10-23 20:04:14 +0000464 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000465 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
466 ($(MAKE) -C $$dir $@ ) || exit 0; \
467 fi ; \
Reid Spencer3a561f52004-10-23 20:04:14 +0000468 done
469endif
Chris Lattnera8abc222002-09-18 03:22:27 +0000470
Reid Spencer3a561f52004-10-23 20:04:14 +0000471#---------------------------------------------------------
472# Handle the PARALLEL_DIRS options for parallel construction
473#---------------------------------------------------------
474ifdef PARALLEL_DIRS
475
Reid Spencercc2d1e22004-10-30 09:19:36 +0000476SubDirs += $(PARALLEL_DIRS)
477
Reid Spencer44cb1b32004-12-03 20:08:48 +0000478# Unfortunately, this list must be maintained if new recursive targets are added
Reid Spencercc2d1e22004-10-30 09:19:36 +0000479all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
480clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000481clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
Reid Spencercc2d1e22004-10-30 09:19:36 +0000482install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
Reid Spencer3a561f52004-10-23 20:04:14 +0000483uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
Reid Spencer44cb1b32004-12-03 20:08:48 +0000484install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
Reid Spencer3a561f52004-10-23 20:04:14 +0000485
Reid Spencer345235ca2004-12-04 22:34:09 +0000486ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
Reid Spencer3a561f52004-10-23 20:04:14 +0000487
Reid Spencer345235ca2004-12-04 22:34:09 +0000488$(ParallelTargets) :
Reid Spencercc2d1e22004-10-30 09:19:36 +0000489 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
Reid Spencer4d71b662004-10-22 21:01:56 +0000490 $(MKDIR) $(@D); \
Reid Spencer11fde542005-01-16 02:20:54 +0000491 $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
John Criswellb3866b62003-11-25 19:32:22 +0000492 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000493 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
494 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) ; \
495 fi
Chris Lattner00950542001-06-06 20:29:01 +0000496endif
497
Reid Spencer3a561f52004-10-23 20:04:14 +0000498#---------------------------------------------------------
499# Handle the OPTIONAL_DIRS options for directores that may
500# or may not exist.
501#---------------------------------------------------------
John Criswell2a6530f2003-06-27 16:58:44 +0000502ifdef OPTIONAL_DIRS
Reid Spencer151f8ba2004-10-25 08:27:37 +0000503
Reid Spencercc2d1e22004-10-30 09:19:36 +0000504SubDirs += $(OPTIONAL_DIRS)
Reid Spencer151f8ba2004-10-25 08:27:37 +0000505
Reid Spencercc2d1e22004-10-30 09:19:36 +0000506$(RecursiveTargets)::
507 $(Verb) for dir in $(OPTIONAL_DIRS); do \
Reid Spencer11fde542005-01-16 02:20:54 +0000508 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
Reid Spencer4d71b662004-10-22 21:01:56 +0000509 if [ ! -f $$dir/Makefile ]; then \
510 $(MKDIR) $$dir; \
Reid Spencer11fde542005-01-16 02:20:54 +0000511 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
Reid Spencer4d71b662004-10-22 21:01:56 +0000512 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000513 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
514 ($(MAKE) -C$$dir $@ ) || exit 1; \
515 fi ; \
Reid Spencer4d71b662004-10-22 21:01:56 +0000516 fi \
John Criswell2a6530f2003-06-27 16:58:44 +0000517 done
518endif
519
Reid Spencerfc945082004-08-20 09:20:05 +0000520#---------------------------------------------------------
521# Handle the CONFIG_FILES options
522#---------------------------------------------------------
523ifdef CONFIG_FILES
Reid Spencerfc945082004-08-20 09:20:05 +0000524
Reid Spencer11fde542005-01-16 02:20:54 +0000525install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
526 $(Echo) Installing Configuration Files To $(PROJ_etcdir)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000527 $(Verb)for file in $(CONFIG_FILES); do \
Reid Spencer11fde542005-01-16 02:20:54 +0000528 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
529 $(INSTALL) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
530 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
531 $(INSTALL) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
Reid Spencer1b426ab2004-11-23 05:59:53 +0000532 else \
533 $(ECHO) Error: cannot find config file $${file}. ; \
534 fi \
Reid Spencerfc945082004-08-20 09:20:05 +0000535 done
Reid Spencer3a561f52004-10-23 20:04:14 +0000536
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000537uninstall-local::
Reid Spencer11fde542005-01-16 02:20:54 +0000538 $(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000539 $(Verb)for file in $(CONFIG_FILES); do \
Reid Spencer11fde542005-01-16 02:20:54 +0000540 $(RM) -f $(PROJ_etcdir)/$${file} ; \
Reid Spencere5487ba2004-10-24 07:53:21 +0000541 done
542
Reid Spencerfc945082004-08-20 09:20:05 +0000543endif
544
Reid Spencer3a561f52004-10-23 20:04:14 +0000545###############################################################################
546# Library Build Rules: Four ways to build a library
547###############################################################################
Chris Lattner00950542001-06-06 20:29:01 +0000548
Reid Spencer7980ea42004-12-05 05:17:22 +0000549#---------------------------------------------------------
550# Bytecode Module Targets:
551# If the user set MODULE_NAME then they want to build a
552# bytecode module from the sources. We compile all the
553# sources and link it together into a single bytecode
554# module.
555#---------------------------------------------------------
556
557ifdef MODULE_NAME
Reid Spencer9a8398e2005-02-14 21:54:08 +0000558ifeq ($(strip $(LLVMGCC)),)
559$(warning Modules require llvm-gcc but no llvm-gcc is available)
560else
Reid Spencer7980ea42004-12-05 05:17:22 +0000561
562Module := $(LibDir)/$(MODULE_NAME).bc
Reid Spencer2f138e72004-12-22 05:57:21 +0000563LinkModule := $(LLVMGCCWITHPATH) -shared -nostdlib
Reid Spencer7980ea42004-12-05 05:17:22 +0000564
565ifdef EXPORTED_SYMBOL_FILE
Reid Spencerf8f57402005-01-28 19:52:32 +0000566LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
Reid Spencer7980ea42004-12-05 05:17:22 +0000567endif
568
569$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
570 $(Echo) Building $(BuildMOde) Bytecode Module $(notdir $@)
571 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
572
573all-local:: $(Module)
574
575clean-local::
576ifneq ($(strip $(Module)),)
577 -$(Verb) $(RM) -f $(Module)
578endif
579
Reid Spencerab3690b2004-12-13 07:38:07 +0000580ifdef BYTECODE_DESTINATION
581ModuleDestDir := $(BYTECODE_DESTINATION)
582else
Reid Spencer11fde542005-01-16 02:20:54 +0000583ModuleDestDir := $(PROJ_libdir)
Reid Spencerab3690b2004-12-13 07:38:07 +0000584endif
Reid Spencer7980ea42004-12-05 05:17:22 +0000585
Reid Spencerab3690b2004-12-13 07:38:07 +0000586DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
587
588install-module:: $(DestModule)
Reid Spencer7980ea42004-12-05 05:17:22 +0000589install-local:: $(DestModule)
590
Reid Spencerab3690b2004-12-13 07:38:07 +0000591$(DestModule): $(ModuleDestDir) $(Module)
Reid Spencer7980ea42004-12-05 05:17:22 +0000592 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
593 $(Verb) $(INSTALL) $(Module) $@
594
595uninstall-local::
596 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
597 -$(Verb) $(RM) -f $(DestModule)
598
599endif
Reid Spencer9a8398e2005-02-14 21:54:08 +0000600endif
Brian Gaeke8abff792004-01-22 22:53:48 +0000601
Reid Spencer3a561f52004-10-23 20:04:14 +0000602# if we're building a library ...
Chris Lattner00950542001-06-06 20:29:01 +0000603ifdef LIBRARYNAME
Vikram S. Adve112a72c2001-07-15 13:16:47 +0000604
Chris Lattner2a548c52002-09-16 22:36:42 +0000605# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
Chris Lattnerccb4ebd2002-09-16 22:34:56 +0000606LIBRARYNAME := $(strip $(LIBRARYNAME))
Reid Spencer492c2932005-01-11 04:31:07 +0000607ifdef LOADABLE_MODULE
608LibName.LA := $(LibDir)/$(LIBRARYNAME).la
609else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000610LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
Reid Spencer492c2932005-01-11 04:31:07 +0000611endif
Reid Spencercc2d1e22004-10-30 09:19:36 +0000612LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
613LibName.O := $(LibDir)/$(LIBRARYNAME).o
Reid Spencer9a2f1372004-12-02 09:28:21 +0000614LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
Chris Lattnerccb4ebd2002-09-16 22:34:56 +0000615
Reid Spencer3a561f52004-10-23 20:04:14 +0000616#---------------------------------------------------------
617# Shared Library Targets:
618# If the user asked for a shared library to be built
619# with the SHARED_LIBRARY variable, then we provide
620# targets for building them.
621#---------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000622ifdef SHARED_LIBRARY
623
Reid Spencercc2d1e22004-10-30 09:19:36 +0000624all-local:: $(LibName.LA)
Reid Spencer4d71b662004-10-22 21:01:56 +0000625
Reid Spencerf2ac1892004-12-16 07:36:08 +0000626$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
Reid Spencer9af3b292004-11-01 07:50:27 +0000627 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000628 $(Verb) $(Link) -o $@ $(ObjectsLO)
629 $(Verb) $(LTInstall) $@ $(LibDir)
Reid Spencer3a561f52004-10-23 20:04:14 +0000630
631clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000632ifneq ($(strip $(LibName.LA)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000633 -$(Verb) $(RM) -f $(LibName.LA)
Reid Spencere5487ba2004-10-24 07:53:21 +0000634endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000635
Reid Spencer11fde542005-01-16 02:20:54 +0000636DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
Reid Spencer4d71b662004-10-22 21:01:56 +0000637
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000638install-local:: $(DestSharedLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000639
Reid Spencer11fde542005-01-16 02:20:54 +0000640$(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
Reid Spencer9af3b292004-11-01 07:50:27 +0000641 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000642 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
Reid Spencer11fde542005-01-16 02:20:54 +0000643 $(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
Reid Spencere5487ba2004-10-24 07:53:21 +0000644
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000645uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000646 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
Reid Spencer11fde542005-01-16 02:20:54 +0000647 -$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
Reid Spencere5487ba2004-10-24 07:53:21 +0000648
Reid Spencer4d71b662004-10-22 21:01:56 +0000649endif
650
Reid Spencer3a561f52004-10-23 20:04:14 +0000651#---------------------------------------------------------
652# Bytecode Library Targets:
653# If the user asked for a bytecode library to be built
654# with the BYTECODE_LIBRARY variable, then we provide
655# targets for building them.
656#---------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000657ifdef BYTECODE_LIBRARY
Reid Spencer9a8398e2005-02-14 21:54:08 +0000658ifeq ($(strip $(LLVMGCC)),)
659$(warning Bytecode libraries require llvm-gcc which could not be found)
660else
Reid Spencer4d71b662004-10-22 21:01:56 +0000661
Reid Spencer776b8052004-12-03 06:04:35 +0000662# make the C and C++ compilers strip debug info out of bytecode libraries.
663BCCompile.C += -Wa,-strip-debug
664BCCompile.CXX += -Wa,-strip-debug
665
Reid Spencer9a2f1372004-12-02 09:28:21 +0000666all-local:: $(LibName.BCA)
667
668ifdef EXPORTED_SYMBOL_FILE
Reid Spencer2f138e72004-12-22 05:57:21 +0000669BCLinkLib = $(LLVMGCCWITHPATH) -shared -nostdlib -Xlinker \
Reid Spencer9a2f1372004-12-02 09:28:21 +0000670 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
671
Reid Spencerf2ac1892004-12-16 07:36:08 +0000672$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(GCCLD) \
Chris Lattner264ccbe2004-12-15 17:14:06 +0000673 $(LLVMToolDir)/llvm-ar
Reid Spencer9a2f1372004-12-02 09:28:21 +0000674 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
675 "(internalize)"
Chris Lattnerb0ea8642004-12-02 21:23:43 +0000676 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
Reid Spencerefd6bb32004-12-13 03:59:35 +0000677 $(Verb) $(RM) -f $@
Reid Spencer9a2f1372004-12-02 09:28:21 +0000678 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
Reid Spencer4d71b662004-10-22 21:01:56 +0000679else
Reid Spencerf2ac1892004-12-16 07:36:08 +0000680$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
Chris Lattner264ccbe2004-12-15 17:14:06 +0000681 $(LLVMToolDir)/llvm-ar
Reid Spencer9a2f1372004-12-02 09:28:21 +0000682 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
Reid Spencerefd6bb32004-12-13 03:59:35 +0000683 $(Verb) $(RM) -f $@
Reid Spencer9a2f1372004-12-02 09:28:21 +0000684 $(Verb) $(LArchive) $@ $(ObjectsBC)
685
Reid Spencer4d71b662004-10-22 21:01:56 +0000686endif
687
Reid Spencer3a561f52004-10-23 20:04:14 +0000688clean-local::
Reid Spencer9a2f1372004-12-02 09:28:21 +0000689ifneq ($(strip $(LibName.BCA)),)
690 -$(Verb) $(RM) -f $(LibName.BCA)
Reid Spencere5487ba2004-10-24 07:53:21 +0000691endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000692
Reid Spencer8f094f32004-12-13 07:28:21 +0000693ifdef BYTECODE_DESTINATION
694BytecodeDestDir := $(BYTECODE_DESTINATION)
695else
Reid Spencer11fde542005-01-16 02:20:54 +0000696BytecodeDestDir := $(PROJ_libdir)
Reid Spencer8f094f32004-12-13 07:28:21 +0000697endif
698
699DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a
Reid Spencer9a2f1372004-12-02 09:28:21 +0000700
Reid Spencer44cb1b32004-12-03 20:08:48 +0000701install-bytecode-local:: $(DestBytecodeLib)
Reid Spencere45ebfa2004-10-26 07:09:33 +0000702
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000703install-local:: $(DestBytecodeLib)
Chris Lattner481cc7c2003-08-15 02:18:35 +0000704
Reid Spencer8f094f32004-12-13 07:28:21 +0000705$(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
Reid Spencer9a2f1372004-12-02 09:28:21 +0000706 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
707 $(Verb) $(INSTALL) $(LibName.BCA) $@
Reid Spencere5487ba2004-10-24 07:53:21 +0000708
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000709uninstall-local::
Reid Spencer9a2f1372004-12-02 09:28:21 +0000710 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000711 -$(Verb) $(RM) -f $(DestBytecodeLib)
Reid Spencer4d71b662004-10-22 21:01:56 +0000712
713endif
Reid Spencer9a8398e2005-02-14 21:54:08 +0000714endif
Vikram S. Adve60f56062002-08-02 18:34:12 +0000715
Reid Spencercc2d1e22004-10-30 09:19:36 +0000716#---------------------------------------------------------
717# ReLinked Library Targets:
718# If the user didn't explicitly forbid building a
719# relinked then we provide targets for building them.
720#---------------------------------------------------------
Chris Lattnere62dbe92002-07-23 17:56:16 +0000721ifndef DONT_BUILD_RELINKED
Reid Spencer4d71b662004-10-22 21:01:56 +0000722
Reid Spencercc2d1e22004-10-30 09:19:36 +0000723all-local:: $(LibName.O)
724
Reid Spencerf2ac1892004-12-16 07:36:08 +0000725$(LibName.O): $(ObjectsO) $(LibDir)/.dir
Reid Spencer9af3b292004-11-01 07:50:27 +0000726 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000727 $(Verb) $(Relink) -o $@ $(ObjectsO)
Reid Spencer4d71b662004-10-22 21:01:56 +0000728
Reid Spencer3a561f52004-10-23 20:04:14 +0000729clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000730ifneq ($(strip $(LibName.O)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000731 -$(Verb) $(RM) -f $(LibName.O)
Reid Spencere5487ba2004-10-24 07:53:21 +0000732endif
733
Reid Spencer11fde542005-01-16 02:20:54 +0000734DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
Reid Spencere5487ba2004-10-24 07:53:21 +0000735
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000736install-local:: $(DestRelinkedLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000737
Reid Spencer11fde542005-01-16 02:20:54 +0000738$(DestRelinkedLib): $(PROJ_libdir) $(LibName.O)
Reid Spencer9af3b292004-11-01 07:50:27 +0000739 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000740 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000741
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000742uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000743 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000744 -$(Verb) $(RM) -f $(DestRelinkedLib)
Reid Spencer4d71b662004-10-22 21:01:56 +0000745
Chris Lattnere62dbe92002-07-23 17:56:16 +0000746endif
Chris Lattner760da062003-03-14 20:25:22 +0000747
Reid Spencercc2d1e22004-10-30 09:19:36 +0000748#---------------------------------------------------------
749# Archive Library Targets:
750# If the user wanted a regular archive library built,
751# then we provide targets for building them.
752#---------------------------------------------------------
Chris Lattnere62dbe92002-07-23 17:56:16 +0000753ifdef BUILD_ARCHIVE
Chris Lattnere62dbe92002-07-23 17:56:16 +0000754
Reid Spencercc2d1e22004-10-30 09:19:36 +0000755all-local:: $(LibName.A)
756
Reid Spencerf2ac1892004-12-16 07:36:08 +0000757$(LibName.A): $(ObjectsO) $(LibDir)/.dir
Reid Spencer9af3b292004-11-01 07:50:27 +0000758 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000759 -$(Verb) $(RM) -f $@
Reid Spencercc2d1e22004-10-30 09:19:36 +0000760 $(Verb) $(Archive) $@ $(ObjectsO)
761 $(Verb) $(Ranlib) $@
Vikram S. Adve41e78912002-09-20 14:03:13 +0000762
Reid Spencer3a561f52004-10-23 20:04:14 +0000763clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000764ifneq ($(strip $(LibName.A)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000765 -$(Verb) $(RM) -f $(LibName.A)
Chris Lattner00950542001-06-06 20:29:01 +0000766endif
767
Reid Spencer11fde542005-01-16 02:20:54 +0000768DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
Reid Spencere5487ba2004-10-24 07:53:21 +0000769
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000770install-local:: $(DestArchiveLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000771
Reid Spencer11fde542005-01-16 02:20:54 +0000772$(DestArchiveLib): $(PROJ_libdir) $(LibName.A)
Reid Spencer9af3b292004-11-01 07:50:27 +0000773 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
Reid Spencer11fde542005-01-16 02:20:54 +0000774 $(Verb) $(MKDIR) $(PROJ_libdir)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000775 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000776
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000777uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000778 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000779 -$(Verb) $(RM) -f $(DestArchiveLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000780
781endif
782
783# endif LIBRARYNAME
Reid Spencer4d71b662004-10-22 21:01:56 +0000784endif
785
Reid Spencerb1dd3dd2004-10-24 08:21:04 +0000786###############################################################################
787# Tool Build Rules: Build executable tool based on TOOLNAME option
788###############################################################################
789
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000790ifdef TOOLNAME
791
Reid Spencercc2d1e22004-10-30 09:19:36 +0000792#---------------------------------------------------------
Reid Spencer7c787c92004-11-29 07:17:07 +0000793# Handle the special "JIT" value for LLVM_LIBS which is a
794# shorthand for a bunch of libraries that get the correct
795# JIT support for a tool that runs JIT.
796#---------------------------------------------------------
797ifeq ($(LLVMLIBS),JIT)
798
799# Make sure we can get our own symbols in the tool
800Link += -dlopen self
801
802# Generic JIT libraries
803JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
804
805# You can enable the X86 JIT on a non-X86 host by setting the flag
806# ENABLE_X86_JIT on the make command line. If not, it will still be
807# enabled automagically on an X86 host.
808ifeq ($(ARCH), x86)
809 ENABLE_X86_JIT = 1
810endif
811
812# What the X86 JIT requires
813ifdef ENABLE_X86_JIT
Chris Lattner85139f52005-01-07 07:51:11 +0000814 JIT_LIBS += LLVMX86 LLVMSelectionDAG
Reid Spencer7c787c92004-11-29 07:17:07 +0000815endif
816
817# You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
818# ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
819# enabled automagically on an SparcV9 host.
820ifeq ($(ARCH), Sparc)
821 ENABLE_SPARCV9_JIT = 1
822endif
823
824# What the Sparc JIT requires
825ifdef ENABLE_SPARCV9_JIT
826 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
827 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
828 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
829 LLVMDataStructure.a LLVMSparcV9RegAlloc
830endif
831
832# You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
833# ENABLE_PPC_JIT on the make command line. If not, it will still be
834# enabled automagically on an PowerPC host.
835ifeq ($(ARCH), PowerPC)
836 ENABLE_PPC_JIT = 1
837endif
838
839# What the PowerPC JIT requires
840ifdef ENABLE_PPC_JIT
841 JIT_LIBS += LLVMPowerPC
842endif
843
844LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
845 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
846 LLVMSystem.a $(PLATFORMLIBDL)
847endif
848
849#---------------------------------------------------------
Reid Spencercc2d1e22004-10-30 09:19:36 +0000850# Set up variables for building a tool.
851#---------------------------------------------------------
Reid Spencer815cbcf2004-11-18 10:03:46 +0000852ifdef EXAMPLE_TOOL
853ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
854else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000855ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
Reid Spencer815cbcf2004-11-18 10:03:46 +0000856endif
Reid Spencercc2d1e22004-10-30 09:19:36 +0000857ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
858ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
859LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
860LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
861ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
862LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
863ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
864LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000865
Reid Spencercc2d1e22004-10-30 09:19:36 +0000866#---------------------------------------------------------
Reid Spencercc2d1e22004-10-30 09:19:36 +0000867# Tell make that we need to rebuild subdirectories before
868# we can link the tool. This affects things like LLI which
869# has library subdirectories.
870#---------------------------------------------------------
871$(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
Chris Lattner8d7dfb32003-01-22 16:13:31 +0000872
Reid Spencercc2d1e22004-10-30 09:19:36 +0000873#---------------------------------------------------------
874# Provide targets for building the tools
875#---------------------------------------------------------
876all-local:: $(ToolBuildPath)
John Criswell2a6530f2003-06-27 16:58:44 +0000877
Reid Spencer3a561f52004-10-23 20:04:14 +0000878clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000879ifneq ($(strip $(ToolBuildPath)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000880 -$(Verb) $(RM) -f $(ToolBuildPath)
Reid Spencere5487ba2004-10-24 07:53:21 +0000881endif
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000882
Reid Spencer815cbcf2004-11-18 10:03:46 +0000883ifdef EXAMPLE_TOOL
884$(ToolBuildPath): $(ExmplDir)/.dir
885else
886$(ToolBuildPath): $(ToolDir)/.dir
887endif
888
Reid Spencerf2ac1892004-12-16 07:36:08 +0000889$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
Reid Spencer9af3b292004-11-01 07:50:27 +0000890 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000891 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
Reid Spencer9a8398e2005-02-14 21:54:08 +0000892 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
Reid Spencer9af3b292004-11-01 07:50:27 +0000893 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
Reid Spencere5487ba2004-10-24 07:53:21 +0000894
Reid Spencer11fde542005-01-16 02:20:54 +0000895DestTool = $(PROJ_bindir)/$(TOOLNAME)
Reid Spencere5487ba2004-10-24 07:53:21 +0000896
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000897install-local:: $(DestTool)
Reid Spencere45ebfa2004-10-26 07:09:33 +0000898
Reid Spencer11fde542005-01-16 02:20:54 +0000899$(DestTool): $(PROJ_bindir) $(ToolBuildPath)
Reid Spencer9af3b292004-11-01 07:50:27 +0000900 $(Echo) Installing $(BuildMode) $(DestTool)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000901 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
Reid Spencere5487ba2004-10-24 07:53:21 +0000902
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000903uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000904 $(Echo) Uninstalling $(BuildMode) $(DestTool)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000905 -$(Verb) $(RM) -f $(DestTool)
Reid Spencere5487ba2004-10-24 07:53:21 +0000906
Reid Spencer4d71b662004-10-22 21:01:56 +0000907endif
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000908
Reid Spencercc2d1e22004-10-30 09:19:36 +0000909###############################################################################
910# Object Build Rules: Build object files based on sources
911###############################################################################
912
913# Provide rule sets for when dependency generation is enabled
Reid Spencer4d71b662004-10-22 21:01:56 +0000914ifndef DISABLE_AUTO_DEPENDENCIES
Vikram S. Adve41e78912002-09-20 14:03:13 +0000915
Reid Spencercc2d1e22004-10-30 09:19:36 +0000916#---------------------------------------------------------
917# Create .lo files in the ObjDir directory from the .cpp and .c files...
918#---------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +0000919ifdef SHARED_LIBRARY
920
Chris Lattner3c473472004-12-16 17:28:50 +0000921$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000922 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000923 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
924 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
925 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
Reid Spencer3a561f52004-10-23 20:04:14 +0000926
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000927$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
928 $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
929 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
930 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
931 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
932
Chris Lattner3c473472004-12-16 17:28:50 +0000933$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000934 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000935 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
936 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
937 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
Reid Spencer3a561f52004-10-23 20:04:14 +0000938
Reid Spencercc2d1e22004-10-30 09:19:36 +0000939#---------------------------------------------------------
940# Create .o files in the ObjDir directory from the .cpp and .c files...
941#---------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +0000942else
Reid Spencer4d71b662004-10-22 21:01:56 +0000943
Chris Lattner3c473472004-12-16 17:28:50 +0000944$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000945 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000946 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
947 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
948 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
Reid Spencer4d71b662004-10-22 21:01:56 +0000949
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000950$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
951 $(Echo) "Compiling $*.cc for $(BuildMode) build"
952 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
953 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
954 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
955
Chris Lattner3c473472004-12-16 17:28:50 +0000956$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000957 $(Echo) "Compiling $*.c for $(BuildMode) build"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000958 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
959 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
960 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
Reid Spencer3a561f52004-10-23 20:04:14 +0000961
962endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000963
Reid Spencercc2d1e22004-10-30 09:19:36 +0000964#---------------------------------------------------------
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000965# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
Reid Spencercc2d1e22004-10-30 09:19:36 +0000966#---------------------------------------------------------
Chris Lattner3c473472004-12-16 17:28:50 +0000967$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000968 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000969 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
970 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
971 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
Reid Spencer4d71b662004-10-22 21:01:56 +0000972
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000973$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
974 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
975 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
976 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
977 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
978
Chris Lattner3c473472004-12-16 17:28:50 +0000979$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000980 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000981 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
982 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
983 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
Reid Spencer4d71b662004-10-22 21:01:56 +0000984
Reid Spencercc2d1e22004-10-30 09:19:36 +0000985# Provide alternate rule sets if dependencies are disabled
Reid Spencer4d71b662004-10-22 21:01:56 +0000986else
987
Reid Spencer3a561f52004-10-23 20:04:14 +0000988ifdef SHARED_LIBRARY
989
Chris Lattner3c473472004-12-16 17:28:50 +0000990$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000991 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
Reid Spencer3a561f52004-10-23 20:04:14 +0000992 $(LTCompile.CXX) $< -o $@
993
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000994$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
995 $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
996 $(LTCompile.CXX) $< -o $@
997
Chris Lattner3c473472004-12-16 17:28:50 +0000998$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencerc3719842004-12-16 18:26:53 +0000999 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
Reid Spencer3a561f52004-10-23 20:04:14 +00001000 $(LTCompile.C) $< -o $@
1001
1002else
Reid Spencer4d71b662004-10-22 21:01:56 +00001003
Chris Lattner3c473472004-12-16 17:28:50 +00001004$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001005 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
Reid Spencer3a561f52004-10-23 20:04:14 +00001006 $(Compile.CXX) $< -o $@
Reid Spencer4d71b662004-10-22 21:01:56 +00001007
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001008$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1009 $(Echo) "Compiling $*.cc for $(BuildMode) build"
1010 $(Compile.CXX) $< -o $@
1011
Chris Lattner3c473472004-12-16 17:28:50 +00001012$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencerc3719842004-12-16 18:26:53 +00001013 $(Echo) "Compiling $*.c for $(BuildMode) build"
Reid Spencer3a561f52004-10-23 20:04:14 +00001014 $(Compile.C) $< -o $@
1015endif
Reid Spencer4d71b662004-10-22 21:01:56 +00001016
Chris Lattner3c473472004-12-16 17:28:50 +00001017$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001018 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
Reid Spencer8676b7e2004-10-31 18:52:15 +00001019 $(BCCompile.CXX) $< -o $@
Reid Spencer4d71b662004-10-22 21:01:56 +00001020
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001021$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1022 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1023 $(BCCompile.CXX) $< -o $@
1024
Chris Lattner3c473472004-12-16 17:28:50 +00001025$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001026 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
Reid Spencer8676b7e2004-10-31 18:52:15 +00001027 $(BCCompile.C) $< -o $@
Brian Gaeke44909cf2003-12-10 00:26:28 +00001028
Chris Lattner1cbc29f2001-09-07 22:57:58 +00001029endif
1030
Reid Spencercc2d1e22004-10-30 09:19:36 +00001031#---------------------------------------------------------
1032# Provide rule to build .bc files from .ll sources,
1033# regardless of dependencies
1034#---------------------------------------------------------
1035$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
Reid Spencer9af3b292004-11-01 07:50:27 +00001036 $(Echo) "Compiling $*.ll for $(BuildMode) build"
Reid Spencercc2d1e22004-10-30 09:19:36 +00001037 $(Verb) $(LLVMAS) $< -f -o $@
1038
1039###############################################################################
1040# TABLEGEN: Provide rules for running tblgen to produce *.inc files
1041###############################################################################
Chris Lattner481cc7c2003-08-15 02:18:35 +00001042
Reid Spencer4d71b662004-10-22 21:01:56 +00001043ifdef TARGET
1044
Reid Spencer11fde542005-01-16 02:20:54 +00001045TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001046INCFiles := $(filter %.inc,$(BUILT_SOURCES))
Chris Lattner3c473472004-12-16 17:28:50 +00001047INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1048.PRECIOUS: $(INCTMPFiles) $(INCFiles)
Reid Spencer4d71b662004-10-22 21:01:56 +00001049
Chris Lattner3c473472004-12-16 17:28:50 +00001050# All of these files depend on tblgen and the .td files.
1051$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
Reid Spencer4d71b662004-10-22 21:01:56 +00001052
Chris Lattner23ee7952004-12-16 17:38:56 +00001053# INCFiles rule: All of the tblgen generated files are emitted to
1054# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1055# us to only "touch" the real file if the contents of it change. IOW, if
1056# tblgen is modified, all of the .inc.tmp files are regereated, but no
1057# dependencies of the .inc files are, unless the contents of the .inc file
1058# changes.
1059$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
Reid Spencerc3719842004-12-16 18:26:53 +00001060 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
Chris Lattner3c473472004-12-16 17:28:50 +00001061
1062$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
1063$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001064 $(Echo) "Building $(<F) register names with tblgen"
1065 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001066
Chris Lattner3c473472004-12-16 17:28:50 +00001067$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
1068$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001069 $(Echo) "Building $(<F) register information header with tblgen"
1070 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001071
Chris Lattner3c473472004-12-16 17:28:50 +00001072$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1073$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001074 $(Echo) "Building $(<F) register info implementation with tblgen"
1075 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001076
Chris Lattner3c473472004-12-16 17:28:50 +00001077$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
1078$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001079 $(Echo) "Building $(<F) instruction names with tblgen"
1080 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001081
Chris Lattner3c473472004-12-16 17:28:50 +00001082$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1083$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001084 $(Echo) "Building $(<F) instruction information with tblgen"
1085 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001086
Chris Lattner3c473472004-12-16 17:28:50 +00001087$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1088$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001089 $(Echo) "Building $(<F) assembly writer with tblgen"
1090 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001091
Chris Lattner02a4f902004-12-16 17:34:04 +00001092$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1093$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
1094 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
Reid Spencercc2d1e22004-10-30 09:19:36 +00001095 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001096
Chris Lattner3c473472004-12-16 17:28:50 +00001097$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1098$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001099 $(Echo) "Building $(<F) code emitter with tblgen"
1100 $(Verb) $(TableGen) -gen-emitter -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001101
Reid Spencer3a561f52004-10-23 20:04:14 +00001102clean-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001103 -$(Verb) $(RM) -f $(INCFiles)
Reid Spencer4d71b662004-10-22 21:01:56 +00001104
1105endif
Chris Lattner481cc7c2003-08-15 02:18:35 +00001106
Reid Spencercc2d1e22004-10-30 09:19:36 +00001107###############################################################################
1108# LEX AND YACC: Provide rules for generating sources with lex and yacc
1109###############################################################################
Chris Lattnere8996782003-01-16 22:44:19 +00001110
Reid Spencercc2d1e22004-10-30 09:19:36 +00001111#---------------------------------------------------------
1112# Provide rules for generating a .cpp source file from
1113# (f)lex input sources.
1114#---------------------------------------------------------
1115
Reid Spencer3d659492004-11-02 16:36:03 +00001116LexFiles := $(filter %.l,$(Sources))
Reid Spencercc2d1e22004-10-30 09:19:36 +00001117
Reid Spencer3d659492004-11-02 16:36:03 +00001118ifneq ($(LexFiles),)
1119
1120LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
Reid Spencercc2d1e22004-10-30 09:19:36 +00001121
1122.PRECIOUS: $(LexOutput)
1123
1124# Note the extra sed filtering here, used to cut down on the warnings emited
1125# by GCC. The last line is a gross hack to work around flex aparently not
1126# being able to resize the buffer on a large token input. Currently, for
1127# uninitialized string buffers in LLVM we can generate very long tokens, so
1128# this is a hack around it.
Chris Lattnerb7dc2b92003-08-15 20:00:47 +00001129# FIXME. (f.e. char Buffer[10000] )
Chris Lattner00950542001-06-06 20:29:01 +00001130%.cpp: %.l
Reid Spencerc2ef8cd2004-12-10 19:44:16 +00001131 $(Echo) Flexing $*.l
Reid Spencercc2d1e22004-10-30 09:19:36 +00001132 $(Verb) $(FLEX) -t $< | \
Reid Spencer4d71b662004-10-22 21:01:56 +00001133 $(SED) 's/void yyunput/inline void yyunput/' | \
1134 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
1135 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
Reid Spencer80f0ef72004-10-28 00:41:43 +00001136 > $@
Chris Lattner00950542001-06-06 20:29:01 +00001137
Reid Spencer9af3b292004-11-01 07:50:27 +00001138clean-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001139 -$(Verb) $(RM) -f $(LexOutput)
Reid Spencer3d659492004-11-02 16:36:03 +00001140 $(Verb) $(RM) -f $(LexOutput)
Reid Spencer9af3b292004-11-01 07:50:27 +00001141
Reid Spencercc2d1e22004-10-30 09:19:36 +00001142endif
1143
1144#---------------------------------------------------------
1145# Provide rules for generating a .cpp and .h source files
1146# from yacc (bison) input sources.
1147#---------------------------------------------------------
1148
Reid Spencer3d659492004-11-02 16:36:03 +00001149YaccFiles := $(filter %.y,$(Sources))
1150ifneq ($(YaccFiles),)
1151YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001152
1153.PRECIOUS: $(YaccOutput)
1154
1155# Cancel built-in rules for yacc
1156%.c: %.y
1157%.cpp: %.y
1158%.h: %.y
1159
Chris Lattner00950542001-06-06 20:29:01 +00001160# Rule for building the bison parsers...
Chris Lattner00950542001-06-06 20:29:01 +00001161%.cpp %.h : %.y
Reid Spencercc2d1e22004-10-30 09:19:36 +00001162 $(Echo) "Bisoning $*.y"
1163 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
1164 $(Verb) $(MV) -f $*.tab.c $*.cpp
1165 $(Verb) $(MV) -f $*.tab.h $*.h
Chris Lattner00950542001-06-06 20:29:01 +00001166
Reid Spencer9af3b292004-11-01 07:50:27 +00001167clean-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001168 -$(Verb) $(RM) -f $(YaccOutput)
Reid Spencer3d659492004-11-02 16:36:03 +00001169 $(Verb) $(RM) -f $(YaccOutput)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001170endif
Chris Lattner00950542001-06-06 20:29:01 +00001171
Reid Spencercc2d1e22004-10-30 09:19:36 +00001172###############################################################################
1173# OTHER RULES: Other rules needed
1174###############################################################################
Reid Spencer4d71b662004-10-22 21:01:56 +00001175
Chris Lattner30440c62003-01-16 21:06:18 +00001176# To create postscript files from dot files...
John Criswelle0f9ac62003-10-02 19:02:02 +00001177ifneq ($(DOT),false)
Chris Lattner30440c62003-01-16 21:06:18 +00001178%.ps: %.dot
Reid Spencer4d71b662004-10-22 21:01:56 +00001179 $(DOT) -Tps < $< > $@
John Criswell7a73b802003-06-30 21:59:07 +00001180else
1181%.ps: %.dot
Reid Spencercc2d1e22004-10-30 09:19:36 +00001182 $(Echo) "Cannot build $@: The program dot is not installed"
John Criswell7a73b802003-06-30 21:59:07 +00001183endif
Chris Lattner30440c62003-01-16 21:06:18 +00001184
John Criswell7f336952003-09-06 14:44:17 +00001185# This rules ensures that header files that are removed still have a rule for
1186# which they can be "generated." This allows make to ignore them and
1187# reproduce the dependency lists.
John Criswell4b6e5d12003-09-18 18:37:08 +00001188%.h:: ;
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001189%.hpp:: ;
John Criswell7f336952003-09-06 14:44:17 +00001190
Reid Spencercc2d1e22004-10-30 09:19:36 +00001191# Define clean-local to clean the current directory. Note that this uses a
1192# very conservative approach ensuring that empty variables do not cause
1193# errors or disastrous removal.
Reid Spencer3a561f52004-10-23 20:04:14 +00001194clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001195ifneq ($(strip $(ObjDir)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001196 -$(Verb) $(RM) -rf $(ObjDir)
Reid Spencere5487ba2004-10-24 07:53:21 +00001197endif
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001198 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
Brian Gaeke9d3cd402004-01-21 19:53:11 +00001199ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001200 -$(Verb) $(RM) -f *$(SHLIBEXT)
Brian Gaeke9d3cd402004-01-21 19:53:11 +00001201endif
John Criswell7a73b802003-06-30 21:59:07 +00001202
Reid Spencer3d659492004-11-02 16:36:03 +00001203clean-all-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001204 -$(Verb) $(RM) -rf Debug Release Profile
Reid Spencer3d659492004-11-02 16:36:03 +00001205
Reid Spencercc2d1e22004-10-30 09:19:36 +00001206# Build tags database for Emacs/Xemacs:
Reid Spencer12d79512004-11-12 02:27:36 +00001207tags:: TAGS CTAGS
1208
Reid Spencercc2d1e22004-10-30 09:19:36 +00001209TAGS:
Reid Spencer11fde542005-01-16 02:20:54 +00001210 find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1211 $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1212 $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1213 $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
Reid Spencer12d79512004-11-12 02:27:36 +00001214 -name '*.cpp' -o -name '*.h' | \
Reid Spencercc2d1e22004-10-30 09:19:36 +00001215 $(ETAGS) $(ETAGSFLAGS) -
1216
Reid Spencer12d79512004-11-12 02:27:36 +00001217CTAGS:
Reid Spencer11fde542005-01-16 02:20:54 +00001218 find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1219 $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1220 $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1221 $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
Reid Spencer12d79512004-11-12 02:27:36 +00001222 \( -name '*.cpp' -o -name '*.h' \) -print | \
Reid Spencer11fde542005-01-16 02:20:54 +00001223 ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L -
Reid Spencer12d79512004-11-12 02:27:36 +00001224
1225
Reid Spencer3a561f52004-10-23 20:04:14 +00001226###############################################################################
1227# DEPENDENCIES: Include the dependency files if we should
1228###############################################################################
Chris Lattner33ad24a2003-08-22 14:10:16 +00001229ifndef DISABLE_AUTO_DEPENDENCIES
1230
Reid Spencer3a561f52004-10-23 20:04:14 +00001231# If its not one of the cleaning targets
Reid Spencercc2d1e22004-10-30 09:19:36 +00001232ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
Reid Spencer4d71b662004-10-22 21:01:56 +00001233
Reid Spencer3a561f52004-10-23 20:04:14 +00001234# Get the list of dependency files
Reid Spencercc2d1e22004-10-30 09:19:36 +00001235DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
Reid Spencer11fde542005-01-16 02:20:54 +00001236DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
Misha Brukman4f7a8cf2003-11-09 21:36:19 +00001237
Reid Spencer3a561f52004-10-23 20:04:14 +00001238-include /dev/null $(DependFiles)
1239
John Criswelld741bcf2003-08-12 18:51:51 +00001240endif
Chris Lattner1ddb6b62003-08-18 17:27:40 +00001241
Reid Spencercc2d1e22004-10-30 09:19:36 +00001242endif
Reid Spencer4d71b662004-10-22 21:01:56 +00001243
Reid Spencer151f8ba2004-10-25 08:27:37 +00001244###############################################################################
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001245# CHECK: Running the test suite
1246###############################################################################
1247
1248check::
Reid Spencer11fde542005-01-16 02:20:54 +00001249 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1250 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001251 $(EchoCmd) Running test suite ; \
Reid Spencer11fde542005-01-16 02:20:54 +00001252 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001253 TESTSUITE=$(TESTSUITE) ; \
1254 else \
1255 $(EchoCmd) No Makefile in test directory ; \
1256 fi ; \
1257 else \
1258 $(EchoCmd) No test directory ; \
1259 fi
1260
1261###############################################################################
Reid Spencercc2d1e22004-10-30 09:19:36 +00001262# DISTRIBUTION: Handle construction of a distribution tarball
Reid Spencer151f8ba2004-10-25 08:27:37 +00001263###############################################################################
1264
Reid Spencere45ebfa2004-10-26 07:09:33 +00001265#------------------------------------------------------------------------
1266# Define distribution related variables
1267#------------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +00001268DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
1269DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1270TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1271DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1272DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
1273DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
Reid Spencer151f8ba2004-10-25 08:27:37 +00001274DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1275 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001276 Makefile.config.in configure autoconf
1277DistOther := $(notdir $(wildcard \
Reid Spencer11fde542005-01-16 02:20:54 +00001278 $(PROJ_SRC_DIR)/*.h \
1279 $(PROJ_SRC_DIR)/*.td \
1280 $(PROJ_SRC_DIR)/*.def \
1281 $(PROJ_SRC_DIR)/*.ll \
1282 $(PROJ_SRC_DIR)/*.in))
Reid Spencercc2d1e22004-10-30 09:19:36 +00001283DistSubDirs := $(SubDirs)
Reid Spencerfbbf3072004-11-29 05:00:33 +00001284DistSources = $(Sources) $(EXTRA_DIST)
1285DistFiles = $(DistAlways) $(DistSources) $(DistOther)
Reid Spencer151f8ba2004-10-25 08:27:37 +00001286
Reid Spencere45ebfa2004-10-26 07:09:33 +00001287#------------------------------------------------------------------------
1288# We MUST build distribution with OBJ_DIR != SRC_DIR
1289#------------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +00001290ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
Reid Spencere45ebfa2004-10-26 07:09:33 +00001291dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001292 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
Reid Spencere45ebfa2004-10-26 07:09:33 +00001293
Reid Spencere45ebfa2004-10-26 07:09:33 +00001294else
1295
Reid Spencere45ebfa2004-10-26 07:09:33 +00001296#------------------------------------------------------------------------
Reid Spencere45ebfa2004-10-26 07:09:33 +00001297# Prevent attempt to run dist targets from anywhere but the top level
1298#------------------------------------------------------------------------
1299ifneq ($(LEVEL),.)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001300dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
Reid Spencer11fde542005-01-16 02:20:54 +00001301 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001302else
1303
1304#------------------------------------------------------------------------
1305# Provide the top level targets
1306#------------------------------------------------------------------------
1307
Reid Spencercc2d1e22004-10-30 09:19:36 +00001308dist-gzip:: $(DistTarGZip)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001309
Reid Spencer345235ca2004-12-04 22:34:09 +00001310$(DistTarGZip) : $(TopDistDir)/.makedistdir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001311 $(Echo) Packing gzipped distribution tar file.
Reid Spencer11fde542005-01-16 02:20:54 +00001312 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
Reid Spencerfbbf3072004-11-29 05:00:33 +00001313 $(GZIP) -c > "$(DistTarGZip)"
Reid Spencere45ebfa2004-10-26 07:09:33 +00001314
Reid Spencercc2d1e22004-10-30 09:19:36 +00001315dist-bzip2:: $(DistTarBZ2)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001316
Reid Spencer345235ca2004-12-04 22:34:09 +00001317$(DistTarBZ2) : $(TopDistDir)/.makedistdir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001318 $(Echo) Packing bzipped distribution tar file.
Reid Spencer11fde542005-01-16 02:20:54 +00001319 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
Reid Spencerfbbf3072004-11-29 05:00:33 +00001320 $(BZIP2) -c >$(DistTarBZ2)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001321
Reid Spencercc2d1e22004-10-30 09:19:36 +00001322dist-zip:: $(DistZip)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001323
Reid Spencer345235ca2004-12-04 22:34:09 +00001324$(DistZip) : $(TopDistDir)/.makedistdir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001325 $(Echo) Packing zipped distribution file.
1326 $(Verb) rm -f $(DistZip)
Reid Spencer11fde542005-01-16 02:20:54 +00001327 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001328
1329dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001330 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
Reid Spencere45ebfa2004-10-26 07:09:33 +00001331
Reid Spencerf8f57402005-01-28 19:52:32 +00001332DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
Reid Spencere45ebfa2004-10-26 07:09:33 +00001333
Reid Spencer345235ca2004-12-04 22:34:09 +00001334dist-check:: $(DistTarGZip)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001335 $(Echo) Checking distribution tar file.
1336 $(Verb) if test -d $(DistCheckDir) ; then \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001337 $(RM) -rf $(DistCheckDir) ; \
1338 fi
Reid Spencercc2d1e22004-10-30 09:19:36 +00001339 $(Verb) $(MKDIR) $(DistCheckDir)
1340 $(Verb) cd $(DistCheckDir) && \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001341 $(MKDIR) $(DistCheckDir)/build && \
1342 $(MKDIR) $(DistCheckDir)/install && \
1343 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1344 cd build && \
1345 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
Reid Spencer32924e02004-12-24 03:36:31 +00001346 --srcdir=../$(DistName) && \
Reid Spencer345235ca2004-12-04 22:34:09 +00001347 $(MAKE) all && \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001348 $(MAKE) check && \
1349 $(MAKE) install && \
1350 $(MAKE) uninstall && \
1351 $(MAKE) dist && \
1352 $(MAKE) clean && \
1353 $(MAKE) dist-clean && \
Reid Spencercc2d1e22004-10-30 09:19:36 +00001354 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
Reid Spencere45ebfa2004-10-26 07:09:33 +00001355
1356dist-clean::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001357 $(Echo) Cleaning distribution files
Reid Spencer345235ca2004-12-04 22:34:09 +00001358 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1359 $(DistCheckDir)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001360
1361endif
1362
1363#------------------------------------------------------------------------
1364# Provide the recursive distdir target for building the distribution directory
1365#------------------------------------------------------------------------
Reid Spencer345235ca2004-12-04 22:34:09 +00001366distdir: $(DistDir)/.makedistdir
1367$(DistDir)/.makedistdir: $(DistSources)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001368 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001369 if test -d "$(DistDir)" ; then \
1370 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1371 exit 1 ; \
1372 fi ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001373 $(EchoCmd) Removing old $(DistDir) ; \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001374 $(RM) -rf $(DistDir); \
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001375 $(EchoCmd) Making 'all' to verify build ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001376 $(MAKE) all ; \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001377 fi
Reid Spencerfbbf3072004-11-29 05:00:33 +00001378 $(Echo) Building Distribution Directory $(DistDir)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001379 $(Verb) $(MKDIR) $(DistDir)
Reid Spencer11fde542005-01-16 02:20:54 +00001380 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1381 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001382 for file in $(DistFiles) ; do \
1383 case "$$file" in \
Reid Spencer11fde542005-01-16 02:20:54 +00001384 $(PROJ_SRC_DIR)/*) \
Reid Spencer345235ca2004-12-04 22:34:09 +00001385 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1386 ;; \
Reid Spencer11fde542005-01-16 02:20:54 +00001387 $(PROJ_SRC_ROOT)/*) \
Reid Spencer345235ca2004-12-04 22:34:09 +00001388 file=`echo "$$file" | \
1389 sed "s#^$$srcrootstrip/##"` \
1390 ;; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001391 esac; \
Reid Spencer11fde542005-01-16 02:20:54 +00001392 if test -f "$(PROJ_SRC_DIR)/$$file" || \
1393 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1394 from_dir="$(PROJ_SRC_DIR)" ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001395 elif test -f "$$file" || test -d "$$file" ; then \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001396 from_dir=. ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001397 fi ; \
1398 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001399 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1400 to_dir="$(DistDir)/$$dir"; \
1401 $(MKDIR) "$$to_dir" ; \
1402 else \
1403 to_dir="$(DistDir)"; \
1404 fi; \
1405 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1406 if test -n "$$mid_dir" ; then \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001407 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001408 fi ; \
1409 if test -d "$$from_dir/$$file"; then \
Reid Spencer11fde542005-01-16 02:20:54 +00001410 if test -d "$(PROJ_SRC_DIR)/$$file" && \
1411 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1412 $(CP) -pR "$(PROJ_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001413 fi; \
Reid Spencerc3719842004-12-16 18:26:53 +00001414 $(CP) -pR $$from_dir/$$file $$to_dir || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001415 elif test -f "$$from_dir/$$file" ; then \
Reid Spencerc3719842004-12-16 18:26:53 +00001416 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001417 elif test -L "$$from_dir/$$file" ; then \
Reid Spencerc3719842004-12-16 18:26:53 +00001418 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001419 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
Reid Spencer345235ca2004-12-04 22:34:09 +00001420 $(EchoCmd) "===== WARNING: Distribution Source " \
1421 "$$from_dir/$$file Not Found!" ; \
Reid Spencercc2d1e22004-10-30 09:19:36 +00001422 elif test "$(Verb)" != '@' ; then \
1423 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001424 fi; \
1425 done
Reid Spencercc2d1e22004-10-30 09:19:36 +00001426 $(Verb) for subdir in $(DistSubDirs) ; do \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001427 if test "$$subdir" \!= "." ; then \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001428 new_distdir="$(DistDir)/$$subdir" ; \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001429 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001430 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || \
1431 exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001432 fi; \
1433 done
Reid Spencer345235ca2004-12-04 22:34:09 +00001434 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1435 $(EchoCmd) Eliminating CVS directories from distribution ; \
1436 $(RM) -rf `find $(TopDistDir) -type d -name CVS -print` ;\
1437 $(MAKE) dist-hook ; \
1438 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1439 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1440 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1441 -o ! -type d ! -perm -444 -exec \
1442 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1443 || chmod -R a+r $(DistDir) ; \
1444 fi
Reid Spencer151f8ba2004-10-25 08:27:37 +00001445
Reid Spencercc2d1e22004-10-30 09:19:36 +00001446# This is invoked by distdir target, define it as a no-op to avoid errors if not
1447# defined by user.
Reid Spencer151f8ba2004-10-25 08:27:37 +00001448dist-hook::
1449
Reid Spencere53e3972004-10-22 23:06:30 +00001450endif
Reid Spencer4d71b662004-10-22 21:01:56 +00001451
1452###############################################################################
Reid Spencere5487ba2004-10-24 07:53:21 +00001453# TOP LEVEL - targets only to apply at the top level directory
1454###############################################################################
1455
1456ifeq ($(LEVEL),.)
1457
1458#------------------------------------------------------------------------
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001459# Install support for the project's include files:
Reid Spencere5487ba2004-10-24 07:53:21 +00001460#------------------------------------------------------------------------
1461install-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001462 $(Echo) Installing include files
Reid Spencer11fde542005-01-16 02:20:54 +00001463 $(Verb) $(MKDIR) $(PROJ_includedir)
1464 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1465 cd $(PROJ_SRC_ROOT)/include && \
Reid Spencer2edabc02005-02-16 15:54:03 +00001466 for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
1467 -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \
1468 $(INSTALL) $$hdr $(PROJ_includedir) ; \
1469 done ; \
Reid Spencere5487ba2004-10-24 07:53:21 +00001470 fi
Chris Lattnerca94fa22005-02-09 02:24:00 +00001471 $(Verb) if [ -d "$(PROJ_OBJ_ROOT)/include" ] ; then \
Reid Spencer2edabc02005-02-16 15:54:03 +00001472 cd $(PROJ_OBJ_ROOT)/include && \
1473 for hdr in `find . -type f -print` ; do \
1474 $(INSTALL) $$hdr $(PROJ_includedir) ; \
1475 done ; \
Chris Lattnerca94fa22005-02-09 02:24:00 +00001476 fi
Reid Spencere5487ba2004-10-24 07:53:21 +00001477
1478uninstall-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001479 $(Echo) Uninstalling include files
Reid Spencer11fde542005-01-16 02:20:54 +00001480 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1481 cd $(PROJ_SRC_ROOT)/include && \
Reid Spencere5487ba2004-10-24 07:53:21 +00001482 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
Chris Lattnerca94fa22005-02-09 02:24:00 +00001483 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \
Reid Spencer11fde542005-01-16 02:20:54 +00001484 -print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
Chris Lattnerca94fa22005-02-09 02:24:00 +00001485 cd $(PROJ_SRC_ROOT)/include && \
1486 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \
1487 | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
1488 fi
Reid Spencere5487ba2004-10-24 07:53:21 +00001489
Reid Spencere5487ba2004-10-24 07:53:21 +00001490endif
1491
Reid Spencer4d71b662004-10-22 21:01:56 +00001492#------------------------------------------------------------------------
1493# Print out the directories used for building
Reid Spencercc2d1e22004-10-30 09:19:36 +00001494#------------------------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +00001495printvars::
Reid Spencer11fde542005-01-16 02:20:54 +00001496 $(Echo) "BuildMode : " '$(BuildMode)'
1497 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1498 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1499 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1500 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1501 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1502 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1503 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
1504 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
1505 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
1506 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
1507 $(Echo) "UserTargets : " '$(UserTargets)'
1508 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1509 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1510 $(Echo) "ObjDir : " '$(ObjDir)'
1511 $(Echo) "LibDir : " '$(LibDir)'
1512 $(Echo) "ToolDir : " '$(ToolDir)'
1513 $(Echo) "ExmplDir : " '$(ExmplDir)'
1514 $(Echo) "Sources : " '$(Sources)'
1515 $(Echo) "TDFiles : " '$(TDFiles)'
1516 $(Echo) "INCFiles : " '$(INCFiles)'
1517 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
1518 $(Echo) "Preconditions: " '$(Preconditions)'
1519 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1520 $(Echo) "Compile.C : " '$(Compile.C)'
1521 $(Echo) "Archive : " '$(Archive)'
1522 $(Echo) "YaccFiles : " '$(YaccFiles)'
1523 $(Echo) "LexFiles : " '$(LexFiles)'
1524 $(Echo) "Module : " '$(Module)'