blob: 03dacce5e166a4ae1101f3b7f63d877357e7dd0b [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001##
John Koleszarc2140b82010-09-09 08:16:39 -04002## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar94c52e42010-06-18 12:39:21 -04003##
4## Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005## 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 Koleszar94c52e42010-06-18 12:39:21 -04007## in the file PATENTS. All contributing project authors may
8## be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009##
10
11
12include config.mk
13quiet?=true
14ifeq ($(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
20all: .DEFAULT
21clean:: .DEFAULT
John Koleszaree8bcb12010-05-24 10:16:44 -040022install:: .DEFAULT
James Berrya0769f72012-05-02 17:25:58 -040023test:: .DEFAULT
John Koleszar1d0dc7c2012-11-02 15:17:36 -070024testdata:: .DEFAULT
Tom Finegan7b7c8432014-04-22 10:38:43 -070025utiltest: .DEFAULT
John Koleszar0ea50ce2010-05-18 11:58:33 -040026
27
28# Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
29# installed on cygwin, so we need to autodetect here.
30md5sum := $(firstword $(wildcard \
31 $(foreach e,md5sum openssl,\
32 $(foreach p,$(subst :, ,$(PATH)),$(p)/$(e)*))\
33 ))
34md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum))
35
36TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
John Koleszaree8bcb12010-05-24 10:16:44 -040037dist:
John Koleszar0ea50ce2010-05-18 11:58:33 -040038 @for t in $(ALL_TARGETS); do \
39 $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
40 done
41 # Run configure for the user with the current toolchain.
42 @if [ -d "$(DIST_DIR)/src" ]; then \
43 mkdir -p "$(DIST_DIR)/build"; \
44 cd "$(DIST_DIR)/build"; \
John Koleszar23d68a52010-06-22 09:53:23 -040045 echo "Rerunning configure $(CONFIGURE_ARGS)"; \
46 ../src/configure $(CONFIGURE_ARGS); \
John Koleszar0ea50ce2010-05-18 11:58:33 -040047 $(if $(filter vs%,$(TGT_CC)),make NO_LAUNCH_DEVENV=1;) \
48 fi
49 @if [ -d "$(DIST_DIR)" ]; then \
50 echo " [MD5SUM] $(DIST_DIR)"; \
51 cd $(DIST_DIR) && \
52 $(md5sum) `find . -name md5sums.txt -prune -o -type f -print` \
53 | sed -e 's/MD5(\(.*\))= \([0-9a-f]\{32\}\)/\2 \1/' \
54 > md5sums.txt;\
55 fi
John Koleszar0ea50ce2010-05-18 11:58:33 -040056endif
57
58ifneq ($(target),)
59# Normally, we want to build the filename from the target and the toolchain.
60# This disambiguates from the $(target).mk file that exists in the source tree.
61# However, the toolchain is part of the target in universal builds, so we
62# don't want to include TOOLCHAIN in that case. FAT_ARCHS is used to test
63# if we're in the universal case.
64include $(target)$(if $(FAT_ARCHS),,-$(TOOLCHAIN)).mk
65endif
66BUILD_ROOT?=.
67VPATH=$(SRC_PATH_BARE)
68CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
John Koleszar1d0dc7c2012-11-02 15:17:36 -070069CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
John Koleszar2ad48102010-10-25 10:28:45 -040070ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/
John Koleszar0ea50ce2010-05-18 11:58:33 -040071DIST_DIR?=dist
72HOSTCC?=gcc
73TGT_ISA:=$(word 1, $(subst -, ,$(TOOLCHAIN)))
74TGT_OS:=$(word 2, $(subst -, ,$(TOOLCHAIN)))
75TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
Luca Barbato44881a52013-01-06 19:19:43 +010076quiet:=$(if $(or $(verbose), $(V)),, yes)
John Koleszar0ea50ce2010-05-18 11:58:33 -040077qexec=$(if $(quiet),@)
78
79# Cancel built-in implicit rules
80%: %.o
81%.asm:
82%.a:
James Berrya0769f72012-05-02 17:25:58 -040083%: %.cc
John Koleszar0ea50ce2010-05-18 11:58:33 -040084
85#
86# Common rules"
87#
James Berrya0769f72012-05-02 17:25:58 -040088.PHONY: all
89all:
John Koleszar0ea50ce2010-05-18 11:58:33 -040090
91.PHONY: clean
92clean::
93 rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s)
94 rm -f $(CLEAN-OBJS)
95
James Zernb867e422014-03-05 14:11:07 -080096.PHONY: clean
97distclean: clean
98 if [ -z "$(target)" ]; then \
99 rm -f Makefile; \
100 rm -f config.log config.mk; \
101 rm -f vpx_config.[hc] vpx_config.asm; \
102 else \
103 rm -f $(target)-$(TOOLCHAIN).mk; \
104 fi
105
John Koleszaree8bcb12010-05-24 10:16:44 -0400106.PHONY: dist
107dist:
John Koleszar0ea50ce2010-05-18 11:58:33 -0400108.PHONY: install
John Koleszaree8bcb12010-05-24 10:16:44 -0400109install::
James Berrya0769f72012-05-02 17:25:58 -0400110.PHONY: test
111test::
John Koleszar1d0dc7c2012-11-02 15:17:36 -0700112.PHONY: testdata
113testdata::
Tom Finegan7b7c8432014-04-22 10:38:43 -0700114.PHONY: utiltest
115utiltest:
John Koleszar0ea50ce2010-05-18 11:58:33 -0400116
Johanna62fcbe2013-04-30 18:22:10 -0700117# Add compiler flags for intrinsic files
118$(BUILD_PFX)%_mmx.c.d: CFLAGS += -mmmx
119$(BUILD_PFX)%_mmx.c.o: CFLAGS += -mmmx
120$(BUILD_PFX)%_sse2.c.d: CFLAGS += -msse2
121$(BUILD_PFX)%_sse2.c.o: CFLAGS += -msse2
122$(BUILD_PFX)%_sse3.c.d: CFLAGS += -msse3
123$(BUILD_PFX)%_sse3.c.o: CFLAGS += -msse3
124$(BUILD_PFX)%_ssse3.c.d: CFLAGS += -mssse3
125$(BUILD_PFX)%_ssse3.c.o: CFLAGS += -mssse3
126$(BUILD_PFX)%_sse4.c.d: CFLAGS += -msse4.1
127$(BUILD_PFX)%_sse4.c.o: CFLAGS += -msse4.1
Erik Niemeyere6863ef2013-10-29 09:48:12 -0600128$(BUILD_PFX)%_avx.c.d: CFLAGS += -mavx
129$(BUILD_PFX)%_avx.c.o: CFLAGS += -mavx
130$(BUILD_PFX)%_avx2.c.d: CFLAGS += -mavx2
131$(BUILD_PFX)%_avx2.c.o: CFLAGS += -mavx2
Johanna62fcbe2013-04-30 18:22:10 -0700132
John Koleszar1760c392012-11-27 15:54:54 -0800133$(BUILD_PFX)%.c.d: %.c
134 $(if $(quiet),@echo " [DEP] $@")
135 $(qexec)mkdir -p $(dir $@)
136 $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@
John Koleszar0ea50ce2010-05-18 11:58:33 -0400137
John Koleszar1760c392012-11-27 15:54:54 -0800138$(BUILD_PFX)%.c.o: %.c
139 $(if $(quiet),@echo " [CC] $@")
140 $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
John Koleszar0ea50ce2010-05-18 11:58:33 -0400141
John Koleszar1760c392012-11-27 15:54:54 -0800142$(BUILD_PFX)%.cc.d: %.cc
143 $(if $(quiet),@echo " [DEP] $@")
144 $(qexec)mkdir -p $(dir $@)
145 $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@
James Berrya0769f72012-05-02 17:25:58 -0400146
John Koleszar1760c392012-11-27 15:54:54 -0800147$(BUILD_PFX)%.cc.o: %.cc
148 $(if $(quiet),@echo " [CXX] $@")
149 $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
James Berrya0769f72012-05-02 17:25:58 -0400150
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -0700151$(BUILD_PFX)%.cpp.d: %.cpp
152 $(if $(quiet),@echo " [DEP] $@")
153 $(qexec)mkdir -p $(dir $@)
154 $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@
155
156$(BUILD_PFX)%.cpp.o: %.cpp
157 $(if $(quiet),@echo " [CXX] $@")
158 $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
159
John Koleszar1760c392012-11-27 15:54:54 -0800160$(BUILD_PFX)%.asm.d: %.asm
161 $(if $(quiet),@echo " [DEP] $@")
162 $(qexec)mkdir -p $(dir $@)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400163 $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \
John Koleszar1760c392012-11-27 15:54:54 -0800164 --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@
John Koleszar0ea50ce2010-05-18 11:58:33 -0400165
John Koleszar1760c392012-11-27 15:54:54 -0800166$(BUILD_PFX)%.asm.o: %.asm
167 $(if $(quiet),@echo " [AS] $@")
168 $(qexec)$(AS) $(ASFLAGS) -o $@ $<
John Koleszar0ea50ce2010-05-18 11:58:33 -0400169
John Koleszar1760c392012-11-27 15:54:54 -0800170$(BUILD_PFX)%.s.d: %.s
171 $(if $(quiet),@echo " [DEP] $@")
172 $(qexec)mkdir -p $(dir $@)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400173 $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \
John Koleszar1760c392012-11-27 15:54:54 -0800174 --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@
John Koleszar0ea50ce2010-05-18 11:58:33 -0400175
John Koleszar1760c392012-11-27 15:54:54 -0800176$(BUILD_PFX)%.s.o: %.s
177 $(if $(quiet),@echo " [AS] $@")
178 $(qexec)$(AS) $(ASFLAGS) -o $@ $<
John Koleszar0ea50ce2010-05-18 11:58:33 -0400179
Johann79327be2011-06-08 14:43:34 -0400180.PRECIOUS: %.c.S
181%.c.S: CFLAGS += -DINLINE_ASM
John Koleszar1760c392012-11-27 15:54:54 -0800182$(BUILD_PFX)%.c.S: %.c
183 $(if $(quiet),@echo " [GEN] $@")
184 $(qexec)$(CC) -S $(CFLAGS) -o $@ $<
Johann79327be2011-06-08 14:43:34 -0400185
John Koleszar0ea50ce2010-05-18 11:58:33 -0400186.PRECIOUS: %.asm.s
John Koleszar1760c392012-11-27 15:54:54 -0800187$(BUILD_PFX)%.asm.s: %.asm
188 $(if $(quiet),@echo " [ASM CONVERSION] $@")
189 $(qexec)mkdir -p $(dir $@)
190 $(qexec)$(ASM_CONVERSION) <$< >$@
John Koleszar0ea50ce2010-05-18 11:58:33 -0400191
192# If we're in debug mode, pretend we don't have GNU strip, to fall back to
193# the copy implementation
194HAVE_GNU_STRIP := $(if $(CONFIG_DEBUG),,$(HAVE_GNU_STRIP))
195ifeq ($(HAVE_GNU_STRIP),yes)
196# Older binutils strip global sybols not needed for relocation processing
197# when given --strip-unneeded. Use nm and awk to identify globals and
198# keep them.
199%.a: %_g.a
200 $(if $(quiet),@echo " [STRIP] $@ < $<")
201 $(qexec)$(STRIP) --strip-unneeded \
202 `$(NM) $< | grep ' [A-TV-Z] ' | awk '{print "-K"$$3'}`\
203 -o $@ $<
204else
205%.a: %_g.a
206 $(if $(quiet),@echo " [CP] $@ < $<")
207 $(qexec)cp $< $@
208endif
209
210#
211# Rule to extract assembly constants from C sources
212#
213obj_int_extract: build/make/obj_int_extract.c
Attila Nagy346b3e72011-03-16 12:56:52 +0200214 $(if $(quiet),@echo " [HOSTCC] $@")
Johannfb037ec2011-03-08 17:41:45 -0500215 $(qexec)$(HOSTCC) -I. -I$(SRC_PATH_BARE) -o $@ $<
John Koleszar0ea50ce2010-05-18 11:58:33 -0400216CLEAN-OBJS += obj_int_extract
217
218#
219# Utility functions
220#
221pairmap=$(if $(strip $(2)),\
222 $(call $(1),$(word 1,$(2)),$(word 2,$(2)))\
223 $(call pairmap,$(1),$(wordlist 3,$(words $(2)),$(2)))\
224)
225
226enabled=$(filter-out $($(1)-no),$($(1)-yes))
227cond_enabled=$(if $(filter yes,$($(1))), $(call enabled,$(2)))
228
229find_file1=$(word 1,$(wildcard $(subst //,/,$(addsuffix /$(1),$(2)))))
230find_file=$(foreach f,$(1),$(call find_file1,$(strip $(f)),$(strip $(2))) )
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -0700231obj_pats=.c=.c.o $(AS_SFX)=$(AS_SFX).o .cc=.cc.o .cpp=.cpp.o
John Koleszar1760c392012-11-27 15:54:54 -0800232objs=$(addprefix $(BUILD_PFX),$(foreach p,$(obj_pats),$(filter %.o,$(1:$(p))) ))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400233
234install_map_templates=$(eval $(call install_map_template,$(1),$(2)))
235
236not=$(subst yes,no,$(1))
237
238ifeq ($(CONFIG_MSVS),yes)
239lib_file_name=$(1).lib
240else
241lib_file_name=lib$(1).a
242endif
243#
244# Rule Templates
245#
246define linker_template
247$(1): $(filter-out -%,$(2))
248$(1):
249 $(if $(quiet),@echo " [LD] $$@")
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400250 $(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400251endef
James Berrya0769f72012-05-02 17:25:58 -0400252define linkerxx_template
253$(1): $(filter-out -%,$(2))
254$(1):
255 $(if $(quiet),@echo " [LD] $$@")
John Koleszar1d0dc7c2012-11-02 15:17:36 -0700256 $(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
James Berrya0769f72012-05-02 17:25:58 -0400257endef
John Koleszar0ea50ce2010-05-18 11:58:33 -0400258# make-3.80 has a bug with expanding large input strings to the eval function,
259# which was triggered in some cases by the following component of
260# linker_template:
261# $(1): $$(call find_file, $(patsubst -l%,lib%.a,$(filter -l%,$(2))),\
262# $$(patsubst -L%,%,$$(filter -L%,$$(LDFLAGS) $(2))))
263# This may be useful to revisit in the future (it tries to locate libraries
264# in a search path and add them as prerequisites
265
266define install_map_template
267$(DIST_DIR)/$(1): $(2)
268 $(if $(quiet),@echo " [INSTALL] $$@")
269 $(qexec)mkdir -p $$(dir $$@)
270 $(qexec)cp -p $$< $$@
271endef
272
273define archive_template
274# Not using a pattern rule here because we don't want to generate empty
275# archives when they are listed as a dependency in files not responsible
276# for creating them.
277$(1):
278 $(if $(quiet),@echo " [AR] $$@")
279 $(qexec)$$(AR) $$(ARFLAGS) $$@ $$?
280endef
281
John Koleszar7aa97a32010-06-03 10:29:04 -0400282define so_template
283# Not using a pattern rule here because we don't want to generate empty
284# archives when they are listed as a dependency in files not responsible
285# for creating them.
286#
287# This needs further abstraction for dealing with non-GNU linkers.
288$(1):
289 $(if $(quiet),@echo " [LD] $$@")
290 $(qexec)$$(LD) -shared $$(LDFLAGS) \
Johannabb7c212011-06-08 11:36:04 -0700291 -Wl,--no-undefined -Wl,-soname,$$(SONAME) \
jimbankoski45e551b2012-07-25 19:39:33 -0700292 -Wl,--version-script,$$(EXPORTS_FILE) -o $$@ \
John Koleszardcb52c02012-07-24 16:18:38 -0700293 $$(filter %.o,$$^) $$(extralibs)
John Koleszar7aa97a32010-06-03 10:29:04 -0400294endef
295
jimbankoski45e551b2012-07-25 19:39:33 -0700296define dl_template
297# Not using a pattern rule here because we don't want to generate empty
298# archives when they are listed as a dependency in files not responsible
299# for creating them.
300$(1):
301 $(if $(quiet),@echo " [LD] $$@")
302 $(qexec)$$(LD) -dynamiclib $$(LDFLAGS) \
303 -exported_symbols_list $$(EXPORTS_FILE) \
304 -Wl,-headerpad_max_install_names,-compatibility_version,1.0,-current_version,$$(VERSION_MAJOR) \
305 -o $$@ \
306 $$(filter %.o,$$^) $$(extralibs)
307endef
308
309
310
John Koleszar0ea50ce2010-05-18 11:58:33 -0400311define lipo_lib_template
312$(1): $(addsuffix /$(1),$(FAT_ARCHS))
313 $(if $(quiet),@echo " [LIPO] $$@")
314 $(qexec)libtool -static -o $$@ $$?
315endef
316
317define lipo_bin_template
318$(1): $(addsuffix /$(1),$(FAT_ARCHS))
319 $(if $(quiet),@echo " [LIPO] $$@")
320 $(qexec)lipo -output $$@ -create $$?
321endef
322
323
324#
325# Get current configuration
326#
327ifneq ($(target),)
328include $(SRC_PATH_BARE)/$(target:-$(TOOLCHAIN)=).mk
329endif
James Zernb867e422014-03-05 14:11:07 -0800330ifeq ($(filter %clean,$(MAKECMDGOALS)),)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400331 # Older versions of make don't like -include directives with no arguments
332 ifneq ($(filter %.d,$(OBJS-yes:.o=.d)),)
333 -include $(filter %.d,$(OBJS-yes:.o=.d))
334 endif
335endif
336
337#
Gaute Strokkenes6795e252011-03-15 12:20:54 +0000338# Configuration dependent rules
John Koleszar0ea50ce2010-05-18 11:58:33 -0400339#
340$(call pairmap,install_map_templates,$(INSTALL_MAPS))
341
342DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS)
343.docs: $(DOCS)
344 @touch $@
345
346INSTALL-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,INSTALL-DOCS)
John Koleszaree8bcb12010-05-24 10:16:44 -0400347ifeq ($(MAKECMDGOALS),dist)
348INSTALL-DOCS+=$(call cond_enabled,CONFIG_INSTALL_DOCS,DIST-DOCS)
349endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400350.install-docs: .docs $(addprefix $(DIST_DIR)/,$(INSTALL-DOCS))
351 @touch $@
352
353clean::
354 rm -f .docs .install-docs $(DOCS)
355
356BINS=$(call enabled,BINS)
357.bins: $(BINS)
358 @touch $@
359
360INSTALL-BINS=$(call cond_enabled,CONFIG_INSTALL_BINS,INSTALL-BINS)
John Koleszaree8bcb12010-05-24 10:16:44 -0400361ifeq ($(MAKECMDGOALS),dist)
362INSTALL-BINS+=$(call cond_enabled,CONFIG_INSTALL_BINS,DIST-BINS)
363endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400364.install-bins: .bins $(addprefix $(DIST_DIR)/,$(INSTALL-BINS))
365 @touch $@
366
367clean::
368 rm -f .bins .install-bins $(BINS)
369
370LIBS=$(call enabled,LIBS)
371.libs: $(LIBS)
372 @touch $@
373$(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
Johannabb7c212011-06-08 11:36:04 -0700374$(foreach lib,$(filter %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
jimbankoski45e551b2012-07-25 19:39:33 -0700375$(foreach lib,$(filter %$(VERSION_MAJOR).dylib,$(LIBS)),$(eval $(call dl_template,$(lib))))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400376
377INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS)
John Koleszaree8bcb12010-05-24 10:16:44 -0400378ifeq ($(MAKECMDGOALS),dist)
379INSTALL-LIBS+=$(call cond_enabled,CONFIG_INSTALL_LIBS,DIST-LIBS)
380endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400381.install-libs: .libs $(addprefix $(DIST_DIR)/,$(INSTALL-LIBS))
382 @touch $@
383
384clean::
385 rm -f .libs .install-libs $(LIBS)
386
387ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
388PROJECTS=$(call enabled,PROJECTS)
389.projects: $(PROJECTS)
390 @touch $@
391
392INSTALL-PROJECTS=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,INSTALL-PROJECTS)
John Koleszaree8bcb12010-05-24 10:16:44 -0400393ifeq ($(MAKECMDGOALS),dist)
394INSTALL-PROJECTS+=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,DIST-PROJECTS)
395endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400396.install-projects: .projects $(addprefix $(DIST_DIR)/,$(INSTALL-PROJECTS))
397 @touch $@
398
399clean::
400 rm -f .projects .install-projects $(PROJECTS)
401endif
402
John Koleszaree8bcb12010-05-24 10:16:44 -0400403# If there are any source files to be distributed, then include the build
John Koleszar0ea50ce2010-05-18 11:58:33 -0400404# system too.
John Koleszaree8bcb12010-05-24 10:16:44 -0400405ifneq ($(call enabled,DIST-SRCS),)
406 DIST-SRCS-yes += configure
407 DIST-SRCS-yes += build/make/configure.sh
408 DIST-SRCS-yes += build/make/gen_asm_deps.sh
409 DIST-SRCS-yes += build/make/Makefile
410 DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
411 DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
412 DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
Johann87784e3a2014-01-08 09:51:15 -0800413 DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_vcxproj.sh
James Berry61046b82011-08-01 16:10:41 -0400414 DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/obj_int_extract.bat
Martin Storsjoad484fc2013-05-18 23:32:49 +0300415 DIST-SRCS-$(CONFIG_MSVS) += build/arm-msvs/obj_int_extract.bat
John Koleszaree8bcb12010-05-24 10:16:44 -0400416 DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
James Zern08348d92013-03-02 13:42:41 -0800417 # Include obj_int_extract if we use offsets from *_asm_*_offsets
Johann8edaf6e2011-02-10 14:57:43 -0500418 DIST-SRCS-$(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64) += build/make/obj_int_extract.c
John Koleszaree8bcb12010-05-24 10:16:44 -0400419 DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
Johannf8af71a2013-01-25 12:11:19 -0800420 DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas_apple.pl
Martin Storsjoa83db432012-11-20 16:05:40 +0200421 DIST-SRCS-$(ARCH_ARM) += build/make/ads2armasm_ms.pl
Martin Storsjo5f760802013-05-15 16:08:19 +0300422 DIST-SRCS-$(ARCH_ARM) += build/make/thumb.pm
John Koleszaree8bcb12010-05-24 10:16:44 -0400423 DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
John Koleszar0ea50ce2010-05-18 11:58:33 -0400424endif
425INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS)
John Koleszaree8bcb12010-05-24 10:16:44 -0400426ifeq ($(MAKECMDGOALS),dist)
427INSTALL-SRCS += $(call cond_enabled,CONFIG_INSTALL_SRCS,DIST-SRCS)
428endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400429.install-srcs: $(addprefix $(DIST_DIR)/src/,$(INSTALL-SRCS))
430 @touch $@
431
432clean::
433 rm -f .install-srcs
434
435ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
436 BUILD_TARGETS += .projects
437 INSTALL_TARGETS += .install-projects
438endif
439BUILD_TARGETS += .docs .libs .bins
440INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
James Berrya0769f72012-05-02 17:25:58 -0400441all: $(BUILD_TARGETS)
John Koleszaree8bcb12010-05-24 10:16:44 -0400442install:: $(INSTALL_TARGETS)
443dist: $(INSTALL_TARGETS)
James Berrya0769f72012-05-02 17:25:58 -0400444test::