Revision: 17866
          http://sourceforge.net/p/edk2/code/17866
Author:   yingke
Date:     2015-07-08 01:06:25 +0000 (Wed, 08 Jul 2015)
Log Message:
-----------
BaseTools: Fix build on FreeBSD and allow use of non-gcc system compiler

On FreeBSD, uuid.h is in /usr/include, not /usr/include/uuid.

Fix some errors when building using clang caused by self-assignment: the
preferred way to 'use' a variable is '(void)x;', not 'x = x;'.

Where the system provides $(CC) etc. by default, don't override it to be gcc.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bruce Cran <[email protected]>
Reviewed-by: Yingke Liu <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c
    trunk/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
    trunk/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
    trunk/edk2/BaseTools/Source/C/Makefiles/header.makefile
    trunk/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile

Modified: trunk/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c
===================================================================
--- trunk/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c      2015-07-07 
15:49:16 UTC (rev 17865)
+++ trunk/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c      2015-07-08 
01:06:25 UTC (rev 17866)
@@ -16,8 +16,13 @@
 //
 // Include files
 //
+
+#if defined(__FreeBSD__)
+#include <uuid.h>
+#elif defined(__GNUC__)
+#include <uuid/uuid.h>
+#endif
 #ifdef __GNUC__
-#include <uuid/uuid.h>
 #include <sys/stat.h>
 #endif
 #include <string.h>

Modified: trunk/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
===================================================================
--- trunk/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c   2015-07-07 
15:49:16 UTC (rev 17865)
+++ trunk/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c   2015-07-08 
01:06:25 UTC (rev 17866)
@@ -43,8 +43,8 @@
 const char *kCantAllocateMessage = "Can not allocate memory";
 const char *kDataErrorMessage = "Data error";
 
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
+static void *SzAlloc(void *p, size_t size) { (void)p; return MyAlloc(size); }
+static void SzFree(void *p, void *address) { (void)p; MyFree(address); }
 static ISzAlloc g_Alloc = { SzAlloc, SzFree };
 
 static Bool mQuietMode = False;

Modified: trunk/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
===================================================================
--- trunk/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c  2015-07-07 
15:49:16 UTC (rev 17865)
+++ trunk/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c  2015-07-08 
01:06:25 UTC (rev 17866)
@@ -2112,7 +2112,7 @@
   if (p->mtMode)
     MatchFinderMt_ReleaseStream(&p->matchFinderMt);
   #else
-  pp = pp;
+  (void)pp;
   #endif
 }
 

Modified: trunk/edk2/BaseTools/Source/C/Makefiles/header.makefile
===================================================================
--- trunk/edk2/BaseTools/Source/C/Makefiles/header.makefile     2015-07-07 
15:49:16 UTC (rev 17865)
+++ trunk/edk2/BaseTools/Source/C/Makefiles/header.makefile     2015-07-08 
01:06:25 UTC (rev 17866)
@@ -21,11 +21,11 @@
 LINUX:=$(findstring Linux, $(shell uname -s))
 DARWIN:=$(findstring Darwin, $(shell uname -s))
 
-CC = gcc
-CXX = g++
-AS = gcc
-AR = ar
-LD = ld
+CC ?= gcc
+CXX ?= g++
+AS ?= gcc
+AR ?= ar
+LD ?= ld
 LINKER ?= $(CC)
 ifeq ($(ARCH), IA32)
 ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/

Modified: trunk/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
===================================================================
--- trunk/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile       
2015-07-07 15:49:16 UTC (rev 17865)
+++ trunk/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile       
2015-07-08 01:06:25 UTC (rev 17866)
@@ -164,7 +164,7 @@
 #
 #   UNIX  (default)
 #
-CC=gcc
+CC?=gcc
 COPT=-O
 ANTLR=${BIN_DIR}/antlr
 DLG=${BIN_DIR}/dlg


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to