Misha Brukman | 6d5ab86 | 2004-04-24 00:10:56 +0000 | [diff] [blame] | 1 | #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===# |
| 2 | # |
John Criswell | d8846c1 | 2003-10-21 14:33:46 +0000 | [diff] [blame] | 3 | # 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 Brukman | 6d5ab86 | 2004-04-24 00:10:56 +0000 | [diff] [blame] | 8 | #===------------------------------------------------------------------------===# |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 9 | # |
| 10 | # This file is included by all of the LLVM makefiles. This file defines common |
Misha Brukman | 36bc642 | 2003-08-21 22:02:18 +0000 | [diff] [blame] | 11 | # rules to do things like compile a .cpp file or generate dependency info. |
| 12 | # These are platform dependent, so this is the file used to specify these |
| 13 | # system dependent operations. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 14 | # |
Vikram S. Adve | c214e71 | 2002-08-29 23:28:46 +0000 | [diff] [blame] | 15 | # The following functionality can be set by setting incoming variables. |
| 16 | # The variable $(LEVEL) *must* be set: |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 17 | # |
| 18 | # 1. LEVEL - The level of the current subdirectory from the top of the |
| 19 | # MagicStats view. This level should be expressed as a path, for |
| 20 | # example, ../.. for two levels deep. |
| 21 | # |
| 22 | # 2. DIRS - A list of subdirectories to be built. Fake targets are set up |
Chris Lattner | a8abc22 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 23 | # so that each of the targets "all", "install", and "clean" each build |
| 24 | # the subdirectories before the local target. DIRS are guaranteed to be |
| 25 | # built in order. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 26 | # |
Chris Lattner | a8abc22 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 27 | # 3. PARALLEL_DIRS - A list of subdirectories to be built, but that may be |
| 28 | # built in any order. All DIRS are built in order before PARALLEL_DIRS are |
| 29 | # built, which are then built in any order. |
| 30 | # |
| 31 | # 4. Source - If specified, this sets the source code filenames. If this |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 32 | # is not set, it defaults to be all of the .cpp, .c, .y, and .l files |
Chris Lattner | e001059 | 2001-10-18 01:48:09 +0000 | [diff] [blame] | 33 | # in the current directory. Also, if you want to build files in addition |
| 34 | # to the local files, you can use the ExtraSource variable |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 35 | # |
Chris Lattner | 694c5df | 2003-05-15 21:28:55 +0000 | [diff] [blame] | 36 | # 5. SourceDir - If specified, this specifies a directory that the source files |
| 37 | # are in, if they are not in the current directory. This should include a |
| 38 | # trailing / character. |
| 39 | # |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 40 | # 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree. |
Dinakar Dhurjati | 584dd18 | 2003-05-29 21:49:00 +0000 | [diff] [blame] | 41 | # |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 42 | # 8. BUILD_SRC_DIR - The directory which contains the current set of Makefiles |
| 43 | # and usually the source code too (unless SourceDir is set). |
| 44 | # |
| 45 | # 9. BUILD_SRC_ROOT - The root directory of the source code being compiled. |
| 46 | # |
| 47 | # 10. BUILD_OBJ_DIR - The directory where object code should be placed. |
| 48 | # |
| 49 | # 11. BUILD_OBJ_ROOT - The root directory for where object code should be |
| 50 | # placed. |
| 51 | # |
| 52 | # For building, |
Chris Lattner | e430a1e | 2003-08-21 22:23:49 +0000 | [diff] [blame] | 53 | # LLVM, LLVM_SRC_ROOT = BUILD_SRC_ROOT |
Chris Lattner | af06a08 | 2003-08-15 03:02:52 +0000 | [diff] [blame] | 54 | # |
Vikram S. Adve | d60aede | 2002-07-09 12:04:21 +0000 | [diff] [blame] | 55 | #===-----------------------------------------------------------------------==== |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 56 | |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 57 | # |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 58 | # Set the VPATH so that we can find source files. |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 59 | # |
John Criswell | 613758d | 2003-09-11 18:03:50 +0000 | [diff] [blame] | 60 | VPATH=$(SourceDir) |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 61 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 62 | ########################################################################### |
| 63 | # Default Targets: |
| 64 | # The following targets are the standard top level targets for |
| 65 | # building. |
| 66 | ########################################################################### |
Chris Lattner | 4bb13b8 | 2002-09-13 22:14:47 +0000 | [diff] [blame] | 67 | |
John Criswell | bd08280 | 2003-10-07 14:16:44 +0000 | [diff] [blame] | 68 | # Ensure people re-run configure when it gets updated |
Misha Brukman | 94fe1f9 | 2003-10-07 15:24:23 +0000 | [diff] [blame] | 69 | all::$(LLVM_OBJ_ROOT)/config.status |
John Criswell | bd08280 | 2003-10-07 14:16:44 +0000 | [diff] [blame] | 70 | |
Chris Lattner | edf1f23 | 2002-07-23 19:21:31 +0000 | [diff] [blame] | 71 | ifdef SHARED_LIBRARY |
| 72 | # if SHARED_LIBRARY is specified, the default is to build the dynamic lib |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 73 | all:: dynamic |
Brian Gaeke | 7976e97 | 2004-01-16 21:12:34 +0000 | [diff] [blame] | 74 | install:: install-dynamic-library |
Chris Lattner | edf1f23 | 2002-07-23 19:21:31 +0000 | [diff] [blame] | 75 | endif |
| 76 | |
Chris Lattner | 95cc1b3 | 2003-08-14 21:10:25 +0000 | [diff] [blame] | 77 | ifdef BYTECODE_LIBRARY |
| 78 | # if BYTECODE_LIBRARY is specified, the default is to build the bytecode lib |
| 79 | all:: bytecodelib |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 80 | install:: install-bytecode-library |
Brian Gaeke | f313ea7 | 2004-03-10 17:38:01 +0000 | [diff] [blame] | 81 | install-bytecode:: install-bytecode-library |
Chris Lattner | 95cc1b3 | 2003-08-14 21:10:25 +0000 | [diff] [blame] | 82 | endif |
| 83 | |
Chris Lattner | b19e59c | 2001-06-29 05:20:16 +0000 | [diff] [blame] | 84 | # Default Rule: Make sure it's also a :: rule |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 85 | all :: |
| 86 | |
| 87 | # Default for install is to at least build everything... |
| 88 | install :: |
| 89 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 90 | # Default rule for test. It ensures everything has a test rule |
| 91 | test:: |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 92 | |
Vikram S. Adve | 6edfe27 | 2003-07-10 19:25:29 +0000 | [diff] [blame] | 93 | # Default rule for building only bytecode. |
| 94 | bytecode:: |
| 95 | |
Brian Gaeke | f313ea7 | 2004-03-10 17:38:01 +0000 | [diff] [blame] | 96 | # Default rule for installing only bytecode. |
| 97 | install-bytecode:: |
| 98 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 99 | # Print out the directories used for building |
| 100 | prdirs:: |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 101 | @${ECHO} "Build Source Root: " $(BUILD_SRC_ROOT) |
| 102 | @${ECHO} "Build Source Dir : " $(BUILD_SRC_DIR) |
| 103 | @${ECHO} "Build Object Root: " $(BUILD_OBJ_ROOT) |
| 104 | @${ECHO} "Build Object Dir : " $(BUILD_OBJ_DIR) |
| 105 | @${ECHO} "LLVM Source Root: " $(LLVM_SRC_ROOT) |
| 106 | @${ECHO} "LLVM Object Root: " $(LLVM_OBJ_ROOT) |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 107 | |
John Criswell | 9621a2b | 2003-08-20 15:18:41 +0000 | [diff] [blame] | 108 | ########################################################################### |
| 109 | # Suffixes and implicit rules: |
| 110 | # Empty out the list of suffixes, generate a list that is only |
| 111 | # used by this Makefile, and cancel useless implicit rules. This |
| 112 | # will hopefully speed up compilation a little bit. |
| 113 | ########################################################################### |
| 114 | .SUFFIXES: |
| 115 | .SUFFIXES: .c .cpp .h .hpp .y .l |
Brian Gaeke | d65ed3f | 2004-01-21 19:59:19 +0000 | [diff] [blame] | 116 | .SUFFIXES: .lo .o .a $(SHLIBEXT) .bc .td |
John Criswell | 9621a2b | 2003-08-20 15:18:41 +0000 | [diff] [blame] | 117 | .SUFFIXES: .ps .dot .d |
| 118 | |
John Criswell | 9691439 | 2003-07-16 20:26:06 +0000 | [diff] [blame] | 119 | # |
| 120 | # Mark all of these targets as phony. This will hopefully speed up builds |
| 121 | # slightly since GNU Make will not try to find implicit rules for targets |
| 122 | # which are marked as Phony. |
| 123 | # |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 124 | .PHONY: all dynamic bytecodelib install-bytecode-library |
Chris Lattner | fbb574d | 2003-08-21 20:39:08 +0000 | [diff] [blame] | 125 | .PHONY: clean distclean install test bytecode prdirs |
John Criswell | 9691439 | 2003-07-16 20:26:06 +0000 | [diff] [blame] | 126 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 127 | ########################################################################### |
| 128 | # Miscellaneous paths and commands: |
| 129 | # This section defines various configuration macros, such as where |
| 130 | # to find burg, tblgen, and libtool. |
| 131 | ########################################################################### |
| 132 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 133 | #-------------------------------------------------------------------- |
Vikram S. Adve | c214e71 | 2002-08-29 23:28:46 +0000 | [diff] [blame] | 134 | # Variables derived from configuration options... |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 135 | #-------------------------------------------------------------------- |
| 136 | |
Vikram S. Adve | dba59ef | 2001-08-06 19:01:20 +0000 | [diff] [blame] | 137 | BURG_OPTS = -I |
| 138 | |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 139 | ifdef ENABLE_PROFILING |
| 140 | ENABLE_OPTIMIZED = 1 |
| 141 | CONFIGURATION := Profile |
| 142 | else |
| 143 | ifdef ENABLE_OPTIMIZED |
| 144 | CONFIGURATION := Release |
| 145 | else |
| 146 | CONFIGURATION := Debug |
| 147 | endif |
| 148 | endif |
| 149 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 150 | # |
| 151 | # Enable this for profiling support with 'gprof' |
| 152 | # This automatically enables optimized builds. |
| 153 | # |
| 154 | ifdef ENABLE_PROFILING |
| 155 | PROFILE = -pg |
| 156 | endif |
| 157 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 158 | ########################################################################### |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 159 | # Library Locations: |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 160 | # These variables describe various library locations: |
| 161 | # |
| 162 | # DEST* = Location of where libraries that are built will be placed. |
| 163 | # LLVM* = Location of LLVM libraries used for linking. |
| 164 | # PROJ* = Location of previously built libraries used for linking. |
| 165 | ########################################################################### |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 166 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 167 | # Libraries that are being built |
| 168 | DESTLIBDEBUG := $(BUILD_OBJ_ROOT)/lib/Debug |
| 169 | DESTLIBRELEASE := $(BUILD_OBJ_ROOT)/lib/Release |
| 170 | DESTLIBPROFILE := $(BUILD_OBJ_ROOT)/lib/Profile |
Chris Lattner | ad2be6c | 2003-09-10 19:37:51 +0000 | [diff] [blame] | 171 | DESTLIBBYTECODE := $(BUILD_OBJ_ROOT)/lib/BytecodeLibs |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 172 | DESTLIBCURRENT := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 173 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 174 | # LLVM libraries used for linking |
| 175 | LLVMLIBDEBUGSOURCE := $(LLVM_OBJ_ROOT)/lib/Debug |
| 176 | LLVMLIBRELEASESOURCE := $(LLVM_OBJ_ROOT)/lib/Release |
| 177 | LLVMLIBPROFILESOURCE := $(LLVM_OBJ_ROOT)/lib/Profile |
| 178 | LLVMLIBCURRENTSOURCE := $(LLVM_OBJ_ROOT)/lib/$(CONFIGURATION) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 179 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 180 | # Libraries that were built that will now be used for linking |
| 181 | PROJLIBDEBUGSOURCE := $(BUILD_OBJ_ROOT)/lib/Debug |
| 182 | PROJLIBRELEASESOURCE := $(BUILD_OBJ_ROOT)/lib/Release |
| 183 | PROJLIBPROFILESOURCE := $(BUILD_OBJ_ROOT)/lib/Profile |
| 184 | PROJLIBCURRENTSOURCE := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 185 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 186 | ########################################################################### |
| 187 | # Tool Locations |
| 188 | # These variables describe various tool locations: |
| 189 | # |
| 190 | # DEST* = Location of where tools that are built will be placed. |
| 191 | # LLVM* = Location of LLVM tools used for building. |
| 192 | # PROJ* = Location of previously built tools used for linking. |
| 193 | ########################################################################### |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 194 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 195 | DESTTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug |
| 196 | DESTTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release |
| 197 | DESTTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile |
| 198 | DESTTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION) |
| 199 | |
| 200 | LLVMTOOLDEBUG := $(LLVM_OBJ_ROOT)/tools/Debug |
| 201 | LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/tools/Release |
| 202 | LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/tools/Profile |
| 203 | LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/tools/$(CONFIGURATION) |
| 204 | |
| 205 | PROJTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug |
| 206 | PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release |
| 207 | PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile |
| 208 | PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION) |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 209 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 210 | # |
| 211 | # Libtool is found in the current directory. |
| 212 | # |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 213 | LIBTOOL := $(LLVM_OBJ_ROOT)/mklib |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 214 | |
| 215 | # |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 216 | # If we're not building a shared library, use the disable-shared tag with |
| 217 | # libtool. This will disable the building of objects for shared libraries and |
| 218 | # only generate static library objects. |
| 219 | # |
| 220 | # For dynamic libraries, we'll take the performance hit for now, since we |
| 221 | # almost never build them. |
| 222 | # |
| 223 | # This should speed up compilation and require no modifications to future |
| 224 | # versions of libtool. |
| 225 | # |
| 226 | ifndef SHARED_LIBRARY |
Chris Lattner | 95cc1b3 | 2003-08-14 21:10:25 +0000 | [diff] [blame] | 227 | LIBTOOL += --tag=disable-shared |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 228 | endif |
| 229 | |
| 230 | # |
Misha Brukman | b5f096f | 2002-09-12 16:05:39 +0000 | [diff] [blame] | 231 | # Verbosity levels |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 232 | # |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 233 | ifndef VERBOSE |
Misha Brukman | b5f096f | 2002-09-12 16:05:39 +0000 | [diff] [blame] | 234 | VERB := @ |
Chris Lattner | 95cc1b3 | 2003-08-14 21:10:25 +0000 | [diff] [blame] | 235 | LIBTOOL += --silent |
Misha Brukman | b5f096f | 2002-09-12 16:05:39 +0000 | [diff] [blame] | 236 | endif |
| 237 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 238 | ########################################################################### |
| 239 | # Miscellaneous paths and commands (part deux): |
| 240 | # This section defines various configuration macros, such as where |
| 241 | # to find burg, tblgen, and libtool. |
| 242 | ########################################################################### |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 243 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 244 | #-------------------------------------------------------------------------- |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 245 | # Utilities used while building the LLVM tree, which live in the utils dir |
| 246 | # |
Chris Lattner | 396d96b | 2004-06-01 19:06:43 +0000 | [diff] [blame] | 247 | BURG := $(LLVMTOOLCURRENT)/burg$(EXEEXT) |
Chris Lattner | eefa3d3 | 2003-11-29 09:50:15 +0000 | [diff] [blame] | 248 | RunBurg := $(BURG) $(BURG_OPTS) |
Chris Lattner | 396d96b | 2004-06-01 19:06:43 +0000 | [diff] [blame] | 249 | TBLGEN := $(LLVMTOOLCURRENT)/tblgen$(EXEEXT) |
| 250 | LGCCLDPROG := $(LLVMTOOLCURRENT)/gccld$(EXEEXT) |
Vikram S. Adve | dba59ef | 2001-08-06 19:01:20 +0000 | [diff] [blame] | 251 | |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 252 | #-------------------------------------------------------------------------- |
| 253 | # The LLVM GCC front-end in C and C++ flavors |
| 254 | # |
Chris Lattner | 9a86a01 | 2003-08-15 15:20:52 +0000 | [diff] [blame] | 255 | LLVMGCC := PATH=$(LLVMTOOLCURRENT):$(PATH) $(LLVMGCCDIR)/bin/gcc |
Chris Lattner | 9a86a01 | 2003-08-15 15:20:52 +0000 | [diff] [blame] | 256 | LLVMGXX := PATH=$(LLVMTOOLCURRENT):$(PATH) $(LLVMGCCDIR)/bin/g++ |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 257 | |
| 258 | #-------------------------------------------------------------------------- |
| 259 | # Some of the compiled LLVM tools which are used for compilation of runtime |
| 260 | # libraries. |
| 261 | # |
Chris Lattner | 396d96b | 2004-06-01 19:06:43 +0000 | [diff] [blame] | 262 | LLVMAS := $(LLVMTOOLCURRENT)/llvm-as$(EXEEXT) |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 263 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 264 | |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 265 | ########################################################################### |
| 266 | # Compile Time Flags |
| 267 | ########################################################################### |
| 268 | |
| 269 | # |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 270 | # Include both the project headers and the LLVM headers for compilation and |
| 271 | # dependency computation. |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 272 | # |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 273 | # BUILD_OBJ_DIR : Files local to the particular object directory |
| 274 | # (locallly generated header files). |
| 275 | # BUILD_SRC_DIR : Files local to the particular source directory. |
| 276 | # BUILD_SRC_ROOT/include : Files global to the project. |
Chris Lattner | 00e730a | 2003-09-15 01:07:32 +0000 | [diff] [blame] | 277 | # LLVM_OBJ_ROOT/include : config.h files generated by autoconf |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 278 | # LEVEL/include : config.h files for the project |
| 279 | # LLVM_SRC_ROOT/include : Files global to LLVM. |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 280 | # |
Chris Lattner | 069f930 | 2003-09-15 01:12:04 +0000 | [diff] [blame] | 281 | CPPFLAGS += -I$(BUILD_OBJ_DIR) -I$(BUILD_SRC_DIR) -I$(LLVM_OBJ_ROOT)/include \ |
| 282 | -I$(BUILD_SRC_ROOT)/include -I$(LEVEL)/include \ |
| 283 | -I$(LLVM_SRC_ROOT)/include |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 284 | |
Vikram S. Adve | feeae58 | 2002-09-18 11:55:13 +0000 | [diff] [blame] | 285 | # By default, strip symbol information from executable |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 286 | ifndef KEEP_SYMBOLS |
Chris Lattner | 527002c | 2003-01-31 19:00:26 +0000 | [diff] [blame] | 287 | STRIP = $(PLATFORMSTRIPOPTS) |
Misha Brukman | 9b51b6f | 2003-07-10 16:52:41 +0000 | [diff] [blame] | 288 | STRIP_WARN_MSG = "(without symbols)" |
Vikram S. Adve | feeae58 | 2002-09-18 11:55:13 +0000 | [diff] [blame] | 289 | endif |
| 290 | |
Brian Gaeke | 90eca55 | 2003-10-28 19:09:28 +0000 | [diff] [blame] | 291 | # Allow GNU extensions: |
Chris Lattner | 73e1d0f | 2002-09-13 16:02:26 +0000 | [diff] [blame] | 292 | CPPFLAGS += -D_GNU_SOURCE |
Brian Gaeke | 90eca55 | 2003-10-28 19:09:28 +0000 | [diff] [blame] | 293 | # Pull in limit macros from stdint.h, even in C++: |
| 294 | CPPFLAGS += -D__STDC_LIMIT_MACROS |
Chris Lattner | 73e1d0f | 2002-09-13 16:02:26 +0000 | [diff] [blame] | 295 | |
Alkis Evlogimenos | bccab5e | 2004-02-13 20:05:44 +0000 | [diff] [blame] | 296 | ### FIXME: this is GCC specific |
Alkis Evlogimenos | 972c0c9 | 2004-05-20 21:31:43 +0000 | [diff] [blame] | 297 | CPPFLAGS += -DATTR_DEPRECATED='__attribute__ ((deprecated))' |
Alkis Evlogimenos | bccab5e | 2004-02-13 20:05:44 +0000 | [diff] [blame] | 298 | |
Chris Lattner | d180300 | 2003-12-06 20:59:45 +0000 | [diff] [blame] | 299 | CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused |
Chris Lattner | bb3dd47 | 2003-08-27 18:26:44 +0000 | [diff] [blame] | 300 | CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 301 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 302 | # |
| 303 | # Compile commands with libtool. |
| 304 | # |
Brian Gaeke | 10c508b | 2004-06-08 18:52:45 +0000 | [diff] [blame] | 305 | Compile := $(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts) |
Chris Lattner | 72987ee | 2003-08-23 15:56:38 +0000 | [diff] [blame] | 306 | CompileC := $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(CompileCommonOpts) |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 307 | |
Chris Lattner | 172b648 | 2002-09-22 02:47:15 +0000 | [diff] [blame] | 308 | # Compile a cpp file, don't link... |
Chris Lattner | 285af38 | 2002-08-12 21:19:28 +0000 | [diff] [blame] | 309 | CompileG := $(Compile) -g -D_DEBUG |
Chris Lattner | 1d1e5b5 | 2003-02-13 16:56:30 +0000 | [diff] [blame] | 310 | CompileO := $(Compile) $(CompileOptimizeOpts) -felide-constructors -fomit-frame-pointer |
| 311 | CompileP := $(Compile) $(CompileOptimizeOpts) -felide-constructors $(PROFILE) |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 312 | |
Chris Lattner | 172b648 | 2002-09-22 02:47:15 +0000 | [diff] [blame] | 313 | # Compile a c file, don't link... |
Chris Lattner | 172b648 | 2002-09-22 02:47:15 +0000 | [diff] [blame] | 314 | CompileCG := $(CompileC) -g -D_DEBUG |
Chris Lattner | fe95dae | 2003-02-19 22:12:20 +0000 | [diff] [blame] | 315 | CompileCO := $(CompileC) $(CompileOptimizeOpts) -fomit-frame-pointer |
| 316 | CompileCP := $(CompileC) $(CompileOptimizeOpts) $(PROFILE) |
Chris Lattner | 172b648 | 2002-09-22 02:47:15 +0000 | [diff] [blame] | 317 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 318 | ########################################################################### |
| 319 | # Link Time Options |
| 320 | ########################################################################### |
Chris Lattner | 172b648 | 2002-09-22 02:47:15 +0000 | [diff] [blame] | 321 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 322 | # |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 323 | # Link final executable |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 324 | # (Note that we always link with the C++ compiler). |
| 325 | # |
Brian Gaeke | 10c508b | 2004-06-08 18:52:45 +0000 | [diff] [blame] | 326 | Link := $(LIBTOOL) --tag=CXX --mode=link $(CXX) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 327 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 328 | # link both projlib and llvmlib libraries |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 329 | LinkG := $(Link) -g -L$(PROJLIBDEBUGSOURCE) -L$(LLVMLIBDEBUGSOURCE) $(STRIP) |
| 330 | LinkO := $(Link) -O3 -L$(PROJLIBRELEASESOURCE) -L$(LLVMLIBRELEASESOURCE) |
| 331 | LinkP := $(Link) -O3 -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PROFILE) |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 332 | |
Dinakar Dhurjati | 87ea8aa | 2003-10-29 14:28:35 +0000 | [diff] [blame] | 333 | # TOOLLINKOPTSB to pass options to the linker like library search path etc |
| 334 | # Note that this is different from TOOLLINKOPTS, these options |
| 335 | # are passed to the linker *before* the USEDLIBS options are passed. |
| 336 | # e.g. usage TOOLLINKOPTSB = -L/home/xxx/lib |
| 337 | ifdef TOOLLINKOPTSB |
| 338 | LinkG := $(LinkG) $(TOOLLINKOPTSB) |
Dinakar Dhurjati | 79903c8 | 2003-10-29 20:34:13 +0000 | [diff] [blame] | 339 | LinkO := $(LinkO) $(TOOLLINKOPTSB) |
| 340 | LinkP := $(LinkP) $(TOOLLINKOPTSB) |
Dinakar Dhurjati | 87ea8aa | 2003-10-29 14:28:35 +0000 | [diff] [blame] | 341 | endif |
| 342 | |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 343 | # Create one .o file from a bunch of .o files... |
Brian Gaeke | 10c508b | 2004-06-08 18:52:45 +0000 | [diff] [blame] | 344 | Relink := ${LIBTOOL} --tag=CXX --mode=link $(CXX) |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 345 | |
| 346 | # |
| 347 | # Configure where the item being compiled should go. |
| 348 | # |
| 349 | ifdef SHARED_LIBRARY |
Chris Lattner | 95cc1b3 | 2003-08-14 21:10:25 +0000 | [diff] [blame] | 350 | Link += -rpath $(DESTLIBCURRENT) |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 351 | endif |
| 352 | |
| 353 | ifdef TOOLNAME |
Chris Lattner | 95cc1b3 | 2003-08-14 21:10:25 +0000 | [diff] [blame] | 354 | Link += -rpath $(DESTTOOLCURRENT) |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 355 | endif |
Chris Lattner | 4bb13b8 | 2002-09-13 22:14:47 +0000 | [diff] [blame] | 356 | |
Misha Brukman | 36bc642 | 2003-08-21 22:02:18 +0000 | [diff] [blame] | 357 | # Create dependency file from CPP file, send to stdout. |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 358 | Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS) |
| 359 | DependC := $(CC) -MM -I$(LEVEL)/include $(CPPFLAGS) |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 360 | |
| 361 | # Archive a bunch of .o files into a .a file... |
Brian Gaeke | 7a45c49 | 2004-02-04 21:41:23 +0000 | [diff] [blame] | 362 | AR = $(AR_PATH) cr |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 363 | |
| 364 | #---------------------------------------------------------- |
| 365 | |
| 366 | # Source includes all of the cpp files, and objects are derived from the |
| 367 | # source files... |
Chris Lattner | e001059 | 2001-10-18 01:48:09 +0000 | [diff] [blame] | 368 | # The local Makefile can list other Source files via ExtraSource = ... |
Vikram S. Adve | c4bed34 | 2001-10-17 12:33:55 +0000 | [diff] [blame] | 369 | # |
Vikram S. Adve | ad9ea7e | 2002-10-14 16:40:04 +0000 | [diff] [blame] | 370 | ifndef Source |
Chris Lattner | 069f930 | 2003-09-15 01:12:04 +0000 | [diff] [blame] | 371 | Source := $(notdir $(ExtraSource) $(wildcard $(SourceDir)/*.cpp \ |
John Criswell | b1f5cfe | 2003-12-29 22:02:12 +0000 | [diff] [blame] | 372 | $(SourceDir)/*.cc $(SourceDir)/*.c $(SourceDir)/*.y \ |
| 373 | $(SourceDir)/*.l)) |
Vikram S. Adve | ad9ea7e | 2002-10-14 16:40:04 +0000 | [diff] [blame] | 374 | endif |
Vikram S. Adve | 112a72c | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 375 | |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 376 | # |
| 377 | # Libtool Objects |
| 378 | # |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 379 | Srcs := $(sort $(basename $(Source))) |
Chris Lattner | eefa3d3 | 2003-11-29 09:50:15 +0000 | [diff] [blame] | 380 | ObjectsO := $(Srcs:%=$(BUILD_OBJ_DIR)/Release/%.lo) |
| 381 | ObjectsP := $(Srcs:%=$(BUILD_OBJ_DIR)/Profile/%.lo) |
| 382 | ObjectsG := $(Srcs:%=$(BUILD_OBJ_DIR)/Debug/%.lo) |
| 383 | ObjectsBC := $(Srcs:%=$(BUILD_OBJ_DIR)/BytecodeObj/%.bc) |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 384 | |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 385 | # |
| 386 | # The real objects underlying the libtool objects |
| 387 | # |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 388 | RObjs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source))))) |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 389 | RObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(RObjs)) |
| 390 | RObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(RObjs)) |
| 391 | RObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(RObjs)) |
| 392 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 393 | #--------------------------------------------------------- |
Chris Lattner | a8abc22 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 394 | # Handle the DIRS and PARALLEL_DIRS options |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 395 | #--------------------------------------------------------- |
| 396 | |
Anand Shukla | 7c7a07e | 2002-09-18 04:29:30 +0000 | [diff] [blame] | 397 | ifdef DIRS |
Brian Gaeke | f313ea7 | 2004-03-10 17:38:01 +0000 | [diff] [blame] | 398 | all install clean test bytecode stripped-bytecode install-bytecode:: |
Chris Lattner | 16d1f73 | 2002-09-17 23:45:34 +0000 | [diff] [blame] | 399 | $(VERB) for dir in ${DIRS}; do \ |
John Criswell | 6057760 | 2003-11-25 17:49:22 +0000 | [diff] [blame] | 400 | if [ ! -f $$dir/Makefile ]; \ |
| 401 | then \ |
John Criswell | b3866b6 | 2003-11-25 19:32:22 +0000 | [diff] [blame] | 402 | $(MKDIR) $$dir; \ |
John Criswell | 6057760 | 2003-11-25 17:49:22 +0000 | [diff] [blame] | 403 | cp $(SourceDir)/$$dir/Makefile $$dir/Makefile; \ |
| 404 | fi; \ |
Misha Brukman | c2fb006 | 2004-05-21 00:09:21 +0000 | [diff] [blame] | 405 | ($(MAKE) -C $$dir $@ $(MFLAGS)) || exit 1; \ |
Chris Lattner | f1ffd99 | 2002-09-17 23:35:02 +0000 | [diff] [blame] | 406 | done |
Anand Shukla | 7c7a07e | 2002-09-18 04:29:30 +0000 | [diff] [blame] | 407 | endif |
Chris Lattner | a8abc22 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 408 | |
| 409 | # Handle PARALLEL_DIRS |
| 410 | ifdef PARALLEL_DIRS |
Vikram S. Adve | 6edfe27 | 2003-07-10 19:25:29 +0000 | [diff] [blame] | 411 | all :: $(addsuffix /.makeall , $(PARALLEL_DIRS)) |
| 412 | install :: $(addsuffix /.makeinstall , $(PARALLEL_DIRS)) |
| 413 | clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS)) |
| 414 | test :: $(addsuffix /.maketest , $(PARALLEL_DIRS)) |
| 415 | bytecode :: $(addsuffix /.makebytecode, $(PARALLEL_DIRS)) |
Chris Lattner | a8df7bd | 2003-12-01 07:28:25 +0000 | [diff] [blame] | 416 | stripped-bytecode :: $(addsuffix /.makestripped-bytecode, $(PARALLEL_DIRS)) |
Brian Gaeke | f313ea7 | 2004-03-10 17:38:01 +0000 | [diff] [blame] | 417 | install-bytecode :: $(addsuffix /.makeinstall-bytecode, $(PARALLEL_DIRS)) |
Chris Lattner | a8abc22 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 418 | |
Brian Gaeke | f313ea7 | 2004-03-10 17:38:01 +0000 | [diff] [blame] | 419 | %/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode %/.makestripped-bytecode %/.makeinstall-bytecode: |
John Criswell | b3866b6 | 2003-11-25 19:32:22 +0000 | [diff] [blame] | 420 | $(VERB) if [ ! -f $(@D)/Makefile ]; \ |
| 421 | then \ |
| 422 | $(MKDIR) $(@D); \ |
| 423 | cp $(SourceDir)/$(@D)/Makefile $(@D)/Makefile; \ |
| 424 | fi; \ |
Misha Brukman | 694b3ff | 2004-05-21 23:21:11 +0000 | [diff] [blame] | 425 | $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) $(MFLAGS) |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 426 | endif |
| 427 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 428 | # Handle directories that may or may not exist |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 429 | ifdef OPTIONAL_DIRS |
Brian Gaeke | f313ea7 | 2004-03-10 17:38:01 +0000 | [diff] [blame] | 430 | all install clean test bytecode stripped-bytecode install-bytecode:: |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 431 | $(VERB) for dir in ${OPTIONAL_DIRS}; do \ |
John Criswell | 6057760 | 2003-11-25 17:49:22 +0000 | [diff] [blame] | 432 | if [ -d $(SourceDir)/$$dir ]; \ |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 433 | then\ |
John Criswell | 6057760 | 2003-11-25 17:49:22 +0000 | [diff] [blame] | 434 | if [ ! -f $$dir/Makefile ]; \ |
| 435 | then \ |
John Criswell | b3866b6 | 2003-11-25 19:32:22 +0000 | [diff] [blame] | 436 | $(MKDIR) $$dir; \ |
John Criswell | 6057760 | 2003-11-25 17:49:22 +0000 | [diff] [blame] | 437 | cp $(SourceDir)/$$dir/Makefile $$dir/Makefile; \ |
| 438 | fi; \ |
Misha Brukman | 694b3ff | 2004-05-21 23:21:11 +0000 | [diff] [blame] | 439 | ($(MAKE) -C$$dir $@ $(MFLAGS)) || exit 1; \ |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 440 | fi \ |
| 441 | done |
| 442 | endif |
| 443 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 444 | ########################################################################### |
| 445 | # Library Build Rules: |
| 446 | # |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 447 | #--------------------------------------------------------- |
| 448 | # Handle the LIBRARYNAME option - used when building libs... |
| 449 | #--------------------------------------------------------- |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 450 | # |
| 451 | # When libraries are built, they are allowed to optionally define the |
| 452 | # DONT_BUILD_RELINKED make variable, which, when defined, prevents a .o file |
| 453 | # from being built for the library. This .o files may then be linked to by a |
| 454 | # tool if the tool does not need (or want) the semantics a .a file provides |
| 455 | # (linking in only object files that are "needed"). If a library is never to |
| 456 | # be used in this way, it is better to define DONT_BUILD_RELINKED, and define |
| 457 | # BUILD_ARCHIVE instead. |
| 458 | # |
| 459 | # Some libraries must be built as .a files (libscalar for example) because if |
Chris Lattner | 1917e95 | 2002-07-31 21:32:05 +0000 | [diff] [blame] | 460 | # it's built as a .o file, then all of the constituent .o files in it will be |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 461 | # linked into tools (for example gccas) even if they only use one of the parts |
| 462 | # of it. For this reason, sometimes it's useful to use libraries as .a files. |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 463 | ########################################################################### |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 464 | |
Brian Gaeke | 8abff79 | 2004-01-22 22:53:48 +0000 | [diff] [blame] | 465 | # Install rule for making bytecode library directory if it does not exist. |
| 466 | # Trigger this by making libraries that need to be installed here depend on it. |
| 467 | $(DESTDIR)$(bytecode_libdir): |
| 468 | $(MKDIR) $@ |
| 469 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 470 | ifdef LIBRARYNAME |
Vikram S. Adve | 112a72c | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 471 | |
Chris Lattner | 2a548c5 | 2002-09-16 22:36:42 +0000 | [diff] [blame] | 472 | # Make sure there isn't any extranous whitespace on the LIBRARYNAME option |
Chris Lattner | ccb4ebd | 2002-09-16 22:34:56 +0000 | [diff] [blame] | 473 | LIBRARYNAME := $(strip $(LIBRARYNAME)) |
| 474 | |
Brian Gaeke | d252d75 | 2004-01-21 21:17:37 +0000 | [diff] [blame] | 475 | LIBNAME_O := $(DESTLIBRELEASE)/lib$(LIBRARYNAME)$(SHLIBEXT) |
| 476 | LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME)$(SHLIBEXT) |
| 477 | LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME)$(SHLIBEXT) |
| 478 | LIBNAME_CUR := $(DESTLIBCURRENT)/lib$(LIBRARYNAME)$(SHLIBEXT) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 479 | LIBNAME_AO := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a |
| 480 | LIBNAME_AP := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a |
| 481 | LIBNAME_AG := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 482 | LIBNAME_ACUR := $(DESTLIBCURRENT)/lib$(LIBRARYNAME).a |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 483 | LIBNAME_OBJO := $(DESTLIBRELEASE)/$(LIBRARYNAME).o |
| 484 | LIBNAME_OBJP := $(DESTLIBPROFILE)/$(LIBRARYNAME).o |
| 485 | LIBNAME_OBJG := $(DESTLIBDEBUG)/$(LIBRARYNAME).o |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 486 | LIBNAME_OBJCUR := $(DESTLIBCURRENT)/$(LIBRARYNAME).o |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 487 | LIBNAME_BC := $(DESTLIBBYTECODE)/lib$(LIBRARYNAME).bc |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 488 | |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 489 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 490 | #-------------------------------------------------------------------- |
| 491 | # Library Targets |
| 492 | # Modify the top level targets to build the desired libraries. |
| 493 | #-------------------------------------------------------------------- |
| 494 | |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 495 | # dynamic target builds a shared object version of the library... |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 496 | dynamic:: $(LIBNAME_CUR) |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 497 | bytecodelib:: $(LIBNAME_BC) |
Brian Gaeke | 13f9932 | 2004-01-21 23:57:21 +0000 | [diff] [blame] | 498 | install-bytecode-library:: $(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 499 | |
Brian Gaeke | 13f9932 | 2004-01-21 23:57:21 +0000 | [diff] [blame] | 500 | $(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc: $(LIBNAME_BC) $(DESTDIR)$(bytecode_libdir) |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 501 | @${ECHO} ======= Installing $(LIBRARYNAME) bytecode library ======= |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 502 | cp $< $@ |
Vikram S. Adve | 60f5606 | 2002-08-02 18:34:12 +0000 | [diff] [blame] | 503 | |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 504 | # Does the library want a .o version built? |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 505 | ifndef DONT_BUILD_RELINKED |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 506 | all:: $(LIBNAME_OBJCUR) |
| 507 | install:: install-single-object-library |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 508 | endif |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 509 | |
| 510 | # Does the library want an archive version built? |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 511 | ifdef BUILD_ARCHIVE |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 512 | all:: $(LIBNAME_ACUR) |
| 513 | install:: install-archive-library |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 514 | endif |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 515 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 516 | #-------------------------------------------------------------------- |
| 517 | # Rules for building libraries |
| 518 | #-------------------------------------------------------------------- |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 519 | |
Chris Lattner | 771ed15 | 2003-10-21 18:00:37 +0000 | [diff] [blame] | 520 | LinkBCLib := $(LLVMGCC) -shared -nostdlib |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 521 | ifdef EXPORTED_SYMBOL_LIST |
| 522 | LinkBCLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST) |
| 523 | else |
Chris Lattner | 22c8328 | 2003-09-15 15:06:54 +0000 | [diff] [blame] | 524 | ifdef EXPORTED_SYMBOL_FILE |
| 525 | LinkBCLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE) |
| 526 | else |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 527 | LinkBCLib += -Xlinker -disable-internalize |
Chris Lattner | 22c8328 | 2003-09-15 15:06:54 +0000 | [diff] [blame] | 528 | endif |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 529 | endif |
| 530 | |
| 531 | |
| 532 | # Rule for building bytecode libraries. |
Chris Lattner | af06a08 | 2003-08-15 03:02:52 +0000 | [diff] [blame] | 533 | $(LIBNAME_BC): $(ObjectsBC) $(LibSubDirs) $(DESTLIBBYTECODE)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 534 | @${ECHO} Linking $(LIBRARYNAME) bytecode library |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 535 | $(VERB) $(LinkBCLib) -o $@ $(ObjectsBC) $(LibSubDirs) $(LibLinkOpts) |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 536 | @${ECHO} ======= Finished building $(LIBRARYNAME) bytecode library ======= |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 537 | # |
| 538 | # Rules for building dynamically linked libraries. |
| 539 | # |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 540 | $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 541 | @${ECHO} Linking $(LIBRARYNAME) dynamic release library |
Chris Lattner | b7dc2b9 | 2003-08-15 20:00:47 +0000 | [diff] [blame] | 542 | $(VERB) $(Link) -o $*.la $(ObjectsO) $(LibSubDirs) $(LibLinkOpts) |
| 543 | $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT) |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 544 | @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic release library ======= |
Vikram S. Adve | 41e7891 | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 545 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 546 | $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 547 | @${ECHO} Linking $(LIBRARYNAME) dynamic profile library |
Chris Lattner | b7dc2b9 | 2003-08-15 20:00:47 +0000 | [diff] [blame] | 548 | $(VERB) $(Link) -o $*.la $(ObjectsP) $(LibSubDirs) $(LibLinkOpts) |
| 549 | $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT) |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 550 | @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic profile library ======= |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 551 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 552 | $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 553 | @${ECHO} Linking $(LIBRARYNAME) dynamic debug library |
Chris Lattner | b7dc2b9 | 2003-08-15 20:00:47 +0000 | [diff] [blame] | 554 | $(VERB) $(Link) -o $*.la $(ObjectsG) $(LibSubDirs) $(LibLinkOpts) |
| 555 | $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT) |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 556 | @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic debug library ======= |
Vikram S. Adve | 112a72c | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 557 | |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 558 | install-dynamic-library: $(LIBNAME_CUR) |
Brian Gaeke | 6c09696 | 2004-02-09 17:38:52 +0000 | [diff] [blame] | 559 | $(MKDIR) $(DESTDIR)$(libdir) |
Brian Gaeke | 819567d | 2004-01-21 21:20:44 +0000 | [diff] [blame] | 560 | $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(DESTDIR)$(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 561 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 562 | # |
| 563 | # Rules for building static archive libraries. |
| 564 | # |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 565 | $(LIBNAME_AO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 566 | @${ECHO} Linking $(LIBRARYNAME) archive release library |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 567 | @$(RM) -f $@ |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 568 | $(VERB) $(Link) -03 -o $@ $(ObjectsO) $(LibSubDirs) -static |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 569 | @${ECHO} Finished building $(LIBRARYNAME) archive release library ======= |
Vikram S. Adve | 41e7891 | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 570 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 571 | $(LIBNAME_AP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 572 | @${ECHO} Linking $(LIBRARYNAME) archive profile library |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 573 | @$(RM) -f $@ |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 574 | $(VERB) $(Link) -03 $(PROFILE) -o $@ $(ObjectsP) $(LibSubDirs) -static |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 575 | @${ECHO} ======= Finished building $(LIBRARYNAME) archive profile library ======= |
Vikram S. Adve | 112a72c | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 576 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 577 | $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 578 | @${ECHO} Linking $(LIBRARYNAME) archive debug library |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 579 | @$(RM) -f $@ |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 580 | $(VERB) $(Link) -g $(STRIP) -o $@ $(ObjectsG) $(LibSubDirs) -static |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 581 | @${ECHO} ======= Finished building $(LIBRARYNAME) archive debug library ======= |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 582 | |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 583 | install-archive-library: $(LIBNAME_ACUR) |
Brian Gaeke | 6c09696 | 2004-02-09 17:38:52 +0000 | [diff] [blame] | 584 | $(MKDIR) $(DESTDIR)$(libdir) |
Brian Gaeke | 819567d | 2004-01-21 21:20:44 +0000 | [diff] [blame] | 585 | $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_ACUR) $(DESTDIR)$(libdir)/lib$(LIBRARYNAME).a |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 586 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 587 | # |
| 588 | # Rules for building .o libraries. |
| 589 | # |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 590 | # JTC: |
| 591 | # Note that for this special case, we specify the actual object files |
| 592 | # instead of their libtool counterparts. This is because libtool |
| 593 | # doesn't want to generate a reloadable object file unless it is given |
| 594 | # .o files explicitly. |
| 595 | # |
| 596 | # Note that we're making an assumption here: If we build a .lo file, |
| 597 | # it's corresponding .o file will be placed in the same directory. |
| 598 | # |
| 599 | # I think that is safe. |
| 600 | # |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 601 | $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 602 | @${ECHO} "Linking `basename $@`" |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 603 | $(VERB) $(Relink) -o $@ $(RObjectsO) $(LibSubDirs) |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 604 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 605 | $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 606 | @${ECHO} "Linking `basename $@`" |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 607 | $(VERB) $(Relink) -o $@ $(RObjectsP) $(LibSubDirs) |
Vikram S. Adve | 41e7891 | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 608 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 609 | $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 610 | @${ECHO} "Linking `basename $@`" |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 611 | $(VERB) $(Relink) -o $@ $(RObjectsG) $(LibSubDirs) |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 612 | |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 613 | install-single-object-library: $(LIBNAME_OBJCUR) |
Brian Gaeke | 6c09696 | 2004-02-09 17:38:52 +0000 | [diff] [blame] | 614 | $(MKDIR) $(DESTDIR)$(libdir) |
Brian Gaeke | 819567d | 2004-01-21 21:20:44 +0000 | [diff] [blame] | 615 | $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_OBJCUR) $(DESTDIR)$(libdir)/$(LIBRARYNAME).o |
Brian Gaeke | 78cb3f2 | 2003-12-18 20:57:48 +0000 | [diff] [blame] | 616 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 617 | endif |
| 618 | |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 619 | #------------------------------------------------------------------------ |
| 620 | # Handle the TOOLNAME option - used when building tool executables... |
| 621 | #------------------------------------------------------------------------ |
| 622 | # |
| 623 | # The TOOLNAME option should be used with a USEDLIBS variable that tells the |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 624 | # libraries (and the order of the libs) that should be linked to the |
| 625 | # tool. USEDLIBS should contain a list of library names (some with .a extension) |
| 626 | # that are automatically linked in as .o files unless the .a suffix is added. |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 627 | # |
| 628 | ifdef TOOLNAME |
| 629 | |
| 630 | # TOOLEXENAME* - These compute the output filenames to generate... |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 631 | TOOLEXENAME_G := $(DESTTOOLDEBUG)/$(TOOLNAME) |
| 632 | TOOLEXENAME_O := $(DESTTOOLRELEASE)/$(TOOLNAME) |
| 633 | TOOLEXENAME_P := $(DESTTOOLPROFILE)/$(TOOLNAME) |
| 634 | TOOLEXENAMES := $(DESTTOOLCURRENT)/$(TOOLNAME) |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 635 | |
| 636 | # USED_LIBS_OPTIONS - Compute the options line that add -llib1 -llib2, etc. |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 637 | PROJ_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) |
| 638 | PROJ_LIBS_OPTIONS_G := $(patsubst %.o, $(PROJLIBDEBUGSOURCE)/%.o, $(PROJ_LIBS_OPTIONS)) |
| 639 | PROJ_LIBS_OPTIONS_O := $(patsubst %.o, $(PROJLIBRELEASESOURCE)/%.o,$(PROJ_LIBS_OPTIONS)) |
| 640 | PROJ_LIBS_OPTIONS_P := $(patsubst %.o, $(PROJLIBPROFILESOURCE)/%.o,$(PROJ_LIBS_OPTIONS)) |
| 641 | |
| 642 | LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS))) |
| 643 | LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o, $(LLVM_LIBS_OPTIONS)) |
| 644 | LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS)) |
| 645 | LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS)) |
| 646 | |
| 647 | LIB_OPTS_G := $(LLVM_LIBS_OPTIONS_G) $(PROJ_LIBS_OPTIONS_G) |
Chris Lattner | e3ba95e | 2003-06-20 15:41:57 +0000 | [diff] [blame] | 648 | LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_O) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 649 | LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P) $(PROJ_LIBS_OPTIONS_P) |
| 650 | |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 651 | # USED_LIB_PATHS - Compute the path of the libraries used so that tools are |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 652 | # rebuilt if libraries change. This has to make sure to handle .a/.so and .o |
Misha Brukman | 1ba3138 | 2003-07-14 17:26:34 +0000 | [diff] [blame] | 653 | # files separately. |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 654 | # |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 655 | STATICUSEDLIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS))) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 656 | USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS)) |
| 657 | USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS)) |
| 658 | USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS)) |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 659 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 660 | # |
| 661 | # Libtool link options: |
| 662 | # Ensure that all binaries have their symbols exported so that they can |
| 663 | # by dlsym'ed. |
| 664 | # |
| 665 | LINK_OPTS := -export-dynamic $(TOOLLINKOPTS) |
Chris Lattner | 8d7dfb3 | 2003-01-22 16:13:31 +0000 | [diff] [blame] | 666 | |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 667 | |
| 668 | |
| 669 | |
| 670 | |
Chris Lattner | 8d7dfb3 | 2003-01-22 16:13:31 +0000 | [diff] [blame] | 671 | # Tell make that we need to rebuild subdirectories before we can link the tool. |
| 672 | # This affects things like LLI which has library subdirectories. |
| 673 | $(USED_LIB_PATHS_G) $(USED_LIB_PATHS_O) $(USED_LIB_PATHS_P): \ |
| 674 | $(addsuffix /.makeall, $(PARALLEL_DIRS)) |
| 675 | |
Chris Lattner | 669bd7c | 2001-10-13 05:10:29 +0000 | [diff] [blame] | 676 | all:: $(TOOLEXENAMES) |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 677 | |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 678 | clean:: |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 679 | $(VERB) $(RM) -f $(TOOLEXENAMES) |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 680 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 681 | $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 682 | @${ECHO} Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG) |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 683 | $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) $(LIBS) |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 684 | @${ECHO} ======= Finished building $(TOOLNAME) debug executable $(STRIP_WARN_MSG) ======= |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 685 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 686 | $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 687 | @${ECHO} Linking $(TOOLNAME) release executable |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 688 | $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS) $(LIBS) |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 689 | @${ECHO} ======= Finished building $(TOOLNAME) release executable ======= |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 690 | |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 691 | $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 692 | @${ECHO} Linking $(TOOLNAME) profile executable |
John Criswell | f4ccd99 | 2003-07-01 14:52:28 +0000 | [diff] [blame] | 693 | $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS) $(LIBS) |
John Criswell | a4c5352 | 2003-11-03 21:12:49 +0000 | [diff] [blame] | 694 | @${ECHO} ======= Finished building $(TOOLNAME) profile executable ======= |
Vikram S. Adve | 41e7891 | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 695 | |
Brian Gaeke | 44909cf | 2003-12-10 00:26:28 +0000 | [diff] [blame] | 696 | install:: $(TOOLEXENAMES) |
Brian Gaeke | 6c09696 | 2004-02-09 17:38:52 +0000 | [diff] [blame] | 697 | $(MKDIR) $(DESTDIR)$(bindir) |
Brian Gaeke | 819567d | 2004-01-21 21:20:44 +0000 | [diff] [blame] | 698 | $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) -c -m 0755 $(TOOLEXENAMES) $(DESTDIR)$(bindir)/$(TOOLNAME) |
Brian Gaeke | 44909cf | 2003-12-10 00:26:28 +0000 | [diff] [blame] | 699 | |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 700 | endif |
| 701 | |
| 702 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 703 | |
| 704 | #--------------------------------------------------------- |
Chris Lattner | 0df847a | 2003-09-15 22:17:02 +0000 | [diff] [blame] | 705 | .PRECIOUS: $(BUILD_OBJ_DIR)/Depend/.dir $(BUILD_OBJ_DIR)/BytecodeObj/.dir |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 706 | .PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir |
Chris Lattner | d85b7a4 | 2004-07-08 03:42:20 +0000 | [diff] [blame] | 707 | .PRECIOUS: $(BUILD_OBJ_DIR)/Profile/.dir |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 708 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 709 | # Create .lo files in the ObjectFiles directory from the .cpp and .c files... |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 710 | $(BUILD_OBJ_DIR)/Release/%.lo: %.cpp $(BUILD_OBJ_DIR)/Release/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 711 | @${ECHO} "Compiling `basename $<`" |
Misha Brukman | b5f096f | 2002-09-12 16:05:39 +0000 | [diff] [blame] | 712 | $(VERB) $(CompileO) $< -o $@ |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 713 | |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 714 | $(BUILD_OBJ_DIR)/Release/%.lo: %.c $(BUILD_OBJ_DIR)/Release/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 715 | @${ECHO} "Compiling `basename $<`" |
Chris Lattner | 1eeac66 | 2002-10-22 23:28:23 +0000 | [diff] [blame] | 716 | $(VERB) $(CompileCO) $< -o $@ |
Vikram S. Adve | 112a72c | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 717 | |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 718 | $(BUILD_OBJ_DIR)/Profile/%.lo: %.cpp $(BUILD_OBJ_DIR)/Profile/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 719 | @${ECHO} "Compiling `basename $<`" |
Vikram S. Adve | 41e7891 | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 720 | $(VERB) $(CompileP) $< -o $@ |
| 721 | |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 722 | $(BUILD_OBJ_DIR)/Profile/%.lo: %.c $(BUILD_OBJ_DIR)/Profile/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 723 | @${ECHO} "Compiling `basename $<`" |
Chris Lattner | 172b648 | 2002-09-22 02:47:15 +0000 | [diff] [blame] | 724 | $(VERB) $(CompileCP) $< -o $@ |
| 725 | |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 726 | $(BUILD_OBJ_DIR)/Debug/%.lo: %.cpp $(BUILD_OBJ_DIR)/Debug/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 727 | @${ECHO} "Compiling `basename $<`" |
Misha Brukman | b5f096f | 2002-09-12 16:05:39 +0000 | [diff] [blame] | 728 | $(VERB) $(CompileG) $< -o $@ |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 729 | |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 730 | $(BUILD_OBJ_DIR)/Debug/%.lo: %.c $(BUILD_OBJ_DIR)/Debug/.dir |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 731 | @${ECHO} "Compiling `basename $<`" |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 732 | $(VERB) $(CompileCG) $< -o $@ |
| 733 | |
Chris Lattner | 0df847a | 2003-09-15 22:17:02 +0000 | [diff] [blame] | 734 | $(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.cpp $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LCC1XX) |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 735 | @${ECHO} "Compiling `basename $<` to bytecode" |
Chris Lattner | d180300 | 2003-12-06 20:59:45 +0000 | [diff] [blame] | 736 | $(VERB) $(LLVMGXX) $(CompileCommonOpts) $(CPPFLAGS) -c $< -o $@ |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 737 | |
Chris Lattner | 0df847a | 2003-09-15 22:17:02 +0000 | [diff] [blame] | 738 | $(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.c $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LCC1) |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 739 | @${ECHO} "Compiling `basename $<` to bytecode" |
Chris Lattner | d180300 | 2003-12-06 20:59:45 +0000 | [diff] [blame] | 740 | $(VERB) $(LLVMGCC) $(CompileCommonOpts) $(CPPFLAGS) -c $< -o $@ |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 741 | |
Chris Lattner | 0df847a | 2003-09-15 22:17:02 +0000 | [diff] [blame] | 742 | $(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.ll $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LLVMAS) |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 743 | @${ECHO} "Compiling `basename $<` to bytecode" |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 744 | $(VERB) $(LLVMAS) $< -f -o $@ |
| 745 | |
| 746 | |
Chris Lattner | e899678 | 2003-01-16 22:44:19 +0000 | [diff] [blame] | 747 | # |
| 748 | # Rules for building lex/yacc files |
| 749 | # |
| 750 | LEX_FILES = $(filter %.l, $(Source)) |
| 751 | LEX_OUTPUT = $(LEX_FILES:%.l=%.cpp) |
| 752 | YACC_FILES = $(filter %.y, $(Source)) |
| 753 | YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output) |
| 754 | .PRECIOUS: $(LEX_OUTPUT) $(YACC_OUTPUT) |
| 755 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 756 | # Create a .cpp source file from a flex input file... this uses sed to cut down |
| 757 | # on the warnings emited by GCC... |
Chris Lattner | 6d131b4 | 2003-01-23 16:33:10 +0000 | [diff] [blame] | 758 | # |
| 759 | # The last line is a gross hack to work around flex aparently not being able to |
| 760 | # resize the buffer on a large token input. Currently, for uninitialized string |
| 761 | # buffers in LLVM we can generate very long tokens, so this is a hack around it. |
Chris Lattner | b7dc2b9 | 2003-08-15 20:00:47 +0000 | [diff] [blame] | 762 | # FIXME. (f.e. char Buffer[10000] ) |
Chris Lattner | 6d131b4 | 2003-01-23 16:33:10 +0000 | [diff] [blame] | 763 | # |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 764 | %.cpp: %.l |
John Criswell | 7ec78aa | 2003-10-16 01:49:00 +0000 | [diff] [blame] | 765 | @${ECHO} Flexing $< |
Chris Lattner | 7bb107d | 2003-08-04 19:48:10 +0000 | [diff] [blame] | 766 | $(VERB) $(FLEX) -t $< | \ |
| 767 | $(SED) '/^find_rule/d' | \ |
| 768 | $(SED) 's/void yyunput/inline void yyunput/' | \ |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 769 | $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \ |
Chris Lattner | a328f88 | 2003-08-04 19:47:06 +0000 | [diff] [blame] | 770 | $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \ |
| 771 | > $@.tmp |
John Criswell | d741bcf | 2003-08-12 18:51:51 +0000 | [diff] [blame] | 772 | $(VERB) cmp -s $@ $@.tmp > /dev/null || ${MV} -f $@.tmp $@ |
Chris Lattner | a328f88 | 2003-08-04 19:47:06 +0000 | [diff] [blame] | 773 | @# remove the output of flex if it didn't get moved over... |
| 774 | @rm -f $@.tmp |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 775 | |
| 776 | # Rule for building the bison parsers... |
Chris Lattner | 694c5df | 2003-05-15 21:28:55 +0000 | [diff] [blame] | 777 | %.c: %.y # Cancel built-in rules for yacc |
| 778 | %.h: %.y # Cancel built-in rules for yacc |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 779 | %.cpp %.h : %.y |
Misha Brukman | b6d59a2 | 2003-11-05 06:41:14 +0000 | [diff] [blame] | 780 | @${ECHO} "Bisoning `basename $<`" |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 781 | $(VERB) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $< |
John Criswell | d741bcf | 2003-08-12 18:51:51 +0000 | [diff] [blame] | 782 | $(VERB) cmp -s $*.tab.c $*.cpp > /dev/null || ${MV} -f $*.tab.c $*.cpp |
| 783 | $(VERB) cmp -s $*.tab.h $*.h > /dev/null || ${MV} -f $*.tab.h $*.h |
Chris Lattner | a328f88 | 2003-08-04 19:47:06 +0000 | [diff] [blame] | 784 | @# If the files were not updated, don't leave them lying around... |
| 785 | @rm -f $*.tab.c $*.tab.h |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 786 | |
| 787 | # To create the directories... |
| 788 | %/.dir: |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 789 | $(VERB) ${MKDIR} $* > /dev/null |
| 790 | @$(DATE) > $@ |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 791 | |
Chris Lattner | 30440c6 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 792 | # To create postscript files from dot files... |
John Criswell | e0f9ac6 | 2003-10-02 19:02:02 +0000 | [diff] [blame] | 793 | ifneq ($(DOT),false) |
Chris Lattner | 30440c6 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 794 | %.ps: %.dot |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 795 | ${DOT} -Tps < $< > $@ |
| 796 | else |
| 797 | %.ps: %.dot |
| 798 | ${ECHO} "Cannot build $@: The program dot is not installed" |
| 799 | endif |
Chris Lattner | 30440c6 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 800 | |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 801 | # |
| 802 | # This rules ensures that header files that are removed still have a rule for |
| 803 | # which they can be "generated." This allows make to ignore them and |
| 804 | # reproduce the dependency lists. |
| 805 | # |
John Criswell | 4b6e5d1 | 2003-09-18 18:37:08 +0000 | [diff] [blame] | 806 | %.h:: ; |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 807 | |
Chris Lattner | 172b648 | 2002-09-22 02:47:15 +0000 | [diff] [blame] | 808 | # 'make clean' nukes the tree |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 809 | clean:: |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 810 | $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release |
| 811 | $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend |
Chris Lattner | 0df847a | 2003-09-15 22:17:02 +0000 | [diff] [blame] | 812 | $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/BytecodeObj |
Brian Gaeke | 9d3cd40 | 2004-01-21 19:53:11 +0000 | [diff] [blame] | 813 | $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc |
| 814 | ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set |
| 815 | $(VERB) $(RM) -f *$(SHLIBEXT) |
| 816 | endif |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 817 | $(VERB) $(RM) -f $(LEX_OUTPUT) $(YACC_OUTPUT) |
| 818 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 819 | ########################################################################### |
| 820 | # C/C++ Dependencies |
| 821 | # Define variables and rules that generate header file dependencies |
| 822 | # from C/C++ source files. |
| 823 | ########################################################################### |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 824 | |
Chris Lattner | 33ad24a | 2003-08-22 14:10:16 +0000 | [diff] [blame] | 825 | ifndef DISABLE_AUTO_DEPENDENCIES |
| 826 | |
Chris Lattner | 694c5df | 2003-05-15 21:28:55 +0000 | [diff] [blame] | 827 | # If dependencies were generated for the file that included this file, |
Misha Brukman | 36bc642 | 2003-08-21 22:02:18 +0000 | [diff] [blame] | 828 | # include the dependencies now... |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 829 | # |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 830 | SourceBaseNames := $(basename $(Source)) |
John Criswell | 8bff509 | 2003-06-11 13:55:44 +0000 | [diff] [blame] | 831 | SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d) |
Chris Lattner | 694c5df | 2003-05-15 21:28:55 +0000 | [diff] [blame] | 832 | |
| 833 | # Create dependencies for the *.cpp files... |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 834 | $(BUILD_OBJ_DIR)/Depend/%.d: %.cpp $(BUILD_OBJ_DIR)/Depend/.dir |
Chris Lattner | 52d792c | 2003-11-08 21:23:06 +0000 | [diff] [blame] | 835 | $(VERB) $(Depend) $< | $(SED) 's|\.o:|\.lo:|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@ |
Chris Lattner | 694c5df | 2003-05-15 21:28:55 +0000 | [diff] [blame] | 836 | |
| 837 | # Create dependencies for the *.c files... |
John Criswell | 410d1b5 | 2003-09-09 20:57:03 +0000 | [diff] [blame] | 838 | $(BUILD_OBJ_DIR)/Depend/%.d: %.c $(BUILD_OBJ_DIR)/Depend/.dir |
Chris Lattner | 52d792c | 2003-11-08 21:23:06 +0000 | [diff] [blame] | 839 | $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o:|\.lo:|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@ |
Chris Lattner | 694c5df | 2003-05-15 21:28:55 +0000 | [diff] [blame] | 840 | |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 841 | # |
John Criswell | bd08280 | 2003-10-07 14:16:44 +0000 | [diff] [blame] | 842 | # Autoconf Dependencies. |
| 843 | # |
Misha Brukman | 94fe1f9 | 2003-10-07 15:24:23 +0000 | [diff] [blame] | 844 | $(LLVM_OBJ_ROOT)/config.status:: $(LLVM_SRC_ROOT)/configure |
Chris Lattner | 4faf860 | 2003-10-10 15:55:43 +0000 | [diff] [blame] | 845 | @${ECHO} "****************************************************************" |
| 846 | @${ECHO} " You need to re-run $(LLVM_SRC_ROOT)/configure" |
| 847 | @${ECHO} " in directory $(LLVM_OBJ_ROOT)" |
| 848 | @${ECHO} "****************************************************************" |
John Criswell | bd08280 | 2003-10-07 14:16:44 +0000 | [diff] [blame] | 849 | $(VERB) exit 1 |
| 850 | |
Misha Brukman | 4f7a8cf | 2003-11-09 21:36:19 +0000 | [diff] [blame] | 851 | # If the Makefile in the source tree has been updated, copy it over into the |
| 852 | # build tree. |
| 853 | Makefile :: $(BUILD_SRC_DIR)/Makefile |
Misha Brukman | 2fe6909 | 2003-11-11 00:05:29 +0000 | [diff] [blame] | 854 | @${ECHO} "===== Updating Makefile from source dir: `dirname $<` =====" |
John Criswell | b3866b6 | 2003-11-25 19:32:22 +0000 | [diff] [blame] | 855 | $(MKDIR) $(@D) |
Misha Brukman | 4f7a8cf | 2003-11-09 21:36:19 +0000 | [diff] [blame] | 856 | cp -f $< $@ |
| 857 | |
John Criswell | bd08280 | 2003-10-07 14:16:44 +0000 | [diff] [blame] | 858 | # |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 859 | # Include dependencies generated from C/C++ source files, but not if we |
| 860 | # are cleaning (this example taken from the GNU Make Manual). |
| 861 | # |
| 862 | ifneq ($(MAKECMDGOALS),clean) |
John Criswell | d741bcf | 2003-08-12 18:51:51 +0000 | [diff] [blame] | 863 | ifneq ($(MAKECMDGOALS),distclean) |
Chris Lattner | 15444a9 | 2003-08-29 14:07:02 +0000 | [diff] [blame] | 864 | -include /dev/null $(SourceDepend) |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 865 | endif |
John Criswell | d741bcf | 2003-08-12 18:51:51 +0000 | [diff] [blame] | 866 | endif |
Chris Lattner | 1ddb6b6 | 2003-08-18 17:27:40 +0000 | [diff] [blame] | 867 | |
Chris Lattner | 33ad24a | 2003-08-22 14:10:16 +0000 | [diff] [blame] | 868 | endif # ifndef DISABLE_AUTO_DEPENDENCIES |