2 ## Copyright (c) 2016 The WebM project authors. All Rights Reserved.
4 ## Use of this source code is governed by a BSD-style license
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
7 ## in the file PATENTS. All contributing project authors may
8 ## be found in the AUTHORS file in the root of the source tree.
11 # List of tools to build.
12 TOOLS-yes += tiny_ssim.c
13 tiny_ssim.SRCS += vpx/vpx_integer.h
14 tiny_ssim.GUID = 3afa9b05-940b-4d68-b5aa-55157d8ed7b4
15 tiny_ssim.DESCRIPTION = Generate SSIM/PSNR from raw .yuv files
18 # End of specified files. The rest of the build rules should happen
19 # automagically from here.
23 # Expand list of selected tools to build (as specified above)
24 TOOLS = $(addprefix tools/,$(call enabled,TOOLS))
25 ALL_SRCS = $(foreach ex,$(TOOLS),$($(notdir $(ex:.c=)).SRCS))
28 # Expand all tools sources into a variable containing all sources
29 # for that tools (not just them main one specified in TOOLS)
30 # and add this file to the list (for MSVS workspace generation)
31 $(foreach ex,$(TOOLS),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) tools.mk))
34 # Create build/install dependencies for all tools. The common case
35 # is handled here. The MSVS case is handled below.
36 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
37 DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(TOOLS:.c=$(EXE_SFX)))
38 DIST-SRCS-yes += $(ALL_SRCS)
39 OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
40 BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(TOOLS:.c=$(EXE_SFX)))
43 # Instantiate linker template for all tools.
44 $(foreach bin,$(BINS-yes),\
46 $(eval $(call linker_template,$(bin),\
47 $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
52 # The following pairs define a mapping of locations in the distribution
53 # tree to locations in the source/build trees.
54 INSTALL_MAPS += src/%.c %.c
55 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
56 INSTALL_MAPS += bin/% %
60 # Build Visual Studio Projects. We use a template here to instantiate
61 # explicit rules rather than using an implicit rule because we want to
62 # leverage make's VPATH searching rather than specifying the paths on
63 # each file in TOOLS. This has the unfortunate side effect that
64 # touching the source files trigger a rebuild of the project files
65 # even though there is no real dependency there (the dependency is on
66 # the makefiles). We may want to revisit this.
67 define vcproj_template
68 $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
69 $(if $(quiet),@echo " [vcproj] $$@")
70 $(qexec)$$(GEN_VCPROJ)\
72 --target=$$(TOOLCHAIN)\
73 --name=$$(@:.$(VCPROJ_SFX)=)\
74 --ver=$$(CONFIG_VS_VERSION)\
75 --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
76 --src-path-bare="$(SRC_PATH_BARE)" \
77 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
78 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
79 $$(INTERNAL_LDFLAGS) $$(LDFLAGS) $$^
81 TOOLS_BASENAME := $(notdir $(TOOLS))
82 PROJECTS-$(CONFIG_MSVS) += $(TOOLS_BASENAME:.c=.$(VCPROJ_SFX))
83 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
84 $(addprefix bin/$(p)/,$(TOOLS_BASENAME:.c=.exe)))
85 $(foreach proj,$(call enabled,PROJECTS),\
86 $(eval $(call vcproj_template,$(proj))))
94 @echo "/*!\page tools_$(@F:.dox=) $(@F:.dox=)" > $@
95 @echo " \includelineno $(<F)" >> $@
100 @echo "/*!\page tools Tools" > $@
101 @echo " This SDK includes a number of tools/utilities."\
102 "The following tools are included: ">>$@
103 @$(foreach ex,$(sort $(notdir $(TOOLS:.c=))),\
104 echo " - \subpage tools_$(ex) $($(ex).DESCRIPTION)" >> $@;)
107 CLEAN-OBJS += tools.doxy tools.dox $(TOOLS:.c=.dox)
108 DOCS-yes += tools.doxy tools.dox
109 tools.doxy: tools.dox $(TOOLS:.c=.dox)
110 @echo "INPUT += $^" > $@