Merge remote-tracking branch 'remotes/upstream/master' into private
Conflicts: arduino-mk/Arduino.mk
This commit is contained in:
commit
35b7f52a16
4 changed files with 323 additions and 378 deletions
119
HISTORY.md
Normal file
119
HISTORY.md
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
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.
|
||||||
|
|
||||||
|
### 0.10.5 (in development)
|
||||||
|
- Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo.
|
||||||
|
- Allow adding extra common dependencies (COMMON_DEPS) (https://github.com/gaftech)
|
||||||
|
- Added ifndef ARDUINO_VAR_PATH for compiling for the attiny (https://github.com/danielesteban)
|
||||||
|
|
||||||
|
### 0.10.4 (2013-05-31) @matthijskooijman
|
||||||
|
- Improved BAUD_RATE detection logic
|
||||||
|
- Added logic to check if there is only .ino or .pde file
|
||||||
|
- Compile .ino/.pde files directly
|
||||||
|
- Output configuration only once
|
||||||
|
- Try to read Version.txt file only if it is present
|
||||||
|
- Refactored dependency code
|
||||||
|
|
||||||
|
### 0.10.3 16.xii 2012 gaftech
|
||||||
|
- Enabling creation of EEPROM file (.eep)
|
||||||
|
- EEPROM upload: eeprom and raw_eeprom targets
|
||||||
|
- Auto EEPROM upload with isp mode: ISP_EEPROM option.
|
||||||
|
- Allow custom OBJDIR
|
||||||
|
|
||||||
|
### 0.10.2 15.xii.2012 Sudar
|
||||||
|
- Added sketch size verification. (https://github.com/fornellas)
|
||||||
|
- Show original line number for error messages (https://github.com/WizenedEE)
|
||||||
|
- Removed -w from CPPFLAGS to show warnings (https://github.com/gaftech)
|
||||||
|
- Changed shebang to use /usr/bin/env (https://github.com/anm)
|
||||||
|
- set USB_VID and USB_PID only for leonardo boards(https://github.com/alohr)
|
||||||
|
- Updated Readme (https://github.com/fr0sty1/)
|
||||||
|
|
||||||
|
### 0.10.1 15.xii.2012 Sudar
|
||||||
|
- Merged all changes from Upstream and the following changes from https://github.com/rpavlik
|
||||||
|
- Allow passing extra flags
|
||||||
|
- Make listing files more useful
|
||||||
|
- Add knowledge of device-specific assembler
|
||||||
|
- Use variables instead of hardcoded commands
|
||||||
|
- Make disasm more helpful
|
||||||
|
- Change .sym output
|
||||||
|
- Provide symbol_sizes and generated_assembly targets.
|
||||||
|
- Be able to silence configuration output
|
||||||
|
- Make everybody depend on the makefile, in case cflags are changed, etc.
|
||||||
|
- Make the makefile error if the arduino port is not present.
|
||||||
|
|
||||||
|
### 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,
|
||||||
|
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).
|
||||||
|
- Changed the name of the Debian/Ubuntu package (ex
|
||||||
|
Scott Howard).
|
||||||
|
- Only set AVRDUDE_CONF if it's not set (ex Tom Hall).
|
||||||
|
- Added support for USB_PID/VID used by the Leonardo (ex Dan
|
||||||
|
Villiom Podlaski Christiansen and Marc Plano-Lesay).
|
||||||
|
|
||||||
|
### 0.9.3.2 10.ix.2012 Sudar
|
||||||
|
- Fixed a typo in README. Issue reported at upstream (https://github.com/mjoldfield/Arduino-Makefile/issues/21)
|
||||||
|
|
||||||
|
### 0.9.3.1 18.viii.2012 jeffkowalski
|
||||||
|
|
||||||
|
- Autodetect ARDUINO_LIBS from includes in LOCAL_SRCS
|
||||||
|
- Autodetect ARDUINO_SKETCHBOOK from file set by Arduino IDE
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- Auto detect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
|
||||||
|
- Categorize libs into user and system (https://github.com/rpavlik/)
|
||||||
|
- Dump size at the end of the build (https://github.com/rpavlik/)
|
||||||
|
- Lots and lots of improvements (https://github.com/rpavlik/)
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- Corrected the ubuntu package names
|
||||||
|
- Prevent the *file-not-found* error if the depends.mk file is not needed
|
||||||
|
- Delete the build-cli folder as well while doing make clean
|
||||||
|
- Added support for compiling .pde files in Arduino 1.0 environment
|
||||||
|
- Replaced = with += in CPPFLAGS assignment so that we can set CPPFLAGS per sketch if needed
|
||||||
|
- Changed AVRDUDE_CONF so it can be defined in per-project makefile (https://github.com/WizenedEE)
|
||||||
|
- Cleaner way to delete the build-cli directory when make clean is invoked
|
||||||
|
- The package name in Debian and Ubuntu is arduino-mk (https://github.com/maqifrnswa)
|
||||||
|
|
||||||
|
### 2012-02-12, version 0.8
|
||||||
|
- Patches for version 1.0 of the Arduino IDE. Older versions might still work, but I’ve not tested it.
|
||||||
|
- A change to the build process: rather than link all the system objects directly into the executable, bundle them in a library first. This should make the final executable smaller.
|
||||||
|
- If TARGET isn’t explicitly set, default to the current directory name. Thanks to Daniele Vergini for this patch.
|
||||||
|
- Add support for .c files in system libraries: Dirk-Willem van Gulik and Evan Goldenberg both reported this and provided patches in the same spirit.
|
||||||
|
- Added a size target as suggested by Alex Satrapa.
|
||||||
|
|
||||||
|
### Unreleased, version 0.7
|
||||||
|
- Added -lm to the linker options, and -F to stty.
|
||||||
|
|
||||||
|
### 2011-06-23, version 0.6
|
||||||
|
- Added ard-parse-boards. Mark Sproul suggested doing something like this ages ago, but I’ve only recently looked at it in detail.
|
||||||
|
- Fabien Le Lez reported that one needs to link with -lc to avoid [linker errors](http://forum.arduino.cc/index.php/topic,40215.0.html).
|
||||||
|
|
||||||
|
### 2011-06-23, version 0.5
|
||||||
|
- Imported changes from Debian/Ubuntu, which incorporate a patch from Stefan Tomanek so that libraries would be compiled too.
|
||||||
|
|
||||||
|
Note: Many other people sent me similar patches, but I didn't get around to using them. In the end, I took the patch from Debian and Ubuntu: there seems merit in not forking the code and using a tested version. So, thanks and apologies to Nick Andrew, Leandro Coletto Biazon, Thibaud Chupin, Craig Hollabaugh, Johannes H. Jensen, Fabien Le Lez, Craig Leres, and Mark Sproul.
|
||||||
|
|
||||||
|
### 2010-05-24, version 0.4
|
||||||
|
Tweaked rules for the reset target on Philip Hands’ advice.
|
||||||
|
|
||||||
|
### 2010-05-21, version 0.3
|
||||||
|
- Tidied up the licensing, making it clear that it’s released under LGPL 2.1.
|
||||||
|
- [Philip Hands](http://hands.com/~phil/) sent me some code to reset the Arduino by dropping DTR for 100ms, and I added it.
|
||||||
|
- Tweaked the Makefile to handle version 0018 of the Arduino software which now includes main.cpp. Accordingly we don’t need to—and indeed must not—add main.cxx to the .pde sketch file. The paths seem to have changed a bit too.
|
||||||
|
|
96
README.md
96
README.md
|
@ -57,100 +57,24 @@ standard location for custom libraries when using the Arduino IDE), you need to
|
||||||
set the `ARDUINO_SKETCHBOOK` variable to point to this directory. By default it
|
set the `ARDUINO_SKETCHBOOK` variable to point to this directory. By default it
|
||||||
is set to `$HOME/sketchbook`.
|
is set to `$HOME/sketchbook`.
|
||||||
|
|
||||||
## Changelog
|
## Versioning
|
||||||
|
|
||||||
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.
|
The current version of the makefile is `0.10.4`. You can find the full history in the [HISTORY.md](HISTORY.md) file
|
||||||
|
|
||||||
### 0.10.2 15.xii.2012 Sudar
|
This project adheres to Semantic [Versioning 2.0](http://semver.org/).
|
||||||
- Added sketch size verification. (https://github.com/fornellas)
|
|
||||||
- Show original line number for error messages (https://github.com/WizenedEE)
|
|
||||||
- Removed -w from CPPFLAGS to show warnings (https://github.com/gaftech)
|
|
||||||
- Changed shebang to use /usr/bin/env (https://github.com/anm)
|
|
||||||
- set USB_VID and USB_PID only for leonardo boards(https://github.com/alohr)
|
|
||||||
- Updated Readme (https://github.com/fr0sty1/)
|
|
||||||
|
|
||||||
### 0.10.1 15.xii.2012 Sudar
|
## Contribution
|
||||||
- Merged all changes from Upstream and the following changes from https://github.com/rpavlik
|
|
||||||
- Allow passing extra flags
|
|
||||||
- Make listing files more useful
|
|
||||||
- Add knowledge of device-specific assembler
|
|
||||||
- Use variables instead of hardcoded commands
|
|
||||||
- Make disasm more helpful
|
|
||||||
- Change .sym output
|
|
||||||
- Provide symbol_sizes and generated_assembly targets.
|
|
||||||
- Be able to silence configuration output
|
|
||||||
- Make everybody depend on the makefile, in case cflags are changed, etc.
|
|
||||||
- Make the makefile error if the arduino port is not present.
|
|
||||||
|
|
||||||
### 0.10 17.ix.12 M J Oldfield
|
All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
|
||||||
- Merged all changes from Upstream
|
|
||||||
|
|
||||||
### 0.9.3.2 10.ix.2012 Sudar
|
If you are looking for ideas to work on, then check out the following TODO items.
|
||||||
- Fixed a typo in README. Issue reported at upstream (https://github.com/mjoldfield/Arduino-Makefile/issues/21)
|
|
||||||
|
|
||||||
### 0.9.3.1 18.viii.2012 jeffkowalski
|
## Know Issues / TODO's
|
||||||
|
|
||||||
- Autodetect ARDUINO_LIBS from includes in LOCAL_SRCS
|
- Doesn't work with Leonardo yet. There are various fixes (#43, #37, #30) but need to verify them #44.
|
||||||
- Autodetect ARDUINO_SKETCHBOOK from file set by Arduino IDE
|
- Doesn't work with Arduino 1.5.x yet.
|
||||||
- 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
|
If you find an issue or have an idea for a feature then log them at https://github.com/sudar/Arduino-Makefile/issues/
|
||||||
|
|
||||||
- Auto detect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
|
|
||||||
- Categorize libs into user and system (https://github.com/rpavlik/)
|
|
||||||
- Dump size at the end of the build (https://github.com/rpavlik/)
|
|
||||||
- Lots and lots of improvements (https://github.com/rpavlik/)
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- Corrected the ubuntu package names
|
|
||||||
- Prevent the *file-not-found* error if the depends.mk file is not needed
|
|
||||||
- Delete the build-cli folder as well while doing make clean
|
|
||||||
- Added support for compiling .pde files in Arduino 1.0 environment
|
|
||||||
- Replaced = with += in CPPFLAGS assignment so that we can set CPPFLAGS per sketch if needed
|
|
||||||
- Changed AVRDUDE_CONF so it can be defined in per-project makefile (https://github.com/WizenedEE)
|
|
||||||
- Cleaner way to delete the build-cli directory when make clean is invoked
|
|
||||||
- The package name in Debian and Ubuntu is arduino-mk (https://github.com/maqifrnswa)
|
|
||||||
|
|
||||||
### 2012-02-12, version 0.8
|
|
||||||
- Patches for version 1.0 of the Arduino IDE. Older versions might still work, but I’ve not tested it.
|
|
||||||
- A change to the build process: rather than link all the system objects directly into the executable, bundle them in a library first. This should make the final executable smaller.
|
|
||||||
- If TARGET isn’t explicitly set, default to the current directory name. Thanks to Daniele Vergini for this patch.
|
|
||||||
- Add support for .c files in system libraries: Dirk-Willem van Gulik and Evan Goldenberg both reported this and provided patches in the same spirit.
|
|
||||||
- Added a size target as suggested by Alex Satrapa.
|
|
||||||
|
|
||||||
### Unreleased, version 0.7
|
|
||||||
- Added -lm to the linker options, and -F to stty.
|
|
||||||
|
|
||||||
### 2011-06-23, version 0.6
|
|
||||||
- Added ard-parse-boards. Mark Sproul suggested doing something like this ages ago, but I’ve only recently looked at it in detail.
|
|
||||||
- Fabien Le Lez reported that one needs to link with -lc to avoid [linker errors](http://forum.arduino.cc/index.php/topic,40215.0.html).
|
|
||||||
|
|
||||||
### 2011-06-23, version 0.5
|
|
||||||
- Imported changes from Debian/Ubuntu, which incorporate a patch from Stefan Tomanek so that libraries would be compiled too.
|
|
||||||
|
|
||||||
Note: Many other people sent me similar patches, but I didn’t get around to using them. In the end, I took the patch from Debian and Ubuntu: there seems merit in not forking the code and using a tested version. So, thanks and apologies to Nick Andrew, Leandro Coletto Biazon, Thibaud Chupin, Craig Hollabaugh, Johannes H. Jensen, Fabien Le Lez, Craig Leres, and Mark Sproul.
|
|
||||||
|
|
||||||
### 2010-05-24, version 0.4
|
|
||||||
Tweaked rules for the reset target on Philip Hands’ advice.
|
|
||||||
|
|
||||||
### 2010-05-21, version 0.3
|
|
||||||
- Tidied up the licensing, making it clear that it’s released under LGPL 2.1.
|
|
||||||
- [Philip Hands](http://hands.com/~phil/) sent me some code to reset the Arduino by dropping DTR for 100ms, and I added it.
|
|
||||||
- Tweaked the Makefile to handle version 0018 of the Arduino software which now includes main.cpp. Accordingly we don’t need to—and indeed must not—add main.cxx to the .pde sketch file. The paths seem to have changed a bit too.
|
|
||||||
|
|
||||||
## Know Issues
|
|
||||||
- Because of the way the makefile is structured, the configuration parameters gets printed twice.
|
|
||||||
- Doesn't work with Leonardo yet.
|
|
||||||
- More todo's at https://github.com/sudar/Arduino-Makefile/issues/
|
|
||||||
|
|
||||||
## Similar works
|
## Similar works
|
||||||
- It's not a derivative of this, but Alan Burlison has written a [similar thing](http://bleaklow.com/2010/06/04/a_makefile_for_arduino_sketches.html).
|
- It's not a derivative of this, but Alan Burlison has written a [similar thing](http://bleaklow.com/2010/06/04/a_makefile_for_arduino_sketches.html).
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
# Arduino command line tools Makefile
|
# Makefile for compiling Arduino sketches from command line
|
||||||
# System part (i.e. project independent)
|
# System part (i.e. project independent)
|
||||||
#
|
#
|
||||||
# Copyright (C) 2012 Sudar <http://sudarmuthu.com>, based on
|
# Copyright (C) 2012 Sudar <http://sudarmuthu.com>, based on
|
||||||
|
@ -19,140 +19,9 @@
|
||||||
#
|
#
|
||||||
# Original Arduino adaptation by mellis, eighthave, oli.keller
|
# Original Arduino adaptation by mellis, eighthave, oli.keller
|
||||||
#
|
#
|
||||||
# Version 0.1 17.ii.2009 M J Oldfield
|
# Current version: 0.10.4
|
||||||
#
|
#
|
||||||
# 0.2 22.ii.2009 M J Oldfield
|
# Refer to HISTORY.md file for complete history of changes
|
||||||
# - fixes so that the Makefile actually works!
|
|
||||||
# - support for uploading via ISP
|
|
||||||
# - orthogonal choices of using the Arduino for
|
|
||||||
# tools, libraries and uploading
|
|
||||||
#
|
|
||||||
# 0.3 21.v.2010 M J Oldfield
|
|
||||||
# - added proper license statement
|
|
||||||
# - added code from Philip Hands to reset
|
|
||||||
# Arduino prior to upload
|
|
||||||
#
|
|
||||||
# 0.4 25.v.2010 M J Oldfield
|
|
||||||
# - tweaked reset target on Philip Hands' advice
|
|
||||||
#
|
|
||||||
# 0.5 23.iii.2011 Stefan Tomanek
|
|
||||||
# - added ad-hoc library building
|
|
||||||
# 17.v.2011 M J Oldfield
|
|
||||||
# - grabbed said version from Ubuntu
|
|
||||||
#
|
|
||||||
# 0.6 22.vi.2011 M J Oldfield
|
|
||||||
# - added ard-parse-boards supports
|
|
||||||
# - added -lc to linker opts,
|
|
||||||
# on Fabien Le Lez's advice
|
|
||||||
#
|
|
||||||
# 0.7 12.vii.2011 M J Oldfield
|
|
||||||
# - moved -lm to the end of linker opts,
|
|
||||||
# to solve Frank Knopf's problem;
|
|
||||||
# - added -F to stty opts: Craig Hollabaugh
|
|
||||||
# reckons it's good for Ubuntu
|
|
||||||
#
|
|
||||||
# 0.8 12.ii.2012 M J Oldfield
|
|
||||||
# - Patches for Arduino 1.0 IDE:
|
|
||||||
# support .ino files;
|
|
||||||
# handle board 'variants';
|
|
||||||
# tweaked compile flags.
|
|
||||||
# - Build a library from all the system
|
|
||||||
# supplied code rather than linking the .o
|
|
||||||
# files directly.
|
|
||||||
# - Let TARGET default to current directory
|
|
||||||
# as per Daniele Vergini's patch.
|
|
||||||
# - Add support for .c files in system
|
|
||||||
# libraries: Dirk-Willem van Gulik and Evan
|
|
||||||
# Goldenberg both reported this and
|
|
||||||
# provided patches in the same spirit.
|
|
||||||
#
|
|
||||||
# 0.9 26.iv.2012 M J Oldfield
|
|
||||||
# - Allow the punter to specify boards.txt
|
|
||||||
# file and parser independently (after
|
|
||||||
# Peplin and Brotchie on github)
|
|
||||||
# - Support user libraries (Peplin's patch)
|
|
||||||
# - Remove main.cpp if NO_CORE_MAIN_CPP is
|
|
||||||
# defined (ex Peplin)
|
|
||||||
# - Added a monitor target which talks to the
|
|
||||||
# Arduino serial port (Peplin's suggestion)
|
|
||||||
# - Rejigged PATH calculations for general
|
|
||||||
# tidiness (ex Peplin)
|
|
||||||
# - Moved the reset target to Perl for
|
|
||||||
# clarity and better error handling (ex
|
|
||||||
# Daniele Vergini)
|
|
||||||
#
|
|
||||||
# 0.9.1 06.vi.2012 Sudar
|
|
||||||
# - Corrected the ubuntu package names
|
|
||||||
# - Prevent the *file-not-found* error if the depends.mk file is not needed
|
|
||||||
# - Delete the build-cli folder as well while doing make clean
|
|
||||||
# - Added support for compiling .pde files in Arduino 1.0 environment
|
|
||||||
# - Replaced = with += in CPPFLAGS assignment so that we can set CPPFLAGS per sketch if needed
|
|
||||||
# - Changed AVRDUDE_CONF so it can be defined in per-project makefile (https://github.com/WizenedEE)
|
|
||||||
# - Cleaner way to delete the build-cli directory when make clean is invoked
|
|
||||||
# - The package name in Debian and Ubuntu is arduino-mk (https://github.com/maqifrnswa)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 0.9.2 06.vi.2012 Sudar
|
|
||||||
# - 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.3 13.vi.2012 Sudar
|
|
||||||
# - Autodetect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
|
|
||||||
# - Categorize libs into user and system (https://github.com/rpavlik/)
|
|
||||||
# - Dump size at the end of the build (https://github.com/rpavlik/)
|
|
||||||
# - Lots and lots of improvements (https://github.com/rpavlik/)
|
|
||||||
# - 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.3.1 18.viii.2012 jeffkowalski
|
|
||||||
# - Autodetect ARDUINO_LIBS from includes in LOCAL_SRCS
|
|
||||||
# - Autodetect ARDUINO_SKETCHBOOK from file
|
|
||||||
# set by Arduino IDE
|
|
||||||
# - Autodetect ARDMK_DIR based on location of
|
|
||||||
# this file
|
|
||||||
# - Added support for utility directory
|
|
||||||
# within SYS and USER libraries
|
|
||||||
#
|
|
||||||
# 0.9.3.2 10.ix.2012 Sudar
|
|
||||||
# - Fixed a typo in README. Issue reported at upstream (https://github.com/mjoldfield/Arduino-Makefile/issues/21)
|
|
||||||
#
|
|
||||||
# 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,
|
|
||||||
# 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).
|
|
||||||
# - Changed the name of the Debian/Ubuntu package (ex
|
|
||||||
# Scott Howard).
|
|
||||||
# - Only set AVRDUDE_CONF if it's not set (ex Tom Hall).
|
|
||||||
# - Added support for USB_PID/VID used by the Leonardo (ex Dan
|
|
||||||
# Villiom Podlaski Christiansen and Marc Plano-Lesay).
|
|
||||||
#
|
|
||||||
# 0.10.1 15.xii.2012 Sudar
|
|
||||||
# - Merged all changes from Upstream and from https://github.com/rpavlik
|
|
||||||
# - Allow passing extra flags (https://github.com/rpavlik)
|
|
||||||
# - Make listing files more useful (https://github.com/rpavlik)
|
|
||||||
# - Add knowledge of device-specific assembler (https://github.com/rpavlik)
|
|
||||||
# - Use variables instead of hardcoded commands (https://github.com/rpavlik)
|
|
||||||
# - Make disasm more helpful (https://github.com/rpavlik)
|
|
||||||
# - Change .sym output (https://github.com/rpavlik)
|
|
||||||
# - Provide symbol_sizes and generated_assembly targets. (https://github.com/rpavlik)
|
|
||||||
# - Be able to silence configuration output (https://github.com/rpavlik)
|
|
||||||
# - Make everybody depend on the makefile, in case cflags are changed, etc. (https://github.com/rpavlik)
|
|
||||||
# - Make the makefile error if the arduino port is not present. (https://github.com/rpavlik)
|
|
||||||
#
|
|
||||||
# 0.10.2 15.xii.2012 Sudar
|
|
||||||
# - Added sketch size verification. (https://github.com/fornellas)
|
|
||||||
# - Show original line number for error messages (https://github.com/WizenedEE)
|
|
||||||
# - Removed -w from CPPFLAGS to show warnings (https://github.com/gaftech)
|
|
||||||
# - Changed shebang to use /usr/bin/env (https://github.com/anm)
|
|
||||||
# - set USB_VID and USB_PID only for leonardo boards(https://github.com/alohr)
|
|
||||||
#
|
|
||||||
# 0.10.3 16.xii 2012 gaftech
|
|
||||||
# - Enabling creation of EEPROM file (.eep)
|
|
||||||
# - EEPROM upload: eeprom and raw_eeprom targets
|
|
||||||
# - Auto EEPROM upload with isp mode: ISP_EEPROM option.
|
|
||||||
# - Allow custom OBJDIR
|
|
||||||
#
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
|
@ -340,10 +209,16 @@ dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
|
||||||
# the number of bytes indicated by the second argument.
|
# the number of bytes indicated by the second argument.
|
||||||
space_pad_to = $(shell echo $(1) " " | head -c$(2))
|
space_pad_to = $(shell echo $(1) " " | head -c$(2))
|
||||||
|
|
||||||
ifndef ARDUINO_QUIET
|
|
||||||
arduino_output = $(info $(1))
|
|
||||||
else
|
|
||||||
arduino_output =
|
arduino_output =
|
||||||
|
# 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
|
||||||
|
# regenerating the dependency file), then output the configuration.
|
||||||
|
ifndef ARDUINO_QUIET
|
||||||
|
ifeq ($(MAKE_RESTARTS),)
|
||||||
|
ifeq ($(MAKELEVEL),0)
|
||||||
|
arduino_output = $(info $(1))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
|
# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
|
||||||
|
@ -356,7 +231,6 @@ show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2))
|
||||||
# Just a nice simple visual separator
|
# Just a nice simple visual separator
|
||||||
show_separator = $(call arduino_output,-------------------------)
|
show_separator = $(call arduino_output,-------------------------)
|
||||||
|
|
||||||
|
|
||||||
$(call show_separator)
|
$(call show_separator)
|
||||||
$(call arduino_output,Arduino.mk Configuration:)
|
$(call arduino_output,Arduino.mk Configuration:)
|
||||||
|
|
||||||
|
@ -375,7 +249,7 @@ endif
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
# Default TARGET to cwd (ex Daniele Vergini)
|
# Default TARGET to pwd (ex Daniele Vergini)
|
||||||
ifndef TARGET
|
ifndef TARGET
|
||||||
TARGET = $(notdir $(CURDIR))
|
TARGET = $(notdir $(CURDIR))
|
||||||
endif
|
endif
|
||||||
|
@ -383,10 +257,10 @@ endif
|
||||||
########################################################################
|
########################################################################
|
||||||
# Arduino version number
|
# Arduino version number
|
||||||
ifndef ARDUINO_VERSION
|
ifndef ARDUINO_VERSION
|
||||||
|
|
||||||
# Remove all the decimals, and right-pad with zeros, and finally grab the first 3 bytes.
|
# Remove all the decimals, and right-pad with zeros, and finally grab the first 3 bytes.
|
||||||
# Works for 1.0 and 1.0.1
|
# Works for 1.0 and 1.0.1
|
||||||
AUTO_ARDUINO_VERSION := $(shell cat $(ARDUINO_DIR)/lib/version.txt | sed -e 's/[.]//g' -e 's/$$/0000/' | head -c3)
|
VERSION_FILE := $(ARDUINO_DIR)/lib/version.txt
|
||||||
|
AUTO_ARDUINO_VERSION := $(shell [ -e $(VERSION_FILE) ] && cat $(VERSION_FILE) | sed -e 's/[.]//g' -e 's/$$/0000/' | head -c3)
|
||||||
ifdef AUTO_ARDUINO_VERSION
|
ifdef AUTO_ARDUINO_VERSION
|
||||||
ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION)
|
ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION)
|
||||||
$(call show_config_variable,ARDUINO_VERSION,[AUTODETECTED])
|
$(call show_config_variable,ARDUINO_VERSION,[AUTODETECTED])
|
||||||
|
@ -420,14 +294,19 @@ ifdef ARDUINO_DIR
|
||||||
endif # BUNDLED_AVR_TOOLS_DIR
|
endif # BUNDLED_AVR_TOOLS_DIR
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
$(call show_config_variable,AVR_TOOLS_DIR)
|
$(call show_config_variable,AVR_TOOLS_DIR)
|
||||||
endif #ndef AVR_TOOLS_DIR
|
endif #ndef AVR_TOOLS_DIR
|
||||||
|
|
||||||
ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
|
ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
|
||||||
$(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
|
$(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
|
||||||
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
|
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
|
||||||
|
|
||||||
|
ifndef ARDUINO_VAR_PATH
|
||||||
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/arduino/variants
|
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/arduino/variants
|
||||||
|
$(call show_config_variable,ARDUINO_VAR_PATH,[COMPUTED],(from ARDUINO_DIR))
|
||||||
|
else
|
||||||
|
$(call show_config_variable,ARDUINO_VAR_PATH,[USER])
|
||||||
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
@ -436,11 +315,9 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef AVR_TOOLS_DIR
|
ifdef AVR_TOOLS_DIR
|
||||||
|
|
||||||
ifndef AVR_TOOLS_PATH
|
ifndef AVR_TOOLS_PATH
|
||||||
AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin
|
AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -467,7 +344,7 @@ endif
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Miscellanea
|
# Miscellaneous
|
||||||
#
|
#
|
||||||
ifndef ARDUINO_SKETCHBOOK
|
ifndef ARDUINO_SKETCHBOOK
|
||||||
ifneq ($(wildcard $(HOME)/.arduino/preferences.txt),)
|
ifneq ($(wildcard $(HOME)/.arduino/preferences.txt),)
|
||||||
|
@ -500,32 +377,6 @@ else
|
||||||
$(call show_config_variable,USER_LIB_PATH)
|
$(call show_config_variable,USER_LIB_PATH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# Serial monitor (just a screen wrapper)
|
|
||||||
#
|
|
||||||
# Quite how to construct the monitor command seems intimately tied
|
|
||||||
# to the command we're using (here screen). So, read the screen docs
|
|
||||||
# for more information (search for 'character special device').
|
|
||||||
#
|
|
||||||
ifndef MONITOR_BAUDRATE
|
|
||||||
#This works only in linux. TODO: Port it to MAC OS also
|
|
||||||
SPEED = $(shell grep --max-count=1 --regexp="Serial.begin" $$(ls -1 *.ino) | sed -e 's/\t//g' -e 's/\/\/.*$$//g' -e 's/(/\t/' -e 's/)/\t/' | awk -F '\t' '{print $$2}' )
|
|
||||||
MONITOR_BAUDRATE = $(findstring $(SPEED),300 1200 2400 4800 9600 14400 19200 28800 38400 57600 115200)
|
|
||||||
|
|
||||||
ifeq ($(MONITOR_BAUDRATE),)
|
|
||||||
MONITOR_BAUDRATE = 9600
|
|
||||||
$(call show_config_variable,MONITOR_BAUDRATE,[ASSUMED])
|
|
||||||
else
|
|
||||||
$(call show_config_variable,MONITOR_BAUDRATE,[DETECTED], (in sketch))
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
$(call show_config_variable,MONITOR_BAUDRATE, [SPECIFIED])
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef MONITOR_CMD
|
|
||||||
MONITOR_CMD = screen
|
|
||||||
endif
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Reset
|
# Reset
|
||||||
#
|
#
|
||||||
|
@ -598,11 +449,11 @@ endif
|
||||||
ifeq ($(VARIANT),leonardo)
|
ifeq ($(VARIANT),leonardo)
|
||||||
# USB IDs for the Leonardo
|
# USB IDs for the Leonardo
|
||||||
ifndef USB_VID
|
ifndef USB_VID
|
||||||
USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid)
|
USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid 2>/dev/null)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef USB_PID
|
ifndef USB_PID
|
||||||
USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid)
|
USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid 2>/dev/null)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -662,8 +513,10 @@ LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o) $(LOCAL_CPP_SRCS:.cpp=.o) \
|
||||||
$(LOCAL_INO_SRCS:.ino=.o) $(LOCAL_AS_SRCS:.S=.o)
|
$(LOCAL_INO_SRCS:.ino=.o) $(LOCAL_AS_SRCS:.S=.o)
|
||||||
LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
|
LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
|
||||||
|
|
||||||
# Dependency files
|
ifneq ($(words $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS)), 1)
|
||||||
DEPS = $(LOCAL_OBJS:.o=.d)
|
#TODO: Support more than one file. https://github.com/sudar/Arduino-Makefile/issues/49
|
||||||
|
$(error Need exactly one .pde or .ino file)
|
||||||
|
endif
|
||||||
|
|
||||||
# core sources
|
# core sources
|
||||||
ifeq ($(strip $(NO_CORE)),)
|
ifeq ($(strip $(NO_CORE)),)
|
||||||
|
@ -695,6 +548,46 @@ ifndef ARDUINO_LIBS
|
||||||
$(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS)))
|
$(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Serial monitor (just a screen wrapper)
|
||||||
|
#
|
||||||
|
# Quite how to construct the monitor command seems intimately tied
|
||||||
|
# to the command we're using (here screen). So, read the screen docs
|
||||||
|
# for more information (search for 'character special device').
|
||||||
|
#
|
||||||
|
ifndef MONITOR_BAUDRATE
|
||||||
|
# This works only in linux. TODO: Port it to MAC OS also
|
||||||
|
# https://github.com/sudar/Arduino-Makefile/issues/52
|
||||||
|
SPEED = $(shell grep --max-count=1 --regexp="Serial.begin" $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS) | sed -e 's/\t//g' -e 's/\/\/.*$$//g' -e 's/(/\t/' -e 's/)/\t/' | awk -F '\t' '{print $$2}' )
|
||||||
|
MONITOR_BAUDRATE = $(findstring $(SPEED),300 1200 2400 4800 9600 14400 19200 28800 38400 57600 115200)
|
||||||
|
|
||||||
|
ifeq ($(MONITOR_BAUDRATE),)
|
||||||
|
MONITOR_BAUDRATE = 9600
|
||||||
|
$(call show_config_variable,MONITOR_BAUDRATE,[ASSUMED])
|
||||||
|
else
|
||||||
|
$(call show_config_variable,MONITOR_BAUDRATE,[DETECTED], (in sketch))
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(call show_config_variable,MONITOR_BAUDRATE, [SPECIFIED])
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef MONITOR_CMD
|
||||||
|
MONITOR_CMD = screen
|
||||||
|
endif
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Include file to use for old .pde files
|
||||||
|
#
|
||||||
|
ifndef ARDUINO_HEADER
|
||||||
|
# We should check for Arduino version, if the file is .pde because a
|
||||||
|
# .pde file might be used in Arduino 1.0
|
||||||
|
ifeq ($(shell expr $(ARDUINO_VERSION) '<' 100), 1)
|
||||||
|
ARDUINO_HEADER=WProgram.h
|
||||||
|
else
|
||||||
|
ARDUINO_HEADER=Arduino.h
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Rules for making stuff
|
# Rules for making stuff
|
||||||
#
|
#
|
||||||
|
@ -706,9 +599,6 @@ TARGET_EEP = $(OBJDIR)/$(TARGET).eep
|
||||||
TARGETS = $(OBJDIR)/$(TARGET).*
|
TARGETS = $(OBJDIR)/$(TARGET).*
|
||||||
CORE_LIB = $(OBJDIR)/libcore.a
|
CORE_LIB = $(OBJDIR)/libcore.a
|
||||||
|
|
||||||
# A list of dependencies
|
|
||||||
DEP_FILE = $(OBJDIR)/depends.mk
|
|
||||||
|
|
||||||
# Names of executables
|
# Names of executables
|
||||||
CC = $(AVR_TOOLS_PATH)/avr-gcc
|
CC = $(AVR_TOOLS_PATH)/avr-gcc
|
||||||
CXX = $(AVR_TOOLS_PATH)/avr-g++
|
CXX = $(AVR_TOOLS_PATH)/avr-g++
|
||||||
|
@ -750,12 +640,20 @@ LIB_OBJS = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(LIB_C_SR
|
||||||
USER_LIB_OBJS = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(USER_LIB_CPP_SRCS)) \
|
USER_LIB_OBJS = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(USER_LIB_CPP_SRCS)) \
|
||||||
$(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(USER_LIB_C_SRCS))
|
$(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(USER_LIB_C_SRCS))
|
||||||
|
|
||||||
|
# Dependency files
|
||||||
|
DEPS = $(LOCAL_OBJS:.o=.d) $(LIB_OBJS:.o=.d) $(USER_LIB_OBJS:.o=.d) $(CORE_OBJS:.o=.d)
|
||||||
|
|
||||||
# Using += instead of =, so that CPPFLAGS can be set per sketch level
|
# Using += instead of =, so that CPPFLAGS can be set per sketch level
|
||||||
CPPFLAGS += -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \
|
CPPFLAGS += -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \
|
||||||
-I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \
|
-I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \
|
||||||
$(SYS_INCLUDES) $(USER_INCLUDES) -g -Os -Wall \
|
$(SYS_INCLUDES) $(USER_INCLUDES) -g -Os -Wall \
|
||||||
-DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID) \
|
|
||||||
-ffunction-sections -fdata-sections
|
-ffunction-sections -fdata-sections
|
||||||
|
|
||||||
|
# USB IDs for the Leonardo
|
||||||
|
ifeq ($(VARIANT),leonardo)
|
||||||
|
CPPFLAGS += -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID)
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS += -std=gnu99 $(EXTRA_FLAGS) $(EXTRA_CFLAGS)
|
CFLAGS += -std=gnu99 $(EXTRA_FLAGS) $(EXTRA_CFLAGS)
|
||||||
CXXFLAGS += -fno-exceptions $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS)
|
CXXFLAGS += -fno-exceptions $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS)
|
||||||
ASFLAGS += -mmcu=$(MCU) -I. -x assembler-with-cpp
|
ASFLAGS += -mmcu=$(MCU) -I. -x assembler-with-cpp
|
||||||
|
@ -778,11 +676,11 @@ else
|
||||||
$(call show_config_info,Size utility: Basic (not AVR-aware),[AUTODETECTED])
|
$(call show_config_info,Size utility: Basic (not AVR-aware),[AUTODETECTED])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq (,$(strip $(ARDUINO_LIBS)))
|
ifneq (,$(strip $(ARDUINO_LIBS)))
|
||||||
$(call arduino_output,-)
|
$(call arduino_output,-)
|
||||||
$(call show_config_info,ARDUINO_LIBS =)
|
$(call show_config_info,ARDUINO_LIBS =)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(strip $(USER_LIB_NAMES)))
|
ifneq (,$(strip $(USER_LIB_NAMES)))
|
||||||
$(foreach lib,$(USER_LIB_NAMES),$(call show_config_info, $(lib),[USER]))
|
$(foreach lib,$(USER_LIB_NAMES),$(call show_config_info, $(lib),[USER]))
|
||||||
endif
|
endif
|
||||||
|
@ -794,7 +692,6 @@ endif
|
||||||
# end of config output
|
# end of config output
|
||||||
$(call show_separator)
|
$(call show_separator)
|
||||||
|
|
||||||
|
|
||||||
# Implicit rules for building everything (needed to get everything in
|
# Implicit rules for building everything (needed to get everything in
|
||||||
# the right directory)
|
# the right directory)
|
||||||
#
|
#
|
||||||
|
@ -804,87 +701,61 @@ $(call show_separator)
|
||||||
# easy to change the build options in future
|
# easy to change the build options in future
|
||||||
|
|
||||||
# library sources
|
# library sources
|
||||||
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.c
|
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.c | $(OBJDIR)
|
||||||
mkdir -p $(dir $@)
|
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp
|
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp | $(OBJDIR)
|
||||||
mkdir -p $(dir $@)
|
$(CC) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
$(CC) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
|
||||||
|
|
||||||
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.cpp
|
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.cpp | $(OBJDIR)
|
||||||
mkdir -p $(dir $@)
|
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.c
|
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.c | $(OBJDIR)
|
||||||
mkdir -p $(dir $@)
|
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
||||||
|
ifdef COMMON_DEPS
|
||||||
|
COMMON_DEPS := $(COMMON_DEPS) Makefile
|
||||||
|
else
|
||||||
|
COMMON_DEPS := Makefile
|
||||||
|
endif
|
||||||
|
|
||||||
# normal local sources
|
# normal local sources
|
||||||
# .o rules are for objects, .d for dependency tracking
|
$(OBJDIR)/%.o: %.c $(COMMON_DEPS) | $(OBJDIR)
|
||||||
# there seems to be an awful lot of duplication here!!!
|
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||||
COMMON_DEPS := Makefile
|
|
||||||
$(OBJDIR)/%.o: %.c $(COMMON_DEPS)
|
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.cc $(COMMON_DEPS)
|
$(OBJDIR)/%.o: %.cc $(COMMON_DEPS) | $(OBJDIR)
|
||||||
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.cpp $(COMMON_DEPS)
|
$(OBJDIR)/%.o: %.cpp $(COMMON_DEPS) | $(OBJDIR)
|
||||||
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.S $(COMMON_DEPS)
|
$(OBJDIR)/%.o: %.S $(COMMON_DEPS) | $(OBJDIR)
|
||||||
|
$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o: %.s $(COMMON_DEPS) | $(OBJDIR)
|
||||||
$(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
|
$(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.s $(COMMON_DEPS)
|
# the pde -> o file
|
||||||
$(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
|
$(OBJDIR)/%.o: %.pde | $(OBJDIR)
|
||||||
|
$(CXX) -x c++ -include $(ARDUINO_HEADER) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/%.d: %.c $(COMMON_DEPS)
|
# the ino -> o file
|
||||||
$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
$(OBJDIR)/%.o: %.ino | $(OBJDIR)
|
||||||
|
$(CXX) -x c++ -include Arduino.h -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
$(OBJDIR)/%.d: %.cc $(COMMON_DEPS)
|
|
||||||
$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
|
||||||
|
|
||||||
$(OBJDIR)/%.d: %.cpp $(COMMON_DEPS)
|
|
||||||
$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
|
||||||
|
|
||||||
$(OBJDIR)/%.d: %.S $(COMMON_DEPS)
|
|
||||||
$(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
|
||||||
|
|
||||||
$(OBJDIR)/%.d: %.s $(COMMON_DEPS)
|
|
||||||
$(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
|
||||||
|
|
||||||
#backward compatibility for .pde files
|
|
||||||
# We should check for Arduino version, if the file is .pde because a .pde file might be used in Arduino 1.0
|
|
||||||
# the pde -> cpp -> o file
|
|
||||||
$(OBJDIR)/%.cpp: %.pde $(COMMON_DEPS)
|
|
||||||
$(ECHO) '#if ARDUINO >= 100\n #include "Arduino.h"\n#else\n #include "WProgram.h"\n#endif\n#line 1' > $@
|
|
||||||
$(CAT) $< >> $@
|
|
||||||
|
|
||||||
# the ino -> cpp -> o file
|
|
||||||
$(OBJDIR)/%.cpp: %.ino $(COMMON_DEPS)
|
|
||||||
$(ECHO) '#include <Arduino.h>\n#line 1' > $@
|
|
||||||
$(CAT) $< >> $@
|
|
||||||
|
|
||||||
$(OBJDIR)/%.o: $(OBJDIR)/%.cpp $(COMMON_DEPS)
|
|
||||||
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
|
||||||
|
|
||||||
$(OBJDIR)/%.d: $(OBJDIR)/%.cpp $(COMMON_DEPS)
|
|
||||||
$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
|
|
||||||
|
|
||||||
# generated assembly
|
# generated assembly
|
||||||
$(OBJDIR)/%.s: $(OBJDIR)/%.cpp $(COMMON_DEPS)
|
$(OBJDIR)/%.s: $(OBJDIR)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
|
||||||
$(CXX) -S -fverbose-asm $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -S -fverbose-asm $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
#$(OBJDIR)/%.lst: $(OBJDIR)/%.s
|
#$(OBJDIR)/%.lst: $(OBJDIR)/%.s
|
||||||
# $(AS) -mmcu=$(MCU) -alhnd $< > $@
|
# $(AS) -mmcu=$(MCU) -alhnd $< > $@
|
||||||
|
|
||||||
# core files
|
# core files
|
||||||
$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS)
|
$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS)
|
$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
|
||||||
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
# various object conversions
|
# various object conversions
|
||||||
$(OBJDIR)/%.hex: $(OBJDIR)/%.elf $(COMMON_DEPS)
|
$(OBJDIR)/%.hex: $(OBJDIR)/%.elf $(COMMON_DEPS)
|
||||||
|
@ -915,8 +786,11 @@ ifndef AVRDUDE_CONF
|
||||||
ifndef AVR_TOOLS_DIR
|
ifndef AVR_TOOLS_DIR
|
||||||
# The avrdude bundled with Arduino can't find its config
|
# The avrdude bundled with Arduino can't find its config
|
||||||
AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf
|
AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf
|
||||||
|
# in the recent arduino distribution (I don't know when),
|
||||||
|
# the conf file is no longer put in
|
||||||
|
# AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
|
||||||
endif
|
endif
|
||||||
# If avrdude is installed separately, it can find its own config flie
|
# If avrdude is installed separately, it can find its own config file
|
||||||
endif
|
endif
|
||||||
|
|
||||||
AVRDUDE_COM_OPTS = -q -V -p $(MCU)
|
AVRDUDE_COM_OPTS = -q -V -p $(MCU)
|
||||||
|
@ -944,6 +818,7 @@ endif
|
||||||
AVRDUDE_UPLOAD_HEX = -U flash:w:$(TARGET_HEX):i
|
AVRDUDE_UPLOAD_HEX = -U flash:w:$(TARGET_HEX):i
|
||||||
AVRDUDE_UPLOAD_EEP = -U eeprom:w:$(TARGET_EEP):i
|
AVRDUDE_UPLOAD_EEP = -U eeprom:w:$(TARGET_EEP):i
|
||||||
AVRDUDE_ISPLOAD_OPTS = $(AVRDUDE_UPLOAD_HEX)
|
AVRDUDE_ISPLOAD_OPTS = $(AVRDUDE_UPLOAD_HEX)
|
||||||
|
|
||||||
ifneq ($(ISP_EEPROM), 0)
|
ifneq ($(ISP_EEPROM), 0)
|
||||||
AVRDUDE_ISPLOAD_OPTS += $(AVRDUDE_UPLOAD_EEP)
|
AVRDUDE_ISPLOAD_OPTS += $(AVRDUDE_UPLOAD_EEP)
|
||||||
endif
|
endif
|
||||||
|
@ -953,8 +828,14 @@ endif
|
||||||
# Explicit targets start here
|
# Explicit targets start here
|
||||||
#
|
#
|
||||||
|
|
||||||
all: $(OBJDIR) $(TARGET_EEP) $(TARGET_HEX) verify_size
|
all: $(TARGET_EEP) $(TARGET_HEX) verify_size
|
||||||
|
|
||||||
|
# Rule to create $(OBJDIR) automatically. All rules with recipes that
|
||||||
|
# create a file within it, but do not already depend on a file within it
|
||||||
|
# should depend on this rule. They should use a "order-only
|
||||||
|
# prerequisite" (e.g., put "| $(OBJDIR)" at the end of the prerequisite
|
||||||
|
# list) to prevent remaking the target when any file in the directory
|
||||||
|
# changes.
|
||||||
$(OBJDIR):
|
$(OBJDIR):
|
||||||
mkdir $(OBJDIR)
|
mkdir $(OBJDIR)
|
||||||
|
|
||||||
|
@ -964,41 +845,64 @@ $(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
|
||||||
$(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(USER_LIB_OBJS)
|
$(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(USER_LIB_OBJS)
|
||||||
$(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(USER_LIB_OBJS)
|
$(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(USER_LIB_OBJS)
|
||||||
|
|
||||||
$(DEP_FILE): $(OBJDIR) $(DEPS)
|
|
||||||
cat $(DEPS) > $(DEP_FILE)
|
|
||||||
|
|
||||||
error_on_leonardo:
|
error_on_leonardo:
|
||||||
$(ERROR_ON_LEONARDO)
|
$(ERROR_ON_LEONARDO)
|
||||||
|
|
||||||
%supload: $(TARGET_HEX) verify_size
|
upload: $(TARGET_HEX) verify_size
|
||||||
sudo $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
# Use submake so we can guarantee the reset happens
|
||||||
$(AVRDUDE_UPLOAD_HEX)
|
# before the upload, even with make -j
|
||||||
|
$(MAKE) reset
|
||||||
|
$(MAKE) do_upload
|
||||||
|
|
||||||
%upload: $(TARGET_HEX) verify_size
|
raw_upload: $(TARGET_HEX) verify_size
|
||||||
|
$(MAKE) error_on_leonardo
|
||||||
|
$(MAKE) do_upload
|
||||||
|
|
||||||
|
sudo_upload: $(TARGET_HEX) verify_size
|
||||||
|
$(MAKE) reset
|
||||||
|
$(MAKE) do_sudo_upload
|
||||||
|
|
||||||
|
raw_sudo_upload: $(TARGET_HEX) verify_size
|
||||||
|
$(MAKE) error_on_leonardo
|
||||||
|
$(MAKE) do_sudo_upload
|
||||||
|
|
||||||
|
do_upload:
|
||||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
||||||
$(AVRDUDE_UPLOAD_HEX)
|
$(AVRDUDE_UPLOAD_HEX)
|
||||||
|
|
||||||
|
# for people who failed to give the permission
|
||||||
|
# even if he set udev correctly. Obviously the dirty mean,
|
||||||
|
# but some people do wan't this feature.
|
||||||
|
# I DO build on my desktop, however not on my laptop (TP-X61),
|
||||||
|
# with the same udev config and the same Arduino-Makefile.
|
||||||
|
# So I gave up and decided to introduce this target.
|
||||||
|
do_sudo_upload:
|
||||||
|
sudo $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
||||||
|
$(AVRDUDE_UPLOAD_HEX)
|
||||||
|
|
||||||
upload: reset %upload
|
do_eeprom: $(TARGET_EEP) $(TARGET_HEX)
|
||||||
raw_upload: error_on_leonardo %upload
|
|
||||||
sudo_upload: reset %supload
|
|
||||||
raw_sudo_upload: error_on_leonardo %supload
|
|
||||||
|
|
||||||
%eeprom: $(TARGET_EEP) $(TARGET_HEX)
|
|
||||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
||||||
$(AVRDUDE_UPLOAD_EEP)
|
$(AVRDUDE_UPLOAD_EEP)
|
||||||
|
|
||||||
%seeprom: $(TARGET_EEP) $(TARGET_HEX)
|
do_sudo_eeprom: $(TARGET_EEP) $(TARGET_HEX)
|
||||||
sudo $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
sudo $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
|
||||||
$(AVRDUDE_UPLOAD_EEP)
|
$(AVRDUDE_UPLOAD_EEP)
|
||||||
|
|
||||||
eeprom: reset %eeprom
|
eeprom: $(TARGET_HEX) verify_size
|
||||||
|
$(MAKE) reset
|
||||||
|
$(MAKE) do_eeprom
|
||||||
|
|
||||||
raw_eeprom: error_on_leonardo %eeprom
|
raw_eeprom: $(TARGET_HEX) verify_size
|
||||||
|
$(MAKE) error_on_leonardo
|
||||||
|
$(MAKE) do_eeprom
|
||||||
|
|
||||||
sudo_eeprom: reset %seeprom
|
sudo_eeprom: $(TARGET_HEX) verify_size
|
||||||
|
$(MAKE) reset
|
||||||
|
$(MAKE) do_sudo_eeprom
|
||||||
|
|
||||||
raw_sudo_eeprom: error_on_leonardo %seeprom
|
raw_sudo_eeprom: $(TARGET_HEX) verify_size
|
||||||
|
$(MAKE) error_on_leonardo
|
||||||
|
$(MAKE) do_sudo_eeprom
|
||||||
|
|
||||||
# the last part is for leonardo.
|
# the last part is for leonardo.
|
||||||
# wait until leonardo reboots and establish a new connection.
|
# wait until leonardo reboots and establish a new connection.
|
||||||
|
@ -1030,12 +934,9 @@ ispload: $(TARGET_EEP) $(TARGET_HEX) verify_size
|
||||||
-U lock:w:$(ISP_LOCK_FUSE_POST):m
|
-U lock:w:$(ISP_LOCK_FUSE_POST):m
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(REMOVE) $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) $(CORE_LIB) $(TARGETS) $(DEP_FILE) $(DEPS) $(USER_LIB_OBJS) ${OBJDIR}
|
$(REMOVE) $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) $(CORE_LIB) $(TARGETS) $(DEPS) $(USER_LIB_OBJS) ${OBJDIR}
|
||||||
|
|
||||||
depends: $(DEPS)
|
size: $(TARGET_HEX)
|
||||||
$(CAT) $(DEPS) > $(DEP_FILE)
|
|
||||||
|
|
||||||
size: $(OBJDIR) $(TARGET_HEX)
|
|
||||||
$(call avr_size,$(TARGET_ELF),$(TARGET_HEX))
|
$(call avr_size,$(TARGET_ELF),$(TARGET_HEX))
|
||||||
|
|
||||||
show_boards:
|
show_boards:
|
||||||
|
@ -1062,6 +963,4 @@ generated_assembly: $(OBJDIR)/$(TARGET).s
|
||||||
.PHONY: all upload raw_upload sudo_upload raw_sudo_upload raw_eeprom sudo_eeprom raw_sudo_eeprom error_on_leonardo reset reset_stty ispload clean depends size show_boards monitor disasm symbol_sizes generated_assembly verify_size
|
.PHONY: all upload raw_upload sudo_upload raw_sudo_upload raw_eeprom sudo_eeprom raw_sudo_eeprom error_on_leonardo reset reset_stty ispload clean depends size show_boards monitor disasm symbol_sizes generated_assembly verify_size
|
||||||
|
|
||||||
# added - in the beginning, so that we don't get an error if the file is not present
|
# added - in the beginning, so that we don't get an error if the file is not present
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
-include $(DEPS)
|
||||||
-include $(DEP_FILE)
|
|
||||||
endif
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ use Getopt::Long;
|
||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
use YAML;
|
use YAML;
|
||||||
|
|
||||||
|
# TODO: If you writing an installation script or a package for the makefile,
|
||||||
|
# then you might want to replace the below path based on the environment.
|
||||||
|
# More discussion at https://github.com/sudar/Arduino-Makefile/issues/50
|
||||||
my %Opt =
|
my %Opt =
|
||||||
(
|
(
|
||||||
boards_txt => '/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/boards.txt',
|
boards_txt => '/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/boards.txt',
|
||||||
|
|
Loading…
Reference in a new issue