| Misha Brukman | 7426c89 | 2004-04-24 00:10:56 +0000 | [diff] [blame] | 1 | #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===# |
| 2 | # |
| John Criswell | 23e43fb | 2003-10-21 14:33:46 +0000 | [diff] [blame] | 3 | # The LLVM Compiler Infrastructure |
| 4 | # |
| Chris Lattner | 11cc8b3 | 2007-12-29 20:11:13 +0000 | [diff] [blame] | 5 | # This file is distributed under the University of Illinois Open Source |
| 6 | # License. See LICENSE.TXT for details. |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 7 | # |
| Misha Brukman | 7426c89 | 2004-04-24 00:10:56 +0000 | [diff] [blame] | 8 | #===------------------------------------------------------------------------===# |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 9 | # |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 10 | # This file is included by all of the LLVM makefiles. For details on how to use |
| 11 | # it properly, please see the document MakefileGuide.html in the docs directory. |
| Chris Lattner | 2e9fc94a | 2003-08-15 03:02:52 +0000 | [diff] [blame] | 12 | # |
| Chris Lattner | b8e7aa0 | 2006-02-14 04:27:15 +0000 | [diff] [blame] | 13 | #===-----------------------------------------------------------------------====# |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 14 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 15 | ################################################################################ |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 16 | # TARGETS: Define standard targets that can be invoked |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 17 | ################################################################################ |
| John Criswell | 3ef61af | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 18 | |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 19 | #-------------------------------------------------------------------- |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 20 | # Define the various target sets |
| 21 | #-------------------------------------------------------------------- |
| Daniel Dunbar | 96ccc47 | 2009-09-13 22:39:27 +0000 | [diff] [blame] | 22 | RecursiveTargets := all clean clean-all install uninstall install-bytecode \ |
| 23 | unitcheck |
| Reid Spencer | 8b5ebe5 | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 24 | LocalTargets := all-local clean-local clean-all-local check-local \ |
| Reid Spencer | d4bd375 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 25 | install-local printvars uninstall-local \ |
| Daniel Dunbar | 96ccc47 | 2009-09-13 22:39:27 +0000 | [diff] [blame] | 26 | install-bytecode-local |
| Chris Lattner | d0382a8 | 2007-09-26 06:10:47 +0000 | [diff] [blame] | 27 | TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \ |
| Bill Wendling | 8790e32 | 2009-01-04 23:12:21 +0000 | [diff] [blame] | 28 | dist-zip unittests |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 29 | UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets) |
| 30 | InternalTargets := preconditions distdir dist-hook |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 31 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 32 | ################################################################################ |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 33 | # INITIALIZATION: Basic things the makefile needs |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 34 | ################################################################################ |
| 35 | |
| 36 | #-------------------------------------------------------------------- |
| 37 | # Set the VPATH so that we can find source files. |
| 38 | #-------------------------------------------------------------------- |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 39 | VPATH=$(PROJ_SRC_DIR) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 40 | |
| 41 | #-------------------------------------------------------------------- |
| Reid Spencer | 7214cfd | 2007-06-29 14:02:07 +0000 | [diff] [blame] | 42 | # Reset the list of suffixes we know how to build. |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 43 | #-------------------------------------------------------------------- |
| 44 | .SUFFIXES: |
| Rafael Espindola | bff44dd | 2013-07-25 20:25:31 +0000 | [diff] [blame] | 45 | .SUFFIXES: .c .cpp .cc .h .hpp .o .a .td .ps .dot .m .mm |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 46 | .SUFFIXES: $(SHLIBEXT) $(SUFFIXES) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 47 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 48 | #-------------------------------------------------------------------- |
| 49 | # Mark all of these targets as phony to avoid implicit rule search |
| 50 | #-------------------------------------------------------------------- |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 51 | .PHONY: $(UserTargets) $(InternalTargets) |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 52 | |
| 53 | #-------------------------------------------------------------------- |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 54 | # Make sure all the user-target rules are double colon rules and |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 55 | # they are defined first. |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 56 | #-------------------------------------------------------------------- |
| 57 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 58 | $(UserTargets):: |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 59 | |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 60 | #------------------------------------------------------------------------ |
| 61 | # LLVMBuild Integration |
| 62 | #------------------------------------------------------------------------ |
| 63 | # |
| 64 | # We use llvm-build to generate all the data required by the Makefile based |
| 65 | # build system in one swoop: |
| 66 | # |
| 67 | # - We generate a file (a Makefile fragment) in the object root which contains |
| 68 | # all the definitions that are required by Makefiles across the entire |
| 69 | # project. |
| 70 | # |
| 71 | # - We generate the library table used by llvm-config. |
| 72 | # |
| 73 | # - We generate the dependencies for the Makefile fragment, so that we will |
| 74 | # automatically reconfigure outselves. |
| 75 | |
| 76 | # The path to the llvm-build tool itself. |
| 77 | LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build |
| 78 | |
| 79 | # The files we are going to generate using llvm-build. |
| 80 | LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild |
| NAKAMURA Takumi | 01e3c64f | 2014-02-09 16:37:02 +0000 | [diff] [blame] | 81 | LLVMBuildCMakeFrag := $(PROJ_OBJ_ROOT)/LLVMBuild.cmake |
| 82 | LLVMBuildCMakeExportsFrag := $(PROJ_OBJ_ROOT)/cmake/modules/LLVMBuildExports.cmake |
| 83 | LLVMBuildMakeFrags := \ |
| 84 | $(LLVMBuildMakeFrag) \ |
| 85 | $(LLVMBuildCMakeFrag) \ |
| 86 | $(LLVMBuildCMakeExportsFrag) |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 87 | LLVMConfigLibraryDependenciesInc := \ |
| Daniel Dunbar | ab0ad4e | 2011-12-01 20:18:09 +0000 | [diff] [blame] | 88 | $(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 89 | |
| Daniel Dunbar | 48032f9 | 2011-11-12 00:18:02 +0000 | [diff] [blame] | 90 | # This is for temporary backwards compatibility. |
| 91 | ifndef TARGET_NATIVE_ARCH |
| 92 | TARGET_NATIVE_ARCH := $(ARCH) |
| 93 | endif |
| 94 | |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 95 | # The rule to create the LLVMBuild Makefile fragment as well as the llvm-config |
| 96 | # library table. |
| 97 | # |
| 98 | # Note that this target gets its real dependencies generated for us by |
| 99 | # llvm-build. |
| Daniel Dunbar | 83b7009 | 2011-11-09 18:48:22 +0000 | [diff] [blame] | 100 | # |
| 101 | # We include a dependency on this Makefile to ensure that changes to the |
| 102 | # generation command get picked up. |
| NAKAMURA Takumi | 01e3c64f | 2014-02-09 16:37:02 +0000 | [diff] [blame] | 103 | $(LLVMBuildMakeFrags): $(PROJ_SRC_ROOT)/Makefile.rules \ |
| 104 | $(PROJ_OBJ_ROOT)/Makefile.config |
| Daniel Dunbar | 1bd49de | 2011-11-03 23:01:50 +0000 | [diff] [blame] | 105 | $(Echo) Constructing LLVMBuild project information. |
| Saleem Abdulrasool | 26127bd | 2013-01-30 04:07:37 +0000 | [diff] [blame] | 106 | $(Verb)$(PYTHON) $(LLVMBuildTool) \ |
| Daniel Dunbar | 48032f9 | 2011-11-12 00:18:02 +0000 | [diff] [blame] | 107 | --native-target "$(TARGET_NATIVE_ARCH)" \ |
| Daniel Dunbar | 807c6e4 | 2011-11-10 01:16:48 +0000 | [diff] [blame] | 108 | --enable-targets "$(TARGETS_TO_BUILD)" \ |
| Preston Gurd | e65f4e6 | 2012-05-07 19:38:40 +0000 | [diff] [blame] | 109 | --enable-optional-components "$(OPTIONAL_COMPONENTS)" \ |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 110 | --write-library-table $(LLVMConfigLibraryDependenciesInc) \ |
| NAKAMURA Takumi | 01e3c64f | 2014-02-09 16:37:02 +0000 | [diff] [blame] | 111 | --write-make-fragment $(LLVMBuildMakeFrag) \ |
| 112 | --write-cmake-fragment $(LLVMBuildCMakeFrag) \ |
| 113 | --write-cmake-exports-fragment $(LLVMBuildCMakeExportsFrag) |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 114 | |
| Daniel Dunbar | 83b7009 | 2011-11-09 18:48:22 +0000 | [diff] [blame] | 115 | # For completeness, let Make know how the extra files are generated. |
| NAKAMURA Takumi | 01e3c64f | 2014-02-09 16:37:02 +0000 | [diff] [blame] | 116 | $(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrags) |
| Daniel Dunbar | 83b7009 | 2011-11-09 18:48:22 +0000 | [diff] [blame] | 117 | |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 118 | # Include the generated Makefile fragment. |
| 119 | # |
| 120 | # We currently only include the dependencies for the fragment itself if we are |
| 121 | # at the top-level. Otherwise, recursive invocations would ends up doing |
| 122 | # substantially more redundant stat'ing. |
| 123 | # |
| 124 | # This means that we won't properly regenerate things for developers used to |
| 125 | # building from a subdirectory, but that is always somewhat unreliable. |
| 126 | ifeq ($(LEVEL),.) |
| 127 | LLVMBUILD_INCLUDE_DEPENDENCIES := 1 |
| Daniel Dunbar | e30365b | 2012-02-02 23:27:34 +0000 | [diff] [blame] | 128 | |
| 129 | # Clean the generated makefile fragment at the top-level. |
| 130 | clean-local:: |
| NAKAMURA Takumi | 01e3c64f | 2014-02-09 16:37:02 +0000 | [diff] [blame] | 131 | -$(Verb) $(RM) -f $(LLVMBuildMakeFrags) |
| Daniel Dunbar | b4ce26a | 2011-11-03 22:46:21 +0000 | [diff] [blame] | 132 | endif |
| 133 | -include $(LLVMBuildMakeFrag) |
| 134 | |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 135 | ################################################################################ |
| 136 | # PRECONDITIONS: that which must be built/checked first |
| 137 | ################################################################################ |
| 138 | |
| Reid Spencer | d4bd375 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 139 | SrcMakefiles := $(filter %Makefile %Makefile.tests,\ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 140 | $(wildcard $(PROJ_SRC_DIR)/Makefile*)) |
| 141 | ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles)) |
| 142 | ConfigureScript := $(PROJ_SRC_ROOT)/configure |
| 143 | ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status |
| 144 | MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in)) |
| 145 | MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in)) |
| 146 | MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config |
| 147 | MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common |
| 148 | PreConditions := $(ConfigStatusScript) $(ObjMakefiles) |
| 149 | ifneq ($(MakefileCommonIn),) |
| 150 | PreConditions += $(MakefileCommon) |
| 151 | endif |
| Chris Lattner | 68c9754 | 2006-09-04 05:23:20 +0000 | [diff] [blame] | 152 | |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 153 | ifneq ($(MakefileConfigIn),) |
| 154 | PreConditions += $(MakefileConfig) |
| 155 | endif |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 156 | |
| Reid Spencer | 53846bc | 2005-08-25 04:59:49 +0000 | [diff] [blame] | 157 | preconditions: $(PreConditions) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 158 | |
| 159 | #------------------------------------------------------------------------ |
| 160 | # Make sure the BUILT_SOURCES are built first |
| 161 | #------------------------------------------------------------------------ |
| Reid Spencer | 97e40f1 | 2004-12-16 07:15:16 +0000 | [diff] [blame] | 162 | $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 163 | |
| Reid Spencer | 48c7439 | 2007-02-07 19:13:19 +0000 | [diff] [blame] | 164 | clean-all-local:: |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 165 | ifneq ($(strip $(BUILT_SOURCES)),) |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 166 | -$(Verb) $(RM) -f $(BUILT_SOURCES) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 167 | endif |
| 168 | |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 169 | ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT)) |
| Reid Spencer | 5581437 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 170 | spotless: |
| Reid Spencer | 5581437 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 171 | $(Verb) if test -x config.status ; then \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 172 | $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \ |
| Reid Spencer | 7ef8e66 | 2004-12-17 07:45:03 +0000 | [diff] [blame] | 173 | $(MKDIR) .spotless.save ; \ |
| 174 | $(MV) config.status .spotless.save ; \ |
| 175 | $(MV) mklib .spotless.save ; \ |
| 176 | $(MV) projects .spotless.save ; \ |
| Reid Spencer | 5581437 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 177 | $(RM) -rf * ; \ |
| Reid Spencer | 7ef8e66 | 2004-12-17 07:45:03 +0000 | [diff] [blame] | 178 | $(MV) .spotless.save/config.status . ; \ |
| 179 | $(MV) .spotless.save/mklib . ; \ |
| 180 | $(MV) .spotless.save/projects . ; \ |
| 181 | $(RM) -rf .spotless.save ; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 182 | $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \ |
| Reid Spencer | 7ef8e66 | 2004-12-17 07:45:03 +0000 | [diff] [blame] | 183 | $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \ |
| 184 | $(ConfigStatusScript) ; \ |
| Reid Spencer | 5581437 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 185 | else \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 186 | $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \ |
| Reid Spencer | 5581437 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 187 | fi |
| Reid Spencer | c49a863 | 2005-12-21 23:17:06 +0000 | [diff] [blame] | 188 | else |
| 189 | spotless: |
| 190 | $(EchoCmd) "spotless target not supported for objdir == srcdir" |
| Reid Spencer | 5581437 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 191 | endif |
| 192 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 193 | $(BUILT_SOURCES) : $(ObjMakefiles) |
| Reid Spencer | b7f710a | 2004-10-28 00:41:43 +0000 | [diff] [blame] | 194 | |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 195 | #------------------------------------------------------------------------ |
| 196 | # Make sure we're not using a stale configuration |
| 197 | #------------------------------------------------------------------------ |
| Reid Spencer | afdc82c | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 198 | reconfigure: |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 199 | $(Echo) Reconfiguring $(PROJ_OBJ_ROOT) |
| 200 | $(Verb) cd $(PROJ_OBJ_ROOT) && \ |
| Reid Spencer | afdc82c | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 201 | $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \ |
| 202 | $(ConfigStatusScript) |
| 203 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 204 | .PRECIOUS: $(ConfigStatusScript) |
| Jim Grosbach | d4ee845 | 2010-10-01 22:32:12 +0000 | [diff] [blame] | 205 | $(ConfigStatusScript): $(ConfigureScript) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 206 | $(Echo) Reconfiguring with $< |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 207 | $(Verb) cd $(PROJ_OBJ_ROOT) && \ |
| Reid Spencer | 50f3487 | 2004-11-29 12:37:44 +0000 | [diff] [blame] | 208 | $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \ |
| 209 | $(ConfigStatusScript) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 210 | |
| Reid Spencer | 83bde55 | 2005-08-25 04:44:18 +0000 | [diff] [blame] | 211 | #------------------------------------------------------------------------ |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 212 | # Make sure the configuration makefile is up to date |
| 213 | #------------------------------------------------------------------------ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 214 | ifneq ($(MakefileConfigIn),) |
| 215 | $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 216 | $(Echo) Regenerating $@ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 217 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config |
| 218 | endif |
| 219 | |
| 220 | ifneq ($(MakefileCommonIn),) |
| 221 | $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript) |
| 222 | $(Echo) Regenerating $@ |
| 223 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common |
| 224 | endif |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 225 | |
| 226 | #------------------------------------------------------------------------ |
| 227 | # If the Makefile in the source tree has been updated, copy it over into the |
| 228 | # build tree. But, only do this if the source and object makefiles differ |
| 229 | #------------------------------------------------------------------------ |
| Daniel Dunbar | 4c5301d | 2010-09-09 17:38:11 +0000 | [diff] [blame] | 230 | ifndef PROJ_MAKEFILE |
| 231 | PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile |
| 232 | endif |
| 233 | |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 234 | ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR)) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 235 | |
| Daniel Dunbar | 4c5301d | 2010-09-09 17:38:11 +0000 | [diff] [blame] | 236 | Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 237 | $(Echo) "Updating Makefile" |
| 238 | $(Verb) $(MKDIR) $(@D) |
| Reid Spencer | afdc82c | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 239 | $(Verb) $(CP) -f $< $@ |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 240 | |
| 241 | # Copy the Makefile.* files unless we're in the root directory which avoids |
| 242 | # the copying of Makefile.config.in or other things that should be explicitly |
| 243 | # taken care of. |
| Daniel Dunbar | 4c5301d | 2010-09-09 17:38:11 +0000 | [diff] [blame] | 244 | $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)% |
| Reid Spencer | d94bb33 | 2004-10-26 23:10:00 +0000 | [diff] [blame] | 245 | @case '$?' in \ |
| 246 | *Makefile.rules) ;; \ |
| 247 | *.in) ;; \ |
| Gordon Henriksen | 04e38cf | 2008-03-10 15:58:40 +0000 | [diff] [blame] | 248 | *) $(EchoCmd) "Updating $(@F)" ; \ |
| Reid Spencer | d94bb33 | 2004-10-26 23:10:00 +0000 | [diff] [blame] | 249 | $(MKDIR) $(@D) ; \ |
| Reid Spencer | afdc82c | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 250 | $(CP) -f $< $@ ;; \ |
| Reid Spencer | d94bb33 | 2004-10-26 23:10:00 +0000 | [diff] [blame] | 251 | esac |
| Gabor Greif | c848f9e | 2008-02-27 13:34:15 +0000 | [diff] [blame] | 252 | |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 253 | endif |
| 254 | |
| 255 | #------------------------------------------------------------------------ |
| 256 | # Set up the basic dependencies |
| 257 | #------------------------------------------------------------------------ |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 258 | $(UserTargets):: $(PreConditions) |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 259 | |
| 260 | all:: all-local |
| Anton Korobeynikov | 8e58c52 | 2008-11-10 07:33:13 +0000 | [diff] [blame] | 261 | clean:: clean-local |
| Reid Spencer | 9d0c1e0 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 262 | clean-all:: clean-local clean-all-local |
| Reid Spencer | 77a46d2 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 263 | install:: install-local |
| 264 | uninstall:: uninstall-local |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 265 | install-local:: all-local |
| Reid Spencer | d4bd375 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 266 | install-bytecode:: install-bytecode-local |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 267 | |
| 268 | ############################################################################### |
| 269 | # VARIABLES: Set up various variables based on configuration data |
| 270 | ############################################################################### |
| 271 | |
| Daniel Dunbar | 78caa02 | 2008-10-03 19:11:19 +0000 | [diff] [blame] | 272 | # Variable for if this make is for a "cleaning" target |
| 273 | ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),) |
| 274 | IS_CLEANING_TARGET=1 |
| 275 | endif |
| 276 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 277 | #-------------------------------------------------------------------- |
| 278 | # Variables derived from configuration we are building |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 279 | #-------------------------------------------------------------------- |
| 280 | |
| Reid Spencer | fd8e641 | 2007-07-10 07:19:53 +0000 | [diff] [blame] | 281 | CPP.Defines := |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 282 | ifeq ($(ENABLE_OPTIMIZED),1) |
| 283 | BuildMode := Release |
| 284 | # Don't use -fomit-frame-pointer on Darwin or FreeBSD. |
| Rafael Espindola | aca9739 | 2013-10-31 14:35:00 +0000 | [diff] [blame] | 285 | ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD)) |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 286 | OmitFramePointer := -fomit-frame-pointer |
| Chris Lattner | c2bd7cf | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 287 | endif |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 288 | |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 289 | CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) |
| 290 | C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) |
| 291 | LD.Flags += $(OPTIMIZE_OPTION) |
| Jeffrey Yasskin | c3273dc | 2009-09-27 17:47:29 +0000 | [diff] [blame] | 292 | ifdef DEBUG_SYMBOLS |
| Jeffrey Yasskin | db28108 | 2009-09-25 16:46:09 +0000 | [diff] [blame] | 293 | BuildMode := $(BuildMode)+Debug |
| 294 | CXX.Flags += -g |
| 295 | C.Flags += -g |
| Jeffrey Yasskin | db28108 | 2009-09-25 16:46:09 +0000 | [diff] [blame] | 296 | KEEP_SYMBOLS := 1 |
| 297 | endif |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 298 | else |
| Daniel Dunbar | 08d4ab9 | 2009-11-16 22:37:52 +0000 | [diff] [blame] | 299 | ifdef NO_DEBUG_SYMBOLS |
| 300 | BuildMode := Unoptimized |
| 301 | CXX.Flags += |
| 302 | C.Flags += |
| Daniel Dunbar | 08d4ab9 | 2009-11-16 22:37:52 +0000 | [diff] [blame] | 303 | KEEP_SYMBOLS := 1 |
| 304 | else |
| 305 | BuildMode := Debug |
| Eric Christopher | f1bd770 | 2013-06-25 01:12:25 +0000 | [diff] [blame] | 306 | ifeq ($(ENABLE_SPLIT_DWARF), 1) |
| 307 | CXX.Flags += -gsplit-dwarf |
| 308 | C.Flags += -gsplit-dwarf |
| 309 | else |
| Daniel Dunbar | 08d4ab9 | 2009-11-16 22:37:52 +0000 | [diff] [blame] | 310 | CXX.Flags += -g |
| 311 | C.Flags += -g |
| Eric Christopher | f1bd770 | 2013-06-25 01:12:25 +0000 | [diff] [blame] | 312 | endif |
| Daniel Dunbar | 08d4ab9 | 2009-11-16 22:37:52 +0000 | [diff] [blame] | 313 | KEEP_SYMBOLS := 1 |
| 314 | endif |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 315 | endif |
| 316 | |
| Eric Christopher | 1094ded | 2011-11-11 22:51:42 +0000 | [diff] [blame] | 317 | ifeq ($(ENABLE_LIBCPP),1) |
| 318 | CXX.Flags += -stdlib=libc++ |
| 319 | LD.Flags += -stdlib=libc++ |
| 320 | endif |
| Chris Lattner | 9304ea4 | 2011-11-10 21:12:28 +0000 | [diff] [blame] | 321 | |
| Chandler Carruth | bbae512 | 2014-03-01 03:33:08 +0000 | [diff] [blame] | 322 | ifeq ($(ENABLE_CXX1Y),1) |
| 323 | CXX.Flags += -std=c++1y |
| 324 | else |
| 325 | CXX.Flags += -std=c++11 |
| Eric Christopher | 04e3597 | 2012-08-03 19:47:14 +0000 | [diff] [blame] | 326 | endif |
| 327 | |
| Eric Christopher | 8486401 | 2012-08-03 19:58:20 +0000 | [diff] [blame] | 328 | ifeq ($(ENABLE_WERROR),1) |
| 329 | CXX.Flags += -Werror |
| 330 | C.Flags += -Werror |
| 331 | endif |
| 332 | |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 333 | ifeq ($(ENABLE_PROFILING),1) |
| 334 | BuildMode := $(BuildMode)+Profile |
| 335 | CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g |
| 336 | C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g |
| Eric Christopher | 1f1578b | 2013-06-25 00:40:03 +0000 | [diff] [blame] | 337 | LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg |
| David Greene | 80f48bd | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 338 | KEEP_SYMBOLS := 1 |
| Chris Lattner | c2bd7cf | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 339 | endif |
| 340 | |
| Benjamin Kramer | d90b595 | 2011-12-22 21:41:32 +0000 | [diff] [blame] | 341 | ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1) |
| Benjamin Kramer | d90b595 | 2011-12-22 21:41:32 +0000 | [diff] [blame] | 342 | CXX.Flags += -fvisibility-inlines-hidden |
| 343 | endif |
| Daniel Dunbar | 61e0a82 | 2008-09-02 17:35:16 +0000 | [diff] [blame] | 344 | |
| Chris Lattner | ab8a7c4 | 2010-01-24 20:20:40 +0000 | [diff] [blame] | 345 | ifdef ENABLE_EXPENSIVE_CHECKS |
| 346 | # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above. |
| 347 | # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160 |
| 348 | REQUIRES_RTTI := 1 |
| 349 | endif |
| 350 | |
| Reid Spencer | 51e6f68 | 2006-08-25 19:54:53 +0000 | [diff] [blame] | 351 | # IF REQUIRES_EH=1 is specified then don't disable exceptions |
| Reid Spencer | 0b6396c | 2006-08-25 20:56:59 +0000 | [diff] [blame] | 352 | ifndef REQUIRES_EH |
| 353 | CXX.Flags += -fno-exceptions |
| Chris Lattner | db308fd | 2010-01-24 20:21:50 +0000 | [diff] [blame] | 354 | else |
| 355 | # If the library requires EH, it also requires RTTI. |
| 356 | REQUIRES_RTTI := 1 |
| Reid Spencer | 0b6396c | 2006-08-25 20:56:59 +0000 | [diff] [blame] | 357 | endif |
| Reid Spencer | 51e6f68 | 2006-08-25 19:54:53 +0000 | [diff] [blame] | 358 | |
| Nicolas Geoffray | 43cce22 | 2009-08-19 22:04:44 +0000 | [diff] [blame] | 359 | ifdef REQUIRES_FRAME_POINTER |
| 360 | CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) |
| 361 | C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) |
| 362 | LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) |
| 363 | endif |
| 364 | |
| Daniel Dunbar | 24c0047 | 2009-09-11 15:47:24 +0000 | [diff] [blame] | 365 | # If REQUIRES_RTTI=1 is specified then don't disable run-time type id. |
| Chris Lattner | 823aed1 | 2010-01-24 20:43:08 +0000 | [diff] [blame] | 366 | ifneq ($(REQUIRES_RTTI), 1) |
| 367 | CXX.Flags += -fno-rtti |
| Reid Spencer | e6bc206 | 2007-05-02 21:29:39 +0000 | [diff] [blame] | 368 | endif |
| 369 | |
| Peter Collingbourne | a92b66e | 2010-10-22 12:54:34 +0000 | [diff] [blame] | 370 | ifeq ($(ENABLE_COVERAGE),1) |
| Daniel Dunbar | 5b86bf5 | 2009-03-13 20:59:41 +0000 | [diff] [blame] | 371 | BuildMode := $(BuildMode)+Coverage |
| Chris Lattner | eaae8d0 | 2009-06-16 23:00:42 +0000 | [diff] [blame] | 372 | CXX.Flags += -ftest-coverage -fprofile-arcs |
| 373 | C.Flags += -ftest-coverage -fprofile-arcs |
| Daniel Dunbar | 5b86bf5 | 2009-03-13 20:59:41 +0000 | [diff] [blame] | 374 | endif |
| 375 | |
| Reid Spencer | 15b8509 | 2006-04-10 16:46:04 +0000 | [diff] [blame] | 376 | # If DISABLE_ASSERTIONS=1 is specified (make command line or configured), |
| 377 | # then disable assertions by defining the appropriate preprocessor symbols. |
| Peter Collingbourne | a92b66e | 2010-10-22 12:54:34 +0000 | [diff] [blame] | 378 | ifeq ($(DISABLE_ASSERTIONS),1) |
| 379 | CPP.Defines += -DNDEBUG |
| 380 | else |
| Duncan Sands | 408bb19 | 2010-07-07 07:48:00 +0000 | [diff] [blame] | 381 | BuildMode := $(BuildMode)+Asserts |
| Reid Spencer | fd8e641 | 2007-07-10 07:19:53 +0000 | [diff] [blame] | 382 | CPP.Defines += -D_DEBUG |
| Chris Lattner | 98c79c3 | 2006-03-21 01:06:41 +0000 | [diff] [blame] | 383 | endif |
| 384 | |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 385 | # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or |
| 386 | # configured), then enable expensive checks by defining the |
| David Greene | 869e4b5 | 2007-06-29 03:36:21 +0000 | [diff] [blame] | 387 | # appropriate preprocessor symbols. |
| Peter Collingbourne | a92b66e | 2010-10-22 12:54:34 +0000 | [diff] [blame] | 388 | ifeq ($(ENABLE_EXPENSIVE_CHECKS),1) |
| David Greene | cbc8ddf | 2007-06-28 19:36:08 +0000 | [diff] [blame] | 389 | BuildMode := $(BuildMode)+Checks |
| Duncan Sands | 445071c | 2008-12-09 21:33:20 +0000 | [diff] [blame] | 390 | CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG |
| David Greene | cbc8ddf | 2007-06-28 19:36:08 +0000 | [diff] [blame] | 391 | endif |
| 392 | |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 393 | # LOADABLE_MODULE implies several other things so we force them to be |
| 394 | # defined/on. |
| 395 | ifdef LOADABLE_MODULE |
| 396 | SHARED_LIBRARY := 1 |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 397 | LINK_LIBS_IN_SHARED := 1 |
| 398 | endif |
| 399 | |
| 400 | ifdef SHARED_LIBRARY |
| 401 | ENABLE_PIC := 1 |
| 402 | PIC_FLAG = "(PIC)" |
| 403 | endif |
| 404 | |
| Reid Spencer | 05a1fe5 | 2006-12-16 22:07:52 +0000 | [diff] [blame] | 405 | ifeq ($(ENABLE_PIC),1) |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 406 | ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| Nick Lewycky | 9e5ed6d | 2009-02-21 08:41:09 +0000 | [diff] [blame] | 407 | # Nothing. Win32 defaults to PIC and warns when given -fPIC |
| 408 | else |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 409 | ifeq ($(HOST_OS),Darwin) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 410 | # Common symbols not allowed in dylib files |
| Nick Lewycky | 9e5ed6d | 2009-02-21 08:41:09 +0000 | [diff] [blame] | 411 | CXX.Flags += -fno-common |
| 412 | C.Flags += -fno-common |
| 413 | else |
| 414 | # Linux and others; pass -fPIC |
| 415 | CXX.Flags += -fPIC |
| 416 | C.Flags += -fPIC |
| 417 | endif |
| 418 | endif |
| Mike Stump | d1b4636 | 2009-05-08 23:08:58 +0000 | [diff] [blame] | 419 | else |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 420 | ifeq ($(HOST_OS),Darwin) |
| Mike Stump | d1b4636 | 2009-05-08 23:08:58 +0000 | [diff] [blame] | 421 | CXX.Flags += -mdynamic-no-pic |
| 422 | C.Flags += -mdynamic-no-pic |
| 423 | endif |
| Reid Spencer | 05a1fe5 | 2006-12-16 22:07:52 +0000 | [diff] [blame] | 424 | endif |
| 425 | |
| Daniel Dunbar | dac1824 | 2010-05-10 20:11:56 +0000 | [diff] [blame] | 426 | # Support makefile variable to disable any kind of timestamp/non-deterministic |
| 427 | # info from being used in the build. |
| 428 | ifeq ($(ENABLE_TIMESTAMPS),1) |
| 429 | DOTDIR_TIMESTAMP_COMMAND := $(DATE) |
| 430 | else |
| 431 | DOTDIR_TIMESTAMP_COMMAND := echo 'Created.' |
| 432 | endif |
| 433 | |
| Anton Korobeynikov | 803c60c | 2010-01-16 14:06:58 +0000 | [diff] [blame] | 434 | ifeq ($(HOST_OS),MingW) |
| 435 | # Work around PR4957 |
| 436 | CPP.Defines += -D__NO_CTYPE_INLINE |
| 437 | ifeq ($(LLVM_CROSS_COMPILING),1) |
| 438 | # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016 |
| 439 | ifdef TOOLNAME |
| 440 | LD.Flags += -Wl,--allow-multiple-definition |
| 441 | endif |
| 442 | endif |
| 443 | endif |
| 444 | |
| Chris Lattner | 8872ec3 | 2011-04-09 06:01:28 +0000 | [diff] [blame] | 445 | CXX.Flags += -Woverloaded-virtual |
| David Greene | cbc8ddf | 2007-06-28 19:36:08 +0000 | [diff] [blame] | 446 | CPP.BaseFlags += $(CPP.Defines) |
| Reid Spencer | 6f682b7 | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 447 | AR.Flags := cru |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 448 | |
| Chris Lattner | dc5a896 | 2006-07-27 18:19:51 +0000 | [diff] [blame] | 449 | # Make Floating point IEEE compliant on Alpha. |
| Andrew Lenharth | 9a98def | 2005-02-13 03:41:10 +0000 | [diff] [blame] | 450 | ifeq ($(ARCH),Alpha) |
| Reid Spencer | 05a1fe5 | 2006-12-16 22:07:52 +0000 | [diff] [blame] | 451 | CXX.Flags += -mieee |
| 452 | CPP.BaseFlags += -mieee |
| 453 | ifeq ($(ENABLE_PIC),0) |
| 454 | CXX.Flags += -fPIC |
| 455 | CPP.BaseFlags += -fPIC |
| 456 | endif |
| Andrew Lenharth | 9a98def | 2005-02-13 03:41:10 +0000 | [diff] [blame] | 457 | |
| Andrew Lenharth | 0ad67b0 | 2007-01-26 13:34:50 +0000 | [diff] [blame] | 458 | LD.Flags += -Wl,--no-relax |
| 459 | endif |
| 460 | |
| NAKAMURA Takumi | 98fa015 | 2010-11-26 09:32:02 +0000 | [diff] [blame] | 461 | # GNU ld/PECOFF accepts but ignores them below; |
| 462 | # --version-script |
| 463 | # --export-dynamic |
| 464 | # --rpath |
| 465 | # FIXME: autoconf should be aware of them. |
| 466 | ifneq (,$(filter $(HOST_OS),Cygwin MingW)) |
| 467 | HAVE_LINK_VERSION_SCRIPT := 0 |
| 468 | RPATH := |
| 469 | RDYNAMIC := -Wl,--export-all-symbols |
| 470 | endif |
| 471 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 472 | #-------------------------------------------------------------------- |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 473 | # Directory locations |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 474 | #-------------------------------------------------------------------- |
| Jim Grosbach | 009db89 | 2008-10-02 22:56:44 +0000 | [diff] [blame] | 475 | TargetMode := |
| 476 | ifeq ($(LLVM_CROSS_COMPILING),1) |
| Anton Korobeynikov | 8e58c52 | 2008-11-10 07:33:13 +0000 | [diff] [blame] | 477 | BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin |
| Jim Grosbach | 009db89 | 2008-10-02 22:56:44 +0000 | [diff] [blame] | 478 | endif |
| 479 | |
| 480 | ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode) |
| Anton Korobeynikov | 8e58c52 | 2008-11-10 07:33:13 +0000 | [diff] [blame] | 481 | ObjDir := $(ObjRootDir) |
| 482 | LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib |
| 483 | ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin |
| 484 | ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples |
| 485 | LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib |
| 486 | LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin |
| 487 | LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples |
| John Criswell | 3ef61af | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 488 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 489 | #-------------------------------------------------------------------- |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 490 | # Locations of shared libraries |
| 491 | #-------------------------------------------------------------------- |
| 492 | |
| 493 | SharedPrefix := lib |
| 494 | SharedLibDir := $(LibDir) |
| 495 | LLVMSharedLibDir := $(LLVMLibDir) |
| 496 | |
| 497 | # Win32.DLL prefers to be located on the "PATH" of binaries. |
| 498 | ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| 499 | SharedLibDir := $(ToolDir) |
| 500 | LLVMSharedLibDir := $(LLVMToolDir) |
| 501 | |
| 502 | ifeq ($(HOST_OS),Cygwin) |
| 503 | SharedPrefix := cyg |
| 504 | else |
| 505 | SharedPrefix := |
| 506 | endif |
| 507 | endif |
| 508 | |
| 509 | #-------------------------------------------------------------------- |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 510 | # Full Paths To Compiled Tools and Utilities |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 511 | #-------------------------------------------------------------------- |
| Daniel Dunbar | 94f3c54 | 2011-11-11 22:59:45 +0000 | [diff] [blame] | 512 | EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]: |
| 513 | ifdef BUILD_DIRS_ONLY |
| 514 | EchoCmd := $(EchoCmd) "(build tools)": |
| 515 | endif |
| 516 | |
| 517 | Echo := @$(EchoCmd) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 518 | ifndef LLVMAS |
| 519 | LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT) |
| 520 | endif |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 521 | ifndef LLVM_TBLGEN |
| Reid Spencer | 0aa9d00 | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 522 | ifeq ($(LLVM_CROSS_COMPILING),1) |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 523 | LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT) |
| Reid Spencer | 0aa9d00 | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 524 | else |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 525 | LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT) |
| Reid Spencer | 0aa9d00 | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 526 | endif |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 527 | endif |
| Daniel Dunbar | a5772b9 | 2011-11-14 17:17:45 +0000 | [diff] [blame] | 528 | ifeq ($(LLVM_CROSS_COMPILING),1) |
| Daniel Dunbar | ab0ad4e | 2011-12-01 20:18:09 +0000 | [diff] [blame] | 529 | LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT) |
| Daniel Dunbar | a5772b9 | 2011-11-14 17:17:45 +0000 | [diff] [blame] | 530 | else |
| Daniel Dunbar | ab0ad4e | 2011-12-01 20:18:09 +0000 | [diff] [blame] | 531 | LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT) |
| Daniel Dunbar | a5772b9 | 2011-11-14 17:17:45 +0000 | [diff] [blame] | 532 | endif |
| Chris Lattner | 68c9754 | 2006-09-04 05:23:20 +0000 | [diff] [blame] | 533 | ifndef LLVMDIS |
| Eric Christopher | 365be44 | 2012-08-28 01:17:46 +0000 | [diff] [blame] | 534 | LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT) |
| Alkis Evlogimenos | a20de02 | 2004-12-13 17:44:14 +0000 | [diff] [blame] | 535 | endif |
| 536 | ifndef LLI |
| Eric Christopher | 365be44 | 2012-08-28 01:17:46 +0000 | [diff] [blame] | 537 | LLI := $(LLVMToolDir)/lli$(EXEEXT) |
| Alkis Evlogimenos | a20de02 | 2004-12-13 17:44:14 +0000 | [diff] [blame] | 538 | endif |
| Alkis Evlogimenos | 2434058 | 2005-02-27 10:21:37 +0000 | [diff] [blame] | 539 | ifndef LLC |
| Eric Christopher | 365be44 | 2012-08-28 01:17:46 +0000 | [diff] [blame] | 540 | LLC := $(LLVMToolDir)/llc$(EXEEXT) |
| Alkis Evlogimenos | 2434058 | 2005-02-27 10:21:37 +0000 | [diff] [blame] | 541 | endif |
| Alkis Evlogimenos | a20de02 | 2004-12-13 17:44:14 +0000 | [diff] [blame] | 542 | ifndef LOPT |
| Eric Christopher | 365be44 | 2012-08-28 01:17:46 +0000 | [diff] [blame] | 543 | LOPT := $(LLVMToolDir)/opt$(EXEEXT) |
| Alkis Evlogimenos | a20de02 | 2004-12-13 17:44:14 +0000 | [diff] [blame] | 544 | endif |
| Alkis Evlogimenos | 7c04a3d | 2005-02-02 00:40:15 +0000 | [diff] [blame] | 545 | ifndef LBUGPOINT |
| Eric Christopher | 365be44 | 2012-08-28 01:17:46 +0000 | [diff] [blame] | 546 | LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT) |
| Alkis Evlogimenos | 7c04a3d | 2005-02-02 00:40:15 +0000 | [diff] [blame] | 547 | endif |
| Nicolas Geoffray | afc2edb | 2012-05-23 20:34:19 +0000 | [diff] [blame] | 548 | ifndef LLVMLINK |
| Eric Christopher | 365be44 | 2012-08-28 01:17:46 +0000 | [diff] [blame] | 549 | LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT) |
| Nicolas Geoffray | afc2edb | 2012-05-23 20:34:19 +0000 | [diff] [blame] | 550 | endif |
| Reid Spencer | 9a6fc82 | 2006-12-03 21:01:45 +0000 | [diff] [blame] | 551 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 552 | #-------------------------------------------------------------------- |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 553 | # Adjust to user's request |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 554 | #-------------------------------------------------------------------- |
| Dinakar Dhurjati | 41f7748 | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 555 | |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 556 | ifeq ($(HOST_OS),Darwin) |
| Bob Wilson | 06d112d | 2012-10-12 21:48:14 +0000 | [diff] [blame] | 557 | ifdef MACOSX_DEPLOYMENT_TARGET |
| 558 | DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET) |
| 559 | else |
| Scott Michel | b1a830a | 2009-03-12 21:03:53 +0000 | [diff] [blame] | 560 | DARWIN_VERSION := `sw_vers -productVersion` |
| Bob Wilson | 06d112d | 2012-10-12 21:48:14 +0000 | [diff] [blame] | 561 | endif |
| Scott Michel | b1a830a | 2009-03-12 21:03:53 +0000 | [diff] [blame] | 562 | # Strip a number like 10.4.7 to 10.4 |
| Dmitri Gribenko | 410ba0c | 2013-11-14 18:31:30 +0000 | [diff] [blame] | 563 | DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]+).*/\1/') |
| Scott Michel | b1a830a | 2009-03-12 21:03:53 +0000 | [diff] [blame] | 564 | # Get "4" out of 10.4 for later pieces in the makefile. |
| Dmitri Gribenko | 410ba0c | 2013-11-14 18:31:30 +0000 | [diff] [blame] | 565 | DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]+).*/\1/') |
| Bill Wendling | f3ef2c7 | 2009-03-22 08:28:45 +0000 | [diff] [blame] | 566 | |
| Daniel Dunbar | 21e71e9 | 2010-12-08 01:48:05 +0000 | [diff] [blame] | 567 | LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress |
| 568 | SharedLinkOptions := -dynamiclib |
| Bob Wilson | a786b2c | 2013-02-05 17:29:03 +0000 | [diff] [blame] | 569 | ifdef DEPLOYMENT_TARGET |
| 570 | SharedLinkOptions += $(DEPLOYMENT_TARGET) |
| 571 | else |
| 572 | ifneq ($(ARCH),ARM) |
| 573 | SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION) |
| 574 | endif |
| Evan Cheng | 57b1419 | 2009-09-08 18:52:20 +0000 | [diff] [blame] | 575 | endif |
| Scott Michel | b1a830a | 2009-03-12 21:03:53 +0000 | [diff] [blame] | 576 | else |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 577 | SharedLinkOptions=-shared |
| Scott Michel | b1a830a | 2009-03-12 21:03:53 +0000 | [diff] [blame] | 578 | endif |
| 579 | |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 580 | ifeq ($(TARGET_OS),Darwin) |
| Bob Wilson | a786b2c | 2013-02-05 17:29:03 +0000 | [diff] [blame] | 581 | ifdef DEPLOYMENT_TARGET |
| 582 | TargetCommonOpts += $(DEPLOYMENT_TARGET) |
| 583 | else |
| 584 | ifneq ($(ARCH),ARM) |
| 585 | TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION) |
| 586 | endif |
| Evan Cheng | 57b1419 | 2009-09-08 18:52:20 +0000 | [diff] [blame] | 587 | endif |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 588 | endif |
| 589 | |
| Reid Spencer | 87e645c | 2005-01-11 04:31:07 +0000 | [diff] [blame] | 590 | ifdef SHARED_LIBRARY |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 591 | ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| Rafael Espindola | 9d2fe3c | 2010-05-16 03:05:14 +0000 | [diff] [blame] | 592 | ifneq ($(HOST_OS),Darwin) |
| 593 | LD.Flags += $(RPATH) -Wl,'$$ORIGIN' |
| Rafael Espindola | c80968e | 2014-02-28 13:48:03 +0000 | [diff] [blame] | 594 | else |
| 595 | LD.Flags += -Wl,-install_name -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)" |
| John Criswell | 3601f37 | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 596 | endif |
| Scott Michel | b1a830a | 2009-03-12 21:03:53 +0000 | [diff] [blame] | 597 | endif |
| Rafael Espindola | 9d2fe3c | 2010-05-16 03:05:14 +0000 | [diff] [blame] | 598 | endif |
| John Criswell | 3601f37 | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 599 | |
| Reid Spencer | f8b4a8e | 2004-11-08 17:32:12 +0000 | [diff] [blame] | 600 | ifdef TOOL_VERBOSE |
| 601 | C.Flags += -v |
| 602 | CXX.Flags += -v |
| 603 | LD.Flags += -v |
| Reid Spencer | f8b4a8e | 2004-11-08 17:32:12 +0000 | [diff] [blame] | 604 | VERBOSE := 1 |
| 605 | endif |
| 606 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 607 | # Adjust settings for verbose mode |
| Chris Lattner | c2bd7cf | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 608 | ifndef VERBOSE |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 609 | Verb := @ |
| Reid Spencer | fcd7815 | 2007-07-23 08:20:46 +0000 | [diff] [blame] | 610 | AR.Flags += >/dev/null 2>/dev/null |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 611 | ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1 |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 612 | else |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 613 | ConfigureScriptFLAGS := |
| Misha Brukman | 1326a7c | 2002-09-12 16:05:39 +0000 | [diff] [blame] | 614 | endif |
| 615 | |
| Vikram S. Adve | d141c28 | 2002-09-18 11:55:13 +0000 | [diff] [blame] | 616 | # By default, strip symbol information from executable |
| Chris Lattner | c2bd7cf | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 617 | ifndef KEEP_SYMBOLS |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 618 | Strip := $(PLATFORMSTRIPOPTS) |
| 619 | StripWarnMsg := "(without symbols)" |
| Charles Davis | bc47545 | 2011-10-26 02:28:32 +0000 | [diff] [blame] | 620 | Install.StripFlag += -s |
| Vikram S. Adve | d141c28 | 2002-09-18 11:55:13 +0000 | [diff] [blame] | 621 | endif |
| 622 | |
| Nico Weber | 47ba8fa | 2013-12-27 22:38:59 +0000 | [diff] [blame] | 623 | # By default, strip dead symbols at link time |
| 624 | ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| 625 | ifneq ($(HOST_OS),Darwin) |
| Jack Carter | 5b3d51c | 2014-01-03 22:18:43 +0000 | [diff] [blame] | 626 | ifneq ($(HOST_ARCH),Mips) |
| Nico Weber | 47ba8fa | 2013-12-27 22:38:59 +0000 | [diff] [blame] | 627 | CXX.Flags += -ffunction-sections -fdata-sections |
| 628 | endif |
| 629 | endif |
| Jack Carter | 5b3d51c | 2014-01-03 22:18:43 +0000 | [diff] [blame] | 630 | endif |
| Nico Weber | 47ba8fa | 2013-12-27 22:38:59 +0000 | [diff] [blame] | 631 | ifndef NO_DEAD_STRIP |
| 632 | ifeq ($(HOST_OS),Darwin) |
| 633 | LD.Flags += -Wl,-dead_strip |
| 634 | else |
| 635 | ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| 636 | LD.Flags += -Wl,--gc-sections |
| 637 | endif |
| 638 | endif |
| 639 | endif |
| 640 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 641 | # Adjust linker flags for building an executable |
| Nick Lewycky | adaf517 | 2010-08-02 03:16:19 +0000 | [diff] [blame] | 642 | ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| Bob Wilson | 9fcf545 | 2013-08-04 22:06:11 +0000 | [diff] [blame] | 643 | ifndef TOOL_NO_EXPORTS |
| 644 | LD.Flags += $(RDYNAMIC) |
| 645 | endif |
| Bill Wendling | 65e8419 | 2012-10-05 00:22:46 +0000 | [diff] [blame] | 646 | ifneq ($(HOST_OS), Darwin) |
| 647 | ifdef TOOLNAME |
| Bob Wilson | 9fcf545 | 2013-08-04 22:06:11 +0000 | [diff] [blame] | 648 | LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' |
| Rafael Espindola | 1250a30 | 2013-05-23 02:38:50 +0000 | [diff] [blame] | 649 | endif |
| 650 | else |
| 651 | ifneq ($(DARWIN_MAJVERS),4) |
| 652 | LD.Flags += $(RPATH) -Wl,@executable_path/../lib |
| 653 | endif |
| 654 | ifeq ($(RC_XBS),YES) |
| 655 | TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX) |
| 656 | LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile) |
| Bill Wendling | 65e8419 | 2012-10-05 00:22:46 +0000 | [diff] [blame] | 657 | endif |
| Jeffrey Yasskin | 6b718f7 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 658 | endif |
| Nick Lewycky | adaf517 | 2010-08-02 03:16:19 +0000 | [diff] [blame] | 659 | endif |
| Ted Kremenek | 3423122 | 2010-07-15 06:36:57 +0000 | [diff] [blame] | 660 | |
| Dinakar Dhurjati | 3ac83a9 | 2003-10-29 14:28:35 +0000 | [diff] [blame] | 661 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 662 | #---------------------------------------------------------- |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 663 | # Options To Invoke Tools |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 664 | #---------------------------------------------------------- |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 665 | |
| Daniel Dunbar | 0315d4a | 2011-06-16 22:30:38 +0000 | [diff] [blame] | 666 | ifdef EXTRA_LD_OPTIONS |
| 667 | LD.Flags += $(EXTRA_LD_OPTIONS) |
| 668 | endif |
| 669 | |
| Daniel Dunbar | 310511d | 2009-05-12 07:26:49 +0000 | [diff] [blame] | 670 | ifndef NO_PEDANTIC |
| Eric Christopher | 31f4354 | 2013-03-15 00:43:00 +0000 | [diff] [blame] | 671 | CompileCommonOpts += -pedantic -Wno-long-long |
| Daniel Dunbar | 310511d | 2009-05-12 07:26:49 +0000 | [diff] [blame] | 672 | endif |
| Duncan Sands | e532b55 | 2009-06-19 12:40:30 +0000 | [diff] [blame] | 673 | CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \ |
| David Greene | 9ff8d47 | 2013-01-09 22:11:13 +0000 | [diff] [blame] | 674 | $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \ |
| David Greene | b609a26 | 2013-01-18 23:22:52 +0000 | [diff] [blame] | 675 | $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \ |
| 676 | $(NO_MISSING_FIELD_INITIALIZERS) |
| Dan Gohman | 0557cd7 | 2010-04-19 18:33:28 +0000 | [diff] [blame] | 677 | # Enable cast-qual for C++; the workaround is to use const_cast. |
| Eric Christopher | 3c190d7 | 2013-05-14 21:52:01 +0000 | [diff] [blame] | 678 | CXX.Flags += -Wcast-qual |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 679 | |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 680 | ifeq ($(HOST_OS),HP-UX) |
| Duraid Madina | 1f898af | 2006-02-15 03:20:16 +0000 | [diff] [blame] | 681 | CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE |
| Duraid Madina | 60c9a3c | 2005-05-16 06:38:09 +0000 | [diff] [blame] | 682 | endif |
| 683 | |
| Chris Lattner | 11c25cf | 2006-05-30 16:38:06 +0000 | [diff] [blame] | 684 | # If we are building a universal binary on Mac OS/X, pass extra options. This |
| 685 | # is useful to people that want to link the LLVM libraries into their universal |
| Chris Lattner | 65e28b3 | 2006-06-29 19:38:04 +0000 | [diff] [blame] | 686 | # apps. |
| 687 | # |
| 688 | # The following can be optionally specified: |
| 689 | # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use. |
| 690 | # For Mac OS/X 10.4 Intel machines, the traditional one is: |
| 691 | # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/ |
| 692 | # UNIVERSAL_ARCH can be optionally specified to be a list of architectures |
| 693 | # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to |
| 694 | # i386/ppc only. |
| Chris Lattner | d81eba5 | 2006-04-06 06:30:15 +0000 | [diff] [blame] | 695 | ifdef UNIVERSAL |
| Chris Lattner | 65e28b3 | 2006-06-29 19:38:04 +0000 | [diff] [blame] | 696 | ifndef UNIVERSAL_ARCH |
| 697 | UNIVERSAL_ARCH := i386 ppc |
| 698 | endif |
| 699 | UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %) |
| Eric Christopher | 97e784a | 2013-06-24 23:20:04 +0000 | [diff] [blame] | 700 | TargetCommonOpts += $(UNIVERSAL_ARCH_OPTIONS) |
| Chris Lattner | 64e85f3 | 2006-06-16 21:47:59 +0000 | [diff] [blame] | 701 | ifdef UNIVERSAL_SDK_PATH |
| Eric Christopher | 97e784a | 2013-06-24 23:20:04 +0000 | [diff] [blame] | 702 | TargetCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH) |
| Chris Lattner | 64e85f3 | 2006-06-16 21:47:59 +0000 | [diff] [blame] | 703 | endif |
| 704 | |
| 705 | # Building universal cannot compute dependencies automatically. |
| Chris Lattner | d81eba5 | 2006-04-06 06:30:15 +0000 | [diff] [blame] | 706 | DISABLE_AUTO_DEPENDENCIES=1 |
| Evan Cheng | 3807bb7 | 2009-03-09 18:28:37 +0000 | [diff] [blame] | 707 | else |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 708 | ifeq ($(TARGET_OS),Darwin) |
| Bill Wendling | 207495d | 2009-03-12 04:10:09 +0000 | [diff] [blame] | 709 | ifeq ($(ARCH),x86_64) |
| Evan Cheng | 3138f7a | 2009-03-23 03:45:56 +0000 | [diff] [blame] | 710 | TargetCommonOpts = -m64 |
| Bill Wendling | 207495d | 2009-03-12 04:10:09 +0000 | [diff] [blame] | 711 | else |
| 712 | ifeq ($(ARCH),x86) |
| Evan Cheng | 3138f7a | 2009-03-23 03:45:56 +0000 | [diff] [blame] | 713 | TargetCommonOpts = -m32 |
| Bill Wendling | 207495d | 2009-03-12 04:10:09 +0000 | [diff] [blame] | 714 | endif |
| Evan Cheng | 3807bb7 | 2009-03-09 18:28:37 +0000 | [diff] [blame] | 715 | endif |
| 716 | endif |
| Chris Lattner | d81eba5 | 2006-04-06 06:30:15 +0000 | [diff] [blame] | 717 | endif |
| 718 | |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 719 | ifeq ($(HOST_OS),SunOS) |
| Michael J. Spencer | 447762d | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 720 | CPP.BaseFlags += -include llvm/Support/Solaris.h |
| Chris Lattner | 01602a1 | 2008-06-24 17:44:42 +0000 | [diff] [blame] | 721 | endif |
| 722 | |
| Edward O'Callaghan | 4ae411e | 2009-10-14 05:55:03 +0000 | [diff] [blame] | 723 | ifeq ($(HOST_OS),AuroraUX) |
| Michael J. Spencer | 447762d | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 724 | CPP.BaseFlags += -include llvm/Support/Solaris.h |
| Edward O'Callaghan | 4ae411e | 2009-10-14 05:55:03 +0000 | [diff] [blame] | 725 | endif # !HOST_OS - AuroraUX. |
| 726 | |
| David Meyer | 4d95473 | 2012-02-18 10:03:19 +0000 | [diff] [blame] | 727 | # On Windows, SharedLibDir != LibDir. The order is important. |
| 728 | ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| 729 | LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir) |
| 730 | else |
| 731 | LD.Flags += -L$(LibDir) -L$(LLVMLibDir) |
| 732 | endif |
| 733 | |
| NAKAMURA Takumi | c5554c9 | 2011-10-11 12:51:44 +0000 | [diff] [blame] | 734 | CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS |
| Reid Spencer | 6f682b7 | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 735 | # All -I flags should go here, so that they don't confuse llvm-config. |
| Duncan Sands | 9f6f4d3 | 2008-01-28 17:38:30 +0000 | [diff] [blame] | 736 | CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ |
| 737 | $(patsubst %,-I%/include,\ |
| Chris Lattner | 6379fc6 | 2008-01-28 04:18:41 +0000 | [diff] [blame] | 738 | $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \ |
| 739 | $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \ |
| 740 | $(CPP.BaseFlags) |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 741 | |
| Daniel Dunbar | 4a1a9ec | 2011-11-03 21:01:32 +0000 | [diff] [blame] | 742 | ifeq ($(INCLUDE_BUILD_DIR),1) |
| 743 | CPP.Flags += -I$(ObjDir) |
| 744 | endif |
| 745 | |
| Daniel Dunbar | 0625b1f | 2011-04-11 22:37:39 +0000 | [diff] [blame] | 746 | # SHOW_DIAGNOSTICS support. |
| 747 | ifeq ($(SHOW_DIAGNOSTICS),1) |
| 748 | Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \ |
| 749 | CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags" |
| 750 | else |
| 751 | Compile.Wrapper := |
| 752 | endif |
| 753 | |
| Daniel Dunbar | 823256b | 2011-11-11 22:59:42 +0000 | [diff] [blame] | 754 | Compile.C = $(Compile.Wrapper) \ |
| Eric Christopher | 46342fe | 2012-08-03 17:45:31 +0000 | [diff] [blame] | 755 | $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \ |
| Daniel Dunbar | 823256b | 2011-11-11 22:59:42 +0000 | [diff] [blame] | 756 | $(TargetCommonOpts) $(CompileCommonOpts) -c |
| 757 | Compile.CXX = $(Compile.Wrapper) \ |
| Eric Christopher | 46342fe | 2012-08-03 17:45:31 +0000 | [diff] [blame] | 758 | $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \ |
| Daniel Dunbar | 823256b | 2011-11-11 22:59:42 +0000 | [diff] [blame] | 759 | $(TargetCommonOpts) $(CompileCommonOpts) -c |
| 760 | Preprocess.CXX= $(Compile.Wrapper) \ |
| Eric Christopher | 46342fe | 2012-08-03 17:45:31 +0000 | [diff] [blame] | 761 | $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \ |
| Daniel Dunbar | 823256b | 2011-11-11 22:59:42 +0000 | [diff] [blame] | 762 | $(CompileCommonOpts) $(CXX.Flags) -E |
| 763 | Link = $(Compile.Wrapper) \ |
| Bob Wilson | 7abe258 | 2013-06-27 06:09:14 +0000 | [diff] [blame] | 764 | $(CXX) $(CXXFLAGS) $(LD.Flags) $(LDFLAGS) \ |
| 765 | $(TargetCommonOpts) $(Strip) |
| Jim Grosbach | 009db89 | 2008-10-02 22:56:44 +0000 | [diff] [blame] | 766 | |
| Eric Christopher | 3fe6967 | 2009-08-18 03:23:40 +0000 | [diff] [blame] | 767 | Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \ |
| Evan Cheng | 3138f7a | 2009-03-23 03:45:56 +0000 | [diff] [blame] | 768 | $(TargetCommonOpts) $(CompileCommonOpts) -E |
| Chris Lattner | bb08795 | 2005-10-05 00:28:41 +0000 | [diff] [blame] | 769 | |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 770 | ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 |
| 771 | ScriptInstall = $(INSTALL) -m 0755 |
| Reid Spencer | 247a10e | 2005-02-24 07:12:43 +0000 | [diff] [blame] | 772 | DataInstall = $(INSTALL) -m 0644 |
| Chris Lattner | 5047536 | 2008-01-15 23:27:40 +0000 | [diff] [blame] | 773 | |
| 774 | # When compiling under Mingw/Cygwin, the tblgen tool expects Windows |
| 775 | # paths. In this case, the SYSPATH function (defined in |
| 776 | # Makefile.config) transforms Unix paths into Windows paths. |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 777 | TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \ |
| Mikhail Glushenkov | 726440d | 2009-01-09 16:31:01 +0000 | [diff] [blame] | 778 | -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \ |
| Chris Lattner | 5047536 | 2008-01-15 23:27:40 +0000 | [diff] [blame] | 779 | -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \ |
| 780 | -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target) |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 781 | LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags) |
| Chris Lattner | 5047536 | 2008-01-15 23:27:40 +0000 | [diff] [blame] | 782 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 783 | Archive = $(AR) $(AR.Flags) |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 784 | ifdef RANLIB |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 785 | Ranlib = $(RANLIB) |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 786 | else |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 787 | Ranlib = ranlib |
| John Criswell | 3ef61af | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 788 | endif |
| 789 | |
| Tom Stellard | e6ba81d | 2014-03-03 15:22:00 +0000 | [diff] [blame^] | 790 | AliasTool = ln -sf |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 791 | |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 792 | #---------------------------------------------------------- |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 793 | # Get the list of source files and compute object file |
| 794 | # names from them. |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 795 | #---------------------------------------------------------- |
| Chris Lattner | b3eb31f | 2006-01-27 22:13:12 +0000 | [diff] [blame] | 796 | |
| 797 | ifndef SOURCES |
| 798 | Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \ |
| Chris Lattner | 814d9ee | 2009-01-02 07:16:45 +0000 | [diff] [blame] | 799 | $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c)) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 800 | else |
| Chris Lattner | b3eb31f | 2006-01-27 22:13:12 +0000 | [diff] [blame] | 801 | Sources := $(SOURCES) |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 802 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 803 | |
| Chris Lattner | b3eb31f | 2006-01-27 22:13:12 +0000 | [diff] [blame] | 804 | ifdef BUILT_SOURCES |
| Chris Lattner | 814d9ee | 2009-01-02 07:16:45 +0000 | [diff] [blame] | 805 | Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES)) |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 806 | endif |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 807 | |
| Chris Lattner | b3eb31f | 2006-01-27 22:13:12 +0000 | [diff] [blame] | 808 | BaseNameSources := $(sort $(basename $(Sources))) |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 809 | SourceDirs := $(sort $(dir $(Sources))) |
| Chris Lattner | b3eb31f | 2006-01-27 22:13:12 +0000 | [diff] [blame] | 810 | |
| 811 | ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o) |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 812 | ObjectDirs := $(SourceDirs:%=$(ObjDir)/%) |
| Chris Lattner | b3eb31f | 2006-01-27 22:13:12 +0000 | [diff] [blame] | 813 | |
| NAKAMURA Takumi | 0b26c3a | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 814 | #---------------------------------------------------------- |
| 815 | # For Mingw MSYS bash and Python/w32: |
| 816 | # |
| 817 | # $(ECHOPATH) prints DOSish pathstring. |
| 818 | # ex) $(ECHOPATH) /include/sys/types.h |
| 819 | # --> C:/mingw/include/sys/types.h |
| 820 | # built-in "echo" does not transform path to DOSish path. |
| 821 | # |
| 822 | # FIXME: It would not be needed when MSYS's python |
| 823 | # were provided. |
| 824 | #---------------------------------------------------------- |
| 825 | |
| 826 | ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE))) |
| Saleem Abdulrasool | 26127bd | 2013-01-30 04:07:37 +0000 | [diff] [blame] | 827 | ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])" |
| NAKAMURA Takumi | 0b26c3a | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 828 | else |
| 829 | ECHOPATH := $(Verb)$(ECHO) |
| 830 | endif |
| 831 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 832 | ############################################################################### |
| 833 | # DIRECTORIES: Handle recursive descent of directory structure |
| 834 | ############################################################################### |
| John Criswell | 3601f37 | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 835 | |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 836 | #--------------------------------------------------------- |
| Reid Spencer | 9c7bfc9 | 2004-10-28 09:15:28 +0000 | [diff] [blame] | 837 | # Provide rules to make install dirs. This must be early |
| 838 | # in the file so they get built before dependencies |
| 839 | #--------------------------------------------------------- |
| 840 | |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 841 | $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir):: |
| Mike Stump | f7a16e9 | 2009-01-22 03:24:22 +0000 | [diff] [blame] | 842 | $(Verb) $(MKDIR) $@ |
| Reid Spencer | 9c7bfc9 | 2004-10-28 09:15:28 +0000 | [diff] [blame] | 843 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 844 | # To create other directories, as needed, and timestamp their creation |
| 845 | %/.dir: |
| 846 | $(Verb) $(MKDIR) $* > /dev/null |
| Daniel Dunbar | dac1824 | 2010-05-10 20:11:56 +0000 | [diff] [blame] | 847 | $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@ |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 848 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 849 | .PRECIOUS: $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir |
| Reid Spencer | 7e9e0b0 | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 850 | .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir |
| Reid Spencer | 9c7bfc9 | 2004-10-28 09:15:28 +0000 | [diff] [blame] | 851 | |
| 852 | #--------------------------------------------------------- |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 853 | # Collect the object directories (as there may be more |
| 854 | # than one if the source code is spread across |
| 855 | # subdirectories). |
| 856 | #--------------------------------------------------------- |
| 857 | |
| 858 | OBJECT_DIRS := $(ObjDir)/.dir $(ObjectDirs:%=%/.dir) |
| 859 | .PRECIOUS: $(OBJECT_DIRS) |
| 860 | |
| 861 | #--------------------------------------------------------- |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 862 | # Handle the DIRS options for sequential construction |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 863 | #--------------------------------------------------------- |
| 864 | |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 865 | SubDirs := |
| Anand Shukla | 8c2a0ee | 2002-09-18 04:29:30 +0000 | [diff] [blame] | 866 | ifdef DIRS |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 867 | SubDirs += $(DIRS) |
| Chris Lattner | b925961 | 2006-07-26 20:22:26 +0000 | [diff] [blame] | 868 | |
| 869 | ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 870 | $(RecursiveTargets):: |
| 871 | $(Verb) for dir in $(DIRS); do \ |
| Daniel Dunbar | 281d6bc | 2010-06-08 20:10:13 +0000 | [diff] [blame] | 872 | if ([ ! -f $$dir/Makefile ] || \ |
| Chris Lattner | c8cbcdd | 2010-06-18 00:35:32 +0000 | [diff] [blame] | 873 | command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \ |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 874 | $(MKDIR) $$dir; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 875 | $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 876 | fi; \ |
| Reid Spencer | a22a5b3 | 2006-05-17 22:55:35 +0000 | [diff] [blame] | 877 | ($(MAKE) -C $$dir $@ ) || exit 1; \ |
| Chris Lattner | 539a23c | 2002-09-17 23:35:02 +0000 | [diff] [blame] | 878 | done |
| Chris Lattner | b925961 | 2006-07-26 20:22:26 +0000 | [diff] [blame] | 879 | else |
| 880 | $(RecursiveTargets):: |
| 881 | $(Verb) for dir in $(DIRS); do \ |
| 882 | ($(MAKE) -C $$dir $@ ) || exit 1; \ |
| 883 | done |
| 884 | endif |
| 885 | |
| Anand Shukla | 8c2a0ee | 2002-09-18 04:29:30 +0000 | [diff] [blame] | 886 | endif |
| Chris Lattner | f3dd5f5 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 887 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 888 | #--------------------------------------------------------- |
| 889 | # Handle the EXPERIMENTAL_DIRS options ensuring success |
| 890 | # after each directory is built. |
| 891 | #--------------------------------------------------------- |
| 892 | ifdef EXPERIMENTAL_DIRS |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 893 | $(RecursiveTargets):: |
| 894 | $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \ |
| Daniel Dunbar | 281d6bc | 2010-06-08 20:10:13 +0000 | [diff] [blame] | 895 | if ([ ! -f $$dir/Makefile ] || \ |
| Chris Lattner | c8cbcdd | 2010-06-18 00:35:32 +0000 | [diff] [blame] | 896 | command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \ |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 897 | $(MKDIR) $$dir; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 898 | $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 899 | fi; \ |
| Reid Spencer | a22a5b3 | 2006-05-17 22:55:35 +0000 | [diff] [blame] | 900 | ($(MAKE) -C $$dir $@ ) || exit 0; \ |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 901 | done |
| 902 | endif |
| Chris Lattner | f3dd5f5 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 903 | |
| Reid Spencer | c49a863 | 2005-12-21 23:17:06 +0000 | [diff] [blame] | 904 | #----------------------------------------------------------- |
| Mike Stump | 82221d6 | 2009-01-24 00:00:41 +0000 | [diff] [blame] | 905 | # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction |
| 906 | #----------------------------------------------------------- |
| 907 | ifdef OPTIONAL_PARALLEL_DIRS |
| NAKAMURA Takumi | 2c1a4cc | 2011-10-16 02:54:19 +0000 | [diff] [blame] | 908 | PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)")) |
| Mike Stump | 82221d6 | 2009-01-24 00:00:41 +0000 | [diff] [blame] | 909 | endif |
| 910 | |
| 911 | #----------------------------------------------------------- |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 912 | # Handle the PARALLEL_DIRS options for parallel construction |
| Reid Spencer | c49a863 | 2005-12-21 23:17:06 +0000 | [diff] [blame] | 913 | #----------------------------------------------------------- |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 914 | ifdef PARALLEL_DIRS |
| 915 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 916 | SubDirs += $(PARALLEL_DIRS) |
| 917 | |
| Reid Spencer | d4bd375 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 918 | # Unfortunately, this list must be maintained if new recursive targets are added |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 919 | all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS)) |
| 920 | clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS)) |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 921 | clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS)) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 922 | install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS)) |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 923 | uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS)) |
| Reid Spencer | d4bd375 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 924 | install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS)) |
| Daniel Dunbar | 96ccc47 | 2009-09-13 22:39:27 +0000 | [diff] [blame] | 925 | unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS)) |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 926 | |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 927 | ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T)) |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 928 | |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 929 | $(ParallelTargets) : |
| NAKAMURA Takumi | 2c1a4cc | 2011-10-16 02:54:19 +0000 | [diff] [blame] | 930 | $(Verb) \ |
| 931 | SD=$(PROJ_SRC_DIR)/$(@D); \ |
| 932 | DD=$(@D); \ |
| 933 | if [ ! -f $$SD/Makefile ]; then \ |
| 934 | SD=$(@D); \ |
| 935 | DD=$(notdir $(@D)); \ |
| 936 | fi; \ |
| 937 | if ([ ! -f $$DD/Makefile ] || \ |
| 938 | command test $$DD/Makefile -ot \ |
| 939 | $$SD/Makefile ); then \ |
| 940 | $(MKDIR) $$DD; \ |
| 941 | $(CP) $$SD/Makefile $$DD/Makefile; \ |
| John Criswell | 6df35dd | 2003-11-25 19:32:22 +0000 | [diff] [blame] | 942 | fi; \ |
| NAKAMURA Takumi | 2c1a4cc | 2011-10-16 02:54:19 +0000 | [diff] [blame] | 943 | $(MAKE) -C $$DD $(subst $(@D)/.make,,$@) |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 944 | endif |
| 945 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 946 | #--------------------------------------------------------- |
| 947 | # Handle the OPTIONAL_DIRS options for directores that may |
| 948 | # or may not exist. |
| 949 | #--------------------------------------------------------- |
| John Criswell | 8224df9 | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 950 | ifdef OPTIONAL_DIRS |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 951 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 952 | SubDirs += $(OPTIONAL_DIRS) |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 953 | |
| Chris Lattner | b925961 | 2006-07-26 20:22:26 +0000 | [diff] [blame] | 954 | ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 955 | $(RecursiveTargets):: |
| 956 | $(Verb) for dir in $(OPTIONAL_DIRS); do \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 957 | if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\ |
| Daniel Dunbar | 281d6bc | 2010-06-08 20:10:13 +0000 | [diff] [blame] | 958 | if ([ ! -f $$dir/Makefile ] || \ |
| Chris Lattner | c8cbcdd | 2010-06-18 00:35:32 +0000 | [diff] [blame] | 959 | command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \ |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 960 | $(MKDIR) $$dir; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 961 | $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 962 | fi; \ |
| Reid Spencer | a22a5b3 | 2006-05-17 22:55:35 +0000 | [diff] [blame] | 963 | ($(MAKE) -C$$dir $@ ) || exit 1; \ |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 964 | fi \ |
| John Criswell | 8224df9 | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 965 | done |
| Chris Lattner | b925961 | 2006-07-26 20:22:26 +0000 | [diff] [blame] | 966 | else |
| 967 | $(RecursiveTargets):: |
| 968 | $(Verb) for dir in $(OPTIONAL_DIRS); do \ |
| Stephen Wilson | a168251 | 2011-02-20 03:51:07 +0000 | [diff] [blame] | 969 | if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\ |
| 970 | ($(MAKE) -C$$dir $@ ) || exit 1; \ |
| 971 | fi \ |
| Chris Lattner | b925961 | 2006-07-26 20:22:26 +0000 | [diff] [blame] | 972 | done |
| 973 | endif |
| John Criswell | 8224df9 | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 974 | endif |
| 975 | |
| Reid Spencer | cc51e7b | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 976 | #--------------------------------------------------------- |
| 977 | # Handle the CONFIG_FILES options |
| 978 | #--------------------------------------------------------- |
| 979 | ifdef CONFIG_FILES |
| Reid Spencer | cc51e7b | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 980 | |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 981 | ifdef NO_INSTALL |
| 982 | install-local:: |
| 983 | $(Echo) Install circumvented with NO_INSTALL |
| 984 | uninstall-local:: |
| 985 | $(Echo) UnInstall circumvented with NO_INSTALL |
| 986 | else |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 987 | install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES) |
| 988 | $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 989 | $(Verb)for file in $(CONFIG_FILES); do \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 990 | if test -f $(PROJ_OBJ_DIR)/$${file} ; then \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 991 | $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 992 | elif test -f $(PROJ_SRC_DIR)/$${file} ; then \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 993 | $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \ |
| Reid Spencer | 39d6a61 | 2004-11-23 05:59:53 +0000 | [diff] [blame] | 994 | else \ |
| 995 | $(ECHO) Error: cannot find config file $${file}. ; \ |
| 996 | fi \ |
| Reid Spencer | cc51e7b | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 997 | done |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 998 | |
| Reid Spencer | be6a4e9 | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 999 | uninstall-local:: |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 1000 | $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1001 | $(Verb)for file in $(CONFIG_FILES); do \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 1002 | $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \ |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1003 | done |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1004 | endif |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1005 | |
| Reid Spencer | cc51e7b | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 1006 | endif |
| 1007 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1008 | ############################################################################### |
| Eric Christopher | b2c4a99 | 2010-06-21 23:49:08 +0000 | [diff] [blame] | 1009 | # Set up variables for building libraries |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1010 | ############################################################################### |
| 1011 | |
| 1012 | #--------------------------------------------------------- |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1013 | # Define various command line options pertaining to the |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1014 | # libraries needed when linking. There are "Proj" libs |
| 1015 | # (defined by the user's project) and "LLVM" libs (defined |
| Chris Lattner | f9ac33d | 2006-09-04 04:47:21 +0000 | [diff] [blame] | 1016 | # by the LLVM project). |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1017 | #--------------------------------------------------------- |
| Andrew Lenharth | 6b62b47 | 2005-08-13 05:09:50 +0000 | [diff] [blame] | 1018 | |
| Chris Lattner | f9ac33d | 2006-09-04 04:47:21 +0000 | [diff] [blame] | 1019 | ifdef USEDLIBS |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1020 | ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) |
| 1021 | ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions)) |
| Chris Lattner | f9ac33d | 2006-09-04 04:47:21 +0000 | [diff] [blame] | 1022 | ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS))) |
| 1023 | ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs)) |
| 1024 | endif |
| 1025 | |
| 1026 | ifdef LLVMLIBS |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1027 | LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS))) |
| 1028 | LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions)) |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1029 | LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS))) |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1030 | LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) |
| Chris Lattner | f9ac33d | 2006-09-04 04:47:21 +0000 | [diff] [blame] | 1031 | endif |
| 1032 | |
| NAKAMURA Takumi | 9c8a97ce0 | 2010-09-10 06:27:02 +0000 | [diff] [blame] | 1033 | # Loadable module for Win32 requires all symbols resolved for linking. |
| 1034 | # Then all symbols in LLVM.dll will be available. |
| 1035 | ifeq ($(ENABLE_SHARED),1) |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1036 | ifdef LOADABLE_MODULE |
| NAKAMURA Takumi | 9c8a97ce0 | 2010-09-10 06:27:02 +0000 | [diff] [blame] | 1037 | ifneq (,$(filter $(HOST_OS),Cygwin MingW)) |
| 1038 | LINK_COMPONENTS += all |
| 1039 | endif |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1040 | endif |
| 1041 | endif |
| 1042 | |
| Daniel Dunbar | 78caa02 | 2008-10-03 19:11:19 +0000 | [diff] [blame] | 1043 | ifndef IS_CLEANING_TARGET |
| Chris Lattner | f9ac33d | 2006-09-04 04:47:21 +0000 | [diff] [blame] | 1044 | ifdef LINK_COMPONENTS |
| Chris Lattner | 68c9754 | 2006-09-04 05:23:20 +0000 | [diff] [blame] | 1045 | |
| 1046 | # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make |
| 1047 | # clean in tools, then do a make in tools (instead of at the top level). |
| 1048 | $(LLVM_CONFIG): |
| 1049 | @echo "*** llvm-config doesn't exist - rebuilding it." |
| 1050 | @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config |
| Gabor Greif | c848f9e | 2008-02-27 13:34:15 +0000 | [diff] [blame] | 1051 | |
| Chris Lattner | 68c9754 | 2006-09-04 05:23:20 +0000 | [diff] [blame] | 1052 | $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG) |
| 1053 | |
| Jeffrey Yasskin | 6b718f7 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 1054 | ifeq ($(ENABLE_SHARED), 1) |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1055 | # We can take the "auto-import" feature to get rid of using dllimport. |
| 1056 | ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| 1057 | LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \ |
| 1058 | -L $(SharedLibDir) |
| 1059 | endif |
| Jeffrey Yasskin | 6b718f7 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 1060 | LLVMLibsOptions += -lLLVM-$(LLVMVersion) |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1061 | LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT) |
| Jeffrey Yasskin | 6b718f7 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 1062 | else |
| Chris Lattner | c19eaaa | 2010-09-01 16:11:17 +0000 | [diff] [blame] | 1063 | |
| 1064 | ifndef NO_LLVM_CONFIG |
| 1065 | LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error) |
| 1066 | ifeq ($(LLVMConfigLibs),Error) |
| 1067 | $(error llvm-config --libs failed) |
| 1068 | endif |
| 1069 | LLVMLibsOptions += $(LLVMConfigLibs) |
| 1070 | LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error) |
| 1071 | ifeq ($(LLVMConfigLibfiles),Error) |
| 1072 | $(error llvm-config --libfiles failed) |
| 1073 | endif |
| 1074 | LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles) |
| 1075 | endif |
| 1076 | |
| Chris Lattner | f9ac33d | 2006-09-04 04:47:21 +0000 | [diff] [blame] | 1077 | endif |
| Chris Lattner | 9a4a92e | 2006-09-04 04:50:10 +0000 | [diff] [blame] | 1078 | endif |
| Jeffrey Yasskin | 6b718f7 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 1079 | endif |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1080 | |
| Dan Gohman | 473a53f | 2010-04-15 20:54:25 +0000 | [diff] [blame] | 1081 | # Set up the library exports file. |
| 1082 | ifdef EXPORTED_SYMBOL_FILE |
| 1083 | |
| 1084 | # First, set up the native export file, which may differ from the source |
| 1085 | # export file. |
| 1086 | |
| 1087 | ifeq ($(HOST_OS),Darwin) |
| 1088 | # Darwin convention prefixes symbols with underscores. |
| Dan Gohman | ff9ecb2 | 2010-04-15 23:08:00 +0000 | [diff] [blame] | 1089 | NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed |
| Dan Gohman | 1639265 | 2010-04-15 22:46:27 +0000 | [diff] [blame] | 1090 | $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir |
| Dan Gohman | 1ce7a55 | 2010-06-01 17:08:56 +0000 | [diff] [blame] | 1091 | $(Verb) sed -e 's/^/_/' < $< > $@ |
| Dan Gohman | 473a53f | 2010-04-15 20:54:25 +0000 | [diff] [blame] | 1092 | clean-local:: |
| 1093 | -$(Verb) $(RM) -f $(NativeExportsFile) |
| 1094 | else |
| Dan Gohman | b7edb42 | 2010-06-01 14:56:56 +0000 | [diff] [blame] | 1095 | ifeq ($(HAVE_LINK_VERSION_SCRIPT),1) |
| 1096 | # Gold and BFD ld require a version script rather than a plain list. |
| 1097 | NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map |
| 1098 | $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir |
| 1099 | $(Verb) echo "{" > $@ |
| Eric Christopher | 5b796ba | 2012-03-12 20:58:14 +0000 | [diff] [blame] | 1100 | $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || : |
| Dan Gohman | 1ce7a55 | 2010-06-01 17:08:56 +0000 | [diff] [blame] | 1101 | $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@ |
| Chris Lattner | 22b7495 | 2011-02-21 18:38:56 +0000 | [diff] [blame] | 1102 | ifneq ($(HOST_OS),OpenBSD) |
| Dan Gohman | b7edb42 | 2010-06-01 14:56:56 +0000 | [diff] [blame] | 1103 | $(Verb) echo " local: *;" >> $@ |
| Chris Lattner | 22b7495 | 2011-02-21 18:38:56 +0000 | [diff] [blame] | 1104 | endif |
| Dan Gohman | b7edb42 | 2010-06-01 14:56:56 +0000 | [diff] [blame] | 1105 | $(Verb) echo "};" >> $@ |
| 1106 | clean-local:: |
| 1107 | -$(Verb) $(RM) -f $(NativeExportsFile) |
| 1108 | else |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1109 | ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| Dan Gohman | 02ab9a6 | 2010-09-03 17:29:33 +0000 | [diff] [blame] | 1110 | # GNU ld Win32 accepts .DEF files that contain "DATA" entries. |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1111 | NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def)) |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1112 | $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir |
| 1113 | $(Echo) Generating $(notdir $@) |
| 1114 | $(Verb) $(ECHO) "EXPORTS" > $@ |
| 1115 | $(Verb) $(CAT) $< >> $@ |
| 1116 | clean-local:: |
| 1117 | -$(Verb) $(RM) -f $(NativeExportsFile) |
| 1118 | else |
| Dan Gohman | 02ab9a6 | 2010-09-03 17:29:33 +0000 | [diff] [blame] | 1119 | # Default behavior: just use the exports file verbatim. |
| 1120 | NativeExportsFile := $(EXPORTED_SYMBOL_FILE) |
| 1121 | endif |
| 1122 | endif |
| 1123 | endif |
| 1124 | |
| 1125 | # Now add the linker command-line options to use the native export file. |
| 1126 | |
| 1127 | # Darwin |
| 1128 | ifeq ($(HOST_OS),Darwin) |
| 1129 | LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile) |
| 1130 | endif |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1131 | |
| Dan Gohman | 91f8ad7 | 2010-04-16 22:58:15 +0000 | [diff] [blame] | 1132 | # gold, bfd ld, etc. |
| Dan Gohman | b7edb42 | 2010-06-01 14:56:56 +0000 | [diff] [blame] | 1133 | ifeq ($(HAVE_LINK_VERSION_SCRIPT),1) |
| 1134 | LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile) |
| Dan Gohman | 473a53f | 2010-04-15 20:54:25 +0000 | [diff] [blame] | 1135 | endif |
| 1136 | |
| Dan Gohman | 02ab9a6 | 2010-09-03 17:29:33 +0000 | [diff] [blame] | 1137 | # Windows |
| 1138 | ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| 1139 | # LLVMLibsOptions is invalidated at processing tools/llvm-shlib. |
| 1140 | SharedLinkOptions += $(NativeExportsFile) |
| Dan Gohman | 473a53f | 2010-04-15 20:54:25 +0000 | [diff] [blame] | 1141 | endif |
| 1142 | |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1143 | endif |
| 1144 | |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1145 | ############################################################################### |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1146 | # Library Build Rules: Four ways to build a library |
| 1147 | ############################################################################### |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1148 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1149 | # if we're building a library ... |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1150 | ifdef LIBRARYNAME |
| Vikram S. Adve | fe34689 | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 1151 | |
| Misha Brukman | 5906bc1 | 2009-08-17 15:31:24 +0000 | [diff] [blame] | 1152 | # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option |
| Chris Lattner | e6e193ca | 2002-09-16 22:34:56 +0000 | [diff] [blame] | 1153 | LIBRARYNAME := $(strip $(LIBRARYNAME)) |
| Tom Stellard | e6ba81d | 2014-03-03 15:22:00 +0000 | [diff] [blame^] | 1154 | LIBRARYALIASNAME := $(strip $(LIBRARYALIASNAME)) |
| Reid Spencer | 87e645c | 2005-01-11 04:31:07 +0000 | [diff] [blame] | 1155 | ifdef LOADABLE_MODULE |
| Rafael Espindola | 4e03719 | 2011-02-03 22:01:15 +0000 | [diff] [blame] | 1156 | BaseLibName.A := $(LIBRARYNAME).a |
| 1157 | BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT) |
| Tom Stellard | e6ba81d | 2014-03-03 15:22:00 +0000 | [diff] [blame^] | 1158 | BaseAliasName.SO := $(LIBRARYALIASNAME)$(SHLIBEXT) |
| Reid Spencer | 87e645c | 2005-01-11 04:31:07 +0000 | [diff] [blame] | 1159 | else |
| Rafael Espindola | 4e03719 | 2011-02-03 22:01:15 +0000 | [diff] [blame] | 1160 | BaseLibName.A := lib$(LIBRARYNAME).a |
| 1161 | BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT) |
| Tom Stellard | e6ba81d | 2014-03-03 15:22:00 +0000 | [diff] [blame^] | 1162 | BaseAliasName.SO := $(SharedPrefix)$(LIBRARYALIASNAME)$(SHLIBEXT) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1163 | endif |
| Rafael Espindola | 4e03719 | 2011-02-03 22:01:15 +0000 | [diff] [blame] | 1164 | LibName.A := $(LibDir)/$(BaseLibName.A) |
| 1165 | LibName.SO := $(SharedLibDir)/$(BaseLibName.SO) |
| Tom Stellard | e6ba81d | 2014-03-03 15:22:00 +0000 | [diff] [blame^] | 1166 | AliasName.SO := $(SharedLibDir)/$(BaseAliasName.SO) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1167 | LibName.O := $(LibDir)/$(LIBRARYNAME).o |
| Chris Lattner | e6e193ca | 2002-09-16 22:34:56 +0000 | [diff] [blame] | 1168 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1169 | #--------------------------------------------------------- |
| 1170 | # Shared Library Targets: |
| 1171 | # If the user asked for a shared library to be built |
| 1172 | # with the SHARED_LIBRARY variable, then we provide |
| 1173 | # targets for building them. |
| 1174 | #--------------------------------------------------------- |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1175 | ifdef SHARED_LIBRARY |
| 1176 | |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1177 | all-local:: $(LibName.SO) |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1178 | |
| Dan Gohman | 473a53f | 2010-04-15 20:54:25 +0000 | [diff] [blame] | 1179 | ifdef EXPORTED_SYMBOL_FILE |
| 1180 | $(LibName.SO): $(NativeExportsFile) |
| 1181 | endif |
| 1182 | |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1183 | ifdef LINK_LIBS_IN_SHARED |
| Reid Spencer | e6458c3 | 2006-08-07 23:12:15 +0000 | [diff] [blame] | 1184 | ifdef LOADABLE_MODULE |
| Chris Lattner | 7cab3de | 2006-11-15 21:04:15 +0000 | [diff] [blame] | 1185 | SharedLibKindMessage := "Loadable Module" |
| Daniel Dunbar | 21e71e9 | 2010-12-08 01:48:05 +0000 | [diff] [blame] | 1186 | SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions) |
| Reid Spencer | e6458c3 | 2006-08-07 23:12:15 +0000 | [diff] [blame] | 1187 | else |
| 1188 | SharedLibKindMessage := "Shared Library" |
| 1189 | endif |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1190 | $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir |
| Reid Spencer | e6458c3 | 2006-08-07 23:12:15 +0000 | [diff] [blame] | 1191 | $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \ |
| Dan Gohman | 14e297e | 2010-07-26 20:15:47 +0000 | [diff] [blame] | 1192 | $(notdir $@) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1193 | $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \ |
| Torok Edwin | 49db738 | 2009-05-26 19:11:47 +0000 | [diff] [blame] | 1194 | $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS) |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1195 | else |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1196 | $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir |
| Dan Gohman | 14e297e | 2010-07-26 20:15:47 +0000 | [diff] [blame] | 1197 | $(Echo) Linking $(BuildMode) Shared Library $(notdir $@) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1198 | $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) |
| Reid Spencer | a80f167 | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 1199 | endif |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1200 | |
| 1201 | clean-local:: |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1202 | ifneq ($(strip $(LibName.SO)),) |
| 1203 | -$(Verb) $(RM) -f $(LibName.SO) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1204 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1205 | |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1206 | ifdef NO_INSTALL |
| 1207 | install-local:: |
| 1208 | $(Echo) Install circumvented with NO_INSTALL |
| 1209 | uninstall-local:: |
| 1210 | $(Echo) Uninstall circumvented with NO_INSTALL |
| 1211 | else |
| Rafael Espindola | 0af6889 | 2010-05-16 03:13:23 +0000 | [diff] [blame] | 1212 | |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1213 | # Win32.DLL prefers to be located on the "PATH" of binaries. |
| 1214 | ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) |
| 1215 | DestSharedLibDir := $(DESTDIR)$(PROJ_bindir) |
| Rafael Espindola | 0af6889 | 2010-05-16 03:13:23 +0000 | [diff] [blame] | 1216 | else |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1217 | DestSharedLibDir := $(DESTDIR)$(PROJ_libdir) |
| Rafael Espindola | 0af6889 | 2010-05-16 03:13:23 +0000 | [diff] [blame] | 1218 | endif |
| Rafael Espindola | 4e03719 | 2011-02-03 22:01:15 +0000 | [diff] [blame] | 1219 | DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO) |
| Tom Stellard | e6ba81d | 2014-03-03 15:22:00 +0000 | [diff] [blame^] | 1220 | DestSharedAlias := $(DestSharedLibDir)/$(BaseAliasName.SO) |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1221 | |
| Reid Spencer | be6a4e9 | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 1222 | install-local:: $(DestSharedLib) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1223 | |
| Anton Korobeynikov | 51b8b1d | 2010-08-17 19:03:03 +0000 | [diff] [blame] | 1224 | $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir) |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1225 | $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1226 | $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib) |
| Tom Stellard | e6ba81d | 2014-03-03 15:22:00 +0000 | [diff] [blame^] | 1227 | ifdef SHARED_ALIAS |
| 1228 | $(Echo) Creating alias from $(DestSharedLib) to $(DestSharedAlias) |
| 1229 | $(Verb) $(AliasTool) $(DestSharedLib) $(DestSharedAlias) |
| 1230 | endif |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1231 | |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1232 | uninstall-local:: |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1233 | $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib) |
| Tim Northover | 3598934 | 2013-08-06 12:50:45 +0000 | [diff] [blame] | 1234 | -$(Verb) $(RM) -f $(DestSharedLib) |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1235 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1236 | endif |
| 1237 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1238 | #--------------------------------------------------------- |
| Chris Lattner | eaae8d0 | 2009-06-16 23:00:42 +0000 | [diff] [blame] | 1239 | # Library Targets: |
| 1240 | # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to |
| 1241 | # building an archive. |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1242 | #--------------------------------------------------------- |
| Jeffrey Yasskin | 6b718f7 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 1243 | ifndef NO_BUILD_ARCHIVE |
| Chris Lattner | 1b91cbd | 2005-10-24 02:21:45 +0000 | [diff] [blame] | 1244 | ifndef BUILD_ARCHIVE |
| Chris Lattner | eaae8d0 | 2009-06-16 23:00:42 +0000 | [diff] [blame] | 1245 | ifndef LOADABLE_MODULE |
| 1246 | BUILD_ARCHIVE = 1 |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1247 | endif |
| Chris Lattner | 76d98ba | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 1248 | endif |
| Jeffrey Yasskin | 6b718f7 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 1249 | endif |
| Chris Lattner | c2bd7cf | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 1250 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1251 | #--------------------------------------------------------- |
| 1252 | # Archive Library Targets: |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1253 | # If the user wanted a regular archive library built, |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1254 | # then we provide targets for building them. |
| 1255 | #--------------------------------------------------------- |
| Chris Lattner | 76d98ba | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 1256 | ifdef BUILD_ARCHIVE |
| Chris Lattner | 76d98ba | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 1257 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1258 | all-local:: $(LibName.A) |
| 1259 | |
| Reid Spencer | aeea3cf | 2004-12-16 07:36:08 +0000 | [diff] [blame] | 1260 | $(LibName.A): $(ObjectsO) $(LibDir)/.dir |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1261 | $(Echo) Building $(BuildMode) Archive Library $(notdir $@) |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1262 | -$(Verb) $(RM) -f $@ |
| Bill Wendling | b2f724e | 2009-01-03 22:46:50 +0000 | [diff] [blame] | 1263 | $(Verb) $(Archive) $@ $(ObjectsO) |
| 1264 | $(Verb) $(Ranlib) $@ |
| Vikram S. Adve | 20aa62f | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 1265 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1266 | clean-local:: |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1267 | ifneq ($(strip $(LibName.A)),) |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1268 | -$(Verb) $(RM) -f $(LibName.A) |
| Chris Lattner | 2f7c963 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1269 | endif |
| 1270 | |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1271 | ifdef NO_INSTALL |
| 1272 | install-local:: |
| 1273 | $(Echo) Install circumvented with NO_INSTALL |
| 1274 | uninstall-local:: |
| 1275 | $(Echo) Uninstall circumvented with NO_INSTALL |
| Daniel Dunbar | 11328b7 | 2010-04-30 22:00:17 +0000 | [diff] [blame] | 1276 | else |
| 1277 | ifdef NO_INSTALL_ARCHIVES |
| Daniel Dunbar | 7d9ec41 | 2010-04-30 20:04:53 +0000 | [diff] [blame] | 1278 | install-local:: |
| 1279 | $(Echo) Install circumvented with NO_INSTALL |
| 1280 | uninstall-local:: |
| 1281 | $(Echo) Uninstall circumvented with NO_INSTALL |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1282 | else |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 1283 | DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1284 | |
| Reid Spencer | be6a4e9 | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 1285 | install-local:: $(DestArchiveLib) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1286 | |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 1287 | $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir) |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1288 | $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib) |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 1289 | $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1290 | $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1291 | |
| Reid Spencer | be6a4e9 | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 1292 | uninstall-local:: |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1293 | $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib) |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1294 | -$(Verb) $(RM) -f $(DestArchiveLib) |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1295 | endif |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1296 | endif |
| Daniel Dunbar | 11328b7 | 2010-04-30 22:00:17 +0000 | [diff] [blame] | 1297 | endif |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1298 | |
| 1299 | # endif LIBRARYNAME |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1300 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1301 | |
| Reid Spencer | dcba778 | 2004-10-24 08:21:04 +0000 | [diff] [blame] | 1302 | ############################################################################### |
| 1303 | # Tool Build Rules: Build executable tool based on TOOLNAME option |
| 1304 | ############################################################################### |
| 1305 | |
| Chris Lattner | 07c7c19 | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 1306 | ifdef TOOLNAME |
| 1307 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1308 | #--------------------------------------------------------- |
| 1309 | # Set up variables for building a tool. |
| 1310 | #--------------------------------------------------------- |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1311 | TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT) |
| Reid Spencer | 7e9e0b0 | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 1312 | ifdef EXAMPLE_TOOL |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1313 | ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME) |
| Reid Spencer | 7e9e0b0 | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 1314 | else |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1315 | ToolBuildPath := $(ToolDir)/$(TOOLEXENAME) |
| 1316 | endif |
| 1317 | |
| 1318 | # TOOLALIAS is a name to symlink (or copy) the tool to. |
| 1319 | ifdef TOOLALIAS |
| 1320 | ifdef EXAMPLE_TOOL |
| 1321 | ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT) |
| 1322 | else |
| 1323 | ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT) |
| 1324 | endif |
| Reid Spencer | 7e9e0b0 | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 1325 | endif |
| Chris Lattner | 07c7c19 | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 1326 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1327 | #--------------------------------------------------------- |
| Chris Lattner | 0f195809 | 2009-02-26 17:47:49 +0000 | [diff] [blame] | 1328 | # Prune Exports |
| 1329 | #--------------------------------------------------------- |
| 1330 | |
| 1331 | # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by |
| 1332 | # not exporting all of the weak symbols from the binary. This reduces dyld |
| 1333 | # startup time by 4x on darwin in some cases. |
| 1334 | ifdef TOOL_NO_EXPORTS |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 1335 | ifeq ($(HOST_OS),Darwin) |
| Chris Lattner | 869b6bf | 2009-03-10 17:15:56 +0000 | [diff] [blame] | 1336 | |
| 1337 | # Tiger tools don't support this. |
| 1338 | ifneq ($(DARWIN_MAJVERS),4) |
| Dan Gohman | 91f8ad7 | 2010-04-16 22:58:15 +0000 | [diff] [blame] | 1339 | LD.Flags += -Wl,-exported_symbol,_main |
| Chris Lattner | 0f195809 | 2009-02-26 17:47:49 +0000 | [diff] [blame] | 1340 | endif |
| Chris Lattner | 869b6bf | 2009-03-10 17:15:56 +0000 | [diff] [blame] | 1341 | endif |
| Chris Lattner | 0f195809 | 2009-02-26 17:47:49 +0000 | [diff] [blame] | 1342 | |
| Rafael Espindola | aca9739 | 2013-10-31 14:35:00 +0000 | [diff] [blame] | 1343 | ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux NetBSD FreeBSD GNU/kFreeBSD GNU)) |
| Bruno Cardoso Lopes | 56129bd | 2010-07-20 08:44:20 +0000 | [diff] [blame] | 1344 | ifneq ($(ARCH), Mips) |
| Nick Lewycky | efd3e90 | 2009-10-25 03:22:00 +0000 | [diff] [blame] | 1345 | LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map |
| Chris Lattner | 0f195809 | 2009-02-26 17:47:49 +0000 | [diff] [blame] | 1346 | endif |
| 1347 | endif |
| Bruno Cardoso Lopes | 56129bd | 2010-07-20 08:44:20 +0000 | [diff] [blame] | 1348 | endif |
| Chris Lattner | 0f195809 | 2009-02-26 17:47:49 +0000 | [diff] [blame] | 1349 | |
| Devang Patel | cedf956 | 2010-07-15 20:57:09 +0000 | [diff] [blame] | 1350 | #--------------------------------------------------------- |
| Daniel Dunbar | 923e3ea | 2010-09-16 00:42:32 +0000 | [diff] [blame] | 1351 | # Tool Order File Support |
| 1352 | #--------------------------------------------------------- |
| 1353 | |
| 1354 | ifeq ($(HOST_OS),Darwin) |
| Daniel Dunbar | d1c487c | 2011-06-28 22:30:17 +0000 | [diff] [blame] | 1355 | ifdef TOOL_ORDER_FILE |
| Daniel Dunbar | 923e3ea | 2010-09-16 00:42:32 +0000 | [diff] [blame] | 1356 | |
| 1357 | LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE) |
| 1358 | |
| 1359 | endif |
| 1360 | endif |
| 1361 | |
| 1362 | #--------------------------------------------------------- |
| Devang Patel | cedf956 | 2010-07-15 20:57:09 +0000 | [diff] [blame] | 1363 | # Tool Version Info Support |
| 1364 | #--------------------------------------------------------- |
| 1365 | |
| 1366 | ifeq ($(HOST_OS),Darwin) |
| 1367 | ifdef TOOL_INFO_PLIST |
| 1368 | |
| 1369 | LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST) |
| 1370 | |
| 1371 | $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST) |
| 1372 | |
| Daniel Dunbar | 0a2f1ba | 2010-07-15 21:51:52 +0000 | [diff] [blame] | 1373 | $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir |
| Devang Patel | cedf956 | 2010-07-15 20:57:09 +0000 | [diff] [blame] | 1374 | $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..." |
| 1375 | $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \ |
| 1376 | -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \ |
| 1377 | -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \ |
| 1378 | -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \ |
| 1379 | $< > $@ |
| 1380 | |
| 1381 | endif |
| 1382 | endif |
| Chris Lattner | 0f195809 | 2009-02-26 17:47:49 +0000 | [diff] [blame] | 1383 | |
| 1384 | #--------------------------------------------------------- |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1385 | # Provide targets for building the tools |
| 1386 | #--------------------------------------------------------- |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1387 | all-local:: $(ToolBuildPath) $(ToolAliasBuildPath) |
| John Criswell | 8224df9 | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 1388 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1389 | clean-local:: |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1390 | ifneq ($(strip $(ToolBuildPath)),) |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1391 | -$(Verb) $(RM) -f $(ToolBuildPath) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1392 | endif |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1393 | ifneq ($(strip $(ToolAliasBuildPath)),) |
| 1394 | -$(Verb) $(RM) -f $(ToolAliasBuildPath) |
| 1395 | endif |
| Chris Lattner | 07c7c19 | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 1396 | |
| Reid Spencer | 7e9e0b0 | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 1397 | ifdef EXAMPLE_TOOL |
| 1398 | $(ToolBuildPath): $(ExmplDir)/.dir |
| 1399 | else |
| 1400 | $(ToolBuildPath): $(ToolDir)/.dir |
| 1401 | endif |
| 1402 | |
| Daniel Dunbar | 7e51b5f | 2012-03-06 19:07:38 +0000 | [diff] [blame] | 1403 | ifdef CODESIGN_TOOLS |
| Filipe Cabecinhas | 5afbec8 | 2013-04-25 01:17:54 +0000 | [diff] [blame] | 1404 | TOOL_CODESIGN_IDENTITY ?= - |
| 1405 | |
| Chris Lattner | a5d27b1 | 2006-09-04 06:39:52 +0000 | [diff] [blame] | 1406 | $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1407 | $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1408 | $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ |
| Reid Spencer | 1053658 | 2006-05-16 06:25:14 +0000 | [diff] [blame] | 1409 | $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) |
| Chris Lattner | e2dcbe0 | 2006-02-14 04:25:54 +0000 | [diff] [blame] | 1410 | $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \ |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1411 | $(StripWarnMsg) |
| Daniel Dunbar | 7e51b5f | 2012-03-06 19:07:38 +0000 | [diff] [blame] | 1412 | $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME) |
| Filipe Cabecinhas | 5afbec8 | 2013-04-25 01:17:54 +0000 | [diff] [blame] | 1413 | $(Verb) codesign -s $(TOOL_CODESIGN_IDENTITY) $@ |
| Daniel Dunbar | 7e51b5f | 2012-03-06 19:07:38 +0000 | [diff] [blame] | 1414 | else |
| 1415 | $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) |
| 1416 | $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) |
| 1417 | $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ |
| 1418 | $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) |
| 1419 | $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \ |
| 1420 | $(StripWarnMsg) |
| 1421 | endif |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1422 | |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1423 | ifneq ($(strip $(ToolAliasBuildPath)),) |
| 1424 | $(ToolAliasBuildPath): $(ToolBuildPath) |
| 1425 | $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg) |
| 1426 | $(Verb) $(RM) -f $(ToolAliasBuildPath) |
| Jordan Rose | 5f9dd32 | 2012-10-04 00:47:59 +0000 | [diff] [blame] | 1427 | $(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath) |
| Dan Gohman | a610304 | 2010-08-18 01:35:53 +0000 | [diff] [blame] | 1428 | $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \ |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1429 | $(StripWarnMsg) |
| 1430 | endif |
| 1431 | |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1432 | ifdef NO_INSTALL |
| 1433 | install-local:: |
| 1434 | $(Echo) Install circumvented with NO_INSTALL |
| 1435 | uninstall-local:: |
| 1436 | $(Echo) Uninstall circumvented with NO_INSTALL |
| 1437 | else |
| Bob Wilson | 3f35470 | 2011-11-28 07:59:52 +0000 | [diff] [blame] | 1438 | |
| 1439 | ifdef INTERNAL_TOOL |
| 1440 | ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin |
| 1441 | else |
| 1442 | ToolBinDir = $(DESTDIR)$(PROJ_bindir) |
| 1443 | endif |
| Jordan Rose | 3c837ab | 2012-10-01 18:40:32 +0000 | [diff] [blame] | 1444 | DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1445 | |
| Reid Spencer | be6a4e9 | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 1446 | install-local:: $(DestTool) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1447 | |
| Bob Wilson | 3f35470 | 2011-11-28 07:59:52 +0000 | [diff] [blame] | 1448 | $(DestTool): $(ToolBuildPath) |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1449 | $(Echo) Installing $(BuildMode) $(DestTool) |
| Bob Wilson | 3f35470 | 2011-11-28 07:59:52 +0000 | [diff] [blame] | 1450 | $(Verb) $(MKDIR) $(ToolBinDir) |
| Reid Spencer | c43b1d4 | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 1451 | $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1452 | |
| Reid Spencer | be6a4e9 | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 1453 | uninstall-local:: |
| Reid Spencer | b5b92fb | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1454 | $(Echo) Uninstalling $(BuildMode) $(DestTool) |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1455 | -$(Verb) $(RM) -f $(DestTool) |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1456 | |
| 1457 | # TOOLALIAS install. |
| 1458 | ifdef TOOLALIAS |
| Jordan Rose | 3c837ab | 2012-10-01 18:40:32 +0000 | [diff] [blame] | 1459 | DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT) |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1460 | |
| 1461 | install-local:: $(DestToolAlias) |
| 1462 | |
| Daniel Dunbar | 207014a9 | 2010-04-30 20:47:09 +0000 | [diff] [blame] | 1463 | $(DestToolAlias): $(DestTool) |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1464 | $(Echo) Installing $(BuildMode) $(DestToolAlias) |
| 1465 | $(Verb) $(RM) -f $(DestToolAlias) |
| Jordan Rose | 5f9dd32 | 2012-10-04 00:47:59 +0000 | [diff] [blame] | 1466 | $(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias) |
| Daniel Dunbar | 0dd2b81 | 2009-11-19 00:14:53 +0000 | [diff] [blame] | 1467 | |
| 1468 | uninstall-local:: |
| 1469 | $(Echo) Uninstalling $(BuildMode) $(DestToolAlias) |
| 1470 | -$(Verb) $(RM) -f $(DestToolAlias) |
| 1471 | endif |
| 1472 | |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 1473 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1474 | endif |
| Chris Lattner | 07c7c19 | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 1475 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1476 | ############################################################################### |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1477 | # Object Build Rules: Build object files based on sources |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1478 | ############################################################################### |
| 1479 | |
| Duraid Madina | cbbc184 | 2006-02-15 03:23:26 +0000 | [diff] [blame] | 1480 | # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX" |
| Anton Korobeynikov | 90e17e7 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 1481 | ifeq ($(HOST_OS),HP-UX) |
| Duraid Madina | cbbc184 | 2006-02-15 03:23:26 +0000 | [diff] [blame] | 1482 | DISABLE_AUTO_DEPENDENCIES=1 |
| 1483 | endif |
| 1484 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1485 | COMPILE_DEPS = $(OBJECT_DIRS) $(BUILT_SOURCES) $(PROJ_MAKEFILE) |
| 1486 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1487 | # Provide rule sets for when dependency generation is enabled |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1488 | ifndef DISABLE_AUTO_DEPENDENCIES |
| Vikram S. Adve | 20aa62f | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 1489 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1490 | #--------------------------------------------------------- |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1491 | # Create .o files in the ObjDir directory from the .cpp and .c files... |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1492 | #--------------------------------------------------------- |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1493 | |
| Chris Lattner | c23e635 | 2007-12-31 23:58:31 +0000 | [diff] [blame] | 1494 | DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \ |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1495 | -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d" |
| Gabor Greif | c848f9e | 2008-02-27 13:34:15 +0000 | [diff] [blame] | 1496 | |
| Daniel Dunbar | 8a28e01 | 2009-05-12 06:35:50 +0000 | [diff] [blame] | 1497 | # If the build succeeded, move the dependency file over, otherwise |
| 1498 | # remove it. |
| Chris Lattner | c23e635 | 2007-12-31 23:58:31 +0000 | [diff] [blame] | 1499 | DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \ |
| 1500 | else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi |
| 1501 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1502 | $(ObjDir)/%.o: %.cpp $(COMPILE_DEPS) |
| Jakob Stoklund Olesen | befc853 | 2009-10-04 17:54:36 +0000 | [diff] [blame] | 1503 | $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1504 | $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ |
| Chris Lattner | c23e635 | 2007-12-31 23:58:31 +0000 | [diff] [blame] | 1505 | $(DEPEND_MOVEFILE) |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1506 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1507 | $(ObjDir)/%.o: %.mm $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1508 | $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG) |
| 1509 | $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ |
| 1510 | $(DEPEND_MOVEFILE) |
| 1511 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1512 | $(ObjDir)/%.o: %.cc $(COMPILE_DEPS) |
| Chris Lattner | 085c715 | 2006-06-21 20:58:03 +0000 | [diff] [blame] | 1513 | $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1514 | $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ |
| Chris Lattner | c23e635 | 2007-12-31 23:58:31 +0000 | [diff] [blame] | 1515 | $(DEPEND_MOVEFILE) |
| Chris Lattner | f60c170 | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1516 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1517 | $(ObjDir)/%.o: %.c $(COMPILE_DEPS) |
| Chris Lattner | 085c715 | 2006-06-21 20:58:03 +0000 | [diff] [blame] | 1518 | $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1519 | $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ |
| Chris Lattner | c23e635 | 2007-12-31 23:58:31 +0000 | [diff] [blame] | 1520 | $(DEPEND_MOVEFILE) |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1521 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1522 | $(ObjDir)/%.o: %.m $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1523 | $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG) |
| 1524 | $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ |
| 1525 | $(DEPEND_MOVEFILE) |
| 1526 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1527 | # Provide alternate rule sets if dependencies are disabled |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1528 | else |
| 1529 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1530 | $(ObjDir)/%.o: %.cpp $(COMPILE_DEPS) |
| Chris Lattner | 085c715 | 2006-06-21 20:58:03 +0000 | [diff] [blame] | 1531 | $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1532 | $(Compile.CXX) $< -o $@ |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1533 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1534 | $(ObjDir)/%.o: %.mm $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1535 | $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG) |
| 1536 | $(Compile.CXX) $< -o $@ |
| 1537 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1538 | $(ObjDir)/%.o: %.cc $(COMPILE_DEPS) |
| Chris Lattner | 085c715 | 2006-06-21 20:58:03 +0000 | [diff] [blame] | 1539 | $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1540 | $(Compile.CXX) $< -o $@ |
| Chris Lattner | f60c170 | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1541 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1542 | $(ObjDir)/%.o: %.c $(COMPILE_DEPS) |
| Chris Lattner | 085c715 | 2006-06-21 20:58:03 +0000 | [diff] [blame] | 1543 | $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1544 | $(Compile.C) $< -o $@ |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1545 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1546 | $(ObjDir)/%.o: %.m $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1547 | $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG) |
| 1548 | $(Compile.C) $< -o $@ |
| Chris Lattner | 07c7c19 | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 1549 | endif |
| 1550 | |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1551 | |
| 1552 | ## Rules for building preprocessed (.i/.ii) outputs. |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1553 | $(BuildMode)/%.ii: %.cpp $(COMPILE_DEPS) |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1554 | $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file" |
| 1555 | $(Verb) $(Preprocess.CXX) $< -o $@ |
| 1556 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1557 | $(BuildMode)/%.ii: %.mm $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1558 | $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file" |
| 1559 | $(Verb) $(Preprocess.CXX) $< -o $@ |
| 1560 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1561 | $(BuildMode)/%.ii: %.cc $(COMPILE_DEPS) |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1562 | $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file" |
| 1563 | $(Verb) $(Preprocess.CXX) $< -o $@ |
| 1564 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1565 | $(BuildMode)/%.i: %.c $(COMPILE_DEPS) |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1566 | $(Echo) "Compiling $*.c for $(BuildMode) build to .i file" |
| 1567 | $(Verb) $(Preprocess.C) $< -o $@ |
| 1568 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1569 | $(BuildMode)/%.i: %.m $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1570 | $(Echo) "Compiling $*.m for $(BuildMode) build to .i file" |
| 1571 | $(Verb) $(Preprocess.C) $< -o $@ |
| 1572 | |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1573 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1574 | $(ObjDir)/%.s: %.cpp $(COMPILE_DEPS) |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1575 | $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1576 | $(Compile.CXX) $< -o $@ -S |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1577 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1578 | $(ObjDir)/%.s: %.mm $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1579 | $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG) |
| 1580 | $(Compile.CXX) $< -o $@ -S |
| 1581 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1582 | $(ObjDir)/%.s: %.cc $(COMPILE_DEPS) |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1583 | $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1584 | $(Compile.CXX) $< -o $@ -S |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1585 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1586 | $(ObjDir)/%.s: %.c $(COMPILE_DEPS) |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1587 | $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG) |
| Nick Lewycky | 28c62d2 | 2009-02-26 07:44:16 +0000 | [diff] [blame] | 1588 | $(Compile.C) $< -o $@ -S |
| Chris Lattner | 161a84e | 2006-06-21 21:01:20 +0000 | [diff] [blame] | 1589 | |
| Chandler Carruth | 9c33cfa | 2013-11-14 23:51:29 +0000 | [diff] [blame] | 1590 | $(ObjDir)/%.s: %.m $(COMPILE_DEPS) |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1591 | $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG) |
| 1592 | $(Compile.C) $< -o $@ -S |
| 1593 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1594 | ############################################################################### |
| 1595 | # TABLEGEN: Provide rules for running tblgen to produce *.inc files |
| 1596 | ############################################################################### |
| Chris Lattner | 0c4f4fe | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 1597 | |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1598 | ifdef TARGET |
| Mikhail Glushenkov | c6333bd | 2009-03-02 09:42:59 +0000 | [diff] [blame] | 1599 | TABLEGEN_INC_FILES_COMMON = 1 |
| 1600 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1601 | |
| Mikhail Glushenkov | c6333bd | 2009-03-02 09:42:59 +0000 | [diff] [blame] | 1602 | ifdef TABLEGEN_INC_FILES_COMMON |
| 1603 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1604 | INCFiles := $(filter %.inc,$(BUILT_SOURCES)) |
| Chris Lattner | 2a02390 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1605 | INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp) |
| 1606 | .PRECIOUS: $(INCTMPFiles) $(INCFiles) |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1607 | |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1608 | # INCFiles rule: All of the tblgen generated files are emitted to |
| Chris Lattner | f86914d | 2004-12-16 17:38:56 +0000 | [diff] [blame] | 1609 | # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows |
| 1610 | # us to only "touch" the real file if the contents of it change. IOW, if |
| Daniel Dunbar | d395a17 | 2008-11-03 17:33:36 +0000 | [diff] [blame] | 1611 | # tblgen is modified, all of the .inc.tmp files are regenerated, but no |
| Chris Lattner | f86914d | 2004-12-16 17:38:56 +0000 | [diff] [blame] | 1612 | # dependencies of the .inc files are, unless the contents of the .inc file |
| 1613 | # changes. |
| 1614 | $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp |
| Reid Spencer | afdc82c | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1615 | $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ |
| Chris Lattner | 2a02390 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1616 | |
| Mikhail Glushenkov | c6333bd | 2009-03-02 09:42:59 +0000 | [diff] [blame] | 1617 | endif # TABLEGEN_INC_FILES_COMMON |
| 1618 | |
| 1619 | ifdef TARGET |
| 1620 | |
| 1621 | TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \ |
| 1622 | $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \ |
| 1623 | $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \ |
| 1624 | $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \ |
| 1625 | $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \ |
| 1626 | $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \ |
| Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 1627 | $(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td) |
| Mikhail Glushenkov | c6333bd | 2009-03-02 09:42:59 +0000 | [diff] [blame] | 1628 | |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1629 | # All .inc.tmp files depend on the .td files. |
| 1630 | $(INCTMPFiles) : $(TDFiles) |
| Rafael Espindola | 59e371a | 2009-03-10 17:58:54 +0000 | [diff] [blame] | 1631 | |
| Chris Lattner | 2a02390 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1632 | $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1633 | $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1634 | $(Echo) "Building $(<F) register info implementation with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1635 | $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $< |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1636 | |
| Chris Lattner | 2a02390 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1637 | $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1638 | $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1639 | $(Echo) "Building $(<F) instruction information with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1640 | $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $< |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1641 | |
| Chris Lattner | 2a02390 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1642 | $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1643 | $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1644 | $(Echo) "Building $(<F) assembly writer with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1645 | $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $< |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1646 | |
| Chris Lattner | 22f937a | 2004-12-16 17:34:04 +0000 | [diff] [blame] | 1647 | $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1648 | $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Chris Lattner | 22f937a | 2004-12-16 17:34:04 +0000 | [diff] [blame] | 1649 | $(Echo) "Building $(<F) assembly writer #1 with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1650 | $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $< |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1651 | |
| Daniel Dunbar | 2841ea4 | 2009-07-13 18:35:35 +0000 | [diff] [blame] | 1652 | $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1653 | $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Daniel Dunbar | 2841ea4 | 2009-07-13 18:35:35 +0000 | [diff] [blame] | 1654 | $(Echo) "Building $(<F) assembly matcher with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1655 | $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $< |
| Daniel Dunbar | 2841ea4 | 2009-07-13 18:35:35 +0000 | [diff] [blame] | 1656 | |
| Jim Grosbach | cd536df | 2010-11-03 23:46:01 +0000 | [diff] [blame] | 1657 | $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1658 | $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Jim Grosbach | cd536df | 2010-11-03 23:46:01 +0000 | [diff] [blame] | 1659 | $(Echo) "Building $(<F) MC code emitter with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1660 | $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $< |
| Jim Grosbach | cd536df | 2010-11-03 23:46:01 +0000 | [diff] [blame] | 1661 | |
| Jim Grosbach | bcb36be | 2011-07-08 17:36:35 +0000 | [diff] [blame] | 1662 | $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1663 | $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Jim Grosbach | bcb36be | 2011-07-08 17:36:35 +0000 | [diff] [blame] | 1664 | $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1665 | $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $< |
| Jim Grosbach | bcb36be | 2011-07-08 17:36:35 +0000 | [diff] [blame] | 1666 | |
| Chris Lattner | 2a02390 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1667 | $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1668 | $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1669 | $(Echo) "Building $(<F) code emitter with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1670 | $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $< |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1671 | |
| Chris Lattner | 33f98bd | 2005-09-03 01:15:25 +0000 | [diff] [blame] | 1672 | $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1673 | $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Dan Gohman | b2226e2 | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 1674 | $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1675 | $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $< |
| Chris Lattner | 33f98bd | 2005-09-03 01:15:25 +0000 | [diff] [blame] | 1676 | |
| Daniel Dunbar | e8b8cce | 2009-11-25 04:46:58 +0000 | [diff] [blame] | 1677 | $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1678 | $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Daniel Dunbar | e8b8cce | 2009-11-25 04:46:58 +0000 | [diff] [blame] | 1679 | $(Echo) "Building $(<F) disassembly tables with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1680 | $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $< |
| Daniel Dunbar | e8b8cce | 2009-11-25 04:46:58 +0000 | [diff] [blame] | 1681 | |
| Dan Gohman | b2226e2 | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 1682 | $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1683 | $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Dan Gohman | b2226e2 | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 1684 | $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1685 | $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $< |
| Dan Gohman | b2226e2 | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 1686 | |
| Evan Cheng | c9c090d | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 1687 | $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1688 | $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Jim Laskey | 9ed9032 | 2005-10-21 19:05:19 +0000 | [diff] [blame] | 1689 | $(Echo) "Building $(<F) subtarget information with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1690 | $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $< |
| Chris Lattner | 33f98bd | 2005-09-03 01:15:25 +0000 | [diff] [blame] | 1691 | |
| Chris Lattner | ee0fe3b | 2007-02-27 20:44:12 +0000 | [diff] [blame] | 1692 | $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1693 | $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Chris Lattner | ee0fe3b | 2007-02-27 20:44:12 +0000 | [diff] [blame] | 1694 | $(Echo) "Building $(<F) calling convention information with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1695 | $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $< |
| Chris Lattner | ee0fe3b | 2007-02-27 20:44:12 +0000 | [diff] [blame] | 1696 | |
| Dale Johannesen | b842d52 | 2009-02-05 01:49:45 +0000 | [diff] [blame] | 1697 | $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \ |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1698 | $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Jakob Stoklund Olesen | 7984305 | 2009-10-15 18:48:47 +0000 | [diff] [blame] | 1699 | $(Echo) "Building $(<F) intrinsics information with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1700 | $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $< |
| Dale Johannesen | b842d52 | 2009-02-05 01:49:45 +0000 | [diff] [blame] | 1701 | |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1702 | $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| Johnny Chen | 7b999ea | 2010-04-02 22:27:38 +0000 | [diff] [blame] | 1703 | $(Echo) "Building $(<F) decoder tables with tblgen" |
| Peter Collingbourne | fb3d935 | 2011-10-06 01:51:51 +0000 | [diff] [blame] | 1704 | $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $< |
| Johnny Chen | 7b999ea | 2010-04-02 22:27:38 +0000 | [diff] [blame] | 1705 | |
| Anshuman Dasgupta | 08ebdc1 | 2011-12-01 21:10:21 +0000 | [diff] [blame] | 1706 | $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) |
| 1707 | $(Echo) "Building $(<F) DFA packetizer tables with tblgen" |
| 1708 | $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $< |
| Johnny Chen | 7b999ea | 2010-04-02 22:27:38 +0000 | [diff] [blame] | 1709 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1710 | clean-local:: |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1711 | -$(Verb) $(RM) -f $(INCFiles) |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1712 | |
| Mikhail Glushenkov | c6333bd | 2009-03-02 09:42:59 +0000 | [diff] [blame] | 1713 | endif # TARGET |
| 1714 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1715 | ############################################################################### |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1716 | # OTHER RULES: Other rules needed |
| 1717 | ############################################################################### |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1718 | |
| Chris Lattner | 23d4739 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 1719 | # To create postscript files from dot files... |
| John Criswell | 4ffb844 | 2003-10-02 19:02:02 +0000 | [diff] [blame] | 1720 | ifneq ($(DOT),false) |
| Chris Lattner | 23d4739 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 1721 | %.ps: %.dot |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1722 | $(DOT) -Tps < $< > $@ |
| John Criswell | 3ef61af | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 1723 | else |
| 1724 | %.ps: %.dot |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1725 | $(Echo) "Cannot build $@: The program dot is not installed" |
| John Criswell | 3ef61af | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 1726 | endif |
| Chris Lattner | 23d4739 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 1727 | |
| John Criswell | 0a6e6aa | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 1728 | # This rules ensures that header files that are removed still have a rule for |
| 1729 | # which they can be "generated." This allows make to ignore them and |
| 1730 | # reproduce the dependency lists. |
| John Criswell | a8391af | 2003-09-18 18:37:08 +0000 | [diff] [blame] | 1731 | %.h:: ; |
| Chris Lattner | f60c170 | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1732 | %.hpp:: ; |
| John Criswell | 0a6e6aa | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 1733 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1734 | # Define clean-local to clean the current directory. Note that this uses a |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1735 | # very conservative approach ensuring that empty variables do not cause |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1736 | # errors or disastrous removal. |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1737 | clean-local:: |
| Jim Grosbach | 009db89 | 2008-10-02 22:56:44 +0000 | [diff] [blame] | 1738 | ifneq ($(strip $(ObjRootDir)),) |
| 1739 | -$(Verb) $(RM) -rf $(ObjRootDir) |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1740 | endif |
| Brian Gaeke | 8625f68 | 2004-01-21 19:53:11 +0000 | [diff] [blame] | 1741 | ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1742 | -$(Verb) $(RM) -f *$(SHLIBEXT) |
| Brian Gaeke | 8625f68 | 2004-01-21 19:53:11 +0000 | [diff] [blame] | 1743 | endif |
| John Criswell | 3ef61af | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 1744 | |
| Reid Spencer | 9d0c1e0 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1745 | clean-all-local:: |
| Reid Spencer | 651dd3ad | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1746 | -$(Verb) $(RM) -rf Debug Release Profile |
| Reid Spencer | 9d0c1e0 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1747 | |
| Reid Spencer | aee67e6 | 2004-11-12 02:27:36 +0000 | [diff] [blame] | 1748 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1749 | ############################################################################### |
| 1750 | # DEPENDENCIES: Include the dependency files if we should |
| 1751 | ############################################################################### |
| Chris Lattner | e9d7d70 | 2003-08-22 14:10:16 +0000 | [diff] [blame] | 1752 | ifndef DISABLE_AUTO_DEPENDENCIES |
| 1753 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1754 | # If its not one of the cleaning targets |
| Daniel Dunbar | 78caa02 | 2008-10-03 19:11:19 +0000 | [diff] [blame] | 1755 | ifndef IS_CLEANING_TARGET |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1756 | |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1757 | # Get the list of dependency files |
| Greg Clayton | f9d1776 | 2010-07-13 18:47:09 +0000 | [diff] [blame] | 1758 | DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources))) |
| Daniel Dunbar | 8a28e01 | 2009-05-12 06:35:50 +0000 | [diff] [blame] | 1759 | DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d) |
| 1760 | |
| Reid Spencer | fcd7815 | 2007-07-23 08:20:46 +0000 | [diff] [blame] | 1761 | -include $(DependFiles) "" |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1762 | |
| John Criswell | 48ecca6 | 2003-08-12 18:51:51 +0000 | [diff] [blame] | 1763 | endif |
| Chris Lattner | 598222b | 2003-08-18 17:27:40 +0000 | [diff] [blame] | 1764 | |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1765 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1766 | |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1767 | ############################################################################### |
| Reid Spencer | 8b5ebe5 | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1768 | # CHECK: Running the test suite |
| 1769 | ############################################################################### |
| 1770 | |
| Eric Christopher | caeddf5 | 2013-04-09 19:42:12 +0000 | [diff] [blame] | 1771 | check:: all |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1772 | $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \ |
| 1773 | if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \ |
| Reid Spencer | 8b5ebe5 | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1774 | $(EchoCmd) Running test suite ; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1775 | $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \ |
| Reid Spencer | 8b5ebe5 | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1776 | TESTSUITE=$(TESTSUITE) ; \ |
| 1777 | else \ |
| 1778 | $(EchoCmd) No Makefile in test directory ; \ |
| 1779 | fi ; \ |
| 1780 | else \ |
| 1781 | $(EchoCmd) No test directory ; \ |
| 1782 | fi |
| 1783 | |
| Chandler Carruth | c00bdab5 | 2012-06-28 00:03:13 +0000 | [diff] [blame] | 1784 | # An alias dating from when both lit and DejaGNU test runners were used. |
| Daniel Dunbar | b1af605 | 2010-08-02 00:05:18 +0000 | [diff] [blame] | 1785 | check-lit:: check |
| 1786 | |
| Daniel Dunbar | f2719e6 | 2009-09-20 06:17:21 +0000 | [diff] [blame] | 1787 | check-all:: |
| 1788 | $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \ |
| 1789 | if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \ |
| 1790 | $(EchoCmd) Running test suite ; \ |
| 1791 | $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \ |
| 1792 | else \ |
| 1793 | $(EchoCmd) No Makefile in test directory ; \ |
| 1794 | fi ; \ |
| 1795 | else \ |
| 1796 | $(EchoCmd) No test directory ; \ |
| 1797 | fi |
| 1798 | |
| Reid Spencer | 8b5ebe5 | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1799 | ############################################################################### |
| Bill Wendling | 8790e32 | 2009-01-04 23:12:21 +0000 | [diff] [blame] | 1800 | # UNITTESTS: Running the unittests test suite |
| 1801 | ############################################################################### |
| 1802 | |
| Bill Wendling | f704f90 | 2009-04-09 18:26:57 +0000 | [diff] [blame] | 1803 | unittests:: |
| Bill Wendling | 8790e32 | 2009-01-04 23:12:21 +0000 | [diff] [blame] | 1804 | $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \ |
| 1805 | if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \ |
| 1806 | $(EchoCmd) Running unittests test suite ; \ |
| Daniel Dunbar | 96ccc47 | 2009-09-13 22:39:27 +0000 | [diff] [blame] | 1807 | $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \ |
| Bill Wendling | 8790e32 | 2009-01-04 23:12:21 +0000 | [diff] [blame] | 1808 | else \ |
| 1809 | $(EchoCmd) No Makefile in unittests directory ; \ |
| 1810 | fi ; \ |
| 1811 | else \ |
| 1812 | $(EchoCmd) No unittests directory ; \ |
| 1813 | fi |
| 1814 | |
| 1815 | ############################################################################### |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1816 | # DISTRIBUTION: Handle construction of a distribution tarball |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1817 | ############################################################################### |
| 1818 | |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1819 | #------------------------------------------------------------------------ |
| 1820 | # Define distribution related variables |
| 1821 | #------------------------------------------------------------------------ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1822 | DistName := $(PROJECT_NAME)-$(PROJ_VERSION) |
| 1823 | DistDir := $(PROJ_OBJ_ROOT)/$(DistName) |
| 1824 | TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName) |
| 1825 | DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz |
| 1826 | DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip |
| 1827 | DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2 |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1828 | DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \ |
| 1829 | ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1830 | Makefile.config.in configure autoconf |
| 1831 | DistOther := $(notdir $(wildcard \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1832 | $(PROJ_SRC_DIR)/*.h \ |
| 1833 | $(PROJ_SRC_DIR)/*.td \ |
| 1834 | $(PROJ_SRC_DIR)/*.def \ |
| 1835 | $(PROJ_SRC_DIR)/*.ll \ |
| 1836 | $(PROJ_SRC_DIR)/*.in)) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1837 | DistSubDirs := $(SubDirs) |
| Reid Spencer | fc66af4 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1838 | DistSources = $(Sources) $(EXTRA_DIST) |
| 1839 | DistFiles = $(DistAlways) $(DistSources) $(DistOther) |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1840 | |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1841 | #------------------------------------------------------------------------ |
| 1842 | # We MUST build distribution with OBJ_DIR != SRC_DIR |
| 1843 | #------------------------------------------------------------------------ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1844 | ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR)) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1845 | dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip :: |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1846 | $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1847 | |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1848 | else |
| 1849 | |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1850 | #------------------------------------------------------------------------ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1851 | # Prevent attempt to run dist targets from anywhere but the top level |
| 1852 | #------------------------------------------------------------------------ |
| 1853 | ifneq ($(LEVEL),.) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1854 | dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip :: |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1855 | $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1856 | else |
| 1857 | |
| 1858 | #------------------------------------------------------------------------ |
| 1859 | # Provide the top level targets |
| 1860 | #------------------------------------------------------------------------ |
| 1861 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1862 | dist-gzip:: $(DistTarGZip) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1863 | |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1864 | $(DistTarGZip) : $(TopDistDir)/.makedistdir |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1865 | $(Echo) Packing gzipped distribution tar file. |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1866 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \ |
| Reid Spencer | fc66af4 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1867 | $(GZIP) -c > "$(DistTarGZip)" |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1868 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1869 | dist-bzip2:: $(DistTarBZ2) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1870 | |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1871 | $(DistTarBZ2) : $(TopDistDir)/.makedistdir |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1872 | $(Echo) Packing bzipped distribution tar file. |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1873 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \ |
| Reid Spencer | fc66af4 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1874 | $(BZIP2) -c >$(DistTarBZ2) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1875 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1876 | dist-zip:: $(DistZip) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1877 | |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1878 | $(DistZip) : $(TopDistDir)/.makedistdir |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1879 | $(Echo) Packing zipped distribution file. |
| 1880 | $(Verb) rm -f $(DistZip) |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1881 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1882 | |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1883 | dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip) |
| Chris Lattner | 0ab5e2c | 2011-04-15 05:18:47 +0000 | [diff] [blame] | 1884 | $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL ===== |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1885 | |
| Reid Spencer | 3a46875 | 2005-01-28 19:52:32 +0000 | [diff] [blame] | 1886 | DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1887 | |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1888 | dist-check:: $(DistTarGZip) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1889 | $(Echo) Checking distribution tar file. |
| 1890 | $(Verb) if test -d $(DistCheckDir) ; then \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1891 | $(RM) -rf $(DistCheckDir) ; \ |
| 1892 | fi |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1893 | $(Verb) $(MKDIR) $(DistCheckDir) |
| 1894 | $(Verb) cd $(DistCheckDir) && \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1895 | $(MKDIR) $(DistCheckDir)/build && \ |
| 1896 | $(MKDIR) $(DistCheckDir)/install && \ |
| 1897 | gunzip -c $(DistTarGZip) | $(TAR) xf - && \ |
| 1898 | cd build && \ |
| 1899 | ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \ |
| Reid Spencer | 13f5193 | 2005-05-24 02:33:20 +0000 | [diff] [blame] | 1900 | --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1901 | $(MAKE) all && \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1902 | $(MAKE) check && \ |
| Bill Wendling | 8790e32 | 2009-01-04 23:12:21 +0000 | [diff] [blame] | 1903 | $(MAKE) unittests && \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1904 | $(MAKE) install && \ |
| 1905 | $(MAKE) uninstall && \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1906 | $(MAKE) dist-clean && \ |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1907 | $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution ===== |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1908 | |
| 1909 | dist-clean:: |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1910 | $(Echo) Cleaning distribution files |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1911 | -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \ |
| 1912 | $(DistCheckDir) |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1913 | |
| 1914 | endif |
| 1915 | |
| 1916 | #------------------------------------------------------------------------ |
| 1917 | # Provide the recursive distdir target for building the distribution directory |
| 1918 | #------------------------------------------------------------------------ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1919 | distdir: $(DistDir)/.makedistdir |
| 1920 | $(DistDir)/.makedistdir: $(DistSources) |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1921 | $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1922 | if test -d "$(DistDir)" ; then \ |
| 1923 | find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \ |
| 1924 | exit 1 ; \ |
| 1925 | fi ; \ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1926 | $(EchoCmd) Removing old $(DistDir) ; \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1927 | $(RM) -rf $(DistDir); \ |
| Reid Spencer | 8b5ebe5 | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1928 | $(EchoCmd) Making 'all' to verify build ; \ |
| Reid Spencer | 15b8509 | 2006-04-10 16:46:04 +0000 | [diff] [blame] | 1929 | $(MAKE) ENABLE_OPTIMIZED=1 all ; \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1930 | fi |
| Reid Spencer | fc66af4 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1931 | $(Echo) Building Distribution Directory $(DistDir) |
| Misha Brukman | 2879c29 | 2009-01-08 02:11:55 +0000 | [diff] [blame] | 1932 | $(Verb) $(MKDIR) $(DistDir) |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1933 | $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \ |
| 1934 | srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1935 | for file in $(DistFiles) ; do \ |
| 1936 | case "$$file" in \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1937 | $(PROJ_SRC_DIR)/*) \ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1938 | file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \ |
| 1939 | ;; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1940 | $(PROJ_SRC_ROOT)/*) \ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1941 | file=`echo "$$file" | \ |
| 1942 | sed "s#^$$srcrootstrip/##"` \ |
| 1943 | ;; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1944 | esac; \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1945 | if test -f "$(PROJ_SRC_DIR)/$$file" || \ |
| 1946 | test -d "$(PROJ_SRC_DIR)/$$file" ; then \ |
| 1947 | from_dir="$(PROJ_SRC_DIR)" ; \ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1948 | elif test -f "$$file" || test -d "$$file" ; then \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1949 | from_dir=. ; \ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1950 | fi ; \ |
| 1951 | to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1952 | if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \ |
| 1953 | to_dir="$(DistDir)/$$dir"; \ |
| 1954 | $(MKDIR) "$$to_dir" ; \ |
| 1955 | else \ |
| 1956 | to_dir="$(DistDir)"; \ |
| 1957 | fi; \ |
| 1958 | mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \ |
| 1959 | if test -n "$$mid_dir" ; then \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1960 | $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1961 | fi ; \ |
| 1962 | if test -d "$$from_dir/$$file"; then \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1963 | if test -d "$(PROJ_SRC_DIR)/$$file" && \ |
| 1964 | test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \ |
| Reid Spencer | 13f5193 | 2005-05-24 02:33:20 +0000 | [diff] [blame] | 1965 | cd $(PROJ_SRC_DIR) ; \ |
| 1966 | $(TAR) cf - $$file --exclude .svn --exclude CVS | \ |
| 1967 | ( cd $$to_dir ; $(TAR) xf - ) ; \ |
| 1968 | cd $(PROJ_OBJ_DIR) ; \ |
| 1969 | else \ |
| 1970 | cd $$from_dir ; \ |
| 1971 | $(TAR) cf - $$file --exclude .svn --exclude CVS | \ |
| 1972 | ( cd $$to_dir ; $(TAR) xf - ) ; \ |
| 1973 | cd $(PROJ_OBJ_DIR) ; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1974 | fi; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1975 | elif test -f "$$from_dir/$$file" ; then \ |
| Reid Spencer | afdc82c | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1976 | $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1977 | elif test -L "$$from_dir/$$file" ; then \ |
| Reid Spencer | afdc82c | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1978 | $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1979 | elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1980 | $(EchoCmd) "===== WARNING: Distribution Source " \ |
| 1981 | "$$from_dir/$$file Not Found!" ; \ |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1982 | elif test "$(Verb)" != '@' ; then \ |
| 1983 | $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1984 | fi; \ |
| 1985 | done |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1986 | $(Verb) for subdir in $(DistSubDirs) ; do \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1987 | if test "$$subdir" \!= "." ; then \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1988 | new_distdir="$(DistDir)/$$subdir" ; \ |
| Reid Spencer | 8da1b5d | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1989 | test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \ |
| Reid Spencer | 15b8509 | 2006-04-10 16:46:04 +0000 | [diff] [blame] | 1990 | ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \ |
| Reid Spencer | 056f022 | 2006-04-07 16:06:18 +0000 | [diff] [blame] | 1991 | DistDir="$$new_distdir" distdir ) || exit 1; \ |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1992 | fi; \ |
| 1993 | done |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1994 | $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \ |
| Reid Spencer | 13f5193 | 2005-05-24 02:33:20 +0000 | [diff] [blame] | 1995 | $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \ |
| Chris Lattner | b8e7aa0 | 2006-02-14 04:27:15 +0000 | [diff] [blame] | 1996 | $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \ |
| 1997 | -name .svn \) -print` ;\ |
| Reid Spencer | 8154658 | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1998 | $(MAKE) dist-hook ; \ |
| 1999 | $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \ |
| 2000 | -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \ |
| 2001 | -o ! -type d ! -perm -400 -exec chmod a+r {} \; \ |
| 2002 | -o ! -type d ! -perm -444 -exec \ |
| 2003 | $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \ |
| 2004 | || chmod -R a+r $(DistDir) ; \ |
| 2005 | fi |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 2006 | |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 2007 | # This is invoked by distdir target, define it as a no-op to avoid errors if not |
| 2008 | # defined by user. |
| Reid Spencer | 100080c | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 2009 | dist-hook:: |
| 2010 | |
| Reid Spencer | 23a7037 | 2004-10-22 23:06:30 +0000 | [diff] [blame] | 2011 | endif |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 2012 | |
| 2013 | ############################################################################### |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 2014 | # TOP LEVEL - targets only to apply at the top level directory |
| 2015 | ############################################################################### |
| 2016 | |
| 2017 | ifeq ($(LEVEL),.) |
| 2018 | |
| 2019 | #------------------------------------------------------------------------ |
| Reid Spencer | 8b5ebe5 | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 2020 | # Install support for the project's include files: |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 2021 | #------------------------------------------------------------------------ |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 2022 | ifdef NO_INSTALL |
| 2023 | install-local:: |
| 2024 | $(Echo) Install circumvented with NO_INSTALL |
| 2025 | uninstall-local:: |
| 2026 | $(Echo) Uninstall circumvented with NO_INSTALL |
| 2027 | else |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 2028 | install-local:: |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 2029 | $(Echo) Installing include files |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 2030 | $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir) |
| Reid Spencer | c43b1d4 | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 2031 | $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \ |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 2032 | cd $(PROJ_SRC_ROOT)/include && \ |
| NAKAMURA Takumi | 2035ab2 | 2011-03-09 09:11:27 +0000 | [diff] [blame] | 2033 | for hdr in `find . -type f \ |
| 2034 | '(' -name LICENSE.TXT \ |
| 2035 | -o -name '*.def' \ |
| 2036 | -o -name '*.h' \ |
| 2037 | -o -name '*.inc' \ |
| 2038 | -o -name '*.td' \ |
| 2039 | ')' -print | grep -v CVS | \ |
| Reid Spencer | c82c2cf | 2007-04-09 19:08:58 +0000 | [diff] [blame] | 2040 | grep -v .svn` ; do \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 2041 | instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \ |
| Reid Spencer | c43b1d4 | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 2042 | if test \! -d "$$instdir" ; then \ |
| 2043 | $(EchoCmd) Making install directory $$instdir ; \ |
| 2044 | $(MKDIR) $$instdir ;\ |
| 2045 | fi ; \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 2046 | $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \ |
| Reid Spencer | 48a82f4 | 2005-02-16 15:54:03 +0000 | [diff] [blame] | 2047 | done ; \ |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 2048 | fi |
| Reid Spencer | 528c980 | 2005-12-23 22:27:56 +0000 | [diff] [blame] | 2049 | ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) |
| Reid Spencer | c43b1d4 | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 2050 | $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \ |
| Reid Spencer | 48a82f4 | 2005-02-16 15:54:03 +0000 | [diff] [blame] | 2051 | cd $(PROJ_OBJ_ROOT)/include && \ |
| NAKAMURA Takumi | 2035ab2 | 2011-03-09 09:11:27 +0000 | [diff] [blame] | 2052 | for hdr in `find . -type f \ |
| 2053 | '(' -name LICENSE.TXT \ |
| 2054 | -o -name '*.def' \ |
| 2055 | -o -name '*.h' \ |
| 2056 | -o -name '*.inc' \ |
| 2057 | -o -name '*.td' \ |
| 2058 | ')' -print | grep -v CVS | \ |
| 2059 | grep -v .svn` ; do \ |
| 2060 | instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \ |
| 2061 | if test \! -d "$$instdir" ; then \ |
| 2062 | $(EchoCmd) Making install directory $$instdir ; \ |
| 2063 | $(MKDIR) $$instdir ;\ |
| 2064 | fi ; \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 2065 | $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \ |
| Reid Spencer | 48a82f4 | 2005-02-16 15:54:03 +0000 | [diff] [blame] | 2066 | done ; \ |
| Chris Lattner | 81bfc9e | 2005-02-09 02:24:00 +0000 | [diff] [blame] | 2067 | fi |
| Reid Spencer | 528c980 | 2005-12-23 22:27:56 +0000 | [diff] [blame] | 2068 | endif |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 2069 | |
| 2070 | uninstall-local:: |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 2071 | $(Echo) Uninstalling include files |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 2072 | $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \ |
| 2073 | cd $(PROJ_SRC_ROOT)/include && \ |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 2074 | $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \ |
| Chris Lattner | 814d9ee | 2009-01-02 07:16:45 +0000 | [diff] [blame] | 2075 | '!' '(' -name '*~' -o -name '.#*' \ |
| Chris Lattner | e2dcbe0 | 2006-02-14 04:25:54 +0000 | [diff] [blame] | 2076 | -o -name '*.in' ')' -print ')' | \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 2077 | grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \ |
| Chris Lattner | 81bfc9e | 2005-02-09 02:24:00 +0000 | [diff] [blame] | 2078 | cd $(PROJ_SRC_ROOT)/include && \ |
| Chris Lattner | e2dcbe0 | 2006-02-14 04:25:54 +0000 | [diff] [blame] | 2079 | $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \ |
| Erick Tryzelaar | 444c095 | 2010-03-04 20:56:19 +0000 | [diff] [blame] | 2080 | -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \ |
| Chris Lattner | 81bfc9e | 2005-02-09 02:24:00 +0000 | [diff] [blame] | 2081 | fi |
| Reid Spencer | a79819d | 2007-02-06 18:53:14 +0000 | [diff] [blame] | 2082 | endif |
| Reid Spencer | 12a3a05 | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 2083 | endif |
| 2084 | |
| Chris Lattner | f8adf7a | 2007-04-14 23:35:45 +0000 | [diff] [blame] | 2085 | check-line-length: |
| Gabor Greif | 697e94c | 2008-05-15 10:04:30 +0000 | [diff] [blame] | 2086 | @echo searching for overlength lines in files: $(Sources) |
| 2087 | @echo |
| 2088 | @echo |
| Gabor Greif | 2dd54ed | 2008-08-28 22:32:39 +0000 | [diff] [blame] | 2089 | egrep -n '.{81}' $(Sources) /dev/null |
| Chris Lattner | f8adf7a | 2007-04-14 23:35:45 +0000 | [diff] [blame] | 2090 | |
| Anton Korobeynikov | fb80151 | 2007-04-16 18:10:23 +0000 | [diff] [blame] | 2091 | check-for-tabs: |
| Gabor Greif | 697e94c | 2008-05-15 10:04:30 +0000 | [diff] [blame] | 2092 | @echo searching for tabs in files: $(Sources) |
| 2093 | @echo |
| 2094 | @echo |
| Gabor Greif | 2dd54ed | 2008-08-28 22:32:39 +0000 | [diff] [blame] | 2095 | egrep -n ' ' $(Sources) /dev/null |
| Gabor Greif | 697e94c | 2008-05-15 10:04:30 +0000 | [diff] [blame] | 2096 | |
| Reid Spencer | e6bc206 | 2007-05-02 21:29:39 +0000 | [diff] [blame] | 2097 | check-footprint: |
| 2098 | @ls -l $(LibDir) | awk '\ |
| 2099 | BEGIN { sum = 0; } \ |
| 2100 | { sum += $$5; } \ |
| 2101 | END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }' |
| 2102 | @ls -l $(ToolDir) | awk '\ |
| 2103 | BEGIN { sum = 0; } \ |
| 2104 | { sum += $$5; } \ |
| 2105 | END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }' |
| Reid Spencer | f206bd7 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 2106 | #------------------------------------------------------------------------ |
| 2107 | # Print out the directories used for building |
| Reid Spencer | f88808a | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 2108 | #------------------------------------------------------------------------ |
| Reid Spencer | 81cd049 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 2109 | printvars:: |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 2110 | $(Echo) "BuildMode : " '$(BuildMode)' |
| 2111 | $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)' |
| 2112 | $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)' |
| 2113 | $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)' |
| 2114 | $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)' |
| 2115 | $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)' |
| 2116 | $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)' |
| 2117 | $(Echo) "PROJ_prefix : " '$(PROJ_prefix)' |
| Bob Wilson | 3f35470 | 2011-11-28 07:59:52 +0000 | [diff] [blame] | 2118 | $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)' |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 2119 | $(Echo) "PROJ_bindir : " '$(PROJ_bindir)' |
| 2120 | $(Echo) "PROJ_libdir : " '$(PROJ_libdir)' |
| 2121 | $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)' |
| Reid Spencer | fe0a01e | 2005-02-16 16:13:02 +0000 | [diff] [blame] | 2122 | $(Echo) "PROJ_includedir : " '$(PROJ_includedir)' |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 2123 | $(Echo) "UserTargets : " '$(UserTargets)' |
| 2124 | $(Echo) "ObjMakefiles : " '$(ObjMakefiles)' |
| 2125 | $(Echo) "SrcMakefiles : " '$(SrcMakefiles)' |
| 2126 | $(Echo) "ObjDir : " '$(ObjDir)' |
| 2127 | $(Echo) "LibDir : " '$(LibDir)' |
| 2128 | $(Echo) "ToolDir : " '$(ToolDir)' |
| 2129 | $(Echo) "ExmplDir : " '$(ExmplDir)' |
| 2130 | $(Echo) "Sources : " '$(Sources)' |
| 2131 | $(Echo) "TDFiles : " '$(TDFiles)' |
| 2132 | $(Echo) "INCFiles : " '$(INCFiles)' |
| 2133 | $(Echo) "INCTMPFiles : " '$(INCTMPFiles)' |
| Reid Spencer | fefb9ea | 2005-03-01 16:27:06 +0000 | [diff] [blame] | 2134 | $(Echo) "PreConditions: " '$(PreConditions)' |
| Reid Spencer | ba6a3db | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 2135 | $(Echo) "Compile.CXX : " '$(Compile.CXX)' |
| 2136 | $(Echo) "Compile.C : " '$(Compile.C)' |
| 2137 | $(Echo) "Archive : " '$(Archive)' |
| 2138 | $(Echo) "YaccFiles : " '$(YaccFiles)' |
| 2139 | $(Echo) "LexFiles : " '$(LexFiles)' |
| 2140 | $(Echo) "Module : " '$(Module)' |
| Reid Spencer | b48e3f8 | 2005-08-24 10:43:10 +0000 | [diff] [blame] | 2141 | $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)' |
| Reid Spencer | ece1358 | 2006-04-09 23:41:14 +0000 | [diff] [blame] | 2142 | $(Echo) "SubDirs : " '$(SubDirs)' |
| Reid Spencer | 200c6f9 | 2007-03-29 19:05:44 +0000 | [diff] [blame] | 2143 | $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)' |
| 2144 | $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)' |
| Daniel Dunbar | 0094e34 | 2009-02-21 20:42:39 +0000 | [diff] [blame] | 2145 | |
| 2146 | ### |
| 2147 | # Debugging |
| 2148 | |
| Daniel Dunbar | 3b3c3f0 | 2009-03-06 22:23:25 +0000 | [diff] [blame] | 2149 | # General debugging rule, use 'make dbg-print-XXX' to print the |
| Daniel Dunbar | 0094e34 | 2009-02-21 20:42:39 +0000 | [diff] [blame] | 2150 | # definition, value and origin of XXX. |
| Daniel Dunbar | 3b3c3f0 | 2009-03-06 22:23:25 +0000 | [diff] [blame] | 2151 | make-print-%: |
| Daniel Dunbar | 0094e34 | 2009-02-21 20:42:39 +0000 | [diff] [blame] | 2152 | $(error PRINT: $(value $*) = "$($*)" (from $(origin $*))) |