2
0

tools.mk 4.4 KB

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