]> granicus.if.org Git - libvpx/blob - tools.mk
Merge "tiny_ssim.c : adds y4m support to tiny_ssim."
[libvpx] / tools.mk
1 ##
2 ##  Copyright (c) 2016 The WebM project authors. All Rights Reserved.
3 ##
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.
9 ##
10
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_mem/include/vpx_mem_intrnl.h
17 tiny_ssim.GUID        = 3afa9b05-940b-4d68-b5aa-55157d8ed7b4
18 tiny_ssim.DESCRIPTION = Generate SSIM/PSNR from raw .yuv files
19
20 #
21 # End of specified files. The rest of the build rules should happen
22 # automagically from here.
23 #
24
25
26 # Expand list of selected tools to build (as specified above)
27 TOOLS           = $(addprefix tools/,$(call enabled,TOOLS))
28 ALL_SRCS        = $(foreach ex,$(TOOLS),$($(notdir $(ex:.c=)).SRCS))
29 CFLAGS += -I../include
30
31
32 # Expand all tools sources into a variable containing all sources
33 # for that tools (not just them main one specified in TOOLS)
34 # and add this file to the list (for MSVS workspace generation)
35 $(foreach ex,$(TOOLS),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) tools.mk))
36
37
38 # Create build/install dependencies for all tools. The common case
39 # is handled here. The MSVS case is handled below.
40 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
41 DIST-BINS-$(NOT_MSVS)      += $(addprefix bin/,$(TOOLS:.c=$(EXE_SFX)))
42 DIST-SRCS-yes              += $(ALL_SRCS)
43 OBJS-$(NOT_MSVS)           += $(call objs,$(ALL_SRCS))
44 BINS-$(NOT_MSVS)           += $(addprefix $(BUILD_PFX),$(TOOLS:.c=$(EXE_SFX)))
45
46 # Instantiate linker template for all tools.
47 $(foreach bin,$(BINS-yes),\
48     $(eval $(bin):)\
49     $(eval $(call linker_template,$(bin),\
50         $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) -lm)))
51
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/%     %
57 INSTALL_MAPS += %         %
58
59
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)\
71             --exe\
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) $$^
80 endef
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))))
87
88 #
89 # Documentation Rules
90 #
91 %.dox: %.c
92         @echo "    [DOXY] $@"
93         @mkdir -p $(dir $@)
94         @echo "/*!\page tools_$(@F:.dox=) $(@F:.dox=)" > $@
95         @echo "   \includelineno $(<F)" >> $@
96         @echo "*/" >> $@
97
98 tools.dox: tools.mk
99         @echo "    [DOXY] $@"
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)" >> $@;)
105         @echo "*/" >> $@
106
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 += $^" > $@