From 93c202497fa12f75c393e686ed470f85faa72af2 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 24 Mar 2009 16:31:15 +0000 Subject: Fix determination of whether json is required svn path=/trunk/hubbub/; revision=6846 --- Makefile | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 824c134..2308c85 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,36 @@ WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ CFLAGS := $(CFLAGS) -std=c99 -D_BSD_SOURCE -I$(CURDIR)/include/ \ -I$(CURDIR)/src $(WARNFLAGS) +# Parserutils ifneq ($(PKGCONFIG),) CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libparserutils --cflags) LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libparserutils --libs) else - LDFLAGS := -lparserutils + LDFLAGS := $(LDFLAGS) -lparserutils +endif + +ifeq ($(MAKECMDGOALS),test) + NEED_JSON := yes +else + ifeq ($(MAKECMDGOALS),profile) + NEED_JSON := yes + else + ifeq ($(MAKECMDGOALS),coverage) + NEED_JSON := yes + endif + endif +endif + +ifeq ($(NEED_JSON),yes) + # We require the presence of libjson -- http://oss.metaparadigm.com/json-c/ + ifneq ($(PKGCONFIG),) + CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json) + LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --libs json) + else + LDFLAGS := $(LDFLAGS) -ljson + endif + + CFLAGS := $(CFLAGS) -Wno-unused-parameter endif include build/makefiles/Makefile.top -- cgit v1.2.3