Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 19 additions & 36 deletions arduino-mk/Arduino.mk → Arduino.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# Original Arduino adaptation by mellis, eighthave, oli.keller
#
# Current version: 1.1.0
# Current version: 1.2.0
#
# Refer to HISTORY.md file for complete history of changes
#
Expand All @@ -29,9 +29,8 @@
#
# We need to worry about three different sorts of file:
#
# 1. Things which are included in this distribution e.g. ard-reset-arduino
# => ARDMK_DIR - Where the *.mk files are stored
# => ARDMK_PATH - Where the ard-reset-arduino script is stored
# 1. The directory where the *.mk files are stored
# => ARDMK_DIR
#
# 2. Things which are always in the Arduino distribution e.g.
# boards.txt, libraries, &c.
Expand Down Expand Up @@ -63,10 +62,6 @@
# If you don't specify these, we can try to guess, but that might not work
# or work the way you want it to.
#
# If you don't install the ard-reset-arduino binary to /usr/local/bin, but
# instead copy them to e.g. /home/mjo/arduino.mk/bin then set
# ARDMK_PATH = /home/mjo/arduino.mk/bin
#
# If you'd rather not see the configuration output, define ARDUINO_QUIET.
#
########################################################################
Expand Down Expand Up @@ -113,7 +108,7 @@
# in your Makefile:
#
# ARDMK_DIR := $(realpath ../../tools/Arduino-Makefile)
# include $(ARDMK_DIR)/arduino-mk/Arduino.mk
# include $(ARDMK_DIR)/Arduino.mk
#
# In any case, once this file has been created the typical workflow is just
#
Expand Down Expand Up @@ -231,25 +226,16 @@ endif
# Makefile distribution path

ifndef ARDMK_DIR
# presume it's a level above the path to our own file
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))/..)
# presume it's the same path to our own file
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
else
# show_config_variable macro is defined in Common.mk file and is not available yet.
# show_config_variable macro is defined in Common.mk file and is not available yet.
# Let's define a variable to know that user specified ARDMK_DIR
ARDMK_DIR_MSG = USER
endif

ifneq ($(wildcard $(ARDMK_DIR)/arduino-mk/Common.mk),)
# git checkout
ARDMK_FILE = $(ARDMK_DIR)/arduino-mk/arduino.mk
include $(ARDMK_DIR)/arduino-mk/Common.mk
else
ifneq ($(wildcard $(ARDMK_DIR)/Common.mk),)
# package install
ARDMK_FILE = $(ARDMK_DIR)/arduino.mk
include $(ARDMK_DIR)/Common.mk
endif
endif
# include Common.mk now we know where it is
include $(ARDMK_DIR)/Common.mk

# show_config_variable macro is available now. So let's print config details for ARDMK_DIR
ifndef ARDMK_DIR_MSG
Expand All @@ -258,13 +244,6 @@ else
$(call show_config_variable,ARDMK_DIR,[USER])
endif

ifndef ARDMK_PATH
ARDMK_PATH = $(ARDMK_DIR)/bin
$(call show_config_variable,ARDMK_PATH,[COMPUTED],(relative to ARDMK_DIR))
else
$(call show_config_variable,ARDMK_PATH,[USER])
endif

########################################################################
# Arduino Directory

Expand Down Expand Up @@ -591,12 +570,16 @@ endif
# Reset

ifndef RESET_CMD
ARD_RESET_ARDUINO := $(shell which ard-reset-arduino)
ifndef ARD_RESET_ARDUINO
# same level as *.mk in bin directory when checked out from git
# or in $PATH when packaged
ARD_RESET_ARDUINO = $(ARDMK_DIR)/bin/ard-reset-arduino
endif
ifneq ($(CATERINA),)
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino --caterina \
$(ARD_RESET_OPTS) $(call get_monitor_port)
RESET_CMD = $(ARD_RESET_ARDUINO) --caterina $(ARD_RESET_OPTS) $(call get_monitor_port)
else
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino \
$(ARD_RESET_OPTS) $(call get_monitor_port)
RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(call get_monitor_port)
endif
endif

Expand Down Expand Up @@ -995,7 +978,7 @@ endif
# Default avrdude options
# -V Do not verify
# -q - suppress progress output
# -D - Disable auto erase for flash memory
# -D - Disable auto erase for flash memory
# (-D is needed for Mega boards. See https://github.com/sudar/Arduino-Makefile/issues/114#issuecomment-25011005)
ifndef AVRDUDE_OPTS
AVRDUDE_OPTS = -q -V -D
Expand Down Expand Up @@ -1221,7 +1204,7 @@ help:
make set_fuses - set fuses without burning bootloader\n\
make help - show this help\n\
"
@$(ECHO) "Please refer to $(ARDMK_FILE) for more details.\n"
@$(ECHO) "Please refer to $(ARDMK_DIR)/Arduino.mk for more details.\n"

.PHONY: all upload raw_upload raw_eeprom error_on_caterina reset reset_stty ispload \
clean depends size show_boards monitor disasm symbol_sizes generated_assembly \
Expand Down
File renamed without changes.
12 changes: 7 additions & 5 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ A Makefile for Arduino Sketches

The following is the rough list of changes that went into different versions.
I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
### 1.2.0 (2014-01-12)
- Fix: Remove use of arduino-mk subdirectory in git. Fix issue #151, #152 and #147 (https://github.com/sej7278)

### 1.1.0 (2013-12-26)
- Don't append port details to avrdude for usbasp. See #123
Expand All @@ -19,7 +21,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Fix: Handle relative paths of bootloader file while burning bootloaders. Fix #126 and #142 (https://github.com/sej7278)
- New: Add `CONTRIBUTING.md` explaining how to contribute to the project.
- New: Force -Os optimization for SoftwareSerial. Add `OPTIMIZATION_FLAGS` and `DEBUG_FLAGS`. (https://github.com/mahoy)
- Fix: Use `ARDUINO_HEADER` variable instead of hardcoded file names. Fix #131
- Fix: Use `ARDUINO_HEADER` variable instead of hardcoded file names. Fix #131

### 1.0.1 (2013-09-25)
- Unconditionally add -D in avrdude options. See #114
Expand Down Expand Up @@ -108,7 +110,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it

### 0.10 17.ix.12 M J Oldfield
- Added installation notes for Fedora (ex Rickard Lindberg).
- Changed size target so that it looks at the ELF object,
- Changed size target so that it looks at the ELF object,
not the hexfile (ex Jared Szechy and Scott Howard).
- Fixed ARDUNIO typo in README.md (ex Kalin Kozhuharov).
- Tweaked OBJDIR handling (ex Matthias Urlichs and Scott Howard).
Expand All @@ -128,7 +130,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Autodetect ARDMK_DIR based on location of this file
- Added support for utility directory within SYS and USER libraries

### 0.9.3 13.vi.2012
### 0.9.3 13.vi.2012

- Auto detect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
- Categorize libs into user and system (https://github.com/rpavlik/)
Expand All @@ -137,12 +139,12 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Changed bytes option for the head shell command, so that it works in Mac as well
- Auto detect Serial Baud rate from sketch if possible

### 0.9.2 06.vi.2012
### 0.9.2 06.vi.2012

- Allow user to choose source files (LOCAL_*_SRCS flags) (https://github.com/Gaftech)
- Modified "make size" behavior: using --mcu option and targeting .elf file instead of .hex file.(https://github.com/Gaftech)

### 0.9.1 06.vi.2012
### 0.9.1 06.vi.2012

- Corrected the ubuntu package names
- Prevent the *file-not-found* error if the depends.mk file is not needed
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ On the Mac you might want to set:

ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
ARDMK_DIR = /usr/local
AVR_TOOLS_DIR = /usr

On Linux, you might prefer:
On Linux, you shouldn't need to set anything other than your board type and port:

ARDUINO_DIR = /usr/share/arduino
ARDMK_DIR = /usr/share/arduino
ARDMK_PATH = /usr/bin
AVR_TOOLS_DIR = /usr
BOARD_TAG = mega2560
MONITOR_PORT = /dev/ttyACM0

- `BOARD_TAG` - Type of board, for a list see boards.txt or `make show_boards`
- `MONITOR_PORT` - The port where your Arduino is plugged in, usually `/dev/ttyACM0` or `/dev/ttyUSB0`
- `ARDUINO_DIR` - Path to Arduino installation
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`
- `ARDMK_PATH` - Path where the `ard-reset-arduino` script is present. If you installed the package, then it is usually `/usr/bin`
- `AVR_TOOLS_DIR` - Path where the avr tools chain binaries are present. If you are going to use the binaries that came with Arduino installation, then you don't have to set it.

The Makefile also delegates resetting the board to a short Perl program.
Expand Down Expand Up @@ -80,7 +80,7 @@ It is possible to use [`colorgcc`](https://github.com/colorgcc/colorgcc) with th

## Versioning

The current version of the makefile is `1.1.0`. You can find the full history in the [HISTORY.md](HISTORY.md) file
The current version of the makefile is `1.2.0`. You can find the full history in the [HISTORY.md](HISTORY.md) file

This project adheres to Semantic [Versioning 2.0](http://semver.org/).

Expand All @@ -92,7 +92,7 @@ published by the Free Software Foundation; either version 2.1 of the License, or

## Contribution

All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
Also checkout the [contribution guide](CONTRIBUTING.md) for more details.

If you are looking for ideas to work on, then check out the following TODO items or the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/).
Expand All @@ -108,7 +108,7 @@ If you find an issue or have an idea for a feature then log them in the [issue t

## Credits

This makefile was originally created by [Martin Oldfield](http://mjo.tc/atelier/2009/02/arduino-cli.html) and he maintained it till v0.10.2.
This makefile was originally created by [Martin Oldfield](http://mjo.tc/atelier/2009/02/arduino-cli.html) and he maintained it till v0.10.2.
From May 2013, it is maintained by [Sudar](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile)

## Similar works
Expand Down
20 changes: 4 additions & 16 deletions arduino-mk/chipKIT.mk → chipKIT.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,11 @@
# The show_config_variable is unavailable before we include the common makefile,
# so we defer logging the ARDMK_DIR info until it happens in Arduino.mk
ifndef ARDMK_DIR
# presume it's a level above the path to our own file
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))/..)
# presume it's the same path to our own file
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
endif

ifndef ARDMK_PATH
ARDMK_PATH = $(ARDMK_DIR)/bin
endif

ifneq ($(wildcard $(ARDMK_DIR)/arduino-mk/Common.mk),)
# git checkout
include $(ARDMK_DIR)/arduino-mk/Common.mk
else
ifneq ($(wildcard $(ARDMK_DIR)/Common.mk),)
# package install
include $(ARDMK_DIR)/Common.mk
endif
endif
include $(ARDMK_DIR)/Common.mk

ifndef MPIDE_DIR
AUTO_MPIDE_DIR := $(firstword \
Expand Down Expand Up @@ -110,4 +98,4 @@ LDFLAGS += -T$(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld
CPPFLAGS += -mno-smart-io -fno-short-double
CFLAGS_STD =

include $(ARDMK_DIR)/arduino-mk/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk
File renamed without changes.
4 changes: 2 additions & 2 deletions packaging/fedora/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ First install the dependencies as root:

From the top-level Arduino-Makefile directory you've checked out of github, run the following (as unprivileged user) to create a compressed tarball using the naming conventions required by rpmbuild:

git archive --prefix=arduino-mk-1.1.0/ --format=tar -o ../arduino-mk-1.1.0.tar.gz -v HEAD | gzip
git archive HEAD --prefix=arduino-mk-1.2.0/ -o ../arduino-mk-1.2.0.tar.gz

If you don't already have a rpmbuild setup (e.g. you've not installed the SRPM) you will need to create the directories:

mkdir -p ~/rpmbuild/{SOURCES,SPECS}

Then copy the tarball and specfile into those directories:

cp ../arduino-mk-1.1.0.tar.gz ~/rpmbuild/SOURCES/
cp ../arduino-mk-1.2.0.tar.gz ~/rpmbuild/SOURCES/
cp packaging/fedora/arduino-mk.spec ~/rpmbuild/SPECS/

Then compile. This will create a binary and source RPM:
Expand Down
8 changes: 5 additions & 3 deletions packaging/fedora/arduino-mk.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: arduino-mk
Version: 1.1.0
Version: 1.2.0
Release: 1%{dist}
Summary: Program your Arduino from the command line
Packager: Simon John <git@the-jedi.co.uk>
Expand Down Expand Up @@ -33,8 +33,8 @@ install -m 755 -d %{buildroot}/%{_docdir}/%{name}
install -m 755 -d %{buildroot}/%{_docdir}/%{name}/examples
for dir in `find examples -type d` ; do install -m 755 -d %{buildroot}/%{_docdir}/%{name}/$dir ; done
for file in `find examples -type f ! -name .gitignore` ; do install -m 644 $file %{buildroot}/%{_docdir}/%{name}/$file ; done
install -m 644 %{name}/*.mk %{buildroot}/%{_datadir}/arduino
install -m 644 %{name}/licence.txt %{buildroot}/%{_docdir}/%{name}
install -m 644 *.mk %{buildroot}/%{_datadir}/arduino
install -m 644 licence.txt %{buildroot}/%{_docdir}/%{name}
install -m 755 bin/ard-reset-arduino %{buildroot}/%{_bindir}/ard-reset-arduino
help2man %{buildroot}/%{_bindir}/ard-reset-arduino -n "Reset Arduino board" -s 1 -m "Arduino CLI Reset" --version-string=%{version} -N -o %{buildroot}/%{_mandir}/man1/ard-reset-arduino.1

Expand All @@ -51,5 +51,7 @@ rm -rf %{buildroot}
%{_docdir}/%{name}/examples

%changelog
* Mon Jan 13 2014 Simon John <git@the-jedi.co.uk>
- Removed arduino-mk subdirectory
* Mon Dec 30 2013 Simon John <git@the-jedi.co.uk>
- Initial release.