shithub: libvpx

Download patch

ref: 77bbcab591aabff332c7ca67b6f215db6176496a
parent: 77f7f6a8e81a8c5d0d0700930d1f32ca487763ce
author: James Zern <jzern@google.com>
date: Wed Feb 5 11:55:01 EST 2014

examples.mk: build examples/*.c directly

since
50fa585 Removing examples code generation and making them static.

the examples have been c files, not generated from text. this removes
GEN_EXAMPLES and replaces it with EXAMPLES, building the source directly
rather than copying it to the build folder

Change-Id: I5445bc49553419e3d2430963517d2c18cdba1f82

--- a/examples.mk
+++ b/examples.mk
@@ -15,9 +15,8 @@
                 third_party/libyuv/source/scale.c  \
                 third_party/libyuv/source/cpu_id.c
 
-# List of examples to build. UTILS are files that are taken from the source
-# tree directly, and GEN_EXAMPLES are files that are created from the
-# examples folder.
+# List of examples to build. UTILS are tools meant for distribution
+# while EXAMPLES demonstrate specific portions of the API.
 UTILS-$(CONFIG_DECODERS)    += vpxdec.c
 vpxdec.SRCS                 += md5_utils.c md5_utils.h
 vpxdec.SRCS                 += vpx_ports/vpx_timer.h
@@ -74,58 +73,58 @@
 #example_xma.GUID             = A955FC4A-73F1-44F7-135E-30D84D32F022
 #example_xma.DESCRIPTION      = External Memory Allocation mode usage
 
-GEN_EXAMPLES-$(CONFIG_VP8_DECODER) += simple_decoder.c
-simple_decoder.GUID                = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
+EXAMPLES-$(CONFIG_VP8_DECODER)     += simple_decoder.c
+simple_decoder.GUID                 = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
 simple_decoder.SRCS                += ivfdec.h ivfdec.c
 simple_decoder.SRCS                += tools_common.h tools_common.c
-simple_decoder.DESCRIPTION         = Simplified decoder loop
-GEN_EXAMPLES-$(CONFIG_VP8_DECODER) += postproc.c
+simple_decoder.DESCRIPTION          = Simplified decoder loop
+EXAMPLES-$(CONFIG_VP8_DECODER)     += postproc.c
 postproc.SRCS                      += ivfdec.h ivfdec.c
 postproc.SRCS                      += tools_common.h tools_common.c
-postproc.GUID                    = 65E33355-F35E-4088-884D-3FD4905881D7
-postproc.DESCRIPTION             = Decoder postprocessor control
-GEN_EXAMPLES-$(CONFIG_VP8_DECODER) += decode_to_md5.c
+postproc.GUID                       = 65E33355-F35E-4088-884D-3FD4905881D7
+postproc.DESCRIPTION                = Decoder postprocessor control
+EXAMPLES-$(CONFIG_VP8_DECODER)     += decode_to_md5.c
 decode_to_md5.SRCS                 += md5_utils.h md5_utils.c
 decode_to_md5.SRCS                 += ivfdec.h ivfdec.c
 decode_to_md5.SRCS                 += tools_common.h tools_common.c
-decode_to_md5.GUID                 = 59120B9B-2735-4BFE-B022-146CA340FE42
-decode_to_md5.DESCRIPTION          = Frame by frame MD5 checksum
+decode_to_md5.GUID                  = 59120B9B-2735-4BFE-B022-146CA340FE42
+decode_to_md5.DESCRIPTION           = Frame by frame MD5 checksum
 
-GEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += simple_encoder.c
+EXAMPLES-$(CONFIG_VP8_ENCODER)  += simple_encoder.c
 simple_encoder.GUID              = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
 simple_encoder.DESCRIPTION       = Simplified encoder loop
-GEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += twopass_encoder.c
+EXAMPLES-$(CONFIG_VP8_ENCODER)  += twopass_encoder.c
 twopass_encoder.GUID             = 73494FA6-4AF9-4763-8FBB-265C92402FD8
 twopass_encoder.DESCRIPTION      = Two-pass encoder loop
-GEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += force_keyframe.c
+EXAMPLES-$(CONFIG_VP8_ENCODER)  += force_keyframe.c
 force_keyframe.GUID              = 3C67CADF-029F-4C86-81F5-D6D4F51177F0
 force_keyframe.DESCRIPTION       = Force generation of keyframes
 ifeq ($(CONFIG_DECODERS),yes)
-GEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += decode_with_drops.c
-decode_with_drops.SRCS             += ivfdec.h ivfdec.c
-decode_with_drops.SRCS             += tools_common.h tools_common.c
+EXAMPLES-$(CONFIG_VP8_ENCODER)  += decode_with_drops.c
+decode_with_drops.SRCS          += ivfdec.h ivfdec.c
+decode_with_drops.SRCS          += tools_common.h tools_common.c
 endif
 decode_with_drops.GUID           = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
 decode_with_drops.DESCRIPTION    = Drops frames while decoding
 ifeq ($(CONFIG_VP8_DECODER),yes)
-GEN_EXAMPLES-$(CONFIG_ERROR_CONCEALMENT) += decode_with_partial_drops.c
+EXAMPLES-$(CONFIG_ERROR_CONCEALMENT)    += decode_with_partial_drops.c
 endif
 decode_with_partial_drops.GUID           = 61C2D026-5754-46AC-916F-1343ECC5537E
 decode_with_partial_drops.DESCRIPTION    = Drops parts of frames while decoding
-GEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += error_resilient.c
+EXAMPLES-$(CONFIG_VP8_ENCODER)  += error_resilient.c
 error_resilient.GUID             = DF5837B9-4145-4F92-A031-44E4F832E00C
 error_resilient.DESCRIPTION      = Error Resiliency Feature
 
-GEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8_set_maps.c
+EXAMPLES-$(CONFIG_VP8_ENCODER)     += vp8_set_maps.c
 vp8_set_maps.GUID                   = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
 vp8_set_maps.DESCRIPTION            = VP8 set active and ROI maps
-GEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8cx_set_ref.c
+EXAMPLES-$(CONFIG_VP8_ENCODER)     += vp8cx_set_ref.c
 vp8cx_set_ref.GUID                  = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
 vp8cx_set_ref.DESCRIPTION           = VP8 set encoder reference frame
 
 
 ifeq ($(CONFIG_MULTI_RES_ENCODING),yes)
-GEN_EXAMPLES-$(CONFIG_VP8_DECODER) += vp8_multi_resolution_encoder.c
+EXAMPLES-$(CONFIG_VP8_DECODER)          += vp8_multi_resolution_encoder.c
 vp8_multi_resolution_encoder.SRCS       += $(LIBYUV_SRCS)
 vp8_multi_resolution_encoder.GUID        = 04f8738e-63c8-423b-90fa-7c2703a374de
 vp8_multi_resolution_encoder.DESCRIPTION = VP8 Multiple-resolution Encoding
@@ -171,17 +170,17 @@
 
 # Expand list of selected examples to build (as specified above)
 UTILS           = $(call enabled,UTILS)
-GEN_EXAMPLES    = $(call enabled,GEN_EXAMPLES)
-ALL_EXAMPLES    = $(UTILS) $(GEN_EXAMPLES)
+EXAMPLES        = $(addprefix examples/,$(call enabled,EXAMPLES))
+ALL_EXAMPLES    = $(UTILS) $(EXAMPLES)
 UTIL_SRCS       = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
-ALL_SRCS        = $(foreach ex,$(ALL_EXAMPLES),$($(ex:.c=).SRCS))
+ALL_SRCS        = $(foreach ex,$(ALL_EXAMPLES),$($(notdir $(ex:.c=)).SRCS))
 CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
 
 
 # Expand all example sources into a variable containing all sources
-# for that example (not just them main one specified in UTILS/GEN_EXAMPLES)
+# for that example (not just them main one specified in UTILS/EXAMPLES)
 # and add this file to the list (for MSVS workspace generation)
-$(foreach ex,$(ALL_EXAMPLES),$(eval $(ex:.c=).SRCS += $(ex) examples.mk))
+$(foreach ex,$(ALL_EXAMPLES),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
 
 
 # If this is a universal (fat) binary, then all the subarchitectures have
@@ -218,14 +217,6 @@
     )
 
 
-# Rules to generate the GEN_EXAMPLES sources
-.PRECIOUS: %.c
-CLEAN-OBJS += $(GEN_EXAMPLES)
-%.c: examples/%.c
-	@echo "    [EXAMPLE] $@"
-	@cp $< $@
-
-
 # The following pairs define a mapping of locations in the distribution
 # tree to locations in the source/build trees.
 INSTALL_MAPS += src/%.c   %.c
@@ -263,8 +254,9 @@
             --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
             $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
 endef
-PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES:.c=.$(VCPROJ_SFX))
+ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
+PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
-                               $(addprefix bin/$(p)/,$(ALL_EXAMPLES:.c=.exe)))
+                               $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
 $(foreach proj,$(call enabled,PROJECTS),\
     $(eval $(call vcproj_template,$(proj))))