John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 1 | ## |
John Koleszar | c2140b8 | 2010-09-09 08:16:39 -0400 | [diff] [blame] | 2 | ## Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 3 | ## |
| 4 | ## Use of this source code is governed by a BSD-style license |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 5 | ## that can be found in the LICENSE file in the root of the source |
| 6 | ## tree. An additional intellectual property rights grant can be found |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 7 | ## in the file PATENTS. All contributing project authors may |
| 8 | ## be found in the AUTHORS file in the root of the source tree. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 9 | ## |
| 10 | |
| 11 | |
| 12 | include config.mk |
| 13 | quiet?=true |
| 14 | ifeq ($(target),) |
| 15 | # If a target wasn't specified, invoke for all enabled targets. |
| 16 | .DEFAULT: |
| 17 | @for t in $(ALL_TARGETS); do \ |
| 18 | $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\ |
| 19 | done |
| 20 | all: .DEFAULT |
| 21 | clean:: .DEFAULT |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 22 | install:: .DEFAULT |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 23 | test:: .DEFAULT |
John Koleszar | 1d0dc7c | 2012-11-02 15:17:36 -0700 | [diff] [blame] | 24 | testdata:: .DEFAULT |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 25 | |
| 26 | |
| 27 | # Note: md5sum is not installed on OS X, but openssl is. Openssl may not be |
| 28 | # installed on cygwin, so we need to autodetect here. |
| 29 | md5sum := $(firstword $(wildcard \ |
| 30 | $(foreach e,md5sum openssl,\ |
| 31 | $(foreach p,$(subst :, ,$(PATH)),$(p)/$(e)*))\ |
| 32 | )) |
| 33 | md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum)) |
| 34 | |
| 35 | TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN))) |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 36 | dist: |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 37 | @for t in $(ALL_TARGETS); do \ |
| 38 | $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\ |
| 39 | done |
| 40 | # Run configure for the user with the current toolchain. |
| 41 | @if [ -d "$(DIST_DIR)/src" ]; then \ |
| 42 | mkdir -p "$(DIST_DIR)/build"; \ |
| 43 | cd "$(DIST_DIR)/build"; \ |
John Koleszar | 23d68a5 | 2010-06-22 09:53:23 -0400 | [diff] [blame] | 44 | echo "Rerunning configure $(CONFIGURE_ARGS)"; \ |
| 45 | ../src/configure $(CONFIGURE_ARGS); \ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 46 | $(if $(filter vs%,$(TGT_CC)),make NO_LAUNCH_DEVENV=1;) \ |
| 47 | fi |
| 48 | @if [ -d "$(DIST_DIR)" ]; then \ |
| 49 | echo " [MD5SUM] $(DIST_DIR)"; \ |
| 50 | cd $(DIST_DIR) && \ |
| 51 | $(md5sum) `find . -name md5sums.txt -prune -o -type f -print` \ |
| 52 | | sed -e 's/MD5(\(.*\))= \([0-9a-f]\{32\}\)/\2 \1/' \ |
| 53 | > md5sums.txt;\ |
| 54 | fi |
| 55 | |
| 56 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 57 | endif |
| 58 | |
| 59 | ifneq ($(target),) |
| 60 | # Normally, we want to build the filename from the target and the toolchain. |
| 61 | # This disambiguates from the $(target).mk file that exists in the source tree. |
| 62 | # However, the toolchain is part of the target in universal builds, so we |
| 63 | # don't want to include TOOLCHAIN in that case. FAT_ARCHS is used to test |
| 64 | # if we're in the universal case. |
| 65 | include $(target)$(if $(FAT_ARCHS),,-$(TOOLCHAIN)).mk |
| 66 | endif |
| 67 | BUILD_ROOT?=. |
| 68 | VPATH=$(SRC_PATH_BARE) |
| 69 | CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) |
John Koleszar | 1d0dc7c | 2012-11-02 15:17:36 -0700 | [diff] [blame] | 70 | CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) |
John Koleszar | 2ad4810 | 2010-10-25 10:28:45 -0400 | [diff] [blame] | 71 | ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 72 | DIST_DIR?=dist |
| 73 | HOSTCC?=gcc |
| 74 | TGT_ISA:=$(word 1, $(subst -, ,$(TOOLCHAIN))) |
| 75 | TGT_OS:=$(word 2, $(subst -, ,$(TOOLCHAIN))) |
| 76 | TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN))) |
Luca Barbato | 44881a5 | 2013-01-06 19:19:43 +0100 | [diff] [blame] | 77 | quiet:=$(if $(or $(verbose), $(V)),, yes) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 78 | qexec=$(if $(quiet),@) |
| 79 | |
| 80 | # Cancel built-in implicit rules |
| 81 | %: %.o |
| 82 | %.asm: |
| 83 | %.a: |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 84 | %: %.cc |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 85 | |
| 86 | # |
| 87 | # Common rules" |
| 88 | # |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 89 | .PHONY: all |
| 90 | all: |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 91 | |
| 92 | .PHONY: clean |
| 93 | clean:: |
| 94 | rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s) |
| 95 | rm -f $(CLEAN-OBJS) |
| 96 | |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 97 | .PHONY: dist |
| 98 | dist: |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 99 | .PHONY: install |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 100 | install:: |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 101 | .PHONY: test |
| 102 | test:: |
John Koleszar | 1d0dc7c | 2012-11-02 15:17:36 -0700 | [diff] [blame] | 103 | .PHONY: testdata |
| 104 | testdata:: |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 105 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 106 | $(BUILD_PFX)%.c.d: %.c |
| 107 | $(if $(quiet),@echo " [DEP] $@") |
| 108 | $(qexec)mkdir -p $(dir $@) |
| 109 | $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 110 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 111 | $(BUILD_PFX)%.c.o: %.c |
| 112 | $(if $(quiet),@echo " [CC] $@") |
| 113 | $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $< |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 114 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 115 | $(BUILD_PFX)%.cc.d: %.cc |
| 116 | $(if $(quiet),@echo " [DEP] $@") |
| 117 | $(qexec)mkdir -p $(dir $@) |
| 118 | $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@ |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 119 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 120 | $(BUILD_PFX)%.cc.o: %.cc |
| 121 | $(if $(quiet),@echo " [CXX] $@") |
| 122 | $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $< |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 123 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 124 | $(BUILD_PFX)%.asm.d: %.asm |
| 125 | $(if $(quiet),@echo " [DEP] $@") |
| 126 | $(qexec)mkdir -p $(dir $@) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 127 | $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \ |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 128 | --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 129 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 130 | $(BUILD_PFX)%.asm.o: %.asm |
| 131 | $(if $(quiet),@echo " [AS] $@") |
| 132 | $(qexec)$(AS) $(ASFLAGS) -o $@ $< |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 133 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 134 | $(BUILD_PFX)%.s.d: %.s |
| 135 | $(if $(quiet),@echo " [DEP] $@") |
| 136 | $(qexec)mkdir -p $(dir $@) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 137 | $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \ |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 138 | --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 139 | |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 140 | $(BUILD_PFX)%.s.o: %.s |
| 141 | $(if $(quiet),@echo " [AS] $@") |
| 142 | $(qexec)$(AS) $(ASFLAGS) -o $@ $< |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 143 | |
Johann | 79327be | 2011-06-08 14:43:34 -0400 | [diff] [blame] | 144 | .PRECIOUS: %.c.S |
| 145 | %.c.S: CFLAGS += -DINLINE_ASM |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 146 | $(BUILD_PFX)%.c.S: %.c |
| 147 | $(if $(quiet),@echo " [GEN] $@") |
| 148 | $(qexec)$(CC) -S $(CFLAGS) -o $@ $< |
Johann | 79327be | 2011-06-08 14:43:34 -0400 | [diff] [blame] | 149 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 150 | .PRECIOUS: %.asm.s |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 151 | $(BUILD_PFX)%.asm.s: %.asm |
| 152 | $(if $(quiet),@echo " [ASM CONVERSION] $@") |
| 153 | $(qexec)mkdir -p $(dir $@) |
| 154 | $(qexec)$(ASM_CONVERSION) <$< >$@ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 155 | |
| 156 | # If we're in debug mode, pretend we don't have GNU strip, to fall back to |
| 157 | # the copy implementation |
| 158 | HAVE_GNU_STRIP := $(if $(CONFIG_DEBUG),,$(HAVE_GNU_STRIP)) |
| 159 | ifeq ($(HAVE_GNU_STRIP),yes) |
| 160 | # Older binutils strip global sybols not needed for relocation processing |
| 161 | # when given --strip-unneeded. Use nm and awk to identify globals and |
| 162 | # keep them. |
| 163 | %.a: %_g.a |
| 164 | $(if $(quiet),@echo " [STRIP] $@ < $<") |
| 165 | $(qexec)$(STRIP) --strip-unneeded \ |
| 166 | `$(NM) $< | grep ' [A-TV-Z] ' | awk '{print "-K"$$3'}`\ |
| 167 | -o $@ $< |
| 168 | else |
| 169 | %.a: %_g.a |
| 170 | $(if $(quiet),@echo " [CP] $@ < $<") |
| 171 | $(qexec)cp $< $@ |
| 172 | endif |
| 173 | |
| 174 | # |
| 175 | # Rule to extract assembly constants from C sources |
| 176 | # |
| 177 | obj_int_extract: build/make/obj_int_extract.c |
Attila Nagy | 346b3e7 | 2011-03-16 12:56:52 +0200 | [diff] [blame] | 178 | $(if $(quiet),@echo " [HOSTCC] $@") |
Johann | fb037ec | 2011-03-08 17:41:45 -0500 | [diff] [blame] | 179 | $(qexec)$(HOSTCC) -I. -I$(SRC_PATH_BARE) -o $@ $< |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 180 | CLEAN-OBJS += obj_int_extract |
| 181 | |
| 182 | # |
| 183 | # Utility functions |
| 184 | # |
| 185 | pairmap=$(if $(strip $(2)),\ |
| 186 | $(call $(1),$(word 1,$(2)),$(word 2,$(2)))\ |
| 187 | $(call pairmap,$(1),$(wordlist 3,$(words $(2)),$(2)))\ |
| 188 | ) |
| 189 | |
| 190 | enabled=$(filter-out $($(1)-no),$($(1)-yes)) |
| 191 | cond_enabled=$(if $(filter yes,$($(1))), $(call enabled,$(2))) |
| 192 | |
| 193 | find_file1=$(word 1,$(wildcard $(subst //,/,$(addsuffix /$(1),$(2))))) |
| 194 | find_file=$(foreach f,$(1),$(call find_file1,$(strip $(f)),$(strip $(2))) ) |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 195 | obj_pats=.c=.c.o $(AS_SFX)=$(AS_SFX).o .cc=.cc.o |
John Koleszar | 1760c39 | 2012-11-27 15:54:54 -0800 | [diff] [blame] | 196 | objs=$(addprefix $(BUILD_PFX),$(foreach p,$(obj_pats),$(filter %.o,$(1:$(p))) )) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 197 | |
| 198 | install_map_templates=$(eval $(call install_map_template,$(1),$(2))) |
| 199 | |
| 200 | not=$(subst yes,no,$(1)) |
| 201 | |
| 202 | ifeq ($(CONFIG_MSVS),yes) |
| 203 | lib_file_name=$(1).lib |
| 204 | else |
| 205 | lib_file_name=lib$(1).a |
| 206 | endif |
| 207 | # |
| 208 | # Rule Templates |
| 209 | # |
| 210 | define linker_template |
| 211 | $(1): $(filter-out -%,$(2)) |
| 212 | $(1): |
| 213 | $(if $(quiet),@echo " [LD] $$@") |
Ronald S. Bultje | bbf890f | 2011-05-02 13:56:41 -0400 | [diff] [blame] | 214 | $(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs)) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 215 | endef |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 216 | define linkerxx_template |
| 217 | $(1): $(filter-out -%,$(2)) |
| 218 | $(1): |
| 219 | $(if $(quiet),@echo " [LD] $$@") |
John Koleszar | 1d0dc7c | 2012-11-02 15:17:36 -0700 | [diff] [blame] | 220 | $(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs)) |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 221 | endef |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 222 | # make-3.80 has a bug with expanding large input strings to the eval function, |
| 223 | # which was triggered in some cases by the following component of |
| 224 | # linker_template: |
| 225 | # $(1): $$(call find_file, $(patsubst -l%,lib%.a,$(filter -l%,$(2))),\ |
| 226 | # $$(patsubst -L%,%,$$(filter -L%,$$(LDFLAGS) $(2)))) |
| 227 | # This may be useful to revisit in the future (it tries to locate libraries |
| 228 | # in a search path and add them as prerequisites |
| 229 | |
| 230 | define install_map_template |
| 231 | $(DIST_DIR)/$(1): $(2) |
| 232 | $(if $(quiet),@echo " [INSTALL] $$@") |
| 233 | $(qexec)mkdir -p $$(dir $$@) |
| 234 | $(qexec)cp -p $$< $$@ |
| 235 | endef |
| 236 | |
| 237 | define archive_template |
| 238 | # Not using a pattern rule here because we don't want to generate empty |
| 239 | # archives when they are listed as a dependency in files not responsible |
| 240 | # for creating them. |
| 241 | $(1): |
| 242 | $(if $(quiet),@echo " [AR] $$@") |
| 243 | $(qexec)$$(AR) $$(ARFLAGS) $$@ $$? |
| 244 | endef |
| 245 | |
John Koleszar | 7aa97a3 | 2010-06-03 10:29:04 -0400 | [diff] [blame] | 246 | define so_template |
| 247 | # Not using a pattern rule here because we don't want to generate empty |
| 248 | # archives when they are listed as a dependency in files not responsible |
| 249 | # for creating them. |
| 250 | # |
| 251 | # This needs further abstraction for dealing with non-GNU linkers. |
| 252 | $(1): |
| 253 | $(if $(quiet),@echo " [LD] $$@") |
| 254 | $(qexec)$$(LD) -shared $$(LDFLAGS) \ |
Johann | abb7c21 | 2011-06-08 11:36:04 -0700 | [diff] [blame] | 255 | -Wl,--no-undefined -Wl,-soname,$$(SONAME) \ |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 256 | -Wl,--version-script,$$(EXPORTS_FILE) -o $$@ \ |
John Koleszar | dcb52c0 | 2012-07-24 16:18:38 -0700 | [diff] [blame] | 257 | $$(filter %.o,$$^) $$(extralibs) |
John Koleszar | 7aa97a3 | 2010-06-03 10:29:04 -0400 | [diff] [blame] | 258 | endef |
| 259 | |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 260 | define dl_template |
| 261 | # Not using a pattern rule here because we don't want to generate empty |
| 262 | # archives when they are listed as a dependency in files not responsible |
| 263 | # for creating them. |
| 264 | $(1): |
| 265 | $(if $(quiet),@echo " [LD] $$@") |
| 266 | $(qexec)$$(LD) -dynamiclib $$(LDFLAGS) \ |
| 267 | -exported_symbols_list $$(EXPORTS_FILE) \ |
| 268 | -Wl,-headerpad_max_install_names,-compatibility_version,1.0,-current_version,$$(VERSION_MAJOR) \ |
| 269 | -o $$@ \ |
| 270 | $$(filter %.o,$$^) $$(extralibs) |
| 271 | endef |
| 272 | |
| 273 | |
| 274 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 275 | define lipo_lib_template |
| 276 | $(1): $(addsuffix /$(1),$(FAT_ARCHS)) |
| 277 | $(if $(quiet),@echo " [LIPO] $$@") |
| 278 | $(qexec)libtool -static -o $$@ $$? |
| 279 | endef |
| 280 | |
| 281 | define lipo_bin_template |
| 282 | $(1): $(addsuffix /$(1),$(FAT_ARCHS)) |
| 283 | $(if $(quiet),@echo " [LIPO] $$@") |
| 284 | $(qexec)lipo -output $$@ -create $$? |
| 285 | endef |
| 286 | |
| 287 | |
| 288 | # |
| 289 | # Get current configuration |
| 290 | # |
| 291 | ifneq ($(target),) |
| 292 | include $(SRC_PATH_BARE)/$(target:-$(TOOLCHAIN)=).mk |
| 293 | endif |
| 294 | ifeq ($(filter clean,$(MAKECMDGOALS)),) |
| 295 | # Older versions of make don't like -include directives with no arguments |
| 296 | ifneq ($(filter %.d,$(OBJS-yes:.o=.d)),) |
| 297 | -include $(filter %.d,$(OBJS-yes:.o=.d)) |
| 298 | endif |
| 299 | endif |
| 300 | |
| 301 | # |
Gaute Strokkenes | 6795e25 | 2011-03-15 12:20:54 +0000 | [diff] [blame] | 302 | # Configuration dependent rules |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 303 | # |
| 304 | $(call pairmap,install_map_templates,$(INSTALL_MAPS)) |
| 305 | |
| 306 | DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS) |
| 307 | .docs: $(DOCS) |
| 308 | @touch $@ |
| 309 | |
| 310 | INSTALL-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,INSTALL-DOCS) |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 311 | ifeq ($(MAKECMDGOALS),dist) |
| 312 | INSTALL-DOCS+=$(call cond_enabled,CONFIG_INSTALL_DOCS,DIST-DOCS) |
| 313 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 314 | .install-docs: .docs $(addprefix $(DIST_DIR)/,$(INSTALL-DOCS)) |
| 315 | @touch $@ |
| 316 | |
| 317 | clean:: |
| 318 | rm -f .docs .install-docs $(DOCS) |
| 319 | |
| 320 | BINS=$(call enabled,BINS) |
| 321 | .bins: $(BINS) |
| 322 | @touch $@ |
| 323 | |
| 324 | INSTALL-BINS=$(call cond_enabled,CONFIG_INSTALL_BINS,INSTALL-BINS) |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 325 | ifeq ($(MAKECMDGOALS),dist) |
| 326 | INSTALL-BINS+=$(call cond_enabled,CONFIG_INSTALL_BINS,DIST-BINS) |
| 327 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 328 | .install-bins: .bins $(addprefix $(DIST_DIR)/,$(INSTALL-BINS)) |
| 329 | @touch $@ |
| 330 | |
| 331 | clean:: |
| 332 | rm -f .bins .install-bins $(BINS) |
| 333 | |
| 334 | LIBS=$(call enabled,LIBS) |
| 335 | .libs: $(LIBS) |
| 336 | @touch $@ |
| 337 | $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib)))) |
Johann | abb7c21 | 2011-06-08 11:36:04 -0700 | [diff] [blame] | 338 | $(foreach lib,$(filter %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib)))) |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 339 | $(foreach lib,$(filter %$(VERSION_MAJOR).dylib,$(LIBS)),$(eval $(call dl_template,$(lib)))) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 340 | |
| 341 | INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS) |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 342 | ifeq ($(MAKECMDGOALS),dist) |
| 343 | INSTALL-LIBS+=$(call cond_enabled,CONFIG_INSTALL_LIBS,DIST-LIBS) |
| 344 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 345 | .install-libs: .libs $(addprefix $(DIST_DIR)/,$(INSTALL-LIBS)) |
| 346 | @touch $@ |
| 347 | |
| 348 | clean:: |
| 349 | rm -f .libs .install-libs $(LIBS) |
| 350 | |
| 351 | ifeq ($(CONFIG_EXTERNAL_BUILD),yes) |
| 352 | PROJECTS=$(call enabled,PROJECTS) |
| 353 | .projects: $(PROJECTS) |
| 354 | @touch $@ |
| 355 | |
| 356 | INSTALL-PROJECTS=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,INSTALL-PROJECTS) |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 357 | ifeq ($(MAKECMDGOALS),dist) |
| 358 | INSTALL-PROJECTS+=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,DIST-PROJECTS) |
| 359 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 360 | .install-projects: .projects $(addprefix $(DIST_DIR)/,$(INSTALL-PROJECTS)) |
| 361 | @touch $@ |
| 362 | |
| 363 | clean:: |
| 364 | rm -f .projects .install-projects $(PROJECTS) |
| 365 | endif |
| 366 | |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 367 | # If there are any source files to be distributed, then include the build |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 368 | # system too. |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 369 | ifneq ($(call enabled,DIST-SRCS),) |
| 370 | DIST-SRCS-yes += configure |
| 371 | DIST-SRCS-yes += build/make/configure.sh |
| 372 | DIST-SRCS-yes += build/make/gen_asm_deps.sh |
| 373 | DIST-SRCS-yes += build/make/Makefile |
| 374 | DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh |
| 375 | DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh |
| 376 | DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh |
John Koleszar | 4d86ef3 | 2010-06-22 08:44:48 -0400 | [diff] [blame] | 377 | DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/yasm.rules |
James Berry | 61046b8 | 2011-08-01 16:10:41 -0400 | [diff] [blame] | 378 | DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/obj_int_extract.bat |
Martin Storsjo | ad484fc | 2013-05-18 23:32:49 +0300 | [diff] [blame^] | 379 | DIST-SRCS-$(CONFIG_MSVS) += build/arm-msvs/obj_int_extract.bat |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 380 | DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh |
James Zern | 08348d9 | 2013-03-02 13:42:41 -0800 | [diff] [blame] | 381 | # Include obj_int_extract if we use offsets from *_asm_*_offsets |
Johann | 8edaf6e | 2011-02-10 14:57:43 -0500 | [diff] [blame] | 382 | DIST-SRCS-$(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64) += build/make/obj_int_extract.c |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 383 | DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl |
Johann | f8af71a | 2013-01-25 12:11:19 -0800 | [diff] [blame] | 384 | DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas_apple.pl |
Martin Storsjo | a83db43 | 2012-11-20 16:05:40 +0200 | [diff] [blame] | 385 | DIST-SRCS-$(ARCH_ARM) += build/make/ads2armasm_ms.pl |
Martin Storsjo | 5f76080 | 2013-05-15 16:08:19 +0300 | [diff] [blame] | 386 | DIST-SRCS-$(ARCH_ARM) += build/make/thumb.pm |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 387 | DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 388 | endif |
| 389 | INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS) |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 390 | ifeq ($(MAKECMDGOALS),dist) |
| 391 | INSTALL-SRCS += $(call cond_enabled,CONFIG_INSTALL_SRCS,DIST-SRCS) |
| 392 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 393 | .install-srcs: $(addprefix $(DIST_DIR)/src/,$(INSTALL-SRCS)) |
| 394 | @touch $@ |
| 395 | |
| 396 | clean:: |
| 397 | rm -f .install-srcs |
| 398 | |
| 399 | ifeq ($(CONFIG_EXTERNAL_BUILD),yes) |
| 400 | BUILD_TARGETS += .projects |
| 401 | INSTALL_TARGETS += .install-projects |
| 402 | endif |
| 403 | BUILD_TARGETS += .docs .libs .bins |
| 404 | INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 405 | all: $(BUILD_TARGETS) |
John Koleszar | ee8bcb1 | 2010-05-24 10:16:44 -0400 | [diff] [blame] | 406 | install:: $(INSTALL_TARGETS) |
| 407 | dist: $(INSTALL_TARGETS) |
James Berry | a0769f7 | 2012-05-02 17:25:58 -0400 | [diff] [blame] | 408 | test:: |