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