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 y4minput.c y4minput.h \
14 vpx/vpx_codec.h vpx/src/vpx_image.c
15 tiny_ssim.SRCS += vpx_mem/vpx_mem.c vpx_mem/vpx_mem.h
16 tiny_ssim.SRCS += vpx_dsp/ssim.h vpx_scale/yv12config.h
17 tiny_ssim.SRCS += vpx_ports/mem.h vpx_ports/mem.h
18 tiny_ssim.SRCS += vpx_mem/include/vpx_mem_intrnl.h
19 tiny_ssim.GUID = 3afa9b05-940b-4d68-b5aa-55157d8ed7b4
20 tiny_ssim.DESCRIPTION = Generate SSIM/PSNR from raw .yuv files
23 # End of specified files. The rest of the build rules should happen
24 # automagically from here.
28 # Expand list of selected tools to build (as specified above)
29 TOOLS = $(addprefix tools/,$(call enabled,TOOLS))
30 ALL_SRCS = $(foreach ex,$(TOOLS),$($(notdir $(ex:.c=)).SRCS))
31 CFLAGS += -I../include
33 ifneq ($(CONFIG_CODEC_SRCS), yes)
34 CFLAGS += -I../include/vpx
37 # Expand all tools sources into a variable containing all sources
38 # for that tools (not just them main one specified in TOOLS)
39 # and add this file to the list (for MSVS workspace generation)
40 $(foreach ex,$(TOOLS),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) tools.mk))
43 # Create build/install dependencies for all tools. The common case
44 # is handled here. The MSVS case is handled below.
45 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
46 DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(TOOLS:.c=$(EXE_SFX)))
47 DIST-SRCS-yes += $(ALL_SRCS)
48 OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
49 BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(TOOLS:.c=$(EXE_SFX)))
51 # Instantiate linker template for all tools.
52 $(foreach bin,$(BINS-yes),\
54 $(eval $(call linker_template,$(bin),\
55 $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) -lm)))
57 # The following pairs define a mapping of locations in the distribution
58 # tree to locations in the source/build trees.
59 INSTALL_MAPS += src/%.c %.c
60 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
61 INSTALL_MAPS += bin/% %
65 # Build Visual Studio Projects. We use a template here to instantiate
66 # explicit rules rather than using an implicit rule because we want to
67 # leverage make's VPATH searching rather than specifying the paths on
68 # each file in TOOLS. This has the unfortunate side effect that
69 # touching the source files trigger a rebuild of the project files
70 # even though there is no real dependency there (the dependency is on
71 # the makefiles). We may want to revisit this.
72 define vcproj_template
73 $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
74 $(if $(quiet),@echo " [vcproj] $$@")
75 $(qexec)$$(GEN_VCPROJ)\
77 --target=$$(TOOLCHAIN)\
78 --name=$$(@:.$(VCPROJ_SFX)=)\
79 --ver=$$(CONFIG_VS_VERSION)\
80 --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
81 --src-path-bare="$(SRC_PATH_BARE)" \
82 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
83 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
84 $$(INTERNAL_LDFLAGS) $$(LDFLAGS) $$^
86 TOOLS_BASENAME := $(notdir $(TOOLS))
87 PROJECTS-$(CONFIG_MSVS) += $(TOOLS_BASENAME:.c=.$(VCPROJ_SFX))
88 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
89 $(addprefix bin/$(p)/,$(TOOLS_BASENAME:.c=.exe)))
90 $(foreach proj,$(call enabled,PROJECTS),\
91 $(eval $(call vcproj_template,$(proj))))
99 @echo "/*!\page tools_$(@F:.dox=) $(@F:.dox=)" > $@
100 @echo " \includelineno $(<F)" >> $@
105 @echo "/*!\page tools Tools" > $@
106 @echo " This SDK includes a number of tools/utilities."\
107 "The following tools are included: ">>$@
108 @$(foreach ex,$(sort $(notdir $(TOOLS:.c=))),\
109 echo " - \subpage tools_$(ex) $($(ex).DESCRIPTION)" >> $@;)
112 CLEAN-OBJS += tools.doxy tools.dox $(TOOLS:.c=.dox)
113 DOCS-yes += tools.doxy tools.dox
114 tools.doxy: tools.dox $(TOOLS:.c=.dox)
115 @echo "INPUT += $^" > $@