]> granicus.if.org Git - libvpx/blob - tools.mk
Merge "ppc: Add vpx_sadnxmx4d_vsx for n,m = {8, 16, 32 ,64}"
[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 ifneq ($(CONFIG_CODEC_SRCS), yes)
32   CFLAGS += -I../include/vpx
33 endif
34
35 # Expand all tools sources into a variable containing all sources
36 # for that tools (not just them main one specified in TOOLS)
37 # and add this file to the list (for MSVS workspace generation)
38 $(foreach ex,$(TOOLS),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) tools.mk))
39
40
41 # Create build/install dependencies for all tools. The common case
42 # is handled here. The MSVS case is handled below.
43 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
44 DIST-BINS-$(NOT_MSVS)      += $(addprefix bin/,$(TOOLS:.c=$(EXE_SFX)))
45 DIST-SRCS-yes              += $(ALL_SRCS)
46 OBJS-$(NOT_MSVS)           += $(call objs,$(ALL_SRCS))
47 BINS-$(NOT_MSVS)           += $(addprefix $(BUILD_PFX),$(TOOLS:.c=$(EXE_SFX)))
48
49 # Instantiate linker template for all tools.
50 $(foreach bin,$(BINS-yes),\
51     $(eval $(bin):)\
52     $(eval $(call linker_template,$(bin),\
53         $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) -lm)))
54
55 # The following pairs define a mapping of locations in the distribution
56 # tree to locations in the source/build trees.
57 INSTALL_MAPS += src/%.c   %.c
58 INSTALL_MAPS += src/%     $(SRC_PATH_BARE)/%
59 INSTALL_MAPS += bin/%     %
60 INSTALL_MAPS += %         %
61
62
63 # Build Visual Studio Projects. We use a template here to instantiate
64 # explicit rules rather than using an implicit rule because we want to
65 # leverage make's VPATH searching rather than specifying the paths on
66 # each file in TOOLS. This has the unfortunate side effect that
67 # touching the source files trigger a rebuild of the project files
68 # even though there is no real dependency there (the dependency is on
69 # the makefiles). We may want to revisit this.
70 define vcproj_template
71 $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
72         $(if $(quiet),@echo "    [vcproj] $$@")
73         $(qexec)$$(GEN_VCPROJ)\
74             --exe\
75             --target=$$(TOOLCHAIN)\
76             --name=$$(@:.$(VCPROJ_SFX)=)\
77             --ver=$$(CONFIG_VS_VERSION)\
78             --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
79             --src-path-bare="$(SRC_PATH_BARE)" \
80             $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
81             --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
82             $$(INTERNAL_LDFLAGS) $$(LDFLAGS) $$^
83 endef
84 TOOLS_BASENAME := $(notdir $(TOOLS))
85 PROJECTS-$(CONFIG_MSVS) += $(TOOLS_BASENAME:.c=.$(VCPROJ_SFX))
86 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
87                                $(addprefix bin/$(p)/,$(TOOLS_BASENAME:.c=.exe)))
88 $(foreach proj,$(call enabled,PROJECTS),\
89     $(eval $(call vcproj_template,$(proj))))
90
91 #
92 # Documentation Rules
93 #
94 %.dox: %.c
95         @echo "    [DOXY] $@"
96         @mkdir -p $(dir $@)
97         @echo "/*!\page tools_$(@F:.dox=) $(@F:.dox=)" > $@
98         @echo "   \includelineno $(<F)" >> $@
99         @echo "*/" >> $@
100
101 tools.dox: tools.mk
102         @echo "    [DOXY] $@"
103         @echo "/*!\page tools Tools" > $@
104         @echo "    This SDK includes a number of tools/utilities."\
105               "The following tools are included: ">>$@
106         @$(foreach ex,$(sort $(notdir $(TOOLS:.c=))),\
107            echo "     - \subpage tools_$(ex) $($(ex).DESCRIPTION)" >> $@;)
108         @echo "*/" >> $@
109
110 CLEAN-OBJS += tools.doxy tools.dox $(TOOLS:.c=.dox)
111 DOCS-yes += tools.doxy tools.dox
112 tools.doxy: tools.dox $(TOOLS:.c=.dox)
113         @echo "INPUT += $^" > $@