#
# picpen/Makefile - PIC Programmer/Emulator for Nanonote
#
# Written 2008, 2010-2011 by Werner Almesberger
# Copyright 2008, 2010-2011 Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#


PREFIX=/usr

ifeq ($(TARGET),)
TARGET = ben_openwrt
endif

CC_ben_jlime = mipsel-linux-gcc
CC_ben_openwrt = mipsel-openwrt-linux-gcc

UPLOAD_ben_jlime = scp f32x jlime:
UPLOAD_ben_openwrt = scp f32x ben:

NAME = picpen
CC = $(CC_$(TARGET))
CFLAGS = -Wall -Wshadow -O9 -g -static
OBJS = picpen.o gpio-xburst.o
LDFLAGS = -static


.PHONY:		all install uninstall clean depend spotless

all:		$(NAME)

$(NAME):	$(OBJS)

upload:
		$(UPLOAD_$(TARGET))

install:	$(NAME)
		install -D $(NAME) $(PREFIX)/bin/$(NAME)

uninstall:
		rm -f $(PREFIX)/bin/$(NAME)

depend:
		$(CPP) $(CFLAGS) -MM -MG *.c >.depend || \
		  { rm -f .depend; exit 1; }

ifeq (.depend,$(wildcard .depend))
include .depend
endif

clean:
		rm -f $(OBJS) $(OBJS_ben) .depend

spotless:	clean
		rm -f $(NAME)
