Support system installation

This commit is contained in:
Bas Wijnen 2014-06-09 23:00:30 -04:00
parent a4dc43b58f
commit 2cfd754796
5 changed files with 123 additions and 0 deletions

7
.gitignore vendored
View file

@ -1,3 +1,10 @@
*.o *.o
build-cli build-cli
/.project /.project
Makefile.in
aclocal.m4
config.guess
config.sub
configure
install-sh
missing

View file

@ -228,6 +228,16 @@
# #
######################################################################## ########################################################################
ifneq ($(shell which arduino-mk-tool),)
# use defaults as set by installation.
# When using this file without installing it, those variables must be set manually.
ARDMK_DIR ?= `arduino-mk-tool ARDMK_DIR`
ARDUINO_DIR ?= `arduino-mk-tool ARDUINO_DIR`
AVR_TOOLS_DIR ?= `arduino-mk-tool AVR_TOOLS_DIR`
AVRDUDE ?= `arduino-mk-tool AVRDUDE`
MONITOR_PORT ?= `arduino-mk-tool MONITOR_PORT`
endif
arduino_output = arduino_output =
# When output is not suppressed and we're in the top-level makefile, # When output is not suppressed and we're in the top-level makefile,
# running for the first time (i.e., not after a restart after # running for the first time (i.e., not after a restart after

29
Makefile.am Normal file
View file

@ -0,0 +1,29 @@
########################################################################
#
# Makefile for compiling Arduino sketches from command line
# System part (i.e. project independent)
# Makefile.am for installing Arduino.mk on the system
#
# Copyright (C) 2014 Bas Wijnen <wijnen@debian.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
########################################################################
AUTOMAKE_OPTIONS = foreign
ardmkdir = ${ARDMK_DIR}
bin_SCRIPTS = arduino-mk-tool bin/ard-reset-arduino
ardmk_DATA = Arduino.mk chipKIT.mk Common.mk
man_MANS = ard-reset-arduino.1
# Allow cleaning up all the junk that autotools create.
JUNK = Makefile.in aclocal.m4 config.guess config.sub configure install-sh missing
autoclean: maintainer-clean
ifneq ($(wildcard $(JUNK)),)
rm -r $(wildcard $(JUNK))
endif

42
arduino-mk-tool.in Normal file
View file

@ -0,0 +1,42 @@
#!/bin/sh
# @configure_input@
########################################################################
#
# Makefile for compiling Arduino sketches from command line
# System part (i.e. project independent)
# arduino-mk-tool, for finding system details when installed to system
#
# Copyright (C) 2014 Bas Wijnen <wijnen@debian.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
########################################################################
prefix=@prefix@
case "$1" in
'')
echo '@ARDMK_DIR@/Arduino.mk'
;;
ARDMK_DIR)
echo '@ARDMK_DIR@'
;;
ARDUINO_DIR)
echo '@ARDUINO_DIR@'
;;
AVR_TOOLS_DIR)
echo '@AVR_TOOLS_DIR@'
;;
AVRDUDE)
echo '@AVRDUDE@'
;;
MONITOR_PORT)
echo '@MONITOR_PORT@'
;;
*)
echo >&2 "usage: $0 [<ARDUINO_DIR|AVR_TOOLS_DIR|AVRDUDE|MONITOR_PORT>]"
exit 1
esac

35
configure.ac Normal file
View file

@ -0,0 +1,35 @@
########################################################################
#
# Makefile for compiling Arduino sketches from command line
# System part (i.e. project independent)
# configure.ac for installing Arduino.mk on the system
#
# Copyright (C) 2014 Bas Wijnen <wijnen@debian.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
########################################################################
AC_PREREQ(2.53)
AC_INIT([arduino-mk],[0.1],[https://github.com/sudar/Arduino-Makefile])
AM_INIT_AUTOMAKE
AC_PATH_PROG([AVRDUDE], [avrdude])
AC_PATH_PROG([CC_NAME], [avr-gcc])
AC_SUBST([AVR_TOOLS_DIR], `AS_DIRNAME([${CC_NAME}])`/..)
AC_CANONICAL_HOST
AS_CASE([$host],
[*-linux-*], [ARDUINO_DIR=${datarootdir}/arduino; MONITOR_PORT="/dev/ttyACM* /dev/ttyUSB*"],
[*-darwin-*], [ARDUINO_DIR=/Applications/Arduino.app/Contents/Resources/Java; MONITOR_PORT=/dev/cu.usb*],
[*-cygwin-*], [MONITOR_PORT=com1])
AS_IF([test "x$ARDUINO_DIR" = x], [AC_MSG_ERROR(["ARDUINO_DIR is not defined for your platform; please define it manually"])])
AS_IF([test "x$MONITOR_PORT" = x], [AC_MSG_ERROR(["MONITOR_PORT is not defined for your platform; please define it manually"])])
AC_SUBST([ARDUINO_DIR])
AC_SUBST([MONITOR_PORT])
AC_SUBST([ARDMK_DIR], [${datarootdir}/arduino])
AC_CONFIG_FILES([arduino-mk-tool] [Makefile])
AC_OUTPUT