Misha Brukman | 6d5ab86 | 2004-04-24 00:10:56 +0000 | [diff] [blame] | 1 | #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===# |
| 2 | # |
John Criswell | d8846c1 | 2003-10-21 14:33:46 +0000 | [diff] [blame] | 3 | # The LLVM Compiler Infrastructure |
| 4 | # |
| 5 | # This file was developed by the LLVM research group and is distributed under |
| 6 | # the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | # |
Misha Brukman | 6d5ab86 | 2004-04-24 00:10:56 +0000 | [diff] [blame] | 8 | #===------------------------------------------------------------------------===# |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 9 | # |
Reid Spencer | 3a561f5 | 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 | af06a08 | 2003-08-15 03:02:52 +0000 | [diff] [blame] | 12 | # |
Vikram S. Adve | d60aede | 2002-07-09 12:04:21 +0000 | [diff] [blame] | 13 | #===-----------------------------------------------------------------------==== |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 14 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 15 | ################################################################################ |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 16 | # TARGETS: Define standard targets that can be invoked |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 17 | ################################################################################ |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 18 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 19 | #-------------------------------------------------------------------- |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 20 | # Define the various target sets |
| 21 | #-------------------------------------------------------------------- |
Chris Lattner | 7dc0282 | 2004-12-03 21:05:57 +0000 | [diff] [blame] | 22 | RecursiveTargets := all clean clean-all install uninstall install-bytecode |
Reid Spencer | 9e8d54a | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 23 | LocalTargets := all-local clean-local clean-all-local check-local \ |
Reid Spencer | 44cb1b3 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 24 | install-local printvars uninstall-local \ |
| 25 | install-bytecode-local |
Reid Spencer | 9e8d54a | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 26 | TopLevelTargets := check dist dist-check dist-clean tags dist-gzip dist-bzip2 \ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 27 | dist-zip |
| 28 | UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets) |
| 29 | InternalTargets := preconditions distdir dist-hook |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 30 | |
Reid Spencer | 755bcf0 | 2005-08-24 10:43:10 +0000 | [diff] [blame^] | 31 | FilesToConfig := \ |
| 32 | include/llvm/Config/config.h \ |
| 33 | include/llvm/Support/DataTypes.h \ |
| 34 | include/llvm/ADT/hash_map \ |
| 35 | include/llvm/ADT/hash_set \ |
| 36 | include/llvm/ADT/iterator |
| 37 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 38 | ################################################################################ |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 39 | # INITIALIZATION: Basic things the makefile needs |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 40 | ################################################################################ |
| 41 | |
| 42 | #-------------------------------------------------------------------- |
| 43 | # Set the VPATH so that we can find source files. |
| 44 | #-------------------------------------------------------------------- |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 45 | VPATH=$(PROJ_SRC_DIR) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 46 | |
| 47 | #-------------------------------------------------------------------- |
| 48 | # Reset the list of suffixes we know how to build |
| 49 | #-------------------------------------------------------------------- |
| 50 | .SUFFIXES: |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 51 | .SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 52 | .SUFFIXES: $(SHLIBEXT) $(SUFFIXES) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 53 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 54 | #-------------------------------------------------------------------- |
| 55 | # Mark all of these targets as phony to avoid implicit rule search |
| 56 | #-------------------------------------------------------------------- |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 57 | .PHONY: $(UserTargets) $(InternalTargets) |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 58 | |
| 59 | #-------------------------------------------------------------------- |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 60 | # Make sure all the user-target rules are double colon rules and |
| 61 | # they are defined first. |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 62 | #-------------------------------------------------------------------- |
| 63 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 64 | $(UserTargets):: |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 65 | |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 66 | ################################################################################ |
| 67 | # PRECONDITIONS: that which must be built/checked first |
| 68 | ################################################################################ |
| 69 | |
Reid Spencer | 44cb1b3 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 70 | SrcMakefiles := $(filter %Makefile %Makefile.tests,\ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 71 | $(wildcard $(PROJ_SRC_DIR)/Makefile*)) |
| 72 | ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles)) |
| 73 | ConfigureScript := $(PROJ_SRC_ROOT)/configure |
| 74 | ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status |
| 75 | MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in)) |
| 76 | MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in)) |
| 77 | MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config |
| 78 | MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common |
| 79 | PreConditions := $(ConfigStatusScript) $(ObjMakefiles) |
| 80 | ifneq ($(MakefileCommonIn),) |
| 81 | PreConditions += $(MakefileCommon) |
| 82 | endif |
| 83 | ifneq ($(MakefileConfigIn),) |
| 84 | PreConditions += $(MakefileConfig) |
| 85 | endif |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 86 | |
Reid Spencer | 755bcf0 | 2005-08-24 10:43:10 +0000 | [diff] [blame^] | 87 | FilesToConfigPATH := $(addprefix $(PROJ_OBJ_ROOT)/,$(FilesToConfig)) |
| 88 | PreConditions += $(FilesToConfigPATH) |
| 89 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 90 | preconditions : $(PreConditions) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 91 | |
| 92 | #------------------------------------------------------------------------ |
| 93 | # Make sure the BUILT_SOURCES are built first |
| 94 | #------------------------------------------------------------------------ |
Reid Spencer | 07a549a | 2004-12-16 07:15:16 +0000 | [diff] [blame] | 95 | $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 96 | |
| 97 | clean-local:: |
| 98 | ifneq ($(strip $(BUILT_SOURCES)),) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 99 | -$(Verb) $(RM) -f $(BUILT_SOURCES) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 100 | endif |
| 101 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 102 | ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT)) |
Reid Spencer | 31f9524 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 103 | spotless: |
Reid Spencer | 31f9524 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 104 | $(Verb) if test -x config.status ; then \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 105 | $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \ |
Reid Spencer | 39b7363 | 2004-12-17 07:45:03 +0000 | [diff] [blame] | 106 | $(MKDIR) .spotless.save ; \ |
| 107 | $(MV) config.status .spotless.save ; \ |
| 108 | $(MV) mklib .spotless.save ; \ |
| 109 | $(MV) projects .spotless.save ; \ |
Reid Spencer | 31f9524 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 110 | $(RM) -rf * ; \ |
Reid Spencer | 39b7363 | 2004-12-17 07:45:03 +0000 | [diff] [blame] | 111 | $(MV) .spotless.save/config.status . ; \ |
| 112 | $(MV) .spotless.save/mklib . ; \ |
| 113 | $(MV) .spotless.save/projects . ; \ |
| 114 | $(RM) -rf .spotless.save ; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 115 | $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \ |
Reid Spencer | 39b7363 | 2004-12-17 07:45:03 +0000 | [diff] [blame] | 116 | $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \ |
| 117 | $(ConfigStatusScript) ; \ |
Reid Spencer | 31f9524 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 118 | else \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 119 | $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \ |
Reid Spencer | 31f9524 | 2004-12-16 08:00:46 +0000 | [diff] [blame] | 120 | fi |
| 121 | endif |
| 122 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 123 | $(BUILT_SOURCES) : $(ObjMakefiles) |
Reid Spencer | 80f0ef7 | 2004-10-28 00:41:43 +0000 | [diff] [blame] | 124 | |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 125 | #------------------------------------------------------------------------ |
| 126 | # Make sure we're not using a stale configuration |
| 127 | #------------------------------------------------------------------------ |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 128 | reconfigure: |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 129 | $(Echo) Reconfiguring $(PROJ_OBJ_ROOT) |
| 130 | $(Verb) cd $(PROJ_OBJ_ROOT) && \ |
| 131 | if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \ |
| 132 | $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \ |
Reid Spencer | 32924e0 | 2004-12-24 03:36:31 +0000 | [diff] [blame] | 133 | fi ; \ |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 134 | $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \ |
| 135 | $(ConfigStatusScript) |
| 136 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 137 | .PRECIOUS: $(ConfigStatusScript) |
| 138 | $(ConfigStatusScript): $(ConfigureScript) |
| 139 | $(Echo) Reconfiguring with $< |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 140 | $(Verb) cd $(PROJ_OBJ_ROOT) && \ |
| 141 | if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \ |
| 142 | $(RM) $(PROJ_OBJ_ROOT)/config.cache ; \ |
Reid Spencer | 32924e0 | 2004-12-24 03:36:31 +0000 | [diff] [blame] | 143 | fi ; \ |
Reid Spencer | 7d27700 | 2004-11-29 12:37:44 +0000 | [diff] [blame] | 144 | $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \ |
| 145 | $(ConfigStatusScript) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 146 | |
Reid Spencer | 755bcf0 | 2005-08-24 10:43:10 +0000 | [diff] [blame^] | 147 | .PRECIOUS: $(FilesToConfigPATH) |
| 148 | $(FilesToConfigPATH) : $(PROJ_OBJ_ROOT)/% : $(PROJ_SRC_ROOT)/%.in |
| 149 | $(Echo) Regenerating $* |
| 150 | $(Verb) cd $(PROJ_OBJ_ROOT) && $(ConfigStatusScript) $* |
| 151 | |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 152 | #------------------------------------------------------------------------ |
| 153 | # Make sure the configuration makefile is up to date |
| 154 | #------------------------------------------------------------------------ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 155 | ifneq ($(MakefileConfigIn),) |
| 156 | $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 157 | $(Echo) Regenerating $@ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 158 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config |
| 159 | endif |
| 160 | |
| 161 | ifneq ($(MakefileCommonIn),) |
| 162 | $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript) |
| 163 | $(Echo) Regenerating $@ |
| 164 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common |
| 165 | endif |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 166 | |
| 167 | #------------------------------------------------------------------------ |
| 168 | # If the Makefile in the source tree has been updated, copy it over into the |
| 169 | # build tree. But, only do this if the source and object makefiles differ |
| 170 | #------------------------------------------------------------------------ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 171 | ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR)) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 172 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 173 | Makefile: $(PROJ_SRC_DIR)/Makefile |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 174 | $(Echo) "Updating Makefile" |
| 175 | $(Verb) $(MKDIR) $(@D) |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 176 | $(Verb) $(CP) -f $< $@ |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 177 | |
| 178 | # Copy the Makefile.* files unless we're in the root directory which avoids |
| 179 | # the copying of Makefile.config.in or other things that should be explicitly |
| 180 | # taken care of. |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 181 | $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile% |
Reid Spencer | 8660678 | 2004-10-26 23:10:00 +0000 | [diff] [blame] | 182 | @case '$?' in \ |
| 183 | *Makefile.rules) ;; \ |
| 184 | *.in) ;; \ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 185 | *) $(Echo) "Updating $(@F)" ; \ |
Reid Spencer | 8660678 | 2004-10-26 23:10:00 +0000 | [diff] [blame] | 186 | $(MKDIR) $(@D) ; \ |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 187 | $(CP) -f $< $@ ;; \ |
Reid Spencer | 8660678 | 2004-10-26 23:10:00 +0000 | [diff] [blame] | 188 | esac |
| 189 | |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 190 | endif |
| 191 | |
| 192 | #------------------------------------------------------------------------ |
| 193 | # Set up the basic dependencies |
| 194 | #------------------------------------------------------------------------ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 195 | $(UserTargets):: $(PreConditions) |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 196 | |
| 197 | all:: all-local |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 198 | clean:: clean-local |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 199 | clean-all:: clean-local clean-all-local |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 200 | install:: install-local |
| 201 | uninstall:: uninstall-local |
Reid Spencer | 9411c64 | 2004-10-26 22:26:33 +0000 | [diff] [blame] | 202 | install-local:: all-local |
Reid Spencer | 44cb1b3 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 203 | install-bytecode:: install-bytecode-local |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 204 | |
| 205 | ############################################################################### |
| 206 | # VARIABLES: Set up various variables based on configuration data |
| 207 | ############################################################################### |
| 208 | |
| 209 | #-------------------------------------------------------------------- |
| 210 | # Variables derived from configuration we are building |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 211 | #-------------------------------------------------------------------- |
| 212 | |
Reid Spencer | 325a87e | 2005-01-02 17:43:20 +0000 | [diff] [blame] | 213 | |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 214 | ifdef ENABLE_PROFILING |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 215 | BuildMode := Profile |
Reid Spencer | 519799e | 2004-12-08 04:34:51 +0000 | [diff] [blame] | 216 | CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 217 | C.Flags := -O3 -DNDEBUG -pg |
| 218 | LD.Flags := -O3 -DNDEBUG -pg |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 219 | else |
| 220 | ifdef ENABLE_OPTIMIZED |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 221 | BuildMode := Release |
Reid Spencer | 325a87e | 2005-01-02 17:43:20 +0000 | [diff] [blame] | 222 | # Don't use -fomit-frame-pointer on FreeBSD |
| 223 | ifneq ($(OS),FreeBSD) |
| 224 | OmitFramePointer := -fomit-frame-pointer |
| 225 | endif |
| 226 | CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors \ |
| 227 | $(OmitFramePointer) |
| 228 | C.Flags := -O3 -DNDEBUG $(OmitFramePointer) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 229 | LD.Flags := -O3 -DNDEBUG |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 230 | else |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 231 | BuildMode := Debug |
Reid Spencer | 519799e | 2004-12-08 04:34:51 +0000 | [diff] [blame] | 232 | CXX.Flags := -g -D_DEBUG |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 233 | C.Flags := -g -D_DEBUG |
| 234 | LD.Flags := -g -D_DEBUG |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 235 | KEEP_SYMBOLS := 1 |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 236 | endif |
| 237 | endif |
| 238 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 239 | CXX.Flags += $(CXXFLAGS) |
| 240 | C.Flags += $(CFLAGS) |
| 241 | CPP.Flags += $(CPPFLAGS) |
| 242 | LD.Flags += $(LDFLAGS) |
| 243 | AR.Flags := cru |
| 244 | LibTool.Flags := --tag=CXX |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 245 | |
Andrew Lenharth | 39bcf5b | 2005-02-13 03:41:10 +0000 | [diff] [blame] | 246 | #Make Floating point ieee complient on alpha |
| 247 | ifeq ($(ARCH),Alpha) |
| 248 | CXX.Flags += -mieee |
| 249 | CPP.Flags += -mieee |
| 250 | endif |
| 251 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 252 | #-------------------------------------------------------------------- |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 253 | # Directory locations |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 254 | #-------------------------------------------------------------------- |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 255 | ObjDir := $(PROJ_OBJ_DIR)/$(BuildMode) |
| 256 | LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib |
| 257 | ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin |
| 258 | ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 259 | LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib |
Reid Spencer | 9a5acaf | 2004-11-18 20:04:39 +0000 | [diff] [blame] | 260 | LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin |
Reid Spencer | 775bf89 | 2004-12-28 07:59:22 +0000 | [diff] [blame] | 261 | LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples |
Reid Spencer | 2f138e7 | 2004-12-22 05:57:21 +0000 | [diff] [blame] | 262 | CFERuntimeLibDir := $(LLVMGCCDIR)/lib |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 263 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 264 | #-------------------------------------------------------------------- |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 265 | # Full Paths To Compiled Tools and Utilities |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 266 | #-------------------------------------------------------------------- |
Reid Spencer | 3ca6d8b | 2005-01-14 16:33:36 +0000 | [diff] [blame] | 267 | EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]: |
| 268 | Echo = @$(EchoCmd) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 269 | ifndef LIBTOOL |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 270 | LIBTOOL := $(LLVM_OBJ_ROOT)/mklib |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 271 | endif |
| 272 | ifndef LLVMAS |
| 273 | LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT) |
| 274 | endif |
| 275 | ifndef BURG |
| 276 | BURG := $(LLVMToolDir)/burg$(EXEEXT) |
| 277 | endif |
| 278 | ifndef TBLGEN |
| 279 | TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT) |
| 280 | endif |
Chris Lattner | 478b3b4 | 2004-11-29 19:47:58 +0000 | [diff] [blame] | 281 | ifndef GCCAS |
| 282 | GCCAS := $(LLVMToolDir)/gccas$(EXEEXT) |
| 283 | endif |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 284 | ifndef GCCLD |
| 285 | GCCLD := $(LLVMToolDir)/gccld$(EXEEXT) |
| 286 | endif |
Alkis Evlogimenos | 7e80cd9 | 2004-12-13 17:44:14 +0000 | [diff] [blame] | 287 | ifndef LDIS |
| 288 | LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT) |
| 289 | endif |
| 290 | ifndef LLI |
| 291 | LLI := $(LLVMToolDir)/lli$(EXEEXT) |
| 292 | endif |
Alkis Evlogimenos | eebaf33 | 2005-02-27 10:21:37 +0000 | [diff] [blame] | 293 | ifndef LLC |
| 294 | LLC := $(LLVMToolDir)/llc$(EXEEXT) |
| 295 | endif |
Alkis Evlogimenos | 7e80cd9 | 2004-12-13 17:44:14 +0000 | [diff] [blame] | 296 | ifndef LOPT |
Alkis Evlogimenos | 20d793a | 2004-12-13 18:08:29 +0000 | [diff] [blame] | 297 | LOPT := $(LLVMToolDir)/opt$(EXEEXT) |
Alkis Evlogimenos | 7e80cd9 | 2004-12-13 17:44:14 +0000 | [diff] [blame] | 298 | endif |
Alkis Evlogimenos | 270e851 | 2005-02-02 00:40:15 +0000 | [diff] [blame] | 299 | ifndef LBUGPOINT |
| 300 | LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT) |
| 301 | endif |
| 302 | |
John Criswell | f5629d0 | 2005-01-03 17:42:57 +0000 | [diff] [blame] | 303 | LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC) |
| 304 | LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX) |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 305 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 306 | #-------------------------------------------------------------------- |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 307 | # Adjust to user's request |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 308 | #-------------------------------------------------------------------- |
Dinakar Dhurjati | ffb55cd | 2003-05-29 16:18:20 +0000 | [diff] [blame] | 309 | |
Reid Spencer | 492c293 | 2005-01-11 04:31:07 +0000 | [diff] [blame] | 310 | # Adjust LD.Flags and Libtool.Flags depending on the kind of library that is |
| 311 | # to be built. Note that if LOADABLE_MODULE is specified then the resulting |
| 312 | # shared library can be opened with dlopen |
| 313 | ifdef SHARED_LIBRARY |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 314 | LD.Flags += -rpath $(LibDir) |
Reid Spencer | 492c293 | 2005-01-11 04:31:07 +0000 | [diff] [blame] | 315 | ifdef LOADABLE_MODULE |
| 316 | LD.Flags += -module |
| 317 | endif |
| 318 | else |
| 319 | LibTool.Flags += --tag=disable-shared |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 320 | endif |
| 321 | |
Reid Spencer | cceed9f | 2004-11-08 17:32:12 +0000 | [diff] [blame] | 322 | ifdef TOOL_VERBOSE |
| 323 | C.Flags += -v |
| 324 | CXX.Flags += -v |
| 325 | LD.Flags += -v |
Reid Spencer | cceed9f | 2004-11-08 17:32:12 +0000 | [diff] [blame] | 326 | VERBOSE := 1 |
| 327 | endif |
| 328 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 329 | # Adjust settings for verbose mode |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 330 | ifndef VERBOSE |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 331 | Verb := @ |
| 332 | LibTool.Flags += --silent |
| 333 | AR.Flags += >/dev/null 2>/dev/null |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 334 | ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1 |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 335 | else |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 336 | ConfigureScriptFLAGS := |
Misha Brukman | b5f096f | 2002-09-12 16:05:39 +0000 | [diff] [blame] | 337 | endif |
| 338 | |
Vikram S. Adve | feeae58 | 2002-09-18 11:55:13 +0000 | [diff] [blame] | 339 | # By default, strip symbol information from executable |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 340 | ifndef KEEP_SYMBOLS |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 341 | Strip := $(PLATFORMSTRIPOPTS) |
| 342 | StripWarnMsg := "(without symbols)" |
Reid Spencer | 860598a | 2005-02-24 07:12:43 +0000 | [diff] [blame] | 343 | Install.StripFlag += -s |
Vikram S. Adve | feeae58 | 2002-09-18 11:55:13 +0000 | [diff] [blame] | 344 | endif |
| 345 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 346 | # Adjust linker flags for building an executable |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 347 | ifdef TOOLNAME |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 348 | ifdef EXAMPLE_TOOL |
| 349 | LD.Flags += -rpath $(ExmplDir) -export-dynamic |
| 350 | else |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 351 | LD.Flags += -rpath $(ToolDir) -export-dynamic |
Dinakar Dhurjati | 87ea8aa | 2003-10-29 14:28:35 +0000 | [diff] [blame] | 352 | endif |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 353 | endif |
Dinakar Dhurjati | 87ea8aa | 2003-10-29 14:28:35 +0000 | [diff] [blame] | 354 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 355 | #---------------------------------------------------------- |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 356 | # Options To Invoke Tools |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 357 | #---------------------------------------------------------- |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 358 | |
| 359 | CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused |
| 360 | |
Duraid Madina | 0ad8fcf | 2005-05-16 06:38:09 +0000 | [diff] [blame] | 361 | ifeq ($(OS),HP-UX) |
| 362 | CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE |
| 363 | endif |
| 364 | |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 365 | LD.Flags += -L$(LibDir) -L$(LLVMLibDir) |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 366 | CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ |
| 367 | -I$(PROJ_OBJ_ROOT)/include \ |
| 368 | -I$(PROJ_SRC_ROOT)/include \ |
| 369 | -I$(LLVM_OBJ_ROOT)/include \ |
| 370 | -I$(LLVM_SRC_ROOT)/include \ |
| 371 | -D_GNU_SOURCE -D__STDC_LIMIT_MACROS |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 372 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 373 | Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags) |
| 374 | LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C) |
Reid Spencer | 2f138e7 | 2004-12-22 05:57:21 +0000 | [diff] [blame] | 375 | BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \ |
| 376 | $(C.Flags) -c |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 377 | Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c |
| 378 | LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX) |
Reid Spencer | bc52ad7 | 2004-12-24 14:47:34 +0000 | [diff] [blame] | 379 | BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \ |
| 380 | $(CXX.Flags) -c |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 381 | Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \ |
| 382 | $(CompileCommonOpts) $(LD.Flags) $(Strip) |
| 383 | Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \ |
Reid Spencer | a69b1ea | 2004-10-28 09:15:28 +0000 | [diff] [blame] | 384 | $(CompileCommonOpts) |
Reid Spencer | 1a9a69c | 2005-02-16 16:13:02 +0000 | [diff] [blame] | 385 | LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \ |
| 386 | $(Install.Flags) |
Reid Spencer | 860598a | 2005-02-24 07:12:43 +0000 | [diff] [blame] | 387 | ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 |
| 388 | DataInstall = $(INSTALL) -m 0644 |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 389 | Burg = $(BURG) -I $(PROJ_SRC_DIR) |
| 390 | TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 391 | Archive = $(AR) $(AR.Flags) |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 392 | LArchive = $(LLVMToolDir)/llvm-ar rcsf |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 393 | ifdef RANLIB |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 394 | Ranlib = $(RANLIB) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 395 | else |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 396 | Ranlib = ranlib |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 397 | endif |
| 398 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 399 | #---------------------------------------------------------- |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 400 | # Get the list of source files and compute object file |
| 401 | # names from them. |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 402 | #---------------------------------------------------------- |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 403 | ifdef FAKE_SOURCES |
| 404 | Sources := |
| 405 | FakeSources := $(FAKE_SOURCES) |
| 406 | ifdef BUILT_SOURCES |
| 407 | FakeSources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES)) |
| 408 | endif |
| 409 | BaseNameSources := $(sort $(basename $(FakeSources))) |
| 410 | ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o) |
| 411 | ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo) |
| 412 | ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 413 | else |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 414 | ifndef SOURCES |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 415 | Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \ |
| 416 | $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \ |
| 417 | $(PROJ_SRC_DIR)/*.l)) |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 418 | else |
| 419 | Sources := $(SOURCES) |
| 420 | endif |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 421 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 422 | ifdef BUILT_SOURCES |
| 423 | Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES)) |
| 424 | endif |
Vikram S. Adve | 112a72c | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 425 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 426 | BaseNameSources := $(sort $(basename $(Sources))) |
| 427 | ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o) |
| 428 | ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo) |
| 429 | ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc) |
| 430 | endif |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 431 | |
| 432 | ############################################################################### |
| 433 | # DIRECTORIES: Handle recursive descent of directory structure |
| 434 | ############################################################################### |
John Criswell | 82f4a5a | 2003-07-31 20:58:51 +0000 | [diff] [blame] | 435 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 436 | #--------------------------------------------------------- |
Reid Spencer | a69b1ea | 2004-10-28 09:15:28 +0000 | [diff] [blame] | 437 | # Provide rules to make install dirs. This must be early |
| 438 | # in the file so they get built before dependencies |
| 439 | #--------------------------------------------------------- |
| 440 | |
Reid Spencer | aa8bc43 | 2005-05-19 20:26:14 +0000 | [diff] [blame] | 441 | $(PROJ_bindir): $(PROJ_bindir)/.dir |
| 442 | $(PROJ_libdir): $(PROJ_libdir)/.dir |
| 443 | $(PROJ_includedir): $(PROJ_includedir)/.dir |
| 444 | $(PROJ_etcdir): $(PROJ_etcdir)/.dir |
Reid Spencer | a69b1ea | 2004-10-28 09:15:28 +0000 | [diff] [blame] | 445 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 446 | # To create other directories, as needed, and timestamp their creation |
| 447 | %/.dir: |
| 448 | $(Verb) $(MKDIR) $* > /dev/null |
Reid Spencer | fbbf307 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 449 | $(Verb) $(DATE) > $@ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 450 | |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 451 | .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir |
| 452 | .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir |
Reid Spencer | a69b1ea | 2004-10-28 09:15:28 +0000 | [diff] [blame] | 453 | |
| 454 | #--------------------------------------------------------- |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 455 | # Handle the DIRS options for sequential construction |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 456 | #--------------------------------------------------------- |
| 457 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 458 | SubDirs := |
Anand Shukla | 7c7a07e | 2002-09-18 04:29:30 +0000 | [diff] [blame] | 459 | ifdef DIRS |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 460 | SubDirs += $(DIRS) |
| 461 | $(RecursiveTargets):: |
| 462 | $(Verb) for dir in $(DIRS); do \ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 463 | if [ ! -f $$dir/Makefile ]; then \ |
| 464 | $(MKDIR) $$dir; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 465 | $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 466 | fi; \ |
Reid Spencer | a23c066 | 2004-12-08 22:58:34 +0000 | [diff] [blame] | 467 | if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \ |
| 468 | ($(MAKE) -C $$dir $@ ) || exit 1; \ |
| 469 | fi ; \ |
Chris Lattner | f1ffd99 | 2002-09-17 23:35:02 +0000 | [diff] [blame] | 470 | done |
Anand Shukla | 7c7a07e | 2002-09-18 04:29:30 +0000 | [diff] [blame] | 471 | endif |
Chris Lattner | a8abc22 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 472 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 473 | #--------------------------------------------------------- |
| 474 | # Handle the EXPERIMENTAL_DIRS options ensuring success |
| 475 | # after each directory is built. |
| 476 | #--------------------------------------------------------- |
| 477 | ifdef EXPERIMENTAL_DIRS |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 478 | $(RecursiveTargets):: |
| 479 | $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \ |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 480 | if [ ! -f $$dir/Makefile ]; then \ |
| 481 | $(MKDIR) $$dir; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 482 | $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 483 | fi; \ |
Reid Spencer | a23c066 | 2004-12-08 22:58:34 +0000 | [diff] [blame] | 484 | if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \ |
| 485 | ($(MAKE) -C $$dir $@ ) || exit 0; \ |
| 486 | fi ; \ |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 487 | done |
| 488 | endif |
Chris Lattner | a8abc22 | 2002-09-18 03:22:27 +0000 | [diff] [blame] | 489 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 490 | #--------------------------------------------------------- |
| 491 | # Handle the PARALLEL_DIRS options for parallel construction |
| 492 | #--------------------------------------------------------- |
| 493 | ifdef PARALLEL_DIRS |
| 494 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 495 | SubDirs += $(PARALLEL_DIRS) |
| 496 | |
Reid Spencer | 44cb1b3 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 497 | # Unfortunately, this list must be maintained if new recursive targets are added |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 498 | all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS)) |
| 499 | clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS)) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 500 | clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS)) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 501 | install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS)) |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 502 | uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS)) |
Reid Spencer | 44cb1b3 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 503 | install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS)) |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 504 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 505 | ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T)) |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 506 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 507 | $(ParallelTargets) : |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 508 | $(Verb) if [ ! -f $(@D)/Makefile ]; then \ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 509 | $(MKDIR) $(@D); \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 510 | $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \ |
John Criswell | b3866b6 | 2003-11-25 19:32:22 +0000 | [diff] [blame] | 511 | fi; \ |
Reid Spencer | a23c066 | 2004-12-08 22:58:34 +0000 | [diff] [blame] | 512 | if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \ |
| 513 | $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) ; \ |
| 514 | fi |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 515 | endif |
| 516 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 517 | #--------------------------------------------------------- |
| 518 | # Handle the OPTIONAL_DIRS options for directores that may |
| 519 | # or may not exist. |
| 520 | #--------------------------------------------------------- |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 521 | ifdef OPTIONAL_DIRS |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 522 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 523 | SubDirs += $(OPTIONAL_DIRS) |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 524 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 525 | $(RecursiveTargets):: |
| 526 | $(Verb) for dir in $(OPTIONAL_DIRS); do \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 527 | if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 528 | if [ ! -f $$dir/Makefile ]; then \ |
| 529 | $(MKDIR) $$dir; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 530 | $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 531 | fi; \ |
Reid Spencer | a23c066 | 2004-12-08 22:58:34 +0000 | [diff] [blame] | 532 | if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \ |
| 533 | ($(MAKE) -C$$dir $@ ) || exit 1; \ |
| 534 | fi ; \ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 535 | fi \ |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 536 | done |
| 537 | endif |
| 538 | |
Reid Spencer | fc94508 | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 539 | #--------------------------------------------------------- |
| 540 | # Handle the CONFIG_FILES options |
| 541 | #--------------------------------------------------------- |
| 542 | ifdef CONFIG_FILES |
Reid Spencer | fc94508 | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 543 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 544 | install-local:: $(PROJ_etcdir) $(CONFIG_FILES) |
| 545 | $(Echo) Installing Configuration Files To $(PROJ_etcdir) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 546 | $(Verb)for file in $(CONFIG_FILES); do \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 547 | if test -f $(PROJ_OBJ_DIR)/$${file} ; then \ |
Reid Spencer | 4a0aaea | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 548 | $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 549 | elif test -f $(PROJ_SRC_DIR)/$${file} ; then \ |
Reid Spencer | 4a0aaea | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 550 | $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \ |
Reid Spencer | 1b426ab | 2004-11-23 05:59:53 +0000 | [diff] [blame] | 551 | else \ |
| 552 | $(ECHO) Error: cannot find config file $${file}. ; \ |
| 553 | fi \ |
Reid Spencer | fc94508 | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 554 | done |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 555 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 556 | uninstall-local:: |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 557 | $(Echo) Uninstalling Configuration Files From $(PROJ_etcdir) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 558 | $(Verb)for file in $(CONFIG_FILES); do \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 559 | $(RM) -f $(PROJ_etcdir)/$${file} ; \ |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 560 | done |
| 561 | |
Reid Spencer | fc94508 | 2004-08-20 09:20:05 +0000 | [diff] [blame] | 562 | endif |
| 563 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 564 | ############################################################################### |
Reid Spencer | 8f9e21e | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 565 | # Set up variables for building libararies |
| 566 | ############################################################################### |
| 567 | |
| 568 | #--------------------------------------------------------- |
| 569 | # Handle the special "JIT" value for LLVM_LIBS which is a |
| 570 | # shorthand for a bunch of libraries that get the correct |
| 571 | # JIT support for a library or a tool that runs JIT. |
| 572 | #--------------------------------------------------------- |
| 573 | ifeq ($(LLVMLIBS),JIT) |
| 574 | |
| 575 | # Make sure we can get our own symbols in the tool |
| 576 | Link += -dlopen self |
| 577 | |
| 578 | # Generic JIT libraries |
| 579 | JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine |
| 580 | |
| 581 | # You can enable the X86 JIT on a non-X86 host by setting the flag |
| 582 | # ENABLE_X86_JIT on the make command line. If not, it will still be |
| 583 | # enabled automagically on an X86 host. |
| 584 | ifeq ($(ARCH), x86) |
| 585 | ENABLE_X86_JIT = 1 |
| 586 | endif |
| 587 | |
| 588 | # What the X86 JIT requires |
| 589 | ifdef ENABLE_X86_JIT |
| 590 | JIT_LIBS += LLVMX86 LLVMSelectionDAG |
| 591 | endif |
| 592 | |
| 593 | # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag |
| 594 | # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be |
| 595 | # enabled automagically on an SparcV9 host. |
| 596 | ifeq ($(ARCH), Sparc) |
| 597 | ENABLE_SPARCV9_JIT = 1 |
| 598 | endif |
| 599 | |
| 600 | # What the Sparc JIT requires |
| 601 | ifdef ENABLE_SPARCV9_JIT |
| 602 | JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \ |
| 603 | LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \ |
| 604 | LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \ |
| 605 | LLVMDataStructure.a LLVMSparcV9RegAlloc |
| 606 | endif |
| 607 | |
| 608 | # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag |
| 609 | # ENABLE_PPC_JIT on the make command line. If not, it will still be |
| 610 | # enabled automagically on an PowerPC host. |
| 611 | ifeq ($(ARCH), PowerPC) |
| 612 | ENABLE_PPC_JIT = 1 |
| 613 | endif |
| 614 | |
| 615 | # What the PowerPC JIT requires |
| 616 | ifdef ENABLE_PPC_JIT |
| 617 | JIT_LIBS += LLVMPowerPC LLVMSelectionDAG |
| 618 | endif |
| 619 | |
Andrew Lenharth | ddc31e8 | 2005-07-22 20:54:01 +0000 | [diff] [blame] | 620 | # You can enable the Alpha JIT on a non-Alpha host by setting the flag |
| 621 | # ENABLE_ALPHA_JIT on the make command line. If not, it will still be |
Misha Brukman | ab25eda | 2005-07-22 22:43:40 +0000 | [diff] [blame] | 622 | # enabled automagically on an Alpha host. |
Andrew Lenharth | ddc31e8 | 2005-07-22 20:54:01 +0000 | [diff] [blame] | 623 | ifeq ($(ARCH), Alpha) |
| 624 | ENABLE_ALPHA_JIT = 1 |
| 625 | endif |
| 626 | |
Andrew Lenharth | 22894e9 | 2005-07-22 22:00:24 +0000 | [diff] [blame] | 627 | # What the Alpha JIT requires |
Andrew Lenharth | ddc31e8 | 2005-07-22 20:54:01 +0000 | [diff] [blame] | 628 | ifdef ENABLE_ALPHA_JIT |
| 629 | JIT_LIBS += LLVMAlpha LLVMSelectionDAG |
| 630 | endif |
| 631 | |
Reid Spencer | 8f9e21e | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 632 | LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \ |
| 633 | LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \ |
| 634 | LLVMSystem.a $(PLATFORMLIBDL) |
| 635 | endif |
| 636 | |
| 637 | #--------------------------------------------------------- |
| 638 | # Define various command line options pertaining to the |
| 639 | # libraries needed when linking. There are "Proj" libs |
| 640 | # (defined by the user's project) and "LLVM" libs (defined |
| 641 | # by the # LLVM project). |
| 642 | #--------------------------------------------------------- |
Misha Brukman | 6c26da6 | 2005-08-17 02:38:56 +0000 | [diff] [blame] | 643 | # Some versions of gcc on Alpha produce too many symbols, so use a .a file |
Andrew Lenharth | 7ac1752 | 2005-08-13 05:09:50 +0000 | [diff] [blame] | 644 | ifeq ($(ARCH),Alpha) |
| 645 | USEDLIBS := $(subst LLVMCore, LLVMCore.a, $(USEDLIBS)) |
| 646 | LLVMLIBS := $(subst LLVMCore, LLVMCore.a, $(LLVMLIBS)) |
| 647 | endif |
| 648 | |
Reid Spencer | 8f9e21e | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 649 | ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) |
| 650 | ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions)) |
| 651 | LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS))) |
| 652 | LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions)) |
| 653 | ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS))) |
| 654 | LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS))) |
| 655 | ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs)) |
| 656 | LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) |
| 657 | |
| 658 | ############################################################################### |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 659 | # Library Build Rules: Four ways to build a library |
| 660 | ############################################################################### |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 661 | |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 662 | #--------------------------------------------------------- |
| 663 | # Bytecode Module Targets: |
| 664 | # If the user set MODULE_NAME then they want to build a |
| 665 | # bytecode module from the sources. We compile all the |
| 666 | # sources and link it together into a single bytecode |
| 667 | # module. |
| 668 | #--------------------------------------------------------- |
| 669 | |
| 670 | ifdef MODULE_NAME |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 671 | ifeq ($(strip $(LLVMGCC)),) |
Reid Spencer | 0d255bd | 2005-05-13 18:32:54 +0000 | [diff] [blame] | 672 | $(warning Modules require llvm-gcc but no llvm-gcc is available ****) |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 673 | else |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 674 | |
| 675 | Module := $(LibDir)/$(MODULE_NAME).bc |
Reid Spencer | 2f138e7 | 2004-12-22 05:57:21 +0000 | [diff] [blame] | 676 | LinkModule := $(LLVMGCCWITHPATH) -shared -nostdlib |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 677 | |
| 678 | ifdef EXPORTED_SYMBOL_FILE |
Reid Spencer | f8f5740 | 2005-01-28 19:52:32 +0000 | [diff] [blame] | 679 | LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE) |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 680 | endif |
| 681 | |
| 682 | $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD) |
Reid Spencer | 0d255bd | 2005-05-13 18:32:54 +0000 | [diff] [blame] | 683 | $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@) |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 684 | $(Verb) $(LinkModule) -o $@ $(ObjectsBC) |
| 685 | |
| 686 | all-local:: $(Module) |
| 687 | |
| 688 | clean-local:: |
| 689 | ifneq ($(strip $(Module)),) |
| 690 | -$(Verb) $(RM) -f $(Module) |
| 691 | endif |
| 692 | |
Reid Spencer | ab3690b | 2004-12-13 07:38:07 +0000 | [diff] [blame] | 693 | ifdef BYTECODE_DESTINATION |
| 694 | ModuleDestDir := $(BYTECODE_DESTINATION) |
| 695 | else |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 696 | ModuleDestDir := $(PROJ_libdir) |
Reid Spencer | ab3690b | 2004-12-13 07:38:07 +0000 | [diff] [blame] | 697 | endif |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 698 | |
Reid Spencer | ab3690b | 2004-12-13 07:38:07 +0000 | [diff] [blame] | 699 | DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc |
| 700 | |
| 701 | install-module:: $(DestModule) |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 702 | install-local:: $(DestModule) |
| 703 | |
Reid Spencer | ab3690b | 2004-12-13 07:38:07 +0000 | [diff] [blame] | 704 | $(DestModule): $(ModuleDestDir) $(Module) |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 705 | $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule) |
Reid Spencer | 151bbe4 | 2005-02-24 21:30:37 +0000 | [diff] [blame] | 706 | $(Verb) $(DataInstall) $(Module) $(DestModule) |
Reid Spencer | 7980ea4 | 2004-12-05 05:17:22 +0000 | [diff] [blame] | 707 | |
| 708 | uninstall-local:: |
| 709 | $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule) |
| 710 | -$(Verb) $(RM) -f $(DestModule) |
| 711 | |
| 712 | endif |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 713 | endif |
Brian Gaeke | 8abff79 | 2004-01-22 22:53:48 +0000 | [diff] [blame] | 714 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 715 | # if we're building a library ... |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 716 | ifdef LIBRARYNAME |
Vikram S. Adve | 112a72c | 2001-07-15 13:16:47 +0000 | [diff] [blame] | 717 | |
Chris Lattner | 2a548c5 | 2002-09-16 22:36:42 +0000 | [diff] [blame] | 718 | # Make sure there isn't any extranous whitespace on the LIBRARYNAME option |
Chris Lattner | ccb4ebd | 2002-09-16 22:34:56 +0000 | [diff] [blame] | 719 | LIBRARYNAME := $(strip $(LIBRARYNAME)) |
Reid Spencer | 492c293 | 2005-01-11 04:31:07 +0000 | [diff] [blame] | 720 | ifdef LOADABLE_MODULE |
| 721 | LibName.LA := $(LibDir)/$(LIBRARYNAME).la |
| 722 | else |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 723 | LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la |
Reid Spencer | 492c293 | 2005-01-11 04:31:07 +0000 | [diff] [blame] | 724 | endif |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 725 | LibName.A := $(LibDir)/lib$(LIBRARYNAME).a |
| 726 | LibName.O := $(LibDir)/$(LIBRARYNAME).o |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 727 | LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca |
Chris Lattner | ccb4ebd | 2002-09-16 22:34:56 +0000 | [diff] [blame] | 728 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 729 | #--------------------------------------------------------- |
| 730 | # Shared Library Targets: |
| 731 | # If the user asked for a shared library to be built |
| 732 | # with the SHARED_LIBRARY variable, then we provide |
| 733 | # targets for building them. |
| 734 | #--------------------------------------------------------- |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 735 | ifdef SHARED_LIBRARY |
| 736 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 737 | all-local:: $(LibName.LA) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 738 | |
Reid Spencer | 8f9e21e | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 739 | ifdef LINK_LIBS_IN_SHARED |
| 740 | $(LibName.LA): $(ObjectsLO) $(LibDir)/.dir |
| 741 | $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT) |
| 742 | $(Verb) $(Link) -o $@ $(ObjectsLO) \ |
| 743 | $(ProjLibsOptions) $(LLVMLibsOptions) |
| 744 | $(Verb) $(LTInstall) $@ $(LibDir) |
| 745 | else |
Reid Spencer | f2ac189 | 2004-12-16 07:36:08 +0000 | [diff] [blame] | 746 | $(LibName.LA): $(ObjectsLO) $(LibDir)/.dir |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 747 | $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 748 | $(Verb) $(Link) -o $@ $(ObjectsLO) |
| 749 | $(Verb) $(LTInstall) $@ $(LibDir) |
Reid Spencer | 8f9e21e | 2005-05-19 00:37:31 +0000 | [diff] [blame] | 750 | endif |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 751 | |
| 752 | clean-local:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 753 | ifneq ($(strip $(LibName.LA)),) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 754 | -$(Verb) $(RM) -f $(LibName.LA) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 755 | endif |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 756 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 757 | DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 758 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 759 | install-local:: $(DestSharedLib) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 760 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 761 | $(DestSharedLib): $(PROJ_libdir) $(LibName.LA) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 762 | $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 763 | $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib) |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 764 | $(Verb) $(LIBTOOL) --finish $(PROJ_libdir) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 765 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 766 | uninstall-local:: |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 767 | $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib) |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 768 | -$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).* |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 769 | |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 770 | endif |
| 771 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 772 | #--------------------------------------------------------- |
| 773 | # Bytecode Library Targets: |
| 774 | # If the user asked for a bytecode library to be built |
| 775 | # with the BYTECODE_LIBRARY variable, then we provide |
| 776 | # targets for building them. |
| 777 | #--------------------------------------------------------- |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 778 | ifdef BYTECODE_LIBRARY |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 779 | ifeq ($(strip $(LLVMGCC)),) |
Reid Spencer | 0d255bd | 2005-05-13 18:32:54 +0000 | [diff] [blame] | 780 | $(warning Bytecode libraries require llvm-gcc which could not be found ****) |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 781 | else |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 782 | |
Reid Spencer | 776b805 | 2004-12-03 06:04:35 +0000 | [diff] [blame] | 783 | # make the C and C++ compilers strip debug info out of bytecode libraries. |
| 784 | BCCompile.C += -Wa,-strip-debug |
| 785 | BCCompile.CXX += -Wa,-strip-debug |
| 786 | |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 787 | all-local:: $(LibName.BCA) |
| 788 | |
| 789 | ifdef EXPORTED_SYMBOL_FILE |
Reid Spencer | 2f138e7 | 2004-12-22 05:57:21 +0000 | [diff] [blame] | 790 | BCLinkLib = $(LLVMGCCWITHPATH) -shared -nostdlib -Xlinker \ |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 791 | -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE) |
| 792 | |
Reid Spencer | f2ac189 | 2004-12-16 07:36:08 +0000 | [diff] [blame] | 793 | $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(GCCLD) \ |
Chris Lattner | 264ccbe | 2004-12-15 17:14:06 +0000 | [diff] [blame] | 794 | $(LLVMToolDir)/llvm-ar |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 795 | $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \ |
| 796 | "(internalize)" |
Chris Lattner | b0ea864 | 2004-12-02 21:23:43 +0000 | [diff] [blame] | 797 | $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC) |
Reid Spencer | efd6bb3 | 2004-12-13 03:59:35 +0000 | [diff] [blame] | 798 | $(Verb) $(RM) -f $@ |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 799 | $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 800 | else |
Reid Spencer | f2ac189 | 2004-12-16 07:36:08 +0000 | [diff] [blame] | 801 | $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \ |
Chris Lattner | 264ccbe | 2004-12-15 17:14:06 +0000 | [diff] [blame] | 802 | $(LLVMToolDir)/llvm-ar |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 803 | $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) |
Reid Spencer | efd6bb3 | 2004-12-13 03:59:35 +0000 | [diff] [blame] | 804 | $(Verb) $(RM) -f $@ |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 805 | $(Verb) $(LArchive) $@ $(ObjectsBC) |
| 806 | |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 807 | endif |
| 808 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 809 | clean-local:: |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 810 | ifneq ($(strip $(LibName.BCA)),) |
| 811 | -$(Verb) $(RM) -f $(LibName.BCA) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 812 | endif |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 813 | |
Reid Spencer | 8f094f3 | 2004-12-13 07:28:21 +0000 | [diff] [blame] | 814 | ifdef BYTECODE_DESTINATION |
| 815 | BytecodeDestDir := $(BYTECODE_DESTINATION) |
| 816 | else |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 817 | BytecodeDestDir := $(PROJ_libdir) |
Reid Spencer | 8f094f3 | 2004-12-13 07:28:21 +0000 | [diff] [blame] | 818 | endif |
| 819 | |
| 820 | DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 821 | |
Reid Spencer | 44cb1b3 | 2004-12-03 20:08:48 +0000 | [diff] [blame] | 822 | install-bytecode-local:: $(DestBytecodeLib) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 823 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 824 | install-local:: $(DestBytecodeLib) |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 825 | |
Reid Spencer | 8f094f3 | 2004-12-13 07:28:21 +0000 | [diff] [blame] | 826 | $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA) |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 827 | $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib) |
Reid Spencer | b80621f | 2005-02-24 21:36:32 +0000 | [diff] [blame] | 828 | $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 829 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 830 | uninstall-local:: |
Reid Spencer | 9a2f137 | 2004-12-02 09:28:21 +0000 | [diff] [blame] | 831 | $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 832 | -$(Verb) $(RM) -f $(DestBytecodeLib) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 833 | |
| 834 | endif |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 835 | endif |
Vikram S. Adve | 60f5606 | 2002-08-02 18:34:12 +0000 | [diff] [blame] | 836 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 837 | #--------------------------------------------------------- |
| 838 | # ReLinked Library Targets: |
| 839 | # If the user didn't explicitly forbid building a |
| 840 | # relinked then we provide targets for building them. |
| 841 | #--------------------------------------------------------- |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 842 | ifndef DONT_BUILD_RELINKED |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 843 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 844 | all-local:: $(LibName.O) |
| 845 | |
Reid Spencer | f2ac189 | 2004-12-16 07:36:08 +0000 | [diff] [blame] | 846 | $(LibName.O): $(ObjectsO) $(LibDir)/.dir |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 847 | $(Echo) Linking $(BuildMode) Object Library $(notdir $@) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 848 | $(Verb) $(Relink) -o $@ $(ObjectsO) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 849 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 850 | clean-local:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 851 | ifneq ($(strip $(LibName.O)),) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 852 | -$(Verb) $(RM) -f $(LibName.O) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 853 | endif |
| 854 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 855 | DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 856 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 857 | install-local:: $(DestRelinkedLib) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 858 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 859 | $(DestRelinkedLib): $(PROJ_libdir) $(LibName.O) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 860 | $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 861 | $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 862 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 863 | uninstall-local:: |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 864 | $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 865 | -$(Verb) $(RM) -f $(DestRelinkedLib) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 866 | |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 867 | endif |
Chris Lattner | 760da06 | 2003-03-14 20:25:22 +0000 | [diff] [blame] | 868 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 869 | #--------------------------------------------------------- |
| 870 | # Archive Library Targets: |
| 871 | # If the user wanted a regular archive library built, |
| 872 | # then we provide targets for building them. |
| 873 | #--------------------------------------------------------- |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 874 | ifdef BUILD_ARCHIVE |
Chris Lattner | e62dbe9 | 2002-07-23 17:56:16 +0000 | [diff] [blame] | 875 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 876 | all-local:: $(LibName.A) |
| 877 | |
Reid Spencer | f2ac189 | 2004-12-16 07:36:08 +0000 | [diff] [blame] | 878 | $(LibName.A): $(ObjectsO) $(LibDir)/.dir |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 879 | $(Echo) Building $(BuildMode) Archive Library $(notdir $@) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 880 | -$(Verb) $(RM) -f $@ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 881 | $(Verb) $(Archive) $@ $(ObjectsO) |
| 882 | $(Verb) $(Ranlib) $@ |
Vikram S. Adve | 41e7891 | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 883 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 884 | clean-local:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 885 | ifneq ($(strip $(LibName.A)),) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 886 | -$(Verb) $(RM) -f $(LibName.A) |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 887 | endif |
| 888 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 889 | DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 890 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 891 | install-local:: $(DestArchiveLib) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 892 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 893 | $(DestArchiveLib): $(PROJ_libdir) $(LibName.A) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 894 | $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib) |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 895 | $(Verb) $(MKDIR) $(PROJ_libdir) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 896 | $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 897 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 898 | uninstall-local:: |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 899 | $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 900 | -$(Verb) $(RM) -f $(DestArchiveLib) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 901 | |
| 902 | endif |
| 903 | |
| 904 | # endif LIBRARYNAME |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 905 | endif |
| 906 | |
Reid Spencer | b1dd3dd | 2004-10-24 08:21:04 +0000 | [diff] [blame] | 907 | ############################################################################### |
| 908 | # Tool Build Rules: Build executable tool based on TOOLNAME option |
| 909 | ############################################################################### |
| 910 | |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 911 | ifdef TOOLNAME |
| 912 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 913 | #--------------------------------------------------------- |
| 914 | # Set up variables for building a tool. |
| 915 | #--------------------------------------------------------- |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 916 | ifdef EXAMPLE_TOOL |
Reid Spencer | 5da2d08 | 2005-05-19 21:03:11 +0000 | [diff] [blame] | 917 | ToolBuildPath := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT) |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 918 | else |
Reid Spencer | 5da2d08 | 2005-05-19 21:03:11 +0000 | [diff] [blame] | 919 | ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT) |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 920 | endif |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 921 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 922 | #--------------------------------------------------------- |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 923 | # Tell make that we need to rebuild subdirectories before |
| 924 | # we can link the tool. This affects things like LLI which |
| 925 | # has library subdirectories. |
| 926 | #--------------------------------------------------------- |
| 927 | $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS)) |
Chris Lattner | 8d7dfb3 | 2003-01-22 16:13:31 +0000 | [diff] [blame] | 928 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 929 | #--------------------------------------------------------- |
| 930 | # Provide targets for building the tools |
| 931 | #--------------------------------------------------------- |
| 932 | all-local:: $(ToolBuildPath) |
John Criswell | 2a6530f | 2003-06-27 16:58:44 +0000 | [diff] [blame] | 933 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 934 | clean-local:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 935 | ifneq ($(strip $(ToolBuildPath)),) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 936 | -$(Verb) $(RM) -f $(ToolBuildPath) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 937 | endif |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 938 | |
Reid Spencer | 815cbcf | 2004-11-18 10:03:46 +0000 | [diff] [blame] | 939 | ifdef EXAMPLE_TOOL |
| 940 | $(ToolBuildPath): $(ExmplDir)/.dir |
| 941 | else |
| 942 | $(ToolBuildPath): $(ToolDir)/.dir |
| 943 | endif |
| 944 | |
Reid Spencer | f2ac189 | 2004-12-16 07:36:08 +0000 | [diff] [blame] | 945 | $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 946 | $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 947 | $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ |
Reid Spencer | 9a8398e | 2005-02-14 21:54:08 +0000 | [diff] [blame] | 948 | $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 949 | $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 950 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 951 | DestTool = $(PROJ_bindir)/$(TOOLNAME) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 952 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 953 | install-local:: $(DestTool) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 954 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 955 | $(DestTool): $(PROJ_bindir) $(ToolBuildPath) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 956 | $(Echo) Installing $(BuildMode) $(DestTool) |
Reid Spencer | 4a0aaea | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 957 | $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 958 | |
Reid Spencer | c6dcc6a | 2004-10-28 07:57:28 +0000 | [diff] [blame] | 959 | uninstall-local:: |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 960 | $(Echo) Uninstalling $(BuildMode) $(DestTool) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 961 | -$(Verb) $(RM) -f $(DestTool) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 962 | |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 963 | endif |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 964 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 965 | ############################################################################### |
| 966 | # Object Build Rules: Build object files based on sources |
| 967 | ############################################################################### |
| 968 | |
| 969 | # Provide rule sets for when dependency generation is enabled |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 970 | ifndef DISABLE_AUTO_DEPENDENCIES |
Vikram S. Adve | 41e7891 | 2002-09-20 14:03:13 +0000 | [diff] [blame] | 971 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 972 | #--------------------------------------------------------- |
| 973 | # Create .lo files in the ObjDir directory from the .cpp and .c files... |
| 974 | #--------------------------------------------------------- |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 975 | ifdef SHARED_LIBRARY |
| 976 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 977 | $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 978 | $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 979 | $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \ |
| 980 | then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ |
| 981 | else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 982 | |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 983 | $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) |
| 984 | $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)" |
| 985 | $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \ |
| 986 | then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ |
| 987 | else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi |
| 988 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 989 | $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 990 | $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 991 | $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \ |
| 992 | then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \ |
| 993 | else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 994 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 995 | #--------------------------------------------------------- |
| 996 | # Create .o files in the ObjDir directory from the .cpp and .c files... |
| 997 | #--------------------------------------------------------- |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 998 | else |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 999 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1000 | $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1001 | $(Echo) "Compiling $*.cpp for $(BuildMode) build" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1002 | $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \ |
| 1003 | then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \ |
| 1004 | else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1005 | |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1006 | $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) |
| 1007 | $(Echo) "Compiling $*.cc for $(BuildMode) build" |
| 1008 | $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \ |
| 1009 | then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \ |
| 1010 | else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi |
| 1011 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1012 | $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1013 | $(Echo) "Compiling $*.c for $(BuildMode) build" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1014 | $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \ |
| 1015 | then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \ |
| 1016 | else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1017 | |
| 1018 | endif |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1019 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1020 | #--------------------------------------------------------- |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1021 | # Create .bc files in the ObjDir directory from .cpp .cc and .c files... |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1022 | #--------------------------------------------------------- |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1023 | $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1024 | $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1025 | $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \ |
| 1026 | then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ |
| 1027 | else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1028 | |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1029 | $(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) |
| 1030 | $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" |
| 1031 | $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \ |
| 1032 | then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ |
| 1033 | else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi |
| 1034 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1035 | $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1036 | $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1037 | $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \ |
| 1038 | then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \ |
| 1039 | else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1040 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1041 | # Provide alternate rule sets if dependencies are disabled |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1042 | else |
| 1043 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1044 | ifdef SHARED_LIBRARY |
| 1045 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1046 | $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1047 | $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)" |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1048 | $(LTCompile.CXX) $< -o $@ |
| 1049 | |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1050 | $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) |
| 1051 | $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)" |
| 1052 | $(LTCompile.CXX) $< -o $@ |
| 1053 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1054 | $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1055 | $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)" |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1056 | $(LTCompile.C) $< -o $@ |
| 1057 | |
| 1058 | else |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1059 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1060 | $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1061 | $(Echo) "Compiling $*.cpp for $(BuildMode) build" |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1062 | $(Compile.CXX) $< -o $@ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1063 | |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1064 | $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) |
| 1065 | $(Echo) "Compiling $*.cc for $(BuildMode) build" |
| 1066 | $(Compile.CXX) $< -o $@ |
| 1067 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1068 | $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1069 | $(Echo) "Compiling $*.c for $(BuildMode) build" |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1070 | $(Compile.C) $< -o $@ |
| 1071 | endif |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1072 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1073 | $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1074 | $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" |
Reid Spencer | 8676b7e | 2004-10-31 18:52:15 +0000 | [diff] [blame] | 1075 | $(BCCompile.CXX) $< -o $@ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1076 | |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1077 | $(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) |
| 1078 | $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" |
| 1079 | $(BCCompile.CXX) $< -o $@ |
| 1080 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1081 | $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1082 | $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" |
Reid Spencer | 8676b7e | 2004-10-31 18:52:15 +0000 | [diff] [blame] | 1083 | $(BCCompile.C) $< -o $@ |
Brian Gaeke | 44909cf | 2003-12-10 00:26:28 +0000 | [diff] [blame] | 1084 | |
Chris Lattner | 1cbc29f | 2001-09-07 22:57:58 +0000 | [diff] [blame] | 1085 | endif |
| 1086 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1087 | #--------------------------------------------------------- |
| 1088 | # Provide rule to build .bc files from .ll sources, |
| 1089 | # regardless of dependencies |
| 1090 | #--------------------------------------------------------- |
| 1091 | $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1092 | $(Echo) "Compiling $*.ll for $(BuildMode) build" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1093 | $(Verb) $(LLVMAS) $< -f -o $@ |
| 1094 | |
| 1095 | ############################################################################### |
| 1096 | # TABLEGEN: Provide rules for running tblgen to produce *.inc files |
| 1097 | ############################################################################### |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 1098 | |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1099 | ifdef TARGET |
| 1100 | |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1101 | TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1102 | INCFiles := $(filter %.inc,$(BUILT_SOURCES)) |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1103 | INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp) |
| 1104 | .PRECIOUS: $(INCTMPFiles) $(INCFiles) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1105 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1106 | # All of these files depend on tblgen and the .td files. |
| 1107 | $(INCTMPFiles) : $(TBLGEN) $(TDFiles) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1108 | |
Chris Lattner | 23ee795 | 2004-12-16 17:38:56 +0000 | [diff] [blame] | 1109 | # INCFiles rule: All of the tblgen generated files are emitted to |
| 1110 | # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows |
| 1111 | # us to only "touch" the real file if the contents of it change. IOW, if |
| 1112 | # tblgen is modified, all of the .inc.tmp files are regereated, but no |
| 1113 | # dependencies of the .inc files are, unless the contents of the .inc file |
| 1114 | # changes. |
| 1115 | $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1116 | $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1117 | |
| 1118 | $(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \ |
| 1119 | $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1120 | $(Echo) "Building $(<F) register names with tblgen" |
| 1121 | $(Verb) $(TableGen) -gen-register-enums -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1122 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1123 | $(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \ |
| 1124 | $(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1125 | $(Echo) "Building $(<F) register information header with tblgen" |
| 1126 | $(Verb) $(TableGen) -gen-register-desc-header -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1127 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1128 | $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \ |
| 1129 | $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1130 | $(Echo) "Building $(<F) register info implementation with tblgen" |
| 1131 | $(Verb) $(TableGen) -gen-register-desc -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1132 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1133 | $(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \ |
| 1134 | $(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1135 | $(Echo) "Building $(<F) instruction names with tblgen" |
| 1136 | $(Verb) $(TableGen) -gen-instr-enums -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1137 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1138 | $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \ |
| 1139 | $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1140 | $(Echo) "Building $(<F) instruction information with tblgen" |
| 1141 | $(Verb) $(TableGen) -gen-instr-desc -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1142 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1143 | $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \ |
| 1144 | $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1145 | $(Echo) "Building $(<F) assembly writer with tblgen" |
| 1146 | $(Verb) $(TableGen) -gen-asm-writer -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1147 | |
Chris Lattner | 02a4f90 | 2004-12-16 17:34:04 +0000 | [diff] [blame] | 1148 | $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \ |
| 1149 | $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir |
| 1150 | $(Echo) "Building $(<F) assembly writer #1 with tblgen" |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1151 | $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1152 | |
Chris Lattner | 3c47347 | 2004-12-16 17:28:50 +0000 | [diff] [blame] | 1153 | $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \ |
| 1154 | $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1155 | $(Echo) "Building $(<F) code emitter with tblgen" |
| 1156 | $(Verb) $(TableGen) -gen-emitter -o $@ $< |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1157 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1158 | clean-local:: |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1159 | -$(Verb) $(RM) -f $(INCFiles) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1160 | |
| 1161 | endif |
Chris Lattner | 481cc7c | 2003-08-15 02:18:35 +0000 | [diff] [blame] | 1162 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1163 | ############################################################################### |
| 1164 | # LEX AND YACC: Provide rules for generating sources with lex and yacc |
| 1165 | ############################################################################### |
Chris Lattner | e899678 | 2003-01-16 22:44:19 +0000 | [diff] [blame] | 1166 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1167 | #--------------------------------------------------------- |
| 1168 | # Provide rules for generating a .cpp source file from |
| 1169 | # (f)lex input sources. |
| 1170 | #--------------------------------------------------------- |
| 1171 | |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1172 | LexFiles := $(filter %.l,$(Sources)) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1173 | |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1174 | ifneq ($(LexFiles),) |
| 1175 | |
| 1176 | LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles))) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1177 | |
| 1178 | .PRECIOUS: $(LexOutput) |
| 1179 | |
| 1180 | # Note the extra sed filtering here, used to cut down on the warnings emited |
| 1181 | # by GCC. The last line is a gross hack to work around flex aparently not |
| 1182 | # being able to resize the buffer on a large token input. Currently, for |
| 1183 | # uninitialized string buffers in LLVM we can generate very long tokens, so |
| 1184 | # this is a hack around it. |
Chris Lattner | b7dc2b9 | 2003-08-15 20:00:47 +0000 | [diff] [blame] | 1185 | # FIXME. (f.e. char Buffer[10000] ) |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1186 | %.cpp: %.l |
Reid Spencer | c2ef8cd | 2004-12-10 19:44:16 +0000 | [diff] [blame] | 1187 | $(Echo) Flexing $*.l |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1188 | $(Verb) $(FLEX) -t $< | \ |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1189 | $(SED) 's/void yyunput/inline void yyunput/' | \ |
| 1190 | $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \ |
| 1191 | $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \ |
Reid Spencer | 80f0ef7 | 2004-10-28 00:41:43 +0000 | [diff] [blame] | 1192 | > $@ |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1193 | |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1194 | clean-local:: |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1195 | -$(Verb) $(RM) -f $(LexOutput) |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1196 | $(Verb) $(RM) -f $(LexOutput) |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1197 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1198 | endif |
| 1199 | |
| 1200 | #--------------------------------------------------------- |
| 1201 | # Provide rules for generating a .cpp and .h source files |
| 1202 | # from yacc (bison) input sources. |
| 1203 | #--------------------------------------------------------- |
| 1204 | |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1205 | YaccFiles := $(filter %.y,$(Sources)) |
| 1206 | ifneq ($(YaccFiles),) |
| 1207 | YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1208 | |
| 1209 | .PRECIOUS: $(YaccOutput) |
| 1210 | |
| 1211 | # Cancel built-in rules for yacc |
| 1212 | %.c: %.y |
| 1213 | %.cpp: %.y |
| 1214 | %.h: %.y |
| 1215 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1216 | # Rule for building the bison parsers... |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1217 | %.cpp %.h : %.y |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1218 | $(Echo) "Bisoning $*.y" |
| 1219 | $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $< |
| 1220 | $(Verb) $(MV) -f $*.tab.c $*.cpp |
| 1221 | $(Verb) $(MV) -f $*.tab.h $*.h |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1222 | |
Reid Spencer | 9af3b29 | 2004-11-01 07:50:27 +0000 | [diff] [blame] | 1223 | clean-local:: |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1224 | -$(Verb) $(RM) -f $(YaccOutput) |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1225 | $(Verb) $(RM) -f $(YaccOutput) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1226 | endif |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 1227 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1228 | ############################################################################### |
| 1229 | # OTHER RULES: Other rules needed |
| 1230 | ############################################################################### |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1231 | |
Chris Lattner | 30440c6 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 1232 | # To create postscript files from dot files... |
John Criswell | e0f9ac6 | 2003-10-02 19:02:02 +0000 | [diff] [blame] | 1233 | ifneq ($(DOT),false) |
Chris Lattner | 30440c6 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 1234 | %.ps: %.dot |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1235 | $(DOT) -Tps < $< > $@ |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 1236 | else |
| 1237 | %.ps: %.dot |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1238 | $(Echo) "Cannot build $@: The program dot is not installed" |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 1239 | endif |
Chris Lattner | 30440c6 | 2003-01-16 21:06:18 +0000 | [diff] [blame] | 1240 | |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 1241 | # This rules ensures that header files that are removed still have a rule for |
| 1242 | # which they can be "generated." This allows make to ignore them and |
| 1243 | # reproduce the dependency lists. |
John Criswell | 4b6e5d1 | 2003-09-18 18:37:08 +0000 | [diff] [blame] | 1244 | %.h:: ; |
Chris Lattner | b05a76c | 2005-02-04 21:28:50 +0000 | [diff] [blame] | 1245 | %.hpp:: ; |
John Criswell | 7f33695 | 2003-09-06 14:44:17 +0000 | [diff] [blame] | 1246 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1247 | # Define clean-local to clean the current directory. Note that this uses a |
| 1248 | # very conservative approach ensuring that empty variables do not cause |
| 1249 | # errors or disastrous removal. |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1250 | clean-local:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1251 | ifneq ($(strip $(ObjDir)),) |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1252 | -$(Verb) $(RM) -rf $(ObjDir) |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1253 | endif |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1254 | -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc |
Brian Gaeke | 9d3cd40 | 2004-01-21 19:53:11 +0000 | [diff] [blame] | 1255 | ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1256 | -$(Verb) $(RM) -f *$(SHLIBEXT) |
Brian Gaeke | 9d3cd40 | 2004-01-21 19:53:11 +0000 | [diff] [blame] | 1257 | endif |
John Criswell | 7a73b80 | 2003-06-30 21:59:07 +0000 | [diff] [blame] | 1258 | |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1259 | clean-all-local:: |
Reid Spencer | ca5fe8f | 2004-11-02 16:56:15 +0000 | [diff] [blame] | 1260 | -$(Verb) $(RM) -rf Debug Release Profile |
Reid Spencer | 3d65949 | 2004-11-02 16:36:03 +0000 | [diff] [blame] | 1261 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1262 | # Build tags database for Emacs/Xemacs: |
Reid Spencer | 12d7951 | 2004-11-12 02:27:36 +0000 | [diff] [blame] | 1263 | tags:: TAGS CTAGS |
| 1264 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1265 | TAGS: |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1266 | find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \ |
| 1267 | $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \ |
| 1268 | $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \ |
| 1269 | $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \ |
Reid Spencer | 12d7951 | 2004-11-12 02:27:36 +0000 | [diff] [blame] | 1270 | -name '*.cpp' -o -name '*.h' | \ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1271 | $(ETAGS) $(ETAGSFLAGS) - |
| 1272 | |
Reid Spencer | 12d7951 | 2004-11-12 02:27:36 +0000 | [diff] [blame] | 1273 | CTAGS: |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1274 | find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \ |
| 1275 | $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \ |
| 1276 | $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \ |
| 1277 | $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \ |
Reid Spencer | 12d7951 | 2004-11-12 02:27:36 +0000 | [diff] [blame] | 1278 | \( -name '*.cpp' -o -name '*.h' \) -print | \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1279 | ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L - |
Reid Spencer | 12d7951 | 2004-11-12 02:27:36 +0000 | [diff] [blame] | 1280 | |
| 1281 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1282 | ############################################################################### |
| 1283 | # DEPENDENCIES: Include the dependency files if we should |
| 1284 | ############################################################################### |
Chris Lattner | 33ad24a | 2003-08-22 14:10:16 +0000 | [diff] [blame] | 1285 | ifndef DISABLE_AUTO_DEPENDENCIES |
| 1286 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1287 | # If its not one of the cleaning targets |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1288 | ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),) |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1289 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1290 | # Get the list of dependency files |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1291 | DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources))) |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1292 | DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles)) |
Misha Brukman | 4f7a8cf | 2003-11-09 21:36:19 +0000 | [diff] [blame] | 1293 | |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1294 | -include /dev/null $(DependFiles) |
| 1295 | |
John Criswell | d741bcf | 2003-08-12 18:51:51 +0000 | [diff] [blame] | 1296 | endif |
Chris Lattner | 1ddb6b6 | 2003-08-18 17:27:40 +0000 | [diff] [blame] | 1297 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1298 | endif |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1299 | |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1300 | ############################################################################### |
Reid Spencer | 9e8d54a | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1301 | # CHECK: Running the test suite |
| 1302 | ############################################################################### |
| 1303 | |
| 1304 | check:: |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1305 | $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \ |
| 1306 | if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \ |
Reid Spencer | 9e8d54a | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1307 | $(EchoCmd) Running test suite ; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1308 | $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \ |
Reid Spencer | 9e8d54a | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1309 | TESTSUITE=$(TESTSUITE) ; \ |
| 1310 | else \ |
| 1311 | $(EchoCmd) No Makefile in test directory ; \ |
| 1312 | fi ; \ |
| 1313 | else \ |
| 1314 | $(EchoCmd) No test directory ; \ |
| 1315 | fi |
| 1316 | |
| 1317 | ############################################################################### |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1318 | # DISTRIBUTION: Handle construction of a distribution tarball |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1319 | ############################################################################### |
| 1320 | |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1321 | #------------------------------------------------------------------------ |
| 1322 | # Define distribution related variables |
| 1323 | #------------------------------------------------------------------------ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1324 | DistName := $(PROJECT_NAME)-$(PROJ_VERSION) |
| 1325 | DistDir := $(PROJ_OBJ_ROOT)/$(DistName) |
| 1326 | TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName) |
| 1327 | DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz |
| 1328 | DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip |
| 1329 | DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2 |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1330 | DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \ |
| 1331 | ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1332 | Makefile.config.in configure autoconf |
| 1333 | DistOther := $(notdir $(wildcard \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1334 | $(PROJ_SRC_DIR)/*.h \ |
| 1335 | $(PROJ_SRC_DIR)/*.td \ |
| 1336 | $(PROJ_SRC_DIR)/*.def \ |
| 1337 | $(PROJ_SRC_DIR)/*.ll \ |
| 1338 | $(PROJ_SRC_DIR)/*.in)) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1339 | DistSubDirs := $(SubDirs) |
Reid Spencer | fbbf307 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1340 | DistSources = $(Sources) $(EXTRA_DIST) |
| 1341 | DistFiles = $(DistAlways) $(DistSources) $(DistOther) |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1342 | |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1343 | #------------------------------------------------------------------------ |
| 1344 | # We MUST build distribution with OBJ_DIR != SRC_DIR |
| 1345 | #------------------------------------------------------------------------ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1346 | ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR)) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1347 | dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip :: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1348 | $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1349 | |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1350 | else |
| 1351 | |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1352 | #------------------------------------------------------------------------ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1353 | # Prevent attempt to run dist targets from anywhere but the top level |
| 1354 | #------------------------------------------------------------------------ |
| 1355 | ifneq ($(LEVEL),.) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1356 | dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip :: |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1357 | $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1358 | else |
| 1359 | |
| 1360 | #------------------------------------------------------------------------ |
| 1361 | # Provide the top level targets |
| 1362 | #------------------------------------------------------------------------ |
| 1363 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1364 | dist-gzip:: $(DistTarGZip) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1365 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1366 | $(DistTarGZip) : $(TopDistDir)/.makedistdir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1367 | $(Echo) Packing gzipped distribution tar file. |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1368 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \ |
Reid Spencer | fbbf307 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1369 | $(GZIP) -c > "$(DistTarGZip)" |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1370 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1371 | dist-bzip2:: $(DistTarBZ2) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1372 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1373 | $(DistTarBZ2) : $(TopDistDir)/.makedistdir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1374 | $(Echo) Packing bzipped distribution tar file. |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1375 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \ |
Reid Spencer | fbbf307 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1376 | $(BZIP2) -c >$(DistTarBZ2) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1377 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1378 | dist-zip:: $(DistZip) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1379 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1380 | $(DistZip) : $(TopDistDir)/.makedistdir |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1381 | $(Echo) Packing zipped distribution file. |
| 1382 | $(Verb) rm -f $(DistZip) |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1383 | $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1384 | |
| 1385 | dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1386 | $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL ===== |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1387 | |
Reid Spencer | f8f5740 | 2005-01-28 19:52:32 +0000 | [diff] [blame] | 1388 | DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1389 | |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1390 | dist-check:: $(DistTarGZip) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1391 | $(Echo) Checking distribution tar file. |
| 1392 | $(Verb) if test -d $(DistCheckDir) ; then \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1393 | $(RM) -rf $(DistCheckDir) ; \ |
| 1394 | fi |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1395 | $(Verb) $(MKDIR) $(DistCheckDir) |
| 1396 | $(Verb) cd $(DistCheckDir) && \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1397 | $(MKDIR) $(DistCheckDir)/build && \ |
| 1398 | $(MKDIR) $(DistCheckDir)/install && \ |
| 1399 | gunzip -c $(DistTarGZip) | $(TAR) xf - && \ |
| 1400 | cd build && \ |
| 1401 | ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \ |
Reid Spencer | 45eeed9 | 2005-05-24 02:33:20 +0000 | [diff] [blame] | 1402 | --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1403 | $(MAKE) all && \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1404 | $(MAKE) check && \ |
| 1405 | $(MAKE) install && \ |
| 1406 | $(MAKE) uninstall && \ |
| 1407 | $(MAKE) dist && \ |
| 1408 | $(MAKE) clean && \ |
| 1409 | $(MAKE) dist-clean && \ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1410 | $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution ===== |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1411 | |
| 1412 | dist-clean:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1413 | $(Echo) Cleaning distribution files |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1414 | -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \ |
| 1415 | $(DistCheckDir) |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1416 | |
| 1417 | endif |
| 1418 | |
| 1419 | #------------------------------------------------------------------------ |
| 1420 | # Provide the recursive distdir target for building the distribution directory |
| 1421 | #------------------------------------------------------------------------ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1422 | distdir: $(DistDir)/.makedistdir |
| 1423 | $(DistDir)/.makedistdir: $(DistSources) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1424 | $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1425 | if test -d "$(DistDir)" ; then \ |
| 1426 | find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \ |
| 1427 | exit 1 ; \ |
| 1428 | fi ; \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1429 | $(EchoCmd) Removing old $(DistDir) ; \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1430 | $(RM) -rf $(DistDir); \ |
Reid Spencer | 9e8d54a | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1431 | $(EchoCmd) Making 'all' to verify build ; \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1432 | $(MAKE) all ; \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1433 | fi |
Reid Spencer | fbbf307 | 2004-11-29 05:00:33 +0000 | [diff] [blame] | 1434 | $(Echo) Building Distribution Directory $(DistDir) |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1435 | $(Verb) $(MKDIR) $(DistDir) |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1436 | $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \ |
| 1437 | srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1438 | for file in $(DistFiles) ; do \ |
| 1439 | case "$$file" in \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1440 | $(PROJ_SRC_DIR)/*) \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1441 | file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \ |
| 1442 | ;; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1443 | $(PROJ_SRC_ROOT)/*) \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1444 | file=`echo "$$file" | \ |
| 1445 | sed "s#^$$srcrootstrip/##"` \ |
| 1446 | ;; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1447 | esac; \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1448 | if test -f "$(PROJ_SRC_DIR)/$$file" || \ |
| 1449 | test -d "$(PROJ_SRC_DIR)/$$file" ; then \ |
| 1450 | from_dir="$(PROJ_SRC_DIR)" ; \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1451 | elif test -f "$$file" || test -d "$$file" ; then \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1452 | from_dir=. ; \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1453 | fi ; \ |
| 1454 | to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1455 | if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \ |
| 1456 | to_dir="$(DistDir)/$$dir"; \ |
| 1457 | $(MKDIR) "$$to_dir" ; \ |
| 1458 | else \ |
| 1459 | to_dir="$(DistDir)"; \ |
| 1460 | fi; \ |
| 1461 | mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \ |
| 1462 | if test -n "$$mid_dir" ; then \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1463 | $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1464 | fi ; \ |
| 1465 | if test -d "$$from_dir/$$file"; then \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1466 | if test -d "$(PROJ_SRC_DIR)/$$file" && \ |
| 1467 | test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \ |
Reid Spencer | 45eeed9 | 2005-05-24 02:33:20 +0000 | [diff] [blame] | 1468 | cd $(PROJ_SRC_DIR) ; \ |
| 1469 | $(TAR) cf - $$file --exclude .svn --exclude CVS | \ |
| 1470 | ( cd $$to_dir ; $(TAR) xf - ) ; \ |
| 1471 | cd $(PROJ_OBJ_DIR) ; \ |
| 1472 | else \ |
| 1473 | cd $$from_dir ; \ |
| 1474 | $(TAR) cf - $$file --exclude .svn --exclude CVS | \ |
| 1475 | ( cd $$to_dir ; $(TAR) xf - ) ; \ |
| 1476 | cd $(PROJ_OBJ_DIR) ; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1477 | fi; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1478 | elif test -f "$$from_dir/$$file" ; then \ |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1479 | $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1480 | elif test -L "$$from_dir/$$file" ; then \ |
Reid Spencer | c371984 | 2004-12-16 18:26:53 +0000 | [diff] [blame] | 1481 | $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1482 | elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1483 | $(EchoCmd) "===== WARNING: Distribution Source " \ |
| 1484 | "$$from_dir/$$file Not Found!" ; \ |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1485 | elif test "$(Verb)" != '@' ; then \ |
| 1486 | $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1487 | fi; \ |
| 1488 | done |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1489 | $(Verb) for subdir in $(DistSubDirs) ; do \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1490 | if test "$$subdir" \!= "." ; then \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1491 | new_distdir="$(DistDir)/$$subdir" ; \ |
Reid Spencer | e45ebfa | 2004-10-26 07:09:33 +0000 | [diff] [blame] | 1492 | test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1493 | ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || \ |
| 1494 | exit 1; \ |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1495 | fi; \ |
| 1496 | done |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1497 | $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \ |
Reid Spencer | 45eeed9 | 2005-05-24 02:33:20 +0000 | [diff] [blame] | 1498 | $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \ |
| 1499 | $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o -name .svn \) -print` ;\ |
Reid Spencer | 345235ca | 2004-12-04 22:34:09 +0000 | [diff] [blame] | 1500 | $(MAKE) dist-hook ; \ |
| 1501 | $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \ |
| 1502 | -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \ |
| 1503 | -o ! -type d ! -perm -400 -exec chmod a+r {} \; \ |
| 1504 | -o ! -type d ! -perm -444 -exec \ |
| 1505 | $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \ |
| 1506 | || chmod -R a+r $(DistDir) ; \ |
| 1507 | fi |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1508 | |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1509 | # This is invoked by distdir target, define it as a no-op to avoid errors if not |
| 1510 | # defined by user. |
Reid Spencer | 151f8ba | 2004-10-25 08:27:37 +0000 | [diff] [blame] | 1511 | dist-hook:: |
| 1512 | |
Reid Spencer | e53e397 | 2004-10-22 23:06:30 +0000 | [diff] [blame] | 1513 | endif |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1514 | |
| 1515 | ############################################################################### |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1516 | # TOP LEVEL - targets only to apply at the top level directory |
| 1517 | ############################################################################### |
| 1518 | |
| 1519 | ifeq ($(LEVEL),.) |
| 1520 | |
| 1521 | #------------------------------------------------------------------------ |
Reid Spencer | 9e8d54a | 2004-12-06 05:35:13 +0000 | [diff] [blame] | 1522 | # Install support for the project's include files: |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1523 | #------------------------------------------------------------------------ |
| 1524 | install-local:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1525 | $(Echo) Installing include files |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1526 | $(Verb) $(MKDIR) $(PROJ_includedir) |
Reid Spencer | 4a0aaea | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 1527 | $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1528 | cd $(PROJ_SRC_ROOT)/include && \ |
Reid Spencer | 2edabc0 | 2005-02-16 15:54:03 +0000 | [diff] [blame] | 1529 | for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \ |
| 1530 | -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \ |
Reid Spencer | 4a0aaea | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 1531 | instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \ |
| 1532 | if test \! -d "$$instdir" ; then \ |
| 1533 | $(EchoCmd) Making install directory $$instdir ; \ |
| 1534 | $(MKDIR) $$instdir ;\ |
| 1535 | fi ; \ |
| 1536 | $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \ |
Reid Spencer | 2edabc0 | 2005-02-16 15:54:03 +0000 | [diff] [blame] | 1537 | done ; \ |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1538 | fi |
Reid Spencer | 4a0aaea | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 1539 | $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \ |
Reid Spencer | 2edabc0 | 2005-02-16 15:54:03 +0000 | [diff] [blame] | 1540 | cd $(PROJ_OBJ_ROOT)/include && \ |
| 1541 | for hdr in `find . -type f -print` ; do \ |
Reid Spencer | 4a0aaea | 2005-02-24 03:56:32 +0000 | [diff] [blame] | 1542 | $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \ |
Reid Spencer | 2edabc0 | 2005-02-16 15:54:03 +0000 | [diff] [blame] | 1543 | done ; \ |
Chris Lattner | ca94fa2 | 2005-02-09 02:24:00 +0000 | [diff] [blame] | 1544 | fi |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1545 | |
| 1546 | uninstall-local:: |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1547 | $(Echo) Uninstalling include files |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1548 | $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \ |
| 1549 | cd $(PROJ_SRC_ROOT)/include && \ |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1550 | $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \ |
Chris Lattner | ca94fa2 | 2005-02-09 02:24:00 +0000 | [diff] [blame] | 1551 | '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \ |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1552 | -print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \ |
Chris Lattner | ca94fa2 | 2005-02-09 02:24:00 +0000 | [diff] [blame] | 1553 | cd $(PROJ_SRC_ROOT)/include && \ |
| 1554 | $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \ |
| 1555 | | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \ |
| 1556 | fi |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1557 | |
Reid Spencer | e5487ba | 2004-10-24 07:53:21 +0000 | [diff] [blame] | 1558 | endif |
| 1559 | |
Reid Spencer | 4d71b66 | 2004-10-22 21:01:56 +0000 | [diff] [blame] | 1560 | #------------------------------------------------------------------------ |
| 1561 | # Print out the directories used for building |
Reid Spencer | cc2d1e2 | 2004-10-30 09:19:36 +0000 | [diff] [blame] | 1562 | #------------------------------------------------------------------------ |
Reid Spencer | 3a561f5 | 2004-10-23 20:04:14 +0000 | [diff] [blame] | 1563 | printvars:: |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1564 | $(Echo) "BuildMode : " '$(BuildMode)' |
| 1565 | $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)' |
| 1566 | $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)' |
| 1567 | $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)' |
| 1568 | $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)' |
| 1569 | $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)' |
| 1570 | $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)' |
| 1571 | $(Echo) "PROJ_prefix : " '$(PROJ_prefix)' |
| 1572 | $(Echo) "PROJ_bindir : " '$(PROJ_bindir)' |
| 1573 | $(Echo) "PROJ_libdir : " '$(PROJ_libdir)' |
| 1574 | $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)' |
Reid Spencer | 1a9a69c | 2005-02-16 16:13:02 +0000 | [diff] [blame] | 1575 | $(Echo) "PROJ_includedir : " '$(PROJ_includedir)' |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1576 | $(Echo) "UserTargets : " '$(UserTargets)' |
| 1577 | $(Echo) "ObjMakefiles : " '$(ObjMakefiles)' |
| 1578 | $(Echo) "SrcMakefiles : " '$(SrcMakefiles)' |
| 1579 | $(Echo) "ObjDir : " '$(ObjDir)' |
| 1580 | $(Echo) "LibDir : " '$(LibDir)' |
| 1581 | $(Echo) "ToolDir : " '$(ToolDir)' |
| 1582 | $(Echo) "ExmplDir : " '$(ExmplDir)' |
| 1583 | $(Echo) "Sources : " '$(Sources)' |
| 1584 | $(Echo) "TDFiles : " '$(TDFiles)' |
| 1585 | $(Echo) "INCFiles : " '$(INCFiles)' |
| 1586 | $(Echo) "INCTMPFiles : " '$(INCTMPFiles)' |
Reid Spencer | e0acb76 | 2005-03-01 16:27:06 +0000 | [diff] [blame] | 1587 | $(Echo) "PreConditions: " '$(PreConditions)' |
Reid Spencer | 11fde54 | 2005-01-16 02:20:54 +0000 | [diff] [blame] | 1588 | $(Echo) "Compile.CXX : " '$(Compile.CXX)' |
| 1589 | $(Echo) "Compile.C : " '$(Compile.C)' |
| 1590 | $(Echo) "Archive : " '$(Archive)' |
| 1591 | $(Echo) "YaccFiles : " '$(YaccFiles)' |
| 1592 | $(Echo) "LexFiles : " '$(LexFiles)' |
| 1593 | $(Echo) "Module : " '$(Module)' |
Reid Spencer | 755bcf0 | 2005-08-24 10:43:10 +0000 | [diff] [blame^] | 1594 | $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)' |