#
#       Searduino
#                                                                   
# Basically a couple of Makefile wrapping the Ardunio
# C and C++ files
#                                                                   
#  Copyright (C) 2012 Henrik Sandklef      
#                                                                   
# 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 3    
# of the License, or any later version.                             
#                                                                   
#                                                                   
# This program is distributed in the hope that it will be useful,   
# but WITHOUT ANY WARRANTY; without even the implied warranty of    
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     
# GNU General Public License for more details.                      
#                                                                   
# You should have received a copy of the GNU General Public License 
# along with this program; if not, write to the Free Software       
# Foundation, Inc., 51 Franklin Street, Boston,            
# MA  02110-1301, USA.                                              
#
#

INSTALLATION_DIR=__INSTALL_DIR__

all: uno mega due mega2560 leonardo

uno:
#	make -f Makefile.uno light-clean
	make -f Makefile.uno lib

due:
#	make -f Makefile.due light-clean
	make -f Makefile.due lib

mega:
#	make -f Makefile.mega light-clean
	make -f Makefile.mega lib

mega2560:
#	make -f Makefile.mega2560 light-clean
	make -f Makefile.mega2560 lib

leonardo:
	make -f Makefile.leonardo lib

clean:
	make -f Makefile.uno clean

check:
	@echo "Nothing to do in libraries"

install: due uno mega mega2560 due leonardo
	 @echo "installing to $(INSTALLATION_DIR)"
	 mkdir -p          $(INSTALLATION_DIR)/share/searduino/arduino-libs 
	 @cp -r libs/*     $(INSTALLATION_DIR)/share/searduino/arduino-libs/

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/EEPROM
	 @cp -r EEPROM/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/EEPROM/	

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Ethernet
	 @cp -r Ethernet/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Ethernet/	

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Firmata
	 @cp -r Firmata/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Firmata/	

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/LiquidCrystal
	 @cp -r LiquidCrystal/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/LiquidCrystal/ 

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/SD
	 @cp -r SD/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/SD/		       

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Servo
	 @cp -r Servo/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Servo/		       

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/SoftwareSerial
	 @cp -r SoftwareSerial/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/SoftwareSerial/      

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/SPI
	 @cp -r SPI/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/SPI/			      

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Stepper
	 @cp -r Stepper/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Stepper/		      

	 @mkdir -p         $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Wire
	 @cp -r Wire/*.h   $(INSTALLATION_DIR)/include/searduino/arduino-sources/libraries/Wire/
	 

distdir:
	echo dummy impl
