topsrc = ..

CC = gcc
CFLAGS = -g -O2
LDFLAGS = 
VPATH = $(topsrc)/extra

PREFIX = $(shell pkg-config --variable=prefix gretl)
GRETL_CFLAGS = $(shell pkg-config --cflags gretl)
LIBS = $(shell pkg-config --libs gretl)

override CFLAGS += $(GRETL_CFLAGS) -DPREFIX=\"$(PREFIX)\"

all: simple_client arma_example nls_example

simple_client: simple_client.c
	$(CC) $(CFLAGS) $< -o $@ $(LIBS)

arma_example: arma_example.c
	$(CC) $(CFLAGS) $< -o $@ $(LIBS)

nls_example: nls_example.c
	$(CC) $(CFLAGS) $< -o $@ $(LIBS)

clean:
	rm -f simple_client arma_example nls_example 

distclean: clean
	rm -f Makefile
