diff mbox

Makefile.am: use pkg-config for json-c

Message ID 1440957943-6171-1-git-send-email-david.ward@ll.mit.edu
State Accepted
Headers show

Commit Message

David Ward Aug. 30, 2015, 6:05 p.m. UTC
Use pkg-config to locate the json-c headers during compilation, as
is done for the glib2 headers. This fixes build errors with Fedora
and RHEL, and it was also tested on Ubuntu Precise and Ubuntu Wily.

Cc: Naresh Bhat <naresh.bhat@linaro.org>
Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 src/Makefile.am           |    4 ++--
 src/acpica/Makefile.am    |    4 ++--
 src/lib/src/Makefile.am   |    4 ++--
 src/utilities/Makefile.am |    3 ++-
 4 files changed, 8 insertions(+), 7 deletions(-)

Comments

Colin Ian King Aug. 30, 2015, 6:17 p.m. UTC | #1
On 30/08/15 19:05, David Ward wrote:
> Use pkg-config to locate the json-c headers during compilation, as
> is done for the glib2 headers. This fixes build errors with Fedora
> and RHEL, and it was also tested on Ubuntu Precise and Ubuntu Wily.
> 
> Cc: Naresh Bhat <naresh.bhat@linaro.org>
> Signed-off-by: David Ward <david.ward@ll.mit.edu>
> ---
>  src/Makefile.am           |    4 ++--
>  src/acpica/Makefile.am    |    4 ++--
>  src/lib/src/Makefile.am   |    4 ++--
>  src/utilities/Makefile.am |    3 ++-
>  4 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 9c8e35e..6336b7d 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -11,8 +11,8 @@ AM_CPPFLAGS = \
>  	-I$(top_srcdir)/src/acpica/source/include \
>  	-I$(top_srcdir)/src/acpica/source/compiler \
>  	-I$(top_srcdir)/efi_runtime \
> -	-I=/usr/include/json \
> -	-I=/usr/include/json-c \
> +	`pkg-config --silence-errors --cflags json` \
> +	`pkg-config --silence-errors --cflags json-c` \
>  	-pthread `pkg-config --cflags glib-2.0 gio-2.0` \
>  	-Wall -Werror -Wextra
>  
> diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
> index 33d7444..24e1f70 100644
> --- a/src/acpica/Makefile.am
> +++ b/src/acpica/Makefile.am
> @@ -8,8 +8,8 @@ AM_CPPFLAGS = 						\
>  	-D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP	\
>  	-I$(top_srcdir)/src/lib/include			\
>  	-I$(srcdir)/source/include			\
> -	-I=/usr/include/json				\
> -	-I=/usr/include/json-c				\
> +	`pkg-config --silence-errors --cflags json`	\
> +	`pkg-config --silence-errors --cflags json-c`	\
>  	-Wall -fno-strict-aliasing
>  
>  #
> diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
> index e1d9af5..f3abde8 100644
> --- a/src/lib/src/Makefile.am
> +++ b/src/lib/src/Makefile.am
> @@ -2,8 +2,8 @@ AM_CPPFLAGS = \
>  	-I$(top_srcdir)/src/lib/include 		\
>  	-I$(top_srcdir)/src/acpica/source/include	\
>  	-I$(top_srcdir)/src/acpica/source/compiler	\
> -	-I=/usr/include/json				\
> -	-I=/usr/include/json-c				\
> +	`pkg-config --silence-errors --cflags json`	\
> +	`pkg-config --silence-errors --cflags json-c`	\
>  	`pkg-config --cflags glib-2.0 gio-2.0` 		\
>  	-DDATAROOTDIR=\"$(datarootdir)\"		\
>  	-Wall -Werror -Wextra
> diff --git a/src/utilities/Makefile.am b/src/utilities/Makefile.am
> index 82e8c58..3160a35 100644
> --- a/src/utilities/Makefile.am
> +++ b/src/utilities/Makefile.am
> @@ -1,5 +1,6 @@
>  AM_CPPFLAGS = -Wall -Werror -Wextra -DDATAROOTDIR=\"$(datarootdir)\" \
> -	-I=/usr/include/json -I=/usr/include/json-c
> +	`pkg-config --silence-errors --cflags json` \
> +	`pkg-config --silence-errors --cflags json-c`
>  
>  bin_PROGRAMS = kernelscan
>  kernelscan_SOURCES = kernelscan.c
> 
Thanks David!

Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung Aug. 31, 2015, 8:51 a.m. UTC | #2
On 08/31/2015 02:17 AM, Colin Ian King wrote:
> On 30/08/15 19:05, David Ward wrote:
>> Use pkg-config to locate the json-c headers during compilation, as
>> is done for the glib2 headers. This fixes build errors with Fedora
>> and RHEL, and it was also tested on Ubuntu Precise and Ubuntu Wily.
>>
>> Cc: Naresh Bhat <naresh.bhat@linaro.org>
>> Signed-off-by: David Ward <david.ward@ll.mit.edu>
>> ---
>>  src/Makefile.am           |    4 ++--
>>  src/acpica/Makefile.am    |    4 ++--
>>  src/lib/src/Makefile.am   |    4 ++--
>>  src/utilities/Makefile.am |    3 ++-
>>  4 files changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index 9c8e35e..6336b7d 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -11,8 +11,8 @@ AM_CPPFLAGS = \
>>  	-I$(top_srcdir)/src/acpica/source/include \
>>  	-I$(top_srcdir)/src/acpica/source/compiler \
>>  	-I$(top_srcdir)/efi_runtime \
>> -	-I=/usr/include/json \
>> -	-I=/usr/include/json-c \
>> +	`pkg-config --silence-errors --cflags json` \
>> +	`pkg-config --silence-errors --cflags json-c` \
>>  	-pthread `pkg-config --cflags glib-2.0 gio-2.0` \
>>  	-Wall -Werror -Wextra
>>  
>> diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
>> index 33d7444..24e1f70 100644
>> --- a/src/acpica/Makefile.am
>> +++ b/src/acpica/Makefile.am
>> @@ -8,8 +8,8 @@ AM_CPPFLAGS = 						\
>>  	-D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP	\
>>  	-I$(top_srcdir)/src/lib/include			\
>>  	-I$(srcdir)/source/include			\
>> -	-I=/usr/include/json				\
>> -	-I=/usr/include/json-c				\
>> +	`pkg-config --silence-errors --cflags json`	\
>> +	`pkg-config --silence-errors --cflags json-c`	\
>>  	-Wall -fno-strict-aliasing
>>  
>>  #
>> diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
>> index e1d9af5..f3abde8 100644
>> --- a/src/lib/src/Makefile.am
>> +++ b/src/lib/src/Makefile.am
>> @@ -2,8 +2,8 @@ AM_CPPFLAGS = \
>>  	-I$(top_srcdir)/src/lib/include 		\
>>  	-I$(top_srcdir)/src/acpica/source/include	\
>>  	-I$(top_srcdir)/src/acpica/source/compiler	\
>> -	-I=/usr/include/json				\
>> -	-I=/usr/include/json-c				\
>> +	`pkg-config --silence-errors --cflags json`	\
>> +	`pkg-config --silence-errors --cflags json-c`	\
>>  	`pkg-config --cflags glib-2.0 gio-2.0` 		\
>>  	-DDATAROOTDIR=\"$(datarootdir)\"		\
>>  	-Wall -Werror -Wextra
>> diff --git a/src/utilities/Makefile.am b/src/utilities/Makefile.am
>> index 82e8c58..3160a35 100644
>> --- a/src/utilities/Makefile.am
>> +++ b/src/utilities/Makefile.am
>> @@ -1,5 +1,6 @@
>>  AM_CPPFLAGS = -Wall -Werror -Wextra -DDATAROOTDIR=\"$(datarootdir)\" \
>> -	-I=/usr/include/json -I=/usr/include/json-c
>> +	`pkg-config --silence-errors --cflags json` \
>> +	`pkg-config --silence-errors --cflags json-c`
>>  
>>  bin_PROGRAMS = kernelscan
>>  kernelscan_SOURCES = kernelscan.c
>>
> Thanks David!
> 
> Acked-by: Colin Ian King <colin.king@canonical.com>
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/Makefile.am b/src/Makefile.am
index 9c8e35e..6336b7d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,8 +11,8 @@  AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/acpica/source/include \
 	-I$(top_srcdir)/src/acpica/source/compiler \
 	-I$(top_srcdir)/efi_runtime \
-	-I=/usr/include/json \
-	-I=/usr/include/json-c \
+	`pkg-config --silence-errors --cflags json` \
+	`pkg-config --silence-errors --cflags json-c` \
 	-pthread `pkg-config --cflags glib-2.0 gio-2.0` \
 	-Wall -Werror -Wextra
 
diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
index 33d7444..24e1f70 100644
--- a/src/acpica/Makefile.am
+++ b/src/acpica/Makefile.am
@@ -8,8 +8,8 @@  AM_CPPFLAGS = 						\
 	-D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP	\
 	-I$(top_srcdir)/src/lib/include			\
 	-I$(srcdir)/source/include			\
-	-I=/usr/include/json				\
-	-I=/usr/include/json-c				\
+	`pkg-config --silence-errors --cflags json`	\
+	`pkg-config --silence-errors --cflags json-c`	\
 	-Wall -fno-strict-aliasing
 
 #
diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
index e1d9af5..f3abde8 100644
--- a/src/lib/src/Makefile.am
+++ b/src/lib/src/Makefile.am
@@ -2,8 +2,8 @@  AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib/include 		\
 	-I$(top_srcdir)/src/acpica/source/include	\
 	-I$(top_srcdir)/src/acpica/source/compiler	\
-	-I=/usr/include/json				\
-	-I=/usr/include/json-c				\
+	`pkg-config --silence-errors --cflags json`	\
+	`pkg-config --silence-errors --cflags json-c`	\
 	`pkg-config --cflags glib-2.0 gio-2.0` 		\
 	-DDATAROOTDIR=\"$(datarootdir)\"		\
 	-Wall -Werror -Wextra
diff --git a/src/utilities/Makefile.am b/src/utilities/Makefile.am
index 82e8c58..3160a35 100644
--- a/src/utilities/Makefile.am
+++ b/src/utilities/Makefile.am
@@ -1,5 +1,6 @@ 
 AM_CPPFLAGS = -Wall -Werror -Wextra -DDATAROOTDIR=\"$(datarootdir)\" \
-	-I=/usr/include/json -I=/usr/include/json-c
+	`pkg-config --silence-errors --cflags json` \
+	`pkg-config --silence-errors --cflags json-c`
 
 bin_PROGRAMS = kernelscan
 kernelscan_SOURCES = kernelscan.c