build: change LDFLAGS/CFLAGS ordering.
authorRonald S. Bultje <rbultje@google.com>
Mon, 2 May 2011 17:56:41 +0000 (13:56 -0400)
committerRonald S. Bultje <rbultje@google.com>
Mon, 2 May 2011 17:56:41 +0000 (13:56 -0400)
Always use CFLAGS/LDFLAGS that point to headers and libvpx.a inside our
build tree before ones from the environment, which could reference
headers or libs outside the build tree.

This fixes issue 307.

Change-Id: I34d176b8c21098f6da5ea71f0147d3c49283cc45

build/make/Makefile
examples.mk

index 64d3c93..a951e99 100755 (executable)
@@ -98,11 +98,11 @@ install::
 $(BUILD_PFX)%.c.d: %.c
        $(if $(quiet),@echo "    [DEP] $@")
        $(qexec)mkdir -p $(dir $@)
-       $(qexec)$(CC) $(CFLAGS) -M $< | $(fmt_deps) > $@
+       $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@
 
 $(BUILD_PFX)%.c.o: %.c
        $(if $(quiet),@echo "    [CC] $@")
-       $(qexec)$(CC) $(CFLAGS) -c -o $@ $<
+       $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 $(BUILD_PFX)%.asm.d: %.asm
        $(if $(quiet),@echo "    [DEP] $@")
@@ -188,7 +188,7 @@ define linker_template
 $(1): $(filter-out -%,$(2))
 $(1):
        $(if $(quiet),@echo    "    [LD] $$@")
-       $(qexec)$$(LD) $$(strip $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
+       $(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
 endef
 # make-3.80 has a bug with expanding large input strings to the eval function,
 # which was triggered in some cases by the following component of
index 89c93db..3e34b56 100644 (file)
@@ -122,8 +122,8 @@ else
     LIB_PATH := $(call enabled,LIB_PATH)
     INC_PATH := $(call enabled,INC_PATH)
 endif
-CFLAGS += $(addprefix -I,$(INC_PATH))
-LDFLAGS += $(addprefix -L,$(LIB_PATH))
+INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
+INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
 
 
 # Expand list of selected examples to build (as specified above)
@@ -214,7 +214,8 @@ $(1): $($(1:.vcproj=).SRCS)
             --ver=$$(CONFIG_VS_VERSION)\
             --proj-guid=$$($$(@:.vcproj=).GUID)\
             $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
-            --out=$$@ $$(CFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) -lwinmm $$^
+            --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
+            $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) -lwinmm $$^
 endef
 PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES:.c=.vcproj)
 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\