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