blob: 895d0bc101dc3fbaef6e97bee17a1ea214942c01 [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
Alkis Evlogimenoseebaf332005-02-27 10:21:37 +0000278ifndef LLC
279LLC := $(LLVMToolDir)/llc$(EXEEXT)
280endif
Alkis Evlogimenos7e80cd92004-12-13 17:44:14 +0000281ifndef LOPT
Alkis Evlogimenos20d793a2004-12-13 18:08:29 +0000282LOPT := $(LLVMToolDir)/opt$(EXEEXT)
Alkis Evlogimenos7e80cd92004-12-13 17:44:14 +0000283endif
Alkis Evlogimenos270e8512005-02-02 00:40:15 +0000284ifndef LBUGPOINT
285LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
286endif
287
John Criswellf5629d02005-01-03 17:42:57 +0000288LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
289LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
Dinakar Dhurjatiffb55cd2003-05-29 16:18:20 +0000290
Reid Spencer3a561f52004-10-23 20:04:14 +0000291#--------------------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000292# Adjust to user's request
Reid Spencer3a561f52004-10-23 20:04:14 +0000293#--------------------------------------------------------------------
Dinakar Dhurjatiffb55cd2003-05-29 16:18:20 +0000294
Reid Spencer492c2932005-01-11 04:31:07 +0000295# Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
296# to be built. Note that if LOADABLE_MODULE is specified then the resulting
297# shared library can be opened with dlopen
298ifdef SHARED_LIBRARY
Reid Spencercc2d1e22004-10-30 09:19:36 +0000299 LD.Flags += -rpath $(LibDir)
Reid Spencer492c2932005-01-11 04:31:07 +0000300 ifdef LOADABLE_MODULE
301 LD.Flags += -module
302 endif
303else
304 LibTool.Flags += --tag=disable-shared
John Criswell82f4a5a2003-07-31 20:58:51 +0000305endif
306
Reid Spencercceed9f2004-11-08 17:32:12 +0000307ifdef TOOL_VERBOSE
308 C.Flags += -v
309 CXX.Flags += -v
310 LD.Flags += -v
Reid Spencercceed9f2004-11-08 17:32:12 +0000311 VERBOSE := 1
312endif
313
Reid Spencer3a561f52004-10-23 20:04:14 +0000314# Adjust settings for verbose mode
Chris Lattner760da062003-03-14 20:25:22 +0000315ifndef VERBOSE
Reid Spencercc2d1e22004-10-30 09:19:36 +0000316 Verb := @
317 LibTool.Flags += --silent
318 AR.Flags += >/dev/null 2>/dev/null
Reid Spencer11fde542005-01-16 02:20:54 +0000319 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
Reid Spencer151f8ba2004-10-25 08:27:37 +0000320else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000321 ConfigureScriptFLAGS :=
Misha Brukmanb5f096f2002-09-12 16:05:39 +0000322endif
323
Vikram S. Advefeeae582002-09-18 11:55:13 +0000324# By default, strip symbol information from executable
Chris Lattner760da062003-03-14 20:25:22 +0000325ifndef KEEP_SYMBOLS
Reid Spencercc2d1e22004-10-30 09:19:36 +0000326 Strip := $(PLATFORMSTRIPOPTS)
327 StripWarnMsg := "(without symbols)"
Reid Spencer860598a2005-02-24 07:12:43 +0000328 Install.StripFlag += -s
Vikram S. Advefeeae582002-09-18 11:55:13 +0000329endif
330
Reid Spencer3a561f52004-10-23 20:04:14 +0000331# Adjust linker flags for building an executable
Reid Spencer4d71b662004-10-22 21:01:56 +0000332ifdef TOOLNAME
Reid Spencer815cbcf2004-11-18 10:03:46 +0000333ifdef EXAMPLE_TOOL
334 LD.Flags += -rpath $(ExmplDir) -export-dynamic
335else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000336 LD.Flags += -rpath $(ToolDir) -export-dynamic
Dinakar Dhurjati87ea8aa2003-10-29 14:28:35 +0000337endif
Reid Spencer815cbcf2004-11-18 10:03:46 +0000338endif
Dinakar Dhurjati87ea8aa2003-10-29 14:28:35 +0000339
Reid Spencer3a561f52004-10-23 20:04:14 +0000340#----------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000341# Options To Invoke Tools
Reid Spencer3a561f52004-10-23 20:04:14 +0000342#----------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000343
344CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
345
Duraid Madina0ad8fcf2005-05-16 06:38:09 +0000346ifeq ($(OS),HP-UX)
347 CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE
348endif
349
Reid Spencer9a8398e2005-02-14 21:54:08 +0000350LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
Reid Spencer11fde542005-01-16 02:20:54 +0000351CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
352 -I$(PROJ_OBJ_ROOT)/include \
353 -I$(PROJ_SRC_ROOT)/include \
354 -I$(LLVM_OBJ_ROOT)/include \
355 -I$(LLVM_SRC_ROOT)/include \
356 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
Reid Spencer4d71b662004-10-22 21:01:56 +0000357
Reid Spencercc2d1e22004-10-30 09:19:36 +0000358Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
359LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
Reid Spencer2f138e72004-12-22 05:57:21 +0000360BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
361 $(C.Flags) -c
Reid Spencercc2d1e22004-10-30 09:19:36 +0000362Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
363LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
Reid Spencerbc52ad72004-12-24 14:47:34 +0000364BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
365 $(CXX.Flags) -c
Reid Spencercc2d1e22004-10-30 09:19:36 +0000366Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
367 $(CompileCommonOpts) $(LD.Flags) $(Strip)
368Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
Reid Spencera69b1ea2004-10-28 09:15:28 +0000369 $(CompileCommonOpts)
Reid Spencer1a9a69c2005-02-16 16:13:02 +0000370LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
371 $(Install.Flags)
Reid Spencer860598a2005-02-24 07:12:43 +0000372ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
373DataInstall = $(INSTALL) -m 0644
Reid Spencer11fde542005-01-16 02:20:54 +0000374Burg = $(BURG) -I $(PROJ_SRC_DIR)
375TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000376Archive = $(AR) $(AR.Flags)
Reid Spencer9a2f1372004-12-02 09:28:21 +0000377LArchive = $(LLVMToolDir)/llvm-ar rcsf
Reid Spencer4d71b662004-10-22 21:01:56 +0000378ifdef RANLIB
Reid Spencer3a561f52004-10-23 20:04:14 +0000379Ranlib = $(RANLIB)
Reid Spencer4d71b662004-10-22 21:01:56 +0000380else
Reid Spencer3a561f52004-10-23 20:04:14 +0000381Ranlib = ranlib
John Criswell7a73b802003-06-30 21:59:07 +0000382endif
383
Chris Lattner00950542001-06-06 20:29:01 +0000384#----------------------------------------------------------
Reid Spencer345235ca2004-12-04 22:34:09 +0000385# Get the list of source files and compute object file
386# names from them.
Reid Spencer3a561f52004-10-23 20:04:14 +0000387#----------------------------------------------------------
Reid Spencer345235ca2004-12-04 22:34:09 +0000388ifdef FAKE_SOURCES
389 Sources :=
390 FakeSources := $(FAKE_SOURCES)
391 ifdef BUILT_SOURCES
392 FakeSources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
393 endif
394 BaseNameSources := $(sort $(basename $(FakeSources)))
395 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
396 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
397 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000398else
Reid Spencer345235ca2004-12-04 22:34:09 +0000399 ifndef SOURCES
Reid Spencer11fde542005-01-16 02:20:54 +0000400 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
401 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
402 $(PROJ_SRC_DIR)/*.l))
Reid Spencer345235ca2004-12-04 22:34:09 +0000403 else
404 Sources := $(SOURCES)
405 endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000406
Reid Spencer345235ca2004-12-04 22:34:09 +0000407 ifdef BUILT_SOURCES
408 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
409 endif
Vikram S. Adve112a72c2001-07-15 13:16:47 +0000410
Reid Spencer345235ca2004-12-04 22:34:09 +0000411 BaseNameSources := $(sort $(basename $(Sources)))
412 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
413 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
414 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
415endif
Reid Spencer3a561f52004-10-23 20:04:14 +0000416
417###############################################################################
418# DIRECTORIES: Handle recursive descent of directory structure
419###############################################################################
John Criswell82f4a5a2003-07-31 20:58:51 +0000420
Chris Lattner00950542001-06-06 20:29:01 +0000421#---------------------------------------------------------
Reid Spencera69b1ea2004-10-28 09:15:28 +0000422# Provide rules to make install dirs. This must be early
423# in the file so they get built before dependencies
424#---------------------------------------------------------
425
Reid Spencer11fde542005-01-16 02:20:54 +0000426$(PROJ_bindir):
427 $(Verb) $(MKDIR) $(PROJ_bindir)
Chris Lattnere4cb90f2004-11-01 06:14:59 +0000428
Reid Spencer11fde542005-01-16 02:20:54 +0000429$(PROJ_libdir):
430 $(Verb) $(MKDIR) $(PROJ_libdir)
Reid Spencera69b1ea2004-10-28 09:15:28 +0000431
Reid Spencer11fde542005-01-16 02:20:54 +0000432$(PROJ_includedir):
433 $(Verb) $(MKDIR) $(PROJ_includedir)
Reid Spencera69b1ea2004-10-28 09:15:28 +0000434
Reid Spencer11fde542005-01-16 02:20:54 +0000435$(PROJ_etcdir):
436 $(Verb) $(MKDIR) $(PROJ_etcdir)
Reid Spencera69b1ea2004-10-28 09:15:28 +0000437
Reid Spencercc2d1e22004-10-30 09:19:36 +0000438# To create other directories, as needed, and timestamp their creation
439%/.dir:
440 $(Verb) $(MKDIR) $* > /dev/null
Reid Spencerfbbf3072004-11-29 05:00:33 +0000441 $(Verb) $(DATE) > $@
Reid Spencercc2d1e22004-10-30 09:19:36 +0000442
Reid Spencer815cbcf2004-11-18 10:03:46 +0000443.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
444.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
Reid Spencera69b1ea2004-10-28 09:15:28 +0000445
446#---------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +0000447# Handle the DIRS options for sequential construction
Chris Lattner00950542001-06-06 20:29:01 +0000448#---------------------------------------------------------
449
Reid Spencercc2d1e22004-10-30 09:19:36 +0000450SubDirs :=
Anand Shukla7c7a07e2002-09-18 04:29:30 +0000451ifdef DIRS
Reid Spencercc2d1e22004-10-30 09:19:36 +0000452SubDirs += $(DIRS)
453$(RecursiveTargets)::
454 $(Verb) for dir in $(DIRS); do \
Reid Spencer4d71b662004-10-22 21:01:56 +0000455 if [ ! -f $$dir/Makefile ]; then \
456 $(MKDIR) $$dir; \
Reid Spencer11fde542005-01-16 02:20:54 +0000457 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
Reid Spencer4d71b662004-10-22 21:01:56 +0000458 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000459 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
460 ($(MAKE) -C $$dir $@ ) || exit 1; \
461 fi ; \
Chris Lattnerf1ffd992002-09-17 23:35:02 +0000462 done
Anand Shukla7c7a07e2002-09-18 04:29:30 +0000463endif
Chris Lattnera8abc222002-09-18 03:22:27 +0000464
Reid Spencer3a561f52004-10-23 20:04:14 +0000465#---------------------------------------------------------
466# Handle the EXPERIMENTAL_DIRS options ensuring success
467# after each directory is built.
468#---------------------------------------------------------
469ifdef EXPERIMENTAL_DIRS
Reid Spencercc2d1e22004-10-30 09:19:36 +0000470$(RecursiveTargets)::
471 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
Reid Spencer3a561f52004-10-23 20:04:14 +0000472 if [ ! -f $$dir/Makefile ]; then \
473 $(MKDIR) $$dir; \
Reid Spencer11fde542005-01-16 02:20:54 +0000474 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
Reid Spencer3a561f52004-10-23 20:04:14 +0000475 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000476 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
477 ($(MAKE) -C $$dir $@ ) || exit 0; \
478 fi ; \
Reid Spencer3a561f52004-10-23 20:04:14 +0000479 done
480endif
Chris Lattnera8abc222002-09-18 03:22:27 +0000481
Reid Spencer3a561f52004-10-23 20:04:14 +0000482#---------------------------------------------------------
483# Handle the PARALLEL_DIRS options for parallel construction
484#---------------------------------------------------------
485ifdef PARALLEL_DIRS
486
Reid Spencercc2d1e22004-10-30 09:19:36 +0000487SubDirs += $(PARALLEL_DIRS)
488
Reid Spencer44cb1b32004-12-03 20:08:48 +0000489# Unfortunately, this list must be maintained if new recursive targets are added
Reid Spencercc2d1e22004-10-30 09:19:36 +0000490all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
491clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000492clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
Reid Spencercc2d1e22004-10-30 09:19:36 +0000493install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
Reid Spencer3a561f52004-10-23 20:04:14 +0000494uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
Reid Spencer44cb1b32004-12-03 20:08:48 +0000495install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
Reid Spencer3a561f52004-10-23 20:04:14 +0000496
Reid Spencer345235ca2004-12-04 22:34:09 +0000497ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
Reid Spencer3a561f52004-10-23 20:04:14 +0000498
Reid Spencer345235ca2004-12-04 22:34:09 +0000499$(ParallelTargets) :
Reid Spencercc2d1e22004-10-30 09:19:36 +0000500 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
Reid Spencer4d71b662004-10-22 21:01:56 +0000501 $(MKDIR) $(@D); \
Reid Spencer11fde542005-01-16 02:20:54 +0000502 $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
John Criswellb3866b62003-11-25 19:32:22 +0000503 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000504 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
505 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) ; \
506 fi
Chris Lattner00950542001-06-06 20:29:01 +0000507endif
508
Reid Spencer3a561f52004-10-23 20:04:14 +0000509#---------------------------------------------------------
510# Handle the OPTIONAL_DIRS options for directores that may
511# or may not exist.
512#---------------------------------------------------------
John Criswell2a6530f2003-06-27 16:58:44 +0000513ifdef OPTIONAL_DIRS
Reid Spencer151f8ba2004-10-25 08:27:37 +0000514
Reid Spencercc2d1e22004-10-30 09:19:36 +0000515SubDirs += $(OPTIONAL_DIRS)
Reid Spencer151f8ba2004-10-25 08:27:37 +0000516
Reid Spencercc2d1e22004-10-30 09:19:36 +0000517$(RecursiveTargets)::
518 $(Verb) for dir in $(OPTIONAL_DIRS); do \
Reid Spencer11fde542005-01-16 02:20:54 +0000519 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
Reid Spencer4d71b662004-10-22 21:01:56 +0000520 if [ ! -f $$dir/Makefile ]; then \
521 $(MKDIR) $$dir; \
Reid Spencer11fde542005-01-16 02:20:54 +0000522 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
Reid Spencer4d71b662004-10-22 21:01:56 +0000523 fi; \
Reid Spencera23c0662004-12-08 22:58:34 +0000524 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
525 ($(MAKE) -C$$dir $@ ) || exit 1; \
526 fi ; \
Reid Spencer4d71b662004-10-22 21:01:56 +0000527 fi \
John Criswell2a6530f2003-06-27 16:58:44 +0000528 done
529endif
530
Reid Spencerfc945082004-08-20 09:20:05 +0000531#---------------------------------------------------------
532# Handle the CONFIG_FILES options
533#---------------------------------------------------------
534ifdef CONFIG_FILES
Reid Spencerfc945082004-08-20 09:20:05 +0000535
Reid Spencer11fde542005-01-16 02:20:54 +0000536install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
537 $(Echo) Installing Configuration Files To $(PROJ_etcdir)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000538 $(Verb)for file in $(CONFIG_FILES); do \
Reid Spencer11fde542005-01-16 02:20:54 +0000539 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
Reid Spencer4a0aaea2005-02-24 03:56:32 +0000540 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
Reid Spencer11fde542005-01-16 02:20:54 +0000541 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
Reid Spencer4a0aaea2005-02-24 03:56:32 +0000542 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
Reid Spencer1b426ab2004-11-23 05:59:53 +0000543 else \
544 $(ECHO) Error: cannot find config file $${file}. ; \
545 fi \
Reid Spencerfc945082004-08-20 09:20:05 +0000546 done
Reid Spencer3a561f52004-10-23 20:04:14 +0000547
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000548uninstall-local::
Reid Spencer11fde542005-01-16 02:20:54 +0000549 $(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000550 $(Verb)for file in $(CONFIG_FILES); do \
Reid Spencer11fde542005-01-16 02:20:54 +0000551 $(RM) -f $(PROJ_etcdir)/$${file} ; \
Reid Spencere5487ba2004-10-24 07:53:21 +0000552 done
553
Reid Spencerfc945082004-08-20 09:20:05 +0000554endif
555
Reid Spencer3a561f52004-10-23 20:04:14 +0000556###############################################################################
Reid Spencer8f9e21e2005-05-19 00:37:31 +0000557# Set up variables for building libararies
558###############################################################################
559
560#---------------------------------------------------------
561# Handle the special "JIT" value for LLVM_LIBS which is a
562# shorthand for a bunch of libraries that get the correct
563# JIT support for a library or a tool that runs JIT.
564#---------------------------------------------------------
565ifeq ($(LLVMLIBS),JIT)
566
567# Make sure we can get our own symbols in the tool
568Link += -dlopen self
569
570# Generic JIT libraries
571JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
572
573# You can enable the X86 JIT on a non-X86 host by setting the flag
574# ENABLE_X86_JIT on the make command line. If not, it will still be
575# enabled automagically on an X86 host.
576ifeq ($(ARCH), x86)
577 ENABLE_X86_JIT = 1
578endif
579
580# What the X86 JIT requires
581ifdef ENABLE_X86_JIT
582 JIT_LIBS += LLVMX86 LLVMSelectionDAG
583endif
584
585# You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
586# ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
587# enabled automagically on an SparcV9 host.
588ifeq ($(ARCH), Sparc)
589 ENABLE_SPARCV9_JIT = 1
590endif
591
592# What the Sparc JIT requires
593ifdef ENABLE_SPARCV9_JIT
594 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
595 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
596 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
597 LLVMDataStructure.a LLVMSparcV9RegAlloc
598endif
599
600# You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
601# ENABLE_PPC_JIT on the make command line. If not, it will still be
602# enabled automagically on an PowerPC host.
603ifeq ($(ARCH), PowerPC)
604 ENABLE_PPC_JIT = 1
605endif
606
607# What the PowerPC JIT requires
608ifdef ENABLE_PPC_JIT
609 JIT_LIBS += LLVMPowerPC LLVMSelectionDAG
610endif
611
612LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
613 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
614 LLVMSystem.a $(PLATFORMLIBDL)
615endif
616
617#---------------------------------------------------------
618# Define various command line options pertaining to the
619# libraries needed when linking. There are "Proj" libs
620# (defined by the user's project) and "LLVM" libs (defined
621# by the # LLVM project).
622#---------------------------------------------------------
623ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
624ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
625LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
626LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
627ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
628LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
629ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
630LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
631
632###############################################################################
Reid Spencer3a561f52004-10-23 20:04:14 +0000633# Library Build Rules: Four ways to build a library
634###############################################################################
Chris Lattner00950542001-06-06 20:29:01 +0000635
Reid Spencer7980ea42004-12-05 05:17:22 +0000636#---------------------------------------------------------
637# Bytecode Module Targets:
638# If the user set MODULE_NAME then they want to build a
639# bytecode module from the sources. We compile all the
640# sources and link it together into a single bytecode
641# module.
642#---------------------------------------------------------
643
644ifdef MODULE_NAME
Reid Spencer9a8398e2005-02-14 21:54:08 +0000645ifeq ($(strip $(LLVMGCC)),)
Reid Spencer0d255bd2005-05-13 18:32:54 +0000646$(warning Modules require llvm-gcc but no llvm-gcc is available ****)
Reid Spencer9a8398e2005-02-14 21:54:08 +0000647else
Reid Spencer7980ea42004-12-05 05:17:22 +0000648
649Module := $(LibDir)/$(MODULE_NAME).bc
Reid Spencer2f138e72004-12-22 05:57:21 +0000650LinkModule := $(LLVMGCCWITHPATH) -shared -nostdlib
Reid Spencer7980ea42004-12-05 05:17:22 +0000651
652ifdef EXPORTED_SYMBOL_FILE
Reid Spencerf8f57402005-01-28 19:52:32 +0000653LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
Reid Spencer7980ea42004-12-05 05:17:22 +0000654endif
655
656$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
Reid Spencer0d255bd2005-05-13 18:32:54 +0000657 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
Reid Spencer7980ea42004-12-05 05:17:22 +0000658 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
659
660all-local:: $(Module)
661
662clean-local::
663ifneq ($(strip $(Module)),)
664 -$(Verb) $(RM) -f $(Module)
665endif
666
Reid Spencerab3690b2004-12-13 07:38:07 +0000667ifdef BYTECODE_DESTINATION
668ModuleDestDir := $(BYTECODE_DESTINATION)
669else
Reid Spencer11fde542005-01-16 02:20:54 +0000670ModuleDestDir := $(PROJ_libdir)
Reid Spencerab3690b2004-12-13 07:38:07 +0000671endif
Reid Spencer7980ea42004-12-05 05:17:22 +0000672
Reid Spencerab3690b2004-12-13 07:38:07 +0000673DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
674
675install-module:: $(DestModule)
Reid Spencer7980ea42004-12-05 05:17:22 +0000676install-local:: $(DestModule)
677
Reid Spencerab3690b2004-12-13 07:38:07 +0000678$(DestModule): $(ModuleDestDir) $(Module)
Reid Spencer7980ea42004-12-05 05:17:22 +0000679 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
Reid Spencer151bbe42005-02-24 21:30:37 +0000680 $(Verb) $(DataInstall) $(Module) $(DestModule)
Reid Spencer7980ea42004-12-05 05:17:22 +0000681
682uninstall-local::
683 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
684 -$(Verb) $(RM) -f $(DestModule)
685
686endif
Reid Spencer9a8398e2005-02-14 21:54:08 +0000687endif
Brian Gaeke8abff792004-01-22 22:53:48 +0000688
Reid Spencer3a561f52004-10-23 20:04:14 +0000689# if we're building a library ...
Chris Lattner00950542001-06-06 20:29:01 +0000690ifdef LIBRARYNAME
Vikram S. Adve112a72c2001-07-15 13:16:47 +0000691
Chris Lattner2a548c52002-09-16 22:36:42 +0000692# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
Chris Lattnerccb4ebd2002-09-16 22:34:56 +0000693LIBRARYNAME := $(strip $(LIBRARYNAME))
Reid Spencer492c2932005-01-11 04:31:07 +0000694ifdef LOADABLE_MODULE
695LibName.LA := $(LibDir)/$(LIBRARYNAME).la
696else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000697LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
Reid Spencer492c2932005-01-11 04:31:07 +0000698endif
Reid Spencercc2d1e22004-10-30 09:19:36 +0000699LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
700LibName.O := $(LibDir)/$(LIBRARYNAME).o
Reid Spencer9a2f1372004-12-02 09:28:21 +0000701LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
Chris Lattnerccb4ebd2002-09-16 22:34:56 +0000702
Reid Spencer3a561f52004-10-23 20:04:14 +0000703#---------------------------------------------------------
704# Shared Library Targets:
705# If the user asked for a shared library to be built
706# with the SHARED_LIBRARY variable, then we provide
707# targets for building them.
708#---------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000709ifdef SHARED_LIBRARY
710
Reid Spencercc2d1e22004-10-30 09:19:36 +0000711all-local:: $(LibName.LA)
Reid Spencer4d71b662004-10-22 21:01:56 +0000712
Reid Spencer8f9e21e2005-05-19 00:37:31 +0000713ifdef LINK_LIBS_IN_SHARED
714$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
715 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
716 $(Verb) $(Link) -o $@ $(ObjectsLO) \
717 $(ProjLibsOptions) $(LLVMLibsOptions)
718 $(Verb) $(LTInstall) $@ $(LibDir)
719else
Reid Spencerf2ac1892004-12-16 07:36:08 +0000720$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
Reid Spencer9af3b292004-11-01 07:50:27 +0000721 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000722 $(Verb) $(Link) -o $@ $(ObjectsLO)
723 $(Verb) $(LTInstall) $@ $(LibDir)
Reid Spencer8f9e21e2005-05-19 00:37:31 +0000724endif
Reid Spencer3a561f52004-10-23 20:04:14 +0000725
726clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000727ifneq ($(strip $(LibName.LA)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000728 -$(Verb) $(RM) -f $(LibName.LA)
Reid Spencere5487ba2004-10-24 07:53:21 +0000729endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000730
Reid Spencer11fde542005-01-16 02:20:54 +0000731DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
Reid Spencer4d71b662004-10-22 21:01:56 +0000732
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000733install-local:: $(DestSharedLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000734
Reid Spencer11fde542005-01-16 02:20:54 +0000735$(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
Reid Spencer9af3b292004-11-01 07:50:27 +0000736 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000737 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
Reid Spencer11fde542005-01-16 02:20:54 +0000738 $(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
Reid Spencere5487ba2004-10-24 07:53:21 +0000739
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000740uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000741 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
Reid Spencer11fde542005-01-16 02:20:54 +0000742 -$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
Reid Spencere5487ba2004-10-24 07:53:21 +0000743
Reid Spencer4d71b662004-10-22 21:01:56 +0000744endif
745
Reid Spencer3a561f52004-10-23 20:04:14 +0000746#---------------------------------------------------------
747# Bytecode Library Targets:
748# If the user asked for a bytecode library to be built
749# with the BYTECODE_LIBRARY variable, then we provide
750# targets for building them.
751#---------------------------------------------------------
Reid Spencer4d71b662004-10-22 21:01:56 +0000752ifdef BYTECODE_LIBRARY
Reid Spencer9a8398e2005-02-14 21:54:08 +0000753ifeq ($(strip $(LLVMGCC)),)
Reid Spencer0d255bd2005-05-13 18:32:54 +0000754$(warning Bytecode libraries require llvm-gcc which could not be found ****)
Reid Spencer9a8398e2005-02-14 21:54:08 +0000755else
Reid Spencer4d71b662004-10-22 21:01:56 +0000756
Reid Spencer776b8052004-12-03 06:04:35 +0000757# make the C and C++ compilers strip debug info out of bytecode libraries.
758BCCompile.C += -Wa,-strip-debug
759BCCompile.CXX += -Wa,-strip-debug
760
Reid Spencer9a2f1372004-12-02 09:28:21 +0000761all-local:: $(LibName.BCA)
762
763ifdef EXPORTED_SYMBOL_FILE
Reid Spencer2f138e72004-12-22 05:57:21 +0000764BCLinkLib = $(LLVMGCCWITHPATH) -shared -nostdlib -Xlinker \
Reid Spencer9a2f1372004-12-02 09:28:21 +0000765 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
766
Reid Spencerf2ac1892004-12-16 07:36:08 +0000767$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(GCCLD) \
Chris Lattner264ccbe2004-12-15 17:14:06 +0000768 $(LLVMToolDir)/llvm-ar
Reid Spencer9a2f1372004-12-02 09:28:21 +0000769 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
770 "(internalize)"
Chris Lattnerb0ea8642004-12-02 21:23:43 +0000771 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
Reid Spencerefd6bb32004-12-13 03:59:35 +0000772 $(Verb) $(RM) -f $@
Reid Spencer9a2f1372004-12-02 09:28:21 +0000773 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
Reid Spencer4d71b662004-10-22 21:01:56 +0000774else
Reid Spencerf2ac1892004-12-16 07:36:08 +0000775$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
Chris Lattner264ccbe2004-12-15 17:14:06 +0000776 $(LLVMToolDir)/llvm-ar
Reid Spencer9a2f1372004-12-02 09:28:21 +0000777 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
Reid Spencerefd6bb32004-12-13 03:59:35 +0000778 $(Verb) $(RM) -f $@
Reid Spencer9a2f1372004-12-02 09:28:21 +0000779 $(Verb) $(LArchive) $@ $(ObjectsBC)
780
Reid Spencer4d71b662004-10-22 21:01:56 +0000781endif
782
Reid Spencer3a561f52004-10-23 20:04:14 +0000783clean-local::
Reid Spencer9a2f1372004-12-02 09:28:21 +0000784ifneq ($(strip $(LibName.BCA)),)
785 -$(Verb) $(RM) -f $(LibName.BCA)
Reid Spencere5487ba2004-10-24 07:53:21 +0000786endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000787
Reid Spencer8f094f32004-12-13 07:28:21 +0000788ifdef BYTECODE_DESTINATION
789BytecodeDestDir := $(BYTECODE_DESTINATION)
790else
Reid Spencer11fde542005-01-16 02:20:54 +0000791BytecodeDestDir := $(PROJ_libdir)
Reid Spencer8f094f32004-12-13 07:28:21 +0000792endif
793
794DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a
Reid Spencer9a2f1372004-12-02 09:28:21 +0000795
Reid Spencer44cb1b32004-12-03 20:08:48 +0000796install-bytecode-local:: $(DestBytecodeLib)
Reid Spencere45ebfa2004-10-26 07:09:33 +0000797
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000798install-local:: $(DestBytecodeLib)
Chris Lattner481cc7c2003-08-15 02:18:35 +0000799
Reid Spencer8f094f32004-12-13 07:28:21 +0000800$(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
Reid Spencer9a2f1372004-12-02 09:28:21 +0000801 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
Reid Spencerb80621f2005-02-24 21:36:32 +0000802 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000803
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000804uninstall-local::
Reid Spencer9a2f1372004-12-02 09:28:21 +0000805 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000806 -$(Verb) $(RM) -f $(DestBytecodeLib)
Reid Spencer4d71b662004-10-22 21:01:56 +0000807
808endif
Reid Spencer9a8398e2005-02-14 21:54:08 +0000809endif
Vikram S. Adve60f56062002-08-02 18:34:12 +0000810
Reid Spencercc2d1e22004-10-30 09:19:36 +0000811#---------------------------------------------------------
812# ReLinked Library Targets:
813# If the user didn't explicitly forbid building a
814# relinked then we provide targets for building them.
815#---------------------------------------------------------
Chris Lattnere62dbe92002-07-23 17:56:16 +0000816ifndef DONT_BUILD_RELINKED
Reid Spencer4d71b662004-10-22 21:01:56 +0000817
Reid Spencercc2d1e22004-10-30 09:19:36 +0000818all-local:: $(LibName.O)
819
Reid Spencerf2ac1892004-12-16 07:36:08 +0000820$(LibName.O): $(ObjectsO) $(LibDir)/.dir
Reid Spencer9af3b292004-11-01 07:50:27 +0000821 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000822 $(Verb) $(Relink) -o $@ $(ObjectsO)
Reid Spencer4d71b662004-10-22 21:01:56 +0000823
Reid Spencer3a561f52004-10-23 20:04:14 +0000824clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000825ifneq ($(strip $(LibName.O)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000826 -$(Verb) $(RM) -f $(LibName.O)
Reid Spencere5487ba2004-10-24 07:53:21 +0000827endif
828
Reid Spencer11fde542005-01-16 02:20:54 +0000829DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
Reid Spencere5487ba2004-10-24 07:53:21 +0000830
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000831install-local:: $(DestRelinkedLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000832
Reid Spencer11fde542005-01-16 02:20:54 +0000833$(DestRelinkedLib): $(PROJ_libdir) $(LibName.O)
Reid Spencer9af3b292004-11-01 07:50:27 +0000834 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000835 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000836
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000837uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000838 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000839 -$(Verb) $(RM) -f $(DestRelinkedLib)
Reid Spencer4d71b662004-10-22 21:01:56 +0000840
Chris Lattnere62dbe92002-07-23 17:56:16 +0000841endif
Chris Lattner760da062003-03-14 20:25:22 +0000842
Reid Spencercc2d1e22004-10-30 09:19:36 +0000843#---------------------------------------------------------
844# Archive Library Targets:
845# If the user wanted a regular archive library built,
846# then we provide targets for building them.
847#---------------------------------------------------------
Chris Lattnere62dbe92002-07-23 17:56:16 +0000848ifdef BUILD_ARCHIVE
Chris Lattnere62dbe92002-07-23 17:56:16 +0000849
Reid Spencercc2d1e22004-10-30 09:19:36 +0000850all-local:: $(LibName.A)
851
Reid Spencerf2ac1892004-12-16 07:36:08 +0000852$(LibName.A): $(ObjectsO) $(LibDir)/.dir
Reid Spencer9af3b292004-11-01 07:50:27 +0000853 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000854 -$(Verb) $(RM) -f $@
Reid Spencercc2d1e22004-10-30 09:19:36 +0000855 $(Verb) $(Archive) $@ $(ObjectsO)
856 $(Verb) $(Ranlib) $@
Vikram S. Adve41e78912002-09-20 14:03:13 +0000857
Reid Spencer3a561f52004-10-23 20:04:14 +0000858clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000859ifneq ($(strip $(LibName.A)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000860 -$(Verb) $(RM) -f $(LibName.A)
Chris Lattner00950542001-06-06 20:29:01 +0000861endif
862
Reid Spencer11fde542005-01-16 02:20:54 +0000863DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
Reid Spencere5487ba2004-10-24 07:53:21 +0000864
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000865install-local:: $(DestArchiveLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000866
Reid Spencer11fde542005-01-16 02:20:54 +0000867$(DestArchiveLib): $(PROJ_libdir) $(LibName.A)
Reid Spencer9af3b292004-11-01 07:50:27 +0000868 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
Reid Spencer11fde542005-01-16 02:20:54 +0000869 $(Verb) $(MKDIR) $(PROJ_libdir)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000870 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000871
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000872uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000873 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000874 -$(Verb) $(RM) -f $(DestArchiveLib)
Reid Spencere5487ba2004-10-24 07:53:21 +0000875
876endif
877
878# endif LIBRARYNAME
Reid Spencer4d71b662004-10-22 21:01:56 +0000879endif
880
Reid Spencerb1dd3dd2004-10-24 08:21:04 +0000881###############################################################################
882# Tool Build Rules: Build executable tool based on TOOLNAME option
883###############################################################################
884
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000885ifdef TOOLNAME
886
Reid Spencercc2d1e22004-10-30 09:19:36 +0000887#---------------------------------------------------------
888# Set up variables for building a tool.
889#---------------------------------------------------------
Reid Spencer815cbcf2004-11-18 10:03:46 +0000890ifdef EXAMPLE_TOOL
891ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
892else
Reid Spencercc2d1e22004-10-30 09:19:36 +0000893ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
Reid Spencer815cbcf2004-11-18 10:03:46 +0000894endif
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000895
Reid Spencercc2d1e22004-10-30 09:19:36 +0000896#---------------------------------------------------------
Reid Spencercc2d1e22004-10-30 09:19:36 +0000897# Tell make that we need to rebuild subdirectories before
898# we can link the tool. This affects things like LLI which
899# has library subdirectories.
900#---------------------------------------------------------
901$(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
Chris Lattner8d7dfb32003-01-22 16:13:31 +0000902
Reid Spencercc2d1e22004-10-30 09:19:36 +0000903#---------------------------------------------------------
904# Provide targets for building the tools
905#---------------------------------------------------------
906all-local:: $(ToolBuildPath)
John Criswell2a6530f2003-06-27 16:58:44 +0000907
Reid Spencer3a561f52004-10-23 20:04:14 +0000908clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +0000909ifneq ($(strip $(ToolBuildPath)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000910 -$(Verb) $(RM) -f $(ToolBuildPath)
Reid Spencere5487ba2004-10-24 07:53:21 +0000911endif
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000912
Reid Spencer815cbcf2004-11-18 10:03:46 +0000913ifdef EXAMPLE_TOOL
914$(ToolBuildPath): $(ExmplDir)/.dir
915else
916$(ToolBuildPath): $(ToolDir)/.dir
917endif
918
Reid Spencerf2ac1892004-12-16 07:36:08 +0000919$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
Reid Spencer9af3b292004-11-01 07:50:27 +0000920 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
Reid Spencercc2d1e22004-10-30 09:19:36 +0000921 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
Reid Spencer9a8398e2005-02-14 21:54:08 +0000922 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
Reid Spencer9af3b292004-11-01 07:50:27 +0000923 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
Reid Spencere5487ba2004-10-24 07:53:21 +0000924
Reid Spencer11fde542005-01-16 02:20:54 +0000925DestTool = $(PROJ_bindir)/$(TOOLNAME)
Reid Spencere5487ba2004-10-24 07:53:21 +0000926
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000927install-local:: $(DestTool)
Reid Spencere45ebfa2004-10-26 07:09:33 +0000928
Reid Spencer11fde542005-01-16 02:20:54 +0000929$(DestTool): $(PROJ_bindir) $(ToolBuildPath)
Reid Spencer9af3b292004-11-01 07:50:27 +0000930 $(Echo) Installing $(BuildMode) $(DestTool)
Reid Spencer4a0aaea2005-02-24 03:56:32 +0000931 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
Reid Spencere5487ba2004-10-24 07:53:21 +0000932
Reid Spencerc6dcc6a2004-10-28 07:57:28 +0000933uninstall-local::
Reid Spencer9af3b292004-11-01 07:50:27 +0000934 $(Echo) Uninstalling $(BuildMode) $(DestTool)
Reid Spencerca5fe8f2004-11-02 16:56:15 +0000935 -$(Verb) $(RM) -f $(DestTool)
Reid Spencere5487ba2004-10-24 07:53:21 +0000936
Reid Spencer4d71b662004-10-22 21:01:56 +0000937endif
Chris Lattner1cbc29f2001-09-07 22:57:58 +0000938
Reid Spencercc2d1e22004-10-30 09:19:36 +0000939###############################################################################
940# Object Build Rules: Build object files based on sources
941###############################################################################
942
943# Provide rule sets for when dependency generation is enabled
Reid Spencer4d71b662004-10-22 21:01:56 +0000944ifndef DISABLE_AUTO_DEPENDENCIES
Vikram S. Adve41e78912002-09-20 14:03:13 +0000945
Reid Spencercc2d1e22004-10-30 09:19:36 +0000946#---------------------------------------------------------
947# Create .lo files in the ObjDir directory from the .cpp and .c files...
948#---------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +0000949ifdef SHARED_LIBRARY
950
Chris Lattner3c473472004-12-16 17:28:50 +0000951$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000952 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000953 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
954 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
955 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
Reid Spencer3a561f52004-10-23 20:04:14 +0000956
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000957$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
958 $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
959 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
960 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
961 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
962
Chris Lattner3c473472004-12-16 17:28:50 +0000963$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000964 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000965 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
966 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
967 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
Reid Spencer3a561f52004-10-23 20:04:14 +0000968
Reid Spencercc2d1e22004-10-30 09:19:36 +0000969#---------------------------------------------------------
970# Create .o files in the ObjDir directory from the .cpp and .c files...
971#---------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +0000972else
Reid Spencer4d71b662004-10-22 21:01:56 +0000973
Chris Lattner3c473472004-12-16 17:28:50 +0000974$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000975 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000976 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
977 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
978 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
Reid Spencer4d71b662004-10-22 21:01:56 +0000979
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000980$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
981 $(Echo) "Compiling $*.cc for $(BuildMode) build"
982 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
983 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
984 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
985
Chris Lattner3c473472004-12-16 17:28:50 +0000986$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000987 $(Echo) "Compiling $*.c for $(BuildMode) build"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000988 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
989 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
990 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
Reid Spencer3a561f52004-10-23 20:04:14 +0000991
992endif
Reid Spencer4d71b662004-10-22 21:01:56 +0000993
Reid Spencercc2d1e22004-10-30 09:19:36 +0000994#---------------------------------------------------------
Chris Lattnerb05a76c2005-02-04 21:28:50 +0000995# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
Reid Spencercc2d1e22004-10-30 09:19:36 +0000996#---------------------------------------------------------
Chris Lattner3c473472004-12-16 17:28:50 +0000997$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +0000998 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
Reid Spencercc2d1e22004-10-30 09:19:36 +0000999 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
1000 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
1001 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
Reid Spencer4d71b662004-10-22 21:01:56 +00001002
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001003$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1004 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1005 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
1006 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
1007 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
1008
Chris Lattner3c473472004-12-16 17:28:50 +00001009$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001010 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
Reid Spencercc2d1e22004-10-30 09:19:36 +00001011 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
1012 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
1013 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
Reid Spencer4d71b662004-10-22 21:01:56 +00001014
Reid Spencercc2d1e22004-10-30 09:19:36 +00001015# Provide alternate rule sets if dependencies are disabled
Reid Spencer4d71b662004-10-22 21:01:56 +00001016else
1017
Reid Spencer3a561f52004-10-23 20:04:14 +00001018ifdef SHARED_LIBRARY
1019
Chris Lattner3c473472004-12-16 17:28:50 +00001020$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001021 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
Reid Spencer3a561f52004-10-23 20:04:14 +00001022 $(LTCompile.CXX) $< -o $@
1023
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001024$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1025 $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
1026 $(LTCompile.CXX) $< -o $@
1027
Chris Lattner3c473472004-12-16 17:28:50 +00001028$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencerc3719842004-12-16 18:26:53 +00001029 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
Reid Spencer3a561f52004-10-23 20:04:14 +00001030 $(LTCompile.C) $< -o $@
1031
1032else
Reid Spencer4d71b662004-10-22 21:01:56 +00001033
Chris Lattner3c473472004-12-16 17:28:50 +00001034$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001035 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
Reid Spencer3a561f52004-10-23 20:04:14 +00001036 $(Compile.CXX) $< -o $@
Reid Spencer4d71b662004-10-22 21:01:56 +00001037
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001038$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1039 $(Echo) "Compiling $*.cc for $(BuildMode) build"
1040 $(Compile.CXX) $< -o $@
1041
Chris Lattner3c473472004-12-16 17:28:50 +00001042$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
Reid Spencerc3719842004-12-16 18:26:53 +00001043 $(Echo) "Compiling $*.c for $(BuildMode) build"
Reid Spencer3a561f52004-10-23 20:04:14 +00001044 $(Compile.C) $< -o $@
1045endif
Reid Spencer4d71b662004-10-22 21:01:56 +00001046
Chris Lattner3c473472004-12-16 17:28:50 +00001047$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001048 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
Reid Spencer8676b7e2004-10-31 18:52:15 +00001049 $(BCCompile.CXX) $< -o $@
Reid Spencer4d71b662004-10-22 21:01:56 +00001050
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001051$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
1052 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1053 $(BCCompile.CXX) $< -o $@
1054
Chris Lattner3c473472004-12-16 17:28:50 +00001055$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
Reid Spencer9af3b292004-11-01 07:50:27 +00001056 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
Reid Spencer8676b7e2004-10-31 18:52:15 +00001057 $(BCCompile.C) $< -o $@
Brian Gaeke44909cf2003-12-10 00:26:28 +00001058
Chris Lattner1cbc29f2001-09-07 22:57:58 +00001059endif
1060
Reid Spencercc2d1e22004-10-30 09:19:36 +00001061#---------------------------------------------------------
1062# Provide rule to build .bc files from .ll sources,
1063# regardless of dependencies
1064#---------------------------------------------------------
1065$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
Reid Spencer9af3b292004-11-01 07:50:27 +00001066 $(Echo) "Compiling $*.ll for $(BuildMode) build"
Reid Spencercc2d1e22004-10-30 09:19:36 +00001067 $(Verb) $(LLVMAS) $< -f -o $@
1068
1069###############################################################################
1070# TABLEGEN: Provide rules for running tblgen to produce *.inc files
1071###############################################################################
Chris Lattner481cc7c2003-08-15 02:18:35 +00001072
Reid Spencer4d71b662004-10-22 21:01:56 +00001073ifdef TARGET
1074
Reid Spencer11fde542005-01-16 02:20:54 +00001075TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001076INCFiles := $(filter %.inc,$(BUILT_SOURCES))
Chris Lattner3c473472004-12-16 17:28:50 +00001077INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1078.PRECIOUS: $(INCTMPFiles) $(INCFiles)
Reid Spencer4d71b662004-10-22 21:01:56 +00001079
Chris Lattner3c473472004-12-16 17:28:50 +00001080# All of these files depend on tblgen and the .td files.
1081$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
Reid Spencer4d71b662004-10-22 21:01:56 +00001082
Chris Lattner23ee7952004-12-16 17:38:56 +00001083# INCFiles rule: All of the tblgen generated files are emitted to
1084# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1085# us to only "touch" the real file if the contents of it change. IOW, if
1086# tblgen is modified, all of the .inc.tmp files are regereated, but no
1087# dependencies of the .inc files are, unless the contents of the .inc file
1088# changes.
1089$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
Reid Spencerc3719842004-12-16 18:26:53 +00001090 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
Chris Lattner3c473472004-12-16 17:28:50 +00001091
1092$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
1093$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001094 $(Echo) "Building $(<F) register names with tblgen"
1095 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001096
Chris Lattner3c473472004-12-16 17:28:50 +00001097$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
1098$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001099 $(Echo) "Building $(<F) register information header with tblgen"
1100 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001101
Chris Lattner3c473472004-12-16 17:28:50 +00001102$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1103$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001104 $(Echo) "Building $(<F) register info implementation with tblgen"
1105 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001106
Chris Lattner3c473472004-12-16 17:28:50 +00001107$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
1108$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001109 $(Echo) "Building $(<F) instruction names with tblgen"
1110 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001111
Chris Lattner3c473472004-12-16 17:28:50 +00001112$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1113$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001114 $(Echo) "Building $(<F) instruction information with tblgen"
1115 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001116
Chris Lattner3c473472004-12-16 17:28:50 +00001117$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1118$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001119 $(Echo) "Building $(<F) assembly writer with tblgen"
1120 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001121
Chris Lattner02a4f902004-12-16 17:34:04 +00001122$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1123$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
1124 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
Reid Spencercc2d1e22004-10-30 09:19:36 +00001125 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001126
Chris Lattner3c473472004-12-16 17:28:50 +00001127$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1128$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001129 $(Echo) "Building $(<F) code emitter with tblgen"
1130 $(Verb) $(TableGen) -gen-emitter -o $@ $<
Reid Spencer4d71b662004-10-22 21:01:56 +00001131
Reid Spencer3a561f52004-10-23 20:04:14 +00001132clean-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001133 -$(Verb) $(RM) -f $(INCFiles)
Reid Spencer4d71b662004-10-22 21:01:56 +00001134
1135endif
Chris Lattner481cc7c2003-08-15 02:18:35 +00001136
Reid Spencercc2d1e22004-10-30 09:19:36 +00001137###############################################################################
1138# LEX AND YACC: Provide rules for generating sources with lex and yacc
1139###############################################################################
Chris Lattnere8996782003-01-16 22:44:19 +00001140
Reid Spencercc2d1e22004-10-30 09:19:36 +00001141#---------------------------------------------------------
1142# Provide rules for generating a .cpp source file from
1143# (f)lex input sources.
1144#---------------------------------------------------------
1145
Reid Spencer3d659492004-11-02 16:36:03 +00001146LexFiles := $(filter %.l,$(Sources))
Reid Spencercc2d1e22004-10-30 09:19:36 +00001147
Reid Spencer3d659492004-11-02 16:36:03 +00001148ifneq ($(LexFiles),)
1149
1150LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
Reid Spencercc2d1e22004-10-30 09:19:36 +00001151
1152.PRECIOUS: $(LexOutput)
1153
1154# Note the extra sed filtering here, used to cut down on the warnings emited
1155# by GCC. The last line is a gross hack to work around flex aparently not
1156# being able to resize the buffer on a large token input. Currently, for
1157# uninitialized string buffers in LLVM we can generate very long tokens, so
1158# this is a hack around it.
Chris Lattnerb7dc2b92003-08-15 20:00:47 +00001159# FIXME. (f.e. char Buffer[10000] )
Chris Lattner00950542001-06-06 20:29:01 +00001160%.cpp: %.l
Reid Spencerc2ef8cd2004-12-10 19:44:16 +00001161 $(Echo) Flexing $*.l
Reid Spencercc2d1e22004-10-30 09:19:36 +00001162 $(Verb) $(FLEX) -t $< | \
Reid Spencer4d71b662004-10-22 21:01:56 +00001163 $(SED) 's/void yyunput/inline void yyunput/' | \
1164 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
1165 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
Reid Spencer80f0ef72004-10-28 00:41:43 +00001166 > $@
Chris Lattner00950542001-06-06 20:29:01 +00001167
Reid Spencer9af3b292004-11-01 07:50:27 +00001168clean-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001169 -$(Verb) $(RM) -f $(LexOutput)
Reid Spencer3d659492004-11-02 16:36:03 +00001170 $(Verb) $(RM) -f $(LexOutput)
Reid Spencer9af3b292004-11-01 07:50:27 +00001171
Reid Spencercc2d1e22004-10-30 09:19:36 +00001172endif
1173
1174#---------------------------------------------------------
1175# Provide rules for generating a .cpp and .h source files
1176# from yacc (bison) input sources.
1177#---------------------------------------------------------
1178
Reid Spencer3d659492004-11-02 16:36:03 +00001179YaccFiles := $(filter %.y,$(Sources))
1180ifneq ($(YaccFiles),)
1181YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001182
1183.PRECIOUS: $(YaccOutput)
1184
1185# Cancel built-in rules for yacc
1186%.c: %.y
1187%.cpp: %.y
1188%.h: %.y
1189
Chris Lattner00950542001-06-06 20:29:01 +00001190# Rule for building the bison parsers...
Chris Lattner00950542001-06-06 20:29:01 +00001191%.cpp %.h : %.y
Reid Spencercc2d1e22004-10-30 09:19:36 +00001192 $(Echo) "Bisoning $*.y"
1193 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
1194 $(Verb) $(MV) -f $*.tab.c $*.cpp
1195 $(Verb) $(MV) -f $*.tab.h $*.h
Chris Lattner00950542001-06-06 20:29:01 +00001196
Reid Spencer9af3b292004-11-01 07:50:27 +00001197clean-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001198 -$(Verb) $(RM) -f $(YaccOutput)
Reid Spencer3d659492004-11-02 16:36:03 +00001199 $(Verb) $(RM) -f $(YaccOutput)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001200endif
Chris Lattner00950542001-06-06 20:29:01 +00001201
Reid Spencercc2d1e22004-10-30 09:19:36 +00001202###############################################################################
1203# OTHER RULES: Other rules needed
1204###############################################################################
Reid Spencer4d71b662004-10-22 21:01:56 +00001205
Chris Lattner30440c62003-01-16 21:06:18 +00001206# To create postscript files from dot files...
John Criswelle0f9ac62003-10-02 19:02:02 +00001207ifneq ($(DOT),false)
Chris Lattner30440c62003-01-16 21:06:18 +00001208%.ps: %.dot
Reid Spencer4d71b662004-10-22 21:01:56 +00001209 $(DOT) -Tps < $< > $@
John Criswell7a73b802003-06-30 21:59:07 +00001210else
1211%.ps: %.dot
Reid Spencercc2d1e22004-10-30 09:19:36 +00001212 $(Echo) "Cannot build $@: The program dot is not installed"
John Criswell7a73b802003-06-30 21:59:07 +00001213endif
Chris Lattner30440c62003-01-16 21:06:18 +00001214
John Criswell7f336952003-09-06 14:44:17 +00001215# This rules ensures that header files that are removed still have a rule for
1216# which they can be "generated." This allows make to ignore them and
1217# reproduce the dependency lists.
John Criswell4b6e5d12003-09-18 18:37:08 +00001218%.h:: ;
Chris Lattnerb05a76c2005-02-04 21:28:50 +00001219%.hpp:: ;
John Criswell7f336952003-09-06 14:44:17 +00001220
Reid Spencercc2d1e22004-10-30 09:19:36 +00001221# Define clean-local to clean the current directory. Note that this uses a
1222# very conservative approach ensuring that empty variables do not cause
1223# errors or disastrous removal.
Reid Spencer3a561f52004-10-23 20:04:14 +00001224clean-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001225ifneq ($(strip $(ObjDir)),)
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001226 -$(Verb) $(RM) -rf $(ObjDir)
Reid Spencere5487ba2004-10-24 07:53:21 +00001227endif
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001228 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
Brian Gaeke9d3cd402004-01-21 19:53:11 +00001229ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001230 -$(Verb) $(RM) -f *$(SHLIBEXT)
Brian Gaeke9d3cd402004-01-21 19:53:11 +00001231endif
John Criswell7a73b802003-06-30 21:59:07 +00001232
Reid Spencer3d659492004-11-02 16:36:03 +00001233clean-all-local::
Reid Spencerca5fe8f2004-11-02 16:56:15 +00001234 -$(Verb) $(RM) -rf Debug Release Profile
Reid Spencer3d659492004-11-02 16:36:03 +00001235
Reid Spencercc2d1e22004-10-30 09:19:36 +00001236# Build tags database for Emacs/Xemacs:
Reid Spencer12d79512004-11-12 02:27:36 +00001237tags:: TAGS CTAGS
1238
Reid Spencercc2d1e22004-10-30 09:19:36 +00001239TAGS:
Reid Spencer11fde542005-01-16 02:20:54 +00001240 find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1241 $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1242 $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1243 $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
Reid Spencer12d79512004-11-12 02:27:36 +00001244 -name '*.cpp' -o -name '*.h' | \
Reid Spencercc2d1e22004-10-30 09:19:36 +00001245 $(ETAGS) $(ETAGSFLAGS) -
1246
Reid Spencer12d79512004-11-12 02:27:36 +00001247CTAGS:
Reid Spencer11fde542005-01-16 02:20:54 +00001248 find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
1249 $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
1250 $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
1251 $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
Reid Spencer12d79512004-11-12 02:27:36 +00001252 \( -name '*.cpp' -o -name '*.h' \) -print | \
Reid Spencer11fde542005-01-16 02:20:54 +00001253 ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L -
Reid Spencer12d79512004-11-12 02:27:36 +00001254
1255
Reid Spencer3a561f52004-10-23 20:04:14 +00001256###############################################################################
1257# DEPENDENCIES: Include the dependency files if we should
1258###############################################################################
Chris Lattner33ad24a2003-08-22 14:10:16 +00001259ifndef DISABLE_AUTO_DEPENDENCIES
1260
Reid Spencer3a561f52004-10-23 20:04:14 +00001261# If its not one of the cleaning targets
Reid Spencercc2d1e22004-10-30 09:19:36 +00001262ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
Reid Spencer4d71b662004-10-22 21:01:56 +00001263
Reid Spencer3a561f52004-10-23 20:04:14 +00001264# Get the list of dependency files
Reid Spencercc2d1e22004-10-30 09:19:36 +00001265DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
Reid Spencer11fde542005-01-16 02:20:54 +00001266DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
Misha Brukman4f7a8cf2003-11-09 21:36:19 +00001267
Reid Spencer3a561f52004-10-23 20:04:14 +00001268-include /dev/null $(DependFiles)
1269
John Criswelld741bcf2003-08-12 18:51:51 +00001270endif
Chris Lattner1ddb6b62003-08-18 17:27:40 +00001271
Reid Spencercc2d1e22004-10-30 09:19:36 +00001272endif
Reid Spencer4d71b662004-10-22 21:01:56 +00001273
Reid Spencer151f8ba2004-10-25 08:27:37 +00001274###############################################################################
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001275# CHECK: Running the test suite
1276###############################################################################
1277
1278check::
Reid Spencer11fde542005-01-16 02:20:54 +00001279 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1280 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001281 $(EchoCmd) Running test suite ; \
Reid Spencer11fde542005-01-16 02:20:54 +00001282 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001283 TESTSUITE=$(TESTSUITE) ; \
1284 else \
1285 $(EchoCmd) No Makefile in test directory ; \
1286 fi ; \
1287 else \
1288 $(EchoCmd) No test directory ; \
1289 fi
1290
1291###############################################################################
Reid Spencercc2d1e22004-10-30 09:19:36 +00001292# DISTRIBUTION: Handle construction of a distribution tarball
Reid Spencer151f8ba2004-10-25 08:27:37 +00001293###############################################################################
1294
Reid Spencere45ebfa2004-10-26 07:09:33 +00001295#------------------------------------------------------------------------
1296# Define distribution related variables
1297#------------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +00001298DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
1299DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1300TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1301DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1302DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
1303DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
Reid Spencer151f8ba2004-10-25 08:27:37 +00001304DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1305 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001306 Makefile.config.in configure autoconf
1307DistOther := $(notdir $(wildcard \
Reid Spencer11fde542005-01-16 02:20:54 +00001308 $(PROJ_SRC_DIR)/*.h \
1309 $(PROJ_SRC_DIR)/*.td \
1310 $(PROJ_SRC_DIR)/*.def \
1311 $(PROJ_SRC_DIR)/*.ll \
1312 $(PROJ_SRC_DIR)/*.in))
Reid Spencercc2d1e22004-10-30 09:19:36 +00001313DistSubDirs := $(SubDirs)
Reid Spencerfbbf3072004-11-29 05:00:33 +00001314DistSources = $(Sources) $(EXTRA_DIST)
1315DistFiles = $(DistAlways) $(DistSources) $(DistOther)
Reid Spencer151f8ba2004-10-25 08:27:37 +00001316
Reid Spencere45ebfa2004-10-26 07:09:33 +00001317#------------------------------------------------------------------------
1318# We MUST build distribution with OBJ_DIR != SRC_DIR
1319#------------------------------------------------------------------------
Reid Spencer11fde542005-01-16 02:20:54 +00001320ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
Reid Spencere45ebfa2004-10-26 07:09:33 +00001321dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001322 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
Reid Spencere45ebfa2004-10-26 07:09:33 +00001323
Reid Spencere45ebfa2004-10-26 07:09:33 +00001324else
1325
Reid Spencere45ebfa2004-10-26 07:09:33 +00001326#------------------------------------------------------------------------
Reid Spencere45ebfa2004-10-26 07:09:33 +00001327# Prevent attempt to run dist targets from anywhere but the top level
1328#------------------------------------------------------------------------
1329ifneq ($(LEVEL),.)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001330dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
Reid Spencer11fde542005-01-16 02:20:54 +00001331 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001332else
1333
1334#------------------------------------------------------------------------
1335# Provide the top level targets
1336#------------------------------------------------------------------------
1337
Reid Spencercc2d1e22004-10-30 09:19:36 +00001338dist-gzip:: $(DistTarGZip)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001339
Reid Spencer345235ca2004-12-04 22:34:09 +00001340$(DistTarGZip) : $(TopDistDir)/.makedistdir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001341 $(Echo) Packing gzipped distribution tar file.
Reid Spencer11fde542005-01-16 02:20:54 +00001342 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
Reid Spencerfbbf3072004-11-29 05:00:33 +00001343 $(GZIP) -c > "$(DistTarGZip)"
Reid Spencere45ebfa2004-10-26 07:09:33 +00001344
Reid Spencercc2d1e22004-10-30 09:19:36 +00001345dist-bzip2:: $(DistTarBZ2)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001346
Reid Spencer345235ca2004-12-04 22:34:09 +00001347$(DistTarBZ2) : $(TopDistDir)/.makedistdir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001348 $(Echo) Packing bzipped distribution tar file.
Reid Spencer11fde542005-01-16 02:20:54 +00001349 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
Reid Spencerfbbf3072004-11-29 05:00:33 +00001350 $(BZIP2) -c >$(DistTarBZ2)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001351
Reid Spencercc2d1e22004-10-30 09:19:36 +00001352dist-zip:: $(DistZip)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001353
Reid Spencer345235ca2004-12-04 22:34:09 +00001354$(DistZip) : $(TopDistDir)/.makedistdir
Reid Spencercc2d1e22004-10-30 09:19:36 +00001355 $(Echo) Packing zipped distribution file.
1356 $(Verb) rm -f $(DistZip)
Reid Spencer11fde542005-01-16 02:20:54 +00001357 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001358
1359dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001360 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
Reid Spencere45ebfa2004-10-26 07:09:33 +00001361
Reid Spencerf8f57402005-01-28 19:52:32 +00001362DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
Reid Spencere45ebfa2004-10-26 07:09:33 +00001363
Reid Spencer345235ca2004-12-04 22:34:09 +00001364dist-check:: $(DistTarGZip)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001365 $(Echo) Checking distribution tar file.
1366 $(Verb) if test -d $(DistCheckDir) ; then \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001367 $(RM) -rf $(DistCheckDir) ; \
1368 fi
Reid Spencercc2d1e22004-10-30 09:19:36 +00001369 $(Verb) $(MKDIR) $(DistCheckDir)
1370 $(Verb) cd $(DistCheckDir) && \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001371 $(MKDIR) $(DistCheckDir)/build && \
1372 $(MKDIR) $(DistCheckDir)/install && \
1373 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1374 cd build && \
1375 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
Reid Spencer32924e02004-12-24 03:36:31 +00001376 --srcdir=../$(DistName) && \
Reid Spencer345235ca2004-12-04 22:34:09 +00001377 $(MAKE) all && \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001378 $(MAKE) check && \
1379 $(MAKE) install && \
1380 $(MAKE) uninstall && \
1381 $(MAKE) dist && \
1382 $(MAKE) clean && \
1383 $(MAKE) dist-clean && \
Reid Spencercc2d1e22004-10-30 09:19:36 +00001384 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
Reid Spencere45ebfa2004-10-26 07:09:33 +00001385
1386dist-clean::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001387 $(Echo) Cleaning distribution files
Reid Spencer345235ca2004-12-04 22:34:09 +00001388 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1389 $(DistCheckDir)
Reid Spencere45ebfa2004-10-26 07:09:33 +00001390
1391endif
1392
1393#------------------------------------------------------------------------
1394# Provide the recursive distdir target for building the distribution directory
1395#------------------------------------------------------------------------
Reid Spencer345235ca2004-12-04 22:34:09 +00001396distdir: $(DistDir)/.makedistdir
1397$(DistDir)/.makedistdir: $(DistSources)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001398 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001399 if test -d "$(DistDir)" ; then \
1400 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1401 exit 1 ; \
1402 fi ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001403 $(EchoCmd) Removing old $(DistDir) ; \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001404 $(RM) -rf $(DistDir); \
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001405 $(EchoCmd) Making 'all' to verify build ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001406 $(MAKE) all ; \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001407 fi
Reid Spencerfbbf3072004-11-29 05:00:33 +00001408 $(Echo) Building Distribution Directory $(DistDir)
Reid Spencercc2d1e22004-10-30 09:19:36 +00001409 $(Verb) $(MKDIR) $(DistDir)
Reid Spencer11fde542005-01-16 02:20:54 +00001410 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1411 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001412 for file in $(DistFiles) ; do \
1413 case "$$file" in \
Reid Spencer11fde542005-01-16 02:20:54 +00001414 $(PROJ_SRC_DIR)/*) \
Reid Spencer345235ca2004-12-04 22:34:09 +00001415 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1416 ;; \
Reid Spencer11fde542005-01-16 02:20:54 +00001417 $(PROJ_SRC_ROOT)/*) \
Reid Spencer345235ca2004-12-04 22:34:09 +00001418 file=`echo "$$file" | \
1419 sed "s#^$$srcrootstrip/##"` \
1420 ;; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001421 esac; \
Reid Spencer11fde542005-01-16 02:20:54 +00001422 if test -f "$(PROJ_SRC_DIR)/$$file" || \
1423 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1424 from_dir="$(PROJ_SRC_DIR)" ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001425 elif test -f "$$file" || test -d "$$file" ; then \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001426 from_dir=. ; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001427 fi ; \
1428 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001429 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1430 to_dir="$(DistDir)/$$dir"; \
1431 $(MKDIR) "$$to_dir" ; \
1432 else \
1433 to_dir="$(DistDir)"; \
1434 fi; \
1435 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1436 if test -n "$$mid_dir" ; then \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001437 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001438 fi ; \
1439 if test -d "$$from_dir/$$file"; then \
Reid Spencer11fde542005-01-16 02:20:54 +00001440 if test -d "$(PROJ_SRC_DIR)/$$file" && \
1441 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1442 $(CP) -pR "$(PROJ_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001443 fi; \
Reid Spencerc3719842004-12-16 18:26:53 +00001444 $(CP) -pR $$from_dir/$$file $$to_dir || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001445 elif test -f "$$from_dir/$$file" ; then \
Reid Spencerc3719842004-12-16 18:26:53 +00001446 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001447 elif test -L "$$from_dir/$$file" ; then \
Reid Spencerc3719842004-12-16 18:26:53 +00001448 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001449 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
Reid Spencer345235ca2004-12-04 22:34:09 +00001450 $(EchoCmd) "===== WARNING: Distribution Source " \
1451 "$$from_dir/$$file Not Found!" ; \
Reid Spencercc2d1e22004-10-30 09:19:36 +00001452 elif test "$(Verb)" != '@' ; then \
1453 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001454 fi; \
1455 done
Reid Spencercc2d1e22004-10-30 09:19:36 +00001456 $(Verb) for subdir in $(DistSubDirs) ; do \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001457 if test "$$subdir" \!= "." ; then \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001458 new_distdir="$(DistDir)/$$subdir" ; \
Reid Spencere45ebfa2004-10-26 07:09:33 +00001459 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
Reid Spencer345235ca2004-12-04 22:34:09 +00001460 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || \
1461 exit 1; \
Reid Spencer151f8ba2004-10-25 08:27:37 +00001462 fi; \
1463 done
Reid Spencer345235ca2004-12-04 22:34:09 +00001464 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1465 $(EchoCmd) Eliminating CVS directories from distribution ; \
1466 $(RM) -rf `find $(TopDistDir) -type d -name CVS -print` ;\
1467 $(MAKE) dist-hook ; \
1468 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1469 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1470 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1471 -o ! -type d ! -perm -444 -exec \
1472 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1473 || chmod -R a+r $(DistDir) ; \
1474 fi
Reid Spencer151f8ba2004-10-25 08:27:37 +00001475
Reid Spencercc2d1e22004-10-30 09:19:36 +00001476# This is invoked by distdir target, define it as a no-op to avoid errors if not
1477# defined by user.
Reid Spencer151f8ba2004-10-25 08:27:37 +00001478dist-hook::
1479
Reid Spencere53e3972004-10-22 23:06:30 +00001480endif
Reid Spencer4d71b662004-10-22 21:01:56 +00001481
1482###############################################################################
Reid Spencere5487ba2004-10-24 07:53:21 +00001483# TOP LEVEL - targets only to apply at the top level directory
1484###############################################################################
1485
1486ifeq ($(LEVEL),.)
1487
1488#------------------------------------------------------------------------
Reid Spencer9e8d54a2004-12-06 05:35:13 +00001489# Install support for the project's include files:
Reid Spencere5487ba2004-10-24 07:53:21 +00001490#------------------------------------------------------------------------
1491install-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001492 $(Echo) Installing include files
Reid Spencer11fde542005-01-16 02:20:54 +00001493 $(Verb) $(MKDIR) $(PROJ_includedir)
Reid Spencer4a0aaea2005-02-24 03:56:32 +00001494 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
Reid Spencer11fde542005-01-16 02:20:54 +00001495 cd $(PROJ_SRC_ROOT)/include && \
Reid Spencer2edabc02005-02-16 15:54:03 +00001496 for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
1497 -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \
Reid Spencer4a0aaea2005-02-24 03:56:32 +00001498 instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
1499 if test \! -d "$$instdir" ; then \
1500 $(EchoCmd) Making install directory $$instdir ; \
1501 $(MKDIR) $$instdir ;\
1502 fi ; \
1503 $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
Reid Spencer2edabc02005-02-16 15:54:03 +00001504 done ; \
Reid Spencere5487ba2004-10-24 07:53:21 +00001505 fi
Reid Spencer4a0aaea2005-02-24 03:56:32 +00001506 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
Reid Spencer2edabc02005-02-16 15:54:03 +00001507 cd $(PROJ_OBJ_ROOT)/include && \
1508 for hdr in `find . -type f -print` ; do \
Reid Spencer4a0aaea2005-02-24 03:56:32 +00001509 $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
Reid Spencer2edabc02005-02-16 15:54:03 +00001510 done ; \
Chris Lattnerca94fa22005-02-09 02:24:00 +00001511 fi
Reid Spencere5487ba2004-10-24 07:53:21 +00001512
1513uninstall-local::
Reid Spencercc2d1e22004-10-30 09:19:36 +00001514 $(Echo) Uninstalling include files
Reid Spencer11fde542005-01-16 02:20:54 +00001515 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1516 cd $(PROJ_SRC_ROOT)/include && \
Reid Spencere5487ba2004-10-24 07:53:21 +00001517 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
Chris Lattnerca94fa22005-02-09 02:24:00 +00001518 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \
Reid Spencer11fde542005-01-16 02:20:54 +00001519 -print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
Chris Lattnerca94fa22005-02-09 02:24:00 +00001520 cd $(PROJ_SRC_ROOT)/include && \
1521 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \
1522 | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
1523 fi
Reid Spencere5487ba2004-10-24 07:53:21 +00001524
Reid Spencere5487ba2004-10-24 07:53:21 +00001525endif
1526
Reid Spencer4d71b662004-10-22 21:01:56 +00001527#------------------------------------------------------------------------
1528# Print out the directories used for building
Reid Spencercc2d1e22004-10-30 09:19:36 +00001529#------------------------------------------------------------------------
Reid Spencer3a561f52004-10-23 20:04:14 +00001530printvars::
Reid Spencer11fde542005-01-16 02:20:54 +00001531 $(Echo) "BuildMode : " '$(BuildMode)'
1532 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1533 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1534 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1535 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1536 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1537 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1538 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
1539 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
1540 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
1541 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
Reid Spencer1a9a69c2005-02-16 16:13:02 +00001542 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
Reid Spencer11fde542005-01-16 02:20:54 +00001543 $(Echo) "UserTargets : " '$(UserTargets)'
1544 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1545 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1546 $(Echo) "ObjDir : " '$(ObjDir)'
1547 $(Echo) "LibDir : " '$(LibDir)'
1548 $(Echo) "ToolDir : " '$(ToolDir)'
1549 $(Echo) "ExmplDir : " '$(ExmplDir)'
1550 $(Echo) "Sources : " '$(Sources)'
1551 $(Echo) "TDFiles : " '$(TDFiles)'
1552 $(Echo) "INCFiles : " '$(INCFiles)'
1553 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
Reid Spencere0acb762005-03-01 16:27:06 +00001554 $(Echo) "PreConditions: " '$(PreConditions)'
Reid Spencer11fde542005-01-16 02:20:54 +00001555 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1556 $(Echo) "Compile.C : " '$(Compile.C)'
1557 $(Echo) "Archive : " '$(Archive)'
1558 $(Echo) "YaccFiles : " '$(YaccFiles)'
1559 $(Echo) "LexFiles : " '$(LexFiles)'
1560 $(Echo) "Module : " '$(Module)'