
SRC := json-c-0.9

TARGETS := build/.libs/libjson.a 

RM := /bin/rm -rf
INSTALL := install

.PHONY: clean install all 
all: install

build/Makefile: $(SRC)/Makefile.in
	mkdir -p build && cd build && ac_cv_func_malloc_0_nonnull=yes \
	ac_cv_func_realloc_0_nonnull=yes	\
	../$(SRC)/configure \
		--prefix=$(PREFIX) \
		--target=$(TARGET_TYPE) \
		--host=$(HOST_TYPE) \
		--build=$(BUILD_TYPE) \
		--disable-shared

$(TARGETS): build/Makefile
	$(MAKE) -C build

install: $(TARGETS)
	$(MAKE) -C build install

clean:
	if [ -f build/Makefile ]; then \
		make -C build clean;       \
	fi
	rm -f build/Makefile
