# VTI Instruments, Inc. (Ametek Instruments)
# Copyright 2014
#
# Makefile to build the EX1629 example

# general compilation and linker variables
EX1629_EXAMPLE_DIR = $(strip $(shell pwd) )
EX1629_EXAMPLE = ex1629_volt_example

CFLAGS  += -I../driver/shared -I../driver/libex1629 -I../driver/client
LDLIBS  += -lm
LIBPATH  = ../driver/libex1629
LIBNAME  = ex1629

EXAMPLE_CSRC = \
	ex1629_volt_example.c \

EXAMPLE_OBJS = $(patsubst %.c,%.o, $(EXAMPLE_CSRC))
EXAMPLE_HDRS = 

all: $(EX1629_EXAMPLE)

$(EXAMPLE_OBJS): %.o: %.c  $(EXAMPLE_HDRS) Makefile
	@test -s $(LIBPATH)/lib$(LIBNAME).a || { echo "Static library (lib$(LIBNAME).a) required to build the example doesn't exist! Exiting..."; exit 1; }
	$(CC) $(CFLAGS) -c $< -o $*.o

$(EX1629_EXAMPLE): $(EXAMPLE_OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) $(EXAMPLE_OBJS) -o $@  $(LDLIBS) -L$(LIBPATH) -l$(LIBNAME)

clean:
	rm -f *.o *.gdb
	rm -f $(EX1629_EXAMPLE)
