#
# General build makefile, only for examples.

INCLUDE ?= $(shell pwd)/../../driver/inc
HEADER = $(INCLUDE)/seamac.h

CC ?=      /usr/bin/gcc
RM ?=      /bin/rm


## ============================================================================
MODEL = Security Key Example
OBJS = list-key.o
APPS = list-key

CFLAGS = -g -Wall -I$(INCLUDE)


## ============================================================================
all: $(APPS)
	@echo "   *$(MODEL) is prepared"
	@echo

$(HEADER):
	@echo
	@echo "  ERROR!  Can't find include file!"
	@echo
	@echo "       I suggest you obtain another copy of this distribution."
	@echo
	@exit 1

$(OBJS): %.o: %.c $(HEADER)
	@echo "     Compiling $(MODEL) source: $*.o"
	@$(CC) $(CFLAGS) -c $< -o $@

$(APPS): %: %.o
	@echo "     Linking $^"
	@$(CC) $(CFLAGS) $^ -o $@

objs: $(OBJS)
	@echo "   *$(MODEL) objects prepared"
	@echo

install: $(APPS)
	@echo "   *${MODEL} is NOT installed, but is built"
	@echo

uninstall:
	@echo "   *${MODEL} was NOT installed"
	@echo 

clean: 
	@echo "     Removing ${MODEL} temp build files"
	@$(RM) -rf $(OBJS) data
	@echo "   *${MODEL} temp build files removed"
	@echo

clobber: 
	@echo "     Removing ${MODEL} build files"
	@$(RM) -rf $(OBJS) $(APPS) data
	@echo "   *${MODEL} build files removed"
	@echo
