| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 1 | #---------------------------------------------------------------------- |
| 2 | # Clients fill in the source files to build |
| 3 | #---------------------------------------------------------------------- |
| 4 | # C_SOURCES := main.c |
| 5 | # CXX_SOURCES := |
| 6 | # OBJC_SOURCES := |
| 7 | # OBJCXX_SOURCES := |
| 8 | # DYLIB_C_SOURCES := |
| Johnny Chen | e9f9770 | 2012-01-11 01:42:58 +0000 | [diff] [blame] | 9 | # DYLIB_CXX_SOURCES := |
| 10 | # |
| 11 | # Specifying DYLIB_ONLY has the effect of building dylib only, skipping |
| 12 | # the building of the a.out executable program. For example, |
| 13 | # DYLIB_ONLY := YES |
| 14 | # |
| Johnny Chen | 64a7e74 | 2012-01-17 00:58:08 +0000 | [diff] [blame^] | 15 | # Also might be of interest: |
| Johnny Chen | 4876b5f | 2012-01-11 01:59:55 +0000 | [diff] [blame] | 16 | # FRAMEWORK_INCLUDES (Darwin only) := |
| 17 | # CFLAGS_EXTRAS := |
| 18 | # LD_EXTRAS := |
| Johnny Chen | 64a7e74 | 2012-01-17 00:58:08 +0000 | [diff] [blame^] | 19 | # |
| 20 | # And test/functionalities/archives/Makefile: |
| 21 | # MAKE_DSYM := NO |
| 22 | # ARCHIVE_NAME := libfoo.a |
| 23 | # ARCHIVE_C_SOURCES := a.c b.c |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 24 | |
| 25 | # Uncomment line below for debugging shell commands |
| 26 | # SHELL = /bin/sh -x |
| 27 | |
| 28 | #---------------------------------------------------------------------- |
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 29 | # If ARCH is not defined, default to x86_64. |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 30 | # If OS is not defined, use 'uname -s' to determine the OS name. |
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 31 | #---------------------------------------------------------------------- |
| 32 | ifeq "$(ARCH)" "" |
| 33 | ARCH = x86_64 |
| 34 | endif |
| 35 | |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 36 | ifeq "$(OS)" "" |
| 37 | OS = $(shell uname -s) |
| 38 | endif |
| 39 | |
| Johnny Chen | 6c17c08 | 2010-09-16 20:54:06 +0000 | [diff] [blame] | 40 | #---------------------------------------------------------------------- |
| Johnny Chen | 597cbbb | 2011-08-23 21:54:10 +0000 | [diff] [blame] | 41 | # CC defaults to clang. |
| Johnny Chen | 4ab4a9b | 2011-08-24 18:12:53 +0000 | [diff] [blame] | 42 | # |
| 43 | # If you change the defaults of CC, be sure to also change it in the file |
| 44 | # test/plugins/builder_base.py, which provides a Python way to return the |
| 45 | # value of the make variable CC -- getCompiler(). |
| 46 | # |
| Johnny Chen | 6055b44 | 2011-01-14 20:55:13 +0000 | [diff] [blame] | 47 | # See also these functions: |
| 48 | # o cxx_compiler |
| 49 | # o cxx_linker |
| Johnny Chen | d43e208 | 2011-01-14 20:46:49 +0000 | [diff] [blame] | 50 | #---------------------------------------------------------------------- |
| Johnny Chen | 597cbbb | 2011-08-23 21:54:10 +0000 | [diff] [blame] | 51 | CC ?= clang |
| Johnny Chen | d43e208 | 2011-01-14 20:46:49 +0000 | [diff] [blame] | 52 | ifeq "$(CC)" "cc" |
| Johnny Chen | 597cbbb | 2011-08-23 21:54:10 +0000 | [diff] [blame] | 53 | CC = clang |
| Johnny Chen | d43e208 | 2011-01-14 20:46:49 +0000 | [diff] [blame] | 54 | endif |
| 55 | |
| 56 | #---------------------------------------------------------------------- |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 57 | # Change any build/tool options needed |
| 58 | #---------------------------------------------------------------------- |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 59 | CFLAGS ?= -gdwarf-2 -O0 |
| Johnny Chen | beac8f9 | 2012-01-10 00:41:11 +0000 | [diff] [blame] | 60 | CFLAGS += $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 61 | ifeq "$(OS)" "Darwin" |
| 62 | CFLAGS += -arch $(ARCH) |
| Greg Clayton | 3bffb08 | 2011-12-10 02:15:28 +0000 | [diff] [blame] | 63 | DS := dsymutil |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 64 | DSFLAGS = |
| 65 | DSYM = $(EXE).dSYM |
| Johnny Chen | fe14162 | 2012-01-12 23:09:42 +0000 | [diff] [blame] | 66 | AR := libtool |
| 67 | ARFLAGS := -static -o |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 68 | endif |
| 69 | |
| Johnny Chen | 53e2edb | 2011-08-09 20:07:16 +0000 | [diff] [blame] | 70 | CXXFLAGS +=$(CFLAGS) |
| 71 | LD = $(CC) |
| 72 | LDFLAGS ?= $(CFLAGS) |
| 73 | LDFLAGS += $(LD_EXTRAS) |
| 74 | OBJECTS = |
| 75 | EXE ?= a.out |
| 76 | |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 77 | ifneq "$(DYLIB_NAME)" "" |
| 78 | ifeq "$(OS)" "Darwin" |
| 79 | DYLIB_FILENAME = lib$(DYLIB_NAME).dylib |
| 80 | else |
| 81 | DYLIB_FILENAME = lib$(DYLIB_NAME).so |
| 82 | endif |
| 83 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 84 | |
| Johnny Chen | bdb4efc | 2011-01-14 18:19:53 +0000 | [diff] [blame] | 85 | # Function that returns the counterpart C++ compiler, given $(CC) as arg. |
| 86 | cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1)))) |
| 87 | |
| 88 | # Function that returns the C++ linker, given $(CC) as arg. |
| Greg Clayton | d50d238 | 2012-01-10 00:00:15 +0000 | [diff] [blame] | 89 | cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1)))) |
| Johnny Chen | 832d233 | 2010-09-30 01:22:34 +0000 | [diff] [blame] | 90 | |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 91 | #---------------------------------------------------------------------- |
| 92 | # dylib settings |
| 93 | #---------------------------------------------------------------------- |
| 94 | ifneq "$(strip $(DYLIB_C_SOURCES))" "" |
| 95 | DYLIB_OBJECTS +=$(strip $(DYLIB_C_SOURCES:.c=.o)) |
| 96 | endif |
| 97 | |
| Greg Clayton | d50d238 | 2012-01-10 00:00:15 +0000 | [diff] [blame] | 98 | ifneq "$(strip $(DYLIB_CXX_SOURCES))" "" |
| 99 | DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o)) |
| 100 | CXX = $(call cxx_compiler,$(CC)) |
| 101 | LD = $(call cxx_linker,$(CC)) |
| 102 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 103 | |
| 104 | #---------------------------------------------------------------------- |
| 105 | # Check if we have any C source files |
| 106 | #---------------------------------------------------------------------- |
| 107 | ifneq "$(strip $(C_SOURCES))" "" |
| 108 | OBJECTS +=$(strip $(C_SOURCES:.c=.o)) |
| 109 | endif |
| 110 | |
| 111 | #---------------------------------------------------------------------- |
| 112 | # Check if we have any C++ source files |
| 113 | #---------------------------------------------------------------------- |
| 114 | ifneq "$(strip $(CXX_SOURCES))" "" |
| 115 | OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o)) |
| Johnny Chen | 832d233 | 2010-09-30 01:22:34 +0000 | [diff] [blame] | 116 | CXX = $(call cxx_compiler,$(CC)) |
| Johnny Chen | bdb4efc | 2011-01-14 18:19:53 +0000 | [diff] [blame] | 117 | LD = $(call cxx_linker,$(CC)) |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 118 | endif |
| 119 | |
| 120 | #---------------------------------------------------------------------- |
| 121 | # Check if we have any ObjC source files |
| 122 | #---------------------------------------------------------------------- |
| 123 | ifneq "$(strip $(OBJC_SOURCES))" "" |
| 124 | OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o)) |
| 125 | LDFLAGS +=-lobjc |
| 126 | endif |
| 127 | |
| 128 | #---------------------------------------------------------------------- |
| 129 | # Check if we have any ObjC++ source files |
| 130 | #---------------------------------------------------------------------- |
| 131 | ifneq "$(strip $(OBJCXX_SOURCES))" "" |
| 132 | OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o)) |
| Johnny Chen | 832d233 | 2010-09-30 01:22:34 +0000 | [diff] [blame] | 133 | CXX = $(call cxx_compiler,$(CC)) |
| Johnny Chen | bdb4efc | 2011-01-14 18:19:53 +0000 | [diff] [blame] | 134 | LD = $(call cxx_linker,$(CC)) |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 135 | ifeq $(findstring lobjc,$(LDFLAGS)) "" |
| 136 | LDFLAGS +=-lobjc |
| 137 | endif |
| 138 | endif |
| 139 | |
| Johnny Chen | fe14162 | 2012-01-12 23:09:42 +0000 | [diff] [blame] | 140 | #---------------------------------------------------------------------- |
| 141 | # Check if we have any C source files for archive |
| 142 | #---------------------------------------------------------------------- |
| 143 | ifneq "$(strip $(ARCHIVE_C_SOURCES))" "" |
| 144 | ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_C_SOURCES:.c=.o)) |
| 145 | endif |
| 146 | |
| 147 | #---------------------------------------------------------------------- |
| 148 | # Check if we have any C++ source files for archive |
| 149 | #---------------------------------------------------------------------- |
| 150 | ifneq "$(strip $(ARCHIVE_CXX_SOURCES))" "" |
| 151 | ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_CXX_SOURCES:.cpp=.o)) |
| 152 | CXX = $(call cxx_compiler,$(CC)) |
| 153 | LD = $(call cxx_linker,$(CC)) |
| 154 | endif |
| 155 | |
| 156 | #---------------------------------------------------------------------- |
| 157 | # Check if we have any ObjC source files for archive |
| 158 | #---------------------------------------------------------------------- |
| 159 | ifneq "$(strip $(ARCHIVE_OBJC_SOURCES))" "" |
| 160 | ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJC_SOURCES:.m=.o)) |
| 161 | LDFLAGS +=-lobjc |
| 162 | endif |
| 163 | |
| 164 | #---------------------------------------------------------------------- |
| 165 | # Check if we have any ObjC++ source files for archive |
| 166 | #---------------------------------------------------------------------- |
| 167 | ifneq "$(strip $(ARCHIVE_OBJCXX_SOURCES))" "" |
| 168 | ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJCXX_SOURCES:.mm=.o)) |
| 169 | CXX = $(call cxx_compiler,$(CC)) |
| 170 | LD = $(call cxx_linker,$(CC)) |
| 171 | ifeq $(findstring lobjc,$(LDFLAGS)) "" |
| 172 | LDFLAGS +=-lobjc |
| 173 | endif |
| 174 | endif |
| 175 | |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 176 | |
| 177 | #---------------------------------------------------------------------- |
| Johnny Chen | beac8f9 | 2012-01-10 00:41:11 +0000 | [diff] [blame] | 178 | # DYLIB_ONLY variable can be used to skip the building of a.out. |
| 179 | # See the sections below regarding dSYM file as well as the building of |
| 180 | # EXE from all the objects. |
| 181 | #---------------------------------------------------------------------- |
| 182 | |
| 183 | #---------------------------------------------------------------------- |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 184 | # Make the dSYM file from the executable if $(MAKE_DSYM) != "NO" |
| 185 | #---------------------------------------------------------------------- |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 186 | ifeq "$(OS)" "Darwin" |
| Johnny Chen | 9101639 | 2011-06-20 20:08:26 +0000 | [diff] [blame] | 187 | ifneq "$(MAKE_DSYM)" "NO" |
| Johnny Chen | beac8f9 | 2012-01-10 00:41:11 +0000 | [diff] [blame] | 188 | ifeq "$(DYLIB_ONLY)" "" |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 189 | $(DSYM) : $(EXE) |
| 190 | $(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)" |
| Johnny Chen | 9101639 | 2011-06-20 20:08:26 +0000 | [diff] [blame] | 191 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 192 | endif |
| Johnny Chen | beac8f9 | 2012-01-10 00:41:11 +0000 | [diff] [blame] | 193 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 194 | |
| 195 | #---------------------------------------------------------------------- |
| 196 | # Compile the executable from all the objects. |
| 197 | #---------------------------------------------------------------------- |
| Johnny Chen | beac8f9 | 2012-01-10 00:41:11 +0000 | [diff] [blame] | 198 | ifneq "$(DYLIB_NAME)" "" |
| 199 | ifeq "$(DYLIB_ONLY)" "" |
| Johnny Chen | fe14162 | 2012-01-12 23:09:42 +0000 | [diff] [blame] | 200 | $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(DYLIB_FILENAME) |
| 201 | $(LD) $(LDFLAGS) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) -o "$(EXE)" |
| Johnny Chen | beac8f9 | 2012-01-10 00:41:11 +0000 | [diff] [blame] | 202 | else |
| 203 | EXE = $(DYLIB_FILENAME) |
| 204 | endif |
| 205 | else |
| Johnny Chen | fe14162 | 2012-01-12 23:09:42 +0000 | [diff] [blame] | 206 | $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) |
| 207 | $(LD) $(LDFLAGS) $(OBJECTS) $(ARCHIVE_NAME) -o "$(EXE)" |
| 208 | endif |
| 209 | |
| 210 | #---------------------------------------------------------------------- |
| 211 | # Make the archive |
| 212 | #---------------------------------------------------------------------- |
| 213 | ifneq "$(ARCHIVE_NAME)" "" |
| 214 | ifeq "$(OS)" "Darwin" |
| 215 | $(ARCHIVE_NAME) : $(ARCHIVE_OBJECTS) |
| 216 | $(AR) $(ARFLAGS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) |
| 217 | $(RM) $(ARCHIVE_OBJECTS) |
| 218 | else |
| 219 | $(ARCHIVE_NAME) : $(foreach ar_obj,$(ARCHIVE_OBJECTS),$(ARCHIVE_NAME)($(ar_obj))) |
| 220 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 221 | endif |
| 222 | |
| 223 | #---------------------------------------------------------------------- |
| 224 | # Make the dylib |
| 225 | #---------------------------------------------------------------------- |
| Peter Collingbourne | 518f03d | 2011-06-20 19:06:04 +0000 | [diff] [blame] | 226 | $(DYLIB_FILENAME) : $(DYLIB_OBJECTS) |
| 227 | ifeq "$(OS)" "Darwin" |
| 228 | $(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)" |
| 229 | else |
| 230 | $(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -shared -o "$(DYLIB_FILENAME)" |
| 231 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 232 | |
| 233 | #---------------------------------------------------------------------- |
| 234 | # Automatic variables based on items already entered. Below we create |
| 235 | # an objects lists from the list of sources by replacing all entries |
| 236 | # that end with .c with .o, and we also create a list of prerequisite |
| 237 | # files by replacing all .c files with .d. |
| 238 | #---------------------------------------------------------------------- |
| 239 | PREREQS := $(OBJECTS:.o=.d) |
| Johnny Chen | e3dc0f0 | 2010-08-24 16:35:00 +0000 | [diff] [blame] | 240 | ifneq "$(DYLIB_NAME)" "" |
| 241 | DYLIB_PREREQS := $(DYLIB_OBJECTS:.o=.d) |
| 242 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 243 | |
| 244 | #---------------------------------------------------------------------- |
| 245 | # Rule for Generating Prerequisites Automatically using .d files and |
| 246 | # the compiler -MM option. The -M option will list all system headers, |
| 247 | # and the -MM option will list all non-system dependencies. |
| 248 | #---------------------------------------------------------------------- |
| 249 | %.d: %.c |
| 250 | @set -e; rm -f $@; \ |
| Johnny Chen | 189bff1 | 2011-08-04 20:44:56 +0000 | [diff] [blame] | 251 | $(CC) -M $(CFLAGS) $< > $@.$$$$; \ |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 252 | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ |
| 253 | rm -f $@.$$$$ |
| 254 | |
| 255 | %.d: %.cpp |
| 256 | @set -e; rm -f $@; \ |
| Johnny Chen | 189bff1 | 2011-08-04 20:44:56 +0000 | [diff] [blame] | 257 | $(CC) -M $(CXXFLAGS) $< > $@.$$$$; \ |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 258 | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ |
| 259 | rm -f $@.$$$$ |
| 260 | |
| 261 | %.d: %.m |
| 262 | @set -e; rm -f $@; \ |
| Johnny Chen | 189bff1 | 2011-08-04 20:44:56 +0000 | [diff] [blame] | 263 | $(CC) -M $(CFLAGS) $< > $@.$$$$; \ |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 264 | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ |
| 265 | rm -f $@.$$$$ |
| 266 | |
| 267 | %.d: %.mm |
| 268 | @set -e; rm -f $@; \ |
| Johnny Chen | 189bff1 | 2011-08-04 20:44:56 +0000 | [diff] [blame] | 269 | $(CC) -M $(CXXFLAGS) $< > $@.$$$$; \ |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 270 | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ |
| 271 | rm -f $@.$$$$ |
| 272 | |
| 273 | #---------------------------------------------------------------------- |
| 274 | # Include all of the makefiles for each source file so we don't have |
| 275 | # to manually track all of the prerequisites for each source file. |
| 276 | #---------------------------------------------------------------------- |
| 277 | sinclude $(PREREQS) |
| Johnny Chen | e3dc0f0 | 2010-08-24 16:35:00 +0000 | [diff] [blame] | 278 | ifneq "$(DYLIB_NAME)" "" |
| 279 | sinclude $(DYLIB_PREREQS) |
| 280 | endif |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 281 | |
| 282 | .PHONY: clean |
| 283 | dsym: $(DSYM) |
| 284 | all: $(EXE) $(DSYM) |
| Johnny Chen | e1030cd | 2010-09-27 20:44:46 +0000 | [diff] [blame] | 285 | clean:: |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 286 | ifeq "$(DYLIB_NAME)" "" |
| Johnny Chen | fe14162 | 2012-01-12 23:09:42 +0000 | [diff] [blame] | 287 | rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 288 | else |
| Johnny Chen | fe14162 | 2012-01-12 23:09:42 +0000 | [diff] [blame] | 289 | rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).dSYM |
| Johnny Chen | 9bc867a | 2010-08-23 23:56:08 +0000 | [diff] [blame] | 290 | endif |
| Johnny Chen | fa38041 | 2011-01-14 21:18:12 +0000 | [diff] [blame] | 291 | |
| 292 | #---------------------------------------------------------------------- |
| 293 | # From http://blog.melski.net/tag/debugging-makefiles/ |
| 294 | # |
| 295 | # Usage: make print-CC print-CXX print-LD |
| 296 | #---------------------------------------------------------------------- |
| 297 | print-%: |
| 298 | @echo '$*=$($*)' |
| 299 | @echo ' origin = $(origin $*)' |
| 300 | @echo ' flavor = $(flavor $*)' |
| 301 | @echo ' value = $(value $*)' |
| Johnny Chen | 8b2c321 | 2011-01-28 17:22:29 +0000 | [diff] [blame] | 302 | |
| 303 | |
| 304 | ### Local Variables: ### |
| 305 | ### mode:makefile ### |
| 306 | ### End: ### |