Re: [PATCH] libyuv linux.mk cleanup & fixes

44 views
Skip to first unread message

Frank Barchard

unread,
Jan 28, 2014, 3:45:00 PM1/28/14
to Andy Voltz, discuss-libyuv
Whatever works for.
Adding discuss-libyuv <discuss...@googlegroups.com> for email.
Normally people report bugs/fixes under libyuv issues
or you can 'browse' the source via browser
make a change, and that'll upload a patch.



On Tue, Jan 28, 2014 at 12:14 PM, Andy Voltz <andy....@timesys.com> wrote:
Hello,

I've been integrating libyuv into our build system, but I encountered a couple of issues with the linux.mk makefile. I'd prefer not setup a Google+ account, so I thought I would email you as the owner of libyuv. Please let me know if there is a mailing list where you'd prefer I submit these changes. I've attached a gzipped patch to address these issues within our environment, but I think the changes make sense for all users. I have also pasted the contents of this patch below, for further explanation.

CC is commonly reserved for GCC, and your wiki instructions even specify to export CC=CROSS_TOOL-gcc. Using CC=gcc would cause linker errors trying to link stdc++. I switched to using CXX and CXXFLAGS--as it seems more standard.

you're probably right.  I just tried it with a cross compiler that only supports c, not c++.  But it is c++... for now.  That will change shortly, and require this be redone, if/when I rename the files .c 

I modifed these CC and CCFLAGS assignments to be conditional, except for -Iinclude, which seems to be necessary for building all the objects in the project.

I removed linux.mk as a dependency for the recipes, because that really doesn't make much sense, since the makefile has no recipe, and is not generated. If it were an included/generated makefile, I think having that dep could be correct.

it was mainly because I was changing the linux.mk alot and wanted it to rebuild.  no problem. 

Lastly, I added libyuv.a as a dependency for the convert utility recipe. This fixes issues with parallel make.

makes sense. 

I hope these changes are helpful to you! Thanks for doing open source work! I also plan to create an 'install' make target, please let me know if you would like a patch for that as well.

it was quickly thrown together, and serves as more of an example.  but its a simple lib, and not a problem to maintain the linux.mk file.

yes!  an install target would be great. 

diff -Nuar libyuv-r634-orig/linux.mk libyuv-r634/linux.mk
--- libyuv-r634-orig/linux.mk   2014-01-28 15:00:05.348272143 -0500
+++ libyuv-r634/linux.mk        2014-01-28 15:01:13.536270622 -0500
@@ -1,8 +1,9 @@
 # This is a generic makefile for libyuv for gcc.
 # make -f linux.mk CC=clang++

-CC=g++
-CCFLAGS=-O2 -fomit-frame-pointer -Iinclude/
+CXX?=g++
+CXXFLAGS?=-O2 -fomit-frame-pointer
+CXXFLAGS+=-Iinclude/

 LOCAL_OBJ_FILES := \
     source/compare.o           \
@@ -32,16 +33,16 @@
     source/video_common.o

 .cc.o:
-       $(CC) -c $(CCFLAGS) $*.cc -o $*.o
+       $(CXX) -c $(CXXFLAGS) $*.cc -o $*.o

-all: libyuv.a convert linux.mk
+all: libyuv.a convert

-libyuv.a: $(LOCAL_OBJ_FILES) linux.mk
+libyuv.a: $(LOCAL_OBJ_FILES)
        $(AR) $(ARFLAGS) -o $@ $(LOCAL_OBJ_FILES)

 # A test utility that uses libyuv conversion.
-convert: util/convert.cc linux.mk
-       $(CC) $(CCFLAGS) -Iutil/ -o $@ util/convert.cc libyuv.a
+convert: util/convert.cc libyuv.a
+       $(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/convert.cc libyuv.a

 clean:
        /bin/rm -f source/*.o *.ii *.s libyuv.a convert

Regards
--
Andy Voltz
Timesys Corporation

Frank Barchard

unread,
Jan 28, 2014, 5:18:46 PM1/28/14
to Andy Voltz, discuss-libyuv
fixed in r977
Reply all
Reply to author
Forward
0 new messages