arduino-mk 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +60 -0
- data/lib/arduino-mk.rb +10 -0
- data/lib/arduino-mk/base.rb +61 -0
- data/lib/arduino-mk/error_improver.rb +42 -0
- data/lib/arduino-mk/makefile/runner.rb +23 -0
- data/lib/arduino-mk/makefile/template.rb +27 -0
- data/lib/arduino-mk/null_project.rb +5 -0
- data/lib/arduino-mk/null_project/null.c +1 -0
- data/lib/arduino-mk/option_parser.rb +35 -0
- data/lib/arduino-mk/project_copier.rb +9 -0
- data/vendor/Arduino-Makefile/Arduino.mk +1306 -0
- data/vendor/Arduino-Makefile/CONTRIBUTING.md +35 -0
- data/vendor/Arduino-Makefile/Common.mk +46 -0
- data/vendor/Arduino-Makefile/HISTORY.md +225 -0
- data/vendor/Arduino-Makefile/README.md +189 -0
- data/vendor/Arduino-Makefile/ard-reset-arduino.1 +48 -0
- data/vendor/Arduino-Makefile/arduino-mk-vars.md +1101 -0
- data/vendor/Arduino-Makefile/bin/ard-reset-arduino +38 -0
- data/vendor/Arduino-Makefile/chipKIT.mk +109 -0
- data/vendor/Arduino-Makefile/examples/ATtinyBlink/ATtinyBlink.ino +23 -0
- data/vendor/Arduino-Makefile/examples/ATtinyBlink/Makefile +13 -0
- data/vendor/Arduino-Makefile/examples/AnalogInOutSerial/AnalogInOutSerial.ino +53 -0
- data/vendor/Arduino-Makefile/examples/AnalogInOutSerial/Makefile +4 -0
- data/vendor/Arduino-Makefile/examples/Blink/Blink.ino +19 -0
- data/vendor/Arduino-Makefile/examples/Blink/Makefile +5 -0
- data/vendor/Arduino-Makefile/examples/BlinkChipKIT/BlinkChipKIT.pde +19 -0
- data/vendor/Arduino-Makefile/examples/BlinkChipKIT/Makefile +5 -0
- data/vendor/Arduino-Makefile/examples/BlinkInAVRC/Makefile +16 -0
- data/vendor/Arduino-Makefile/examples/BlinkInAVRC/blink.c +38 -0
- data/vendor/Arduino-Makefile/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino +65 -0
- data/vendor/Arduino-Makefile/examples/BlinkWithoutDelay/Makefile +4 -0
- data/vendor/Arduino-Makefile/examples/Fade/Fade.ino +31 -0
- data/vendor/Arduino-Makefile/examples/Fade/Makefile +4 -0
- data/vendor/Arduino-Makefile/examples/HelloWorld/HelloWorld.ino +58 -0
- data/vendor/Arduino-Makefile/examples/HelloWorld/Makefile +4 -0
- data/vendor/Arduino-Makefile/examples/MakefileExample/Makefile-example.mk +55 -0
- data/vendor/Arduino-Makefile/examples/README.md +7 -0
- data/vendor/Arduino-Makefile/examples/TinySoftWareSerial/Makefile +14 -0
- data/vendor/Arduino-Makefile/examples/TinySoftWareSerial/TinySoftwareSerial.ino +12 -0
- data/vendor/Arduino-Makefile/examples/WebServer/Makefile +6 -0
- data/vendor/Arduino-Makefile/examples/WebServer/WebServer.ino +82 -0
- data/vendor/Arduino-Makefile/examples/master_reader/Makefile +6 -0
- data/vendor/Arduino-Makefile/examples/master_reader/master_reader.ino +32 -0
- data/vendor/Arduino-Makefile/examples/toneMelody/Makefile +4 -0
- data/vendor/Arduino-Makefile/examples/toneMelody/pitches.h +95 -0
- data/vendor/Arduino-Makefile/examples/toneMelody/toneMelody.ino +49 -0
- data/vendor/Arduino-Makefile/licence.txt +502 -0
- data/vendor/Arduino-Makefile/packaging/debian/README.md +23 -0
- data/vendor/Arduino-Makefile/packaging/fedora/README.md +39 -0
- data/vendor/Arduino-Makefile/packaging/fedora/arduino-mk.spec +70 -0
- metadata +110 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
# Contributing To Arduino Makefile
|
2
|
+
|
3
|
+
Community made patches, localizations, bug reports, documentation and contributions are always welcome and are crucial to the success of this project.
|
4
|
+
|
5
|
+
When contributing please ensure you follow the guidelines below so that we can keep on top of things.
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
Submit a ticket for your issue, assuming one does not already exist.
|
10
|
+
|
11
|
+
- Raise it on our [Issue Tracker](https://github.com/sudar/Arduino-Makefile/issues)
|
12
|
+
- Clearly describe the issue including steps to reproduce the bug.
|
13
|
+
- Make sure you fill in the earliest version that you know has the issue as well as the following
|
14
|
+
- Your operating system (Mac, Linux/Unix, Windows)
|
15
|
+
- Your Arduino IDE version
|
16
|
+
- Snippet of your makefile
|
17
|
+
|
18
|
+
## Making Changes
|
19
|
+
|
20
|
+
- Fork the repository on GitHub
|
21
|
+
- Make the changes to your forked repository
|
22
|
+
- Update the [changelog file](HISTORY.md) and add a note about your change. If possible prefix it with either Fix, Tweak or New
|
23
|
+
- If you are adding or changing the behavior of any variable, then update the corresponding documentation in the [arduino-mk-vars.md](arduino-mk-vars.md) file as well
|
24
|
+
- When committing, reference your issue (if present) and include a note about the fix
|
25
|
+
- If possible (and if makes sense) do atomic commits
|
26
|
+
- Try to follow [this guideline](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) while choosing the git commit message
|
27
|
+
- Push the changes to your fork and submit a pull request to the 'master' branch of the this repository
|
28
|
+
|
29
|
+
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
|
30
|
+
|
31
|
+
# Additional Resources
|
32
|
+
|
33
|
+
- [General GitHub Documentation](http://help.github.com/)
|
34
|
+
- [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/)
|
35
|
+
- [Guide about contributing code in GitHub](http://sudarmuthu.com/blog/contributing-to-project-hosted-in-github)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Useful functions
|
2
|
+
# Returns the first argument (typically a directory), if the file or directory
|
3
|
+
# named by concatenating the first and optionally second argument
|
4
|
+
# (directory and optional filename) exists
|
5
|
+
dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
|
6
|
+
|
7
|
+
# Run a shell script if it exists. Stops make on error.
|
8
|
+
runscript_if_exists = \
|
9
|
+
$(if $(wildcard $(1)), \
|
10
|
+
$(if $(findstring 0, \
|
11
|
+
$(lastword $(shell $(abspath $(wildcard $(1))); echo $$?))), \
|
12
|
+
$(info Info: $(1) success), \
|
13
|
+
$(error ERROR: $(1) failed)))
|
14
|
+
|
15
|
+
# For message printing: pad the right side of the first argument with spaces to
|
16
|
+
# the number of bytes indicated by the second argument.
|
17
|
+
space_pad_to = $(shell echo $(1) " " | head -c$(2))
|
18
|
+
|
19
|
+
# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
|
20
|
+
show_config_info = $(call arduino_output,- $(call space_pad_to,$(2),20) $(1))
|
21
|
+
|
22
|
+
# Call with the name of the variable, a prefix tag if desired (like [AUTODETECTED]),
|
23
|
+
# and an explanation if desired (like (found in $$PATH)
|
24
|
+
show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2))
|
25
|
+
|
26
|
+
# Just a nice simple visual separator
|
27
|
+
show_separator = $(call arduino_output,-------------------------)
|
28
|
+
|
29
|
+
$(call show_separator)
|
30
|
+
$(call arduino_output,Arduino.mk Configuration:)
|
31
|
+
|
32
|
+
########################################################################
|
33
|
+
#
|
34
|
+
# Detect OS
|
35
|
+
ifeq ($(OS),Windows_NT)
|
36
|
+
CURRENT_OS = WINDOWS
|
37
|
+
else
|
38
|
+
UNAME_S := $(shell uname -s)
|
39
|
+
ifeq ($(UNAME_S),Linux)
|
40
|
+
CURRENT_OS = LINUX
|
41
|
+
endif
|
42
|
+
ifeq ($(UNAME_S),Darwin)
|
43
|
+
CURRENT_OS = MAC
|
44
|
+
endif
|
45
|
+
endif
|
46
|
+
$(call show_config_variable,CURRENT_OS,[AUTODETECTED])
|
@@ -0,0 +1,225 @@
|
|
1
|
+
A Makefile for Arduino Sketches
|
2
|
+
===============================
|
3
|
+
|
4
|
+
The following is the rough list of changes that went into different versions.
|
5
|
+
I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
|
6
|
+
|
7
|
+
### 1.3.4 (In development)
|
8
|
+
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)
|
9
|
+
- Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers)
|
10
|
+
- Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz)
|
11
|
+
|
12
|
+
### 1.3.3 (2014-04-12)
|
13
|
+
- Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278)
|
14
|
+
|
15
|
+
### 1.3.2 (2014-04-11)
|
16
|
+
- Fix: Add arduino-mk-vars.md file to RPM SPECfile. (https://github.com/sej7278)
|
17
|
+
- Fix: Add avr-libc/malloc.c and realloc.c to included core files. Fixes issue #163 (https://github.com/sej7278)
|
18
|
+
- Fix: Add "gpio" to the list of isp that don't have a port. (Issue #165, #166) (https://github.com/sej7278)
|
19
|
+
- Fix: Add "-D__PROG_TYPES_COMPAT__" to the avr-g++ compiler flags to match IDE. (https://github.com/sej7278)
|
20
|
+
- New: Create `Makefile-example-mk`, a *real life* `Makefile` example, to be used as a reference. (https://github.com/tinyladi)
|
21
|
+
- Tweak: Add `OBJDIR` to `arduino-mk-vars.md` (https://github.com/tinyladi)
|
22
|
+
- Tweak: *Beautify* `arduino-mk-vars.md` with code blocks. (https://github.com/tinyladi)
|
23
|
+
- Fix: AVR tools paths for chipKIT in Linux. (https://github.com/peplin)
|
24
|
+
- Fix: Consider usb or usb:... to be a valid ISP_PORT (https://github.com/geoffholden)
|
25
|
+
- Add: Add phony target to run pre-build hook script (https://github.com/jrid)
|
26
|
+
- Fix: Add BOOTLOADER_PARENT to `arduino-mk-vars.md` and fixed BOOTLOADER_PATH example. (https://github.com/sej7278)
|
27
|
+
- Tweak: Replace perl reset script with Python script. (https://github.com/sej7278)
|
28
|
+
- Tweak: Made choice of Python2/3 interpreter up to the OS. (https://github.com/peplin)
|
29
|
+
- Tweak: Simplified packaging dependencies. (https://github.com/sej7278)
|
30
|
+
- Tweak: Tweak AVRDUDE conf detection in windows. (https://github.com/EAGMnor)
|
31
|
+
|
32
|
+
### 1.3.1 (2014-02-04)
|
33
|
+
- Fix: BUNDLED_AVR_TOOLS_DIR is now set properly when using only arduino-core and not the whole arduino package. (https://github.com/sej7278)
|
34
|
+
- New: Document all variables that can be overridden. (https://github.com/sej7278)
|
35
|
+
- New: Add a new `help_vars` target to display information about variables that can be overridden.
|
36
|
+
|
37
|
+
### 1.3.0 (2014-01-29)
|
38
|
+
- Fix: Use more reliable serial device naming in Windows. Fix issue #139 and #155 (https://github.com/peplin)
|
39
|
+
- Fix: Document that ARDUINO_DIR must be a relative path in Windows. Fix issue #156 (https://github.com/peplin)
|
40
|
+
- Tweak: Don't hard code MONITOR_PORT in examples, for more flexible testing. (Issue #157) (https://github.com/peplin)
|
41
|
+
- Tweak: Silence the stderr output from call to `which`. (Issue #158) (https://github.com/peplin)
|
42
|
+
- Fix: Override complete compiler tool paths for chipKIT. (Issue #159) (https://github.com/peplin)
|
43
|
+
- New: The makefile is compatible with Windows
|
44
|
+
- New: Update `README.md` file about usage and Windows compatibility
|
45
|
+
|
46
|
+
### 1.2.0 (2014-01-14)
|
47
|
+
- Add: Add RPM SPECfile and new `package` directory to store package instructions and files (https://github.com/sej7278)
|
48
|
+
- Fix: Remove use of arduino-mk subdirectory in git. Fix issue #151, #152 and #147 (https://github.com/sej7278)
|
49
|
+
- Fix: Remove `arduino-mk` directory from all examples. Fix #154
|
50
|
+
|
51
|
+
### 1.1.0 (2013-12-26)
|
52
|
+
- Don't append port details to avrdude for usbasp. See #123
|
53
|
+
- Ignore commented lines while parsing boards.txt file. See #124
|
54
|
+
- In ISP mode, read baudrate and programmer from boards.txt. See #125
|
55
|
+
- Add `burn_bootloader` target. See #85
|
56
|
+
- Show correct path to `arduino.mk` file in help message. Fix #120
|
57
|
+
- Change echo for printf. Fix #129 (https://github.com/thomassigurdsen)
|
58
|
+
- Add support for ChipKiT 2013. Fix #136 (https://github.com/peplin)
|
59
|
+
- Auto detect and include libraries specified in `USER_LIB_PATH`. Fix #135 (https://github.com/tinyladi)
|
60
|
+
- Use `MAKEFILE_LIST` to get the name of the make file. Fix #130 (https://github.com/cantora)
|
61
|
+
- New: Add option to set fuses without burning a bootloader. Fix #141 (https://github.com/sej7278)
|
62
|
+
- Tweak: Don't append port details to avrdude for usbtiny. Fix #140 and #138 (https://github.com/PPvG)
|
63
|
+
- Fix: Handle relative paths of bootloader file while burning bootloaders. Fix #126 and #142 (https://github.com/sej7278)
|
64
|
+
- New: Add `CONTRIBUTING.md` explaining how to contribute to the project.
|
65
|
+
- New: Force -Os optimization for SoftwareSerial. Add `OPTIMIZATION_FLAGS` and `DEBUG_FLAGS`. (https://github.com/mahoy)
|
66
|
+
- Fix: Use `ARDUINO_HEADER` variable instead of hardcoded file names. Fix #131
|
67
|
+
|
68
|
+
### 1.0.1 (2013-09-25)
|
69
|
+
- Unconditionally add -D in avrdude options. See #114
|
70
|
+
|
71
|
+
### 1.0.0 (2013-09-22)
|
72
|
+
- Add $OBJDIR to the list of configuration that gets printed. Fix issue #77
|
73
|
+
- Add support for specifying optimization level. Fix issue #81
|
74
|
+
- Add support for reseting "Micro" Arduino. Fix issue #80 (https://github.com/sej7278)
|
75
|
+
- Remove "utility" from example makefiles. Fix issue #84
|
76
|
+
- Auto detect alternate core path from sketchbook folder. Fix issue #86
|
77
|
+
- Remove redundant checks for ARDUINO_DIR
|
78
|
+
- Improve avrdude and avrdude.conf path auto detection. Fix issue #48
|
79
|
+
- Move binary sketch size verification logic inside makefile. Fix issue #54
|
80
|
+
- Remove dependency on wait-connection-leonardo shell script. Fix issue #95
|
81
|
+
- Add support for the Digilent chipKIT platform. (https://github.com/peplin)
|
82
|
+
- Implement ard-parse-boards with shell scripting instead of Perl (https://github.com/peplin)
|
83
|
+
- Compile with debugging symbols only when DEBUG=1 (https://github.com/peplin)
|
84
|
+
- Replace Leonardo detection with Caterina detection (https://github.com/sej7278)
|
85
|
+
- Autodetect baudrate only if either a .ino/.pde is present
|
86
|
+
- Allow building with Arduino core, without a .ino/.pde file
|
87
|
+
- Ability to support different Arduino cores (https://github.com/sej7278)
|
88
|
+
|
89
|
+
### 0.12.0 (2013-06-20)
|
90
|
+
- Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman)
|
91
|
+
- Deprecate "generated_assembly" target in favour of "generate_assembly". Fix issue #79
|
92
|
+
|
93
|
+
### 0.11.0 (2013-06-15)
|
94
|
+
- Replace hardcoded executables with variable
|
95
|
+
- Fix whitespace issues
|
96
|
+
- Add a warning when HEX_MAXIMUM_SIZE is not specified
|
97
|
+
- Add the ability to configure avrdude options. Fix issue #53
|
98
|
+
- Handle cases where certain fuse bits are not present. Fix issue #61
|
99
|
+
- Add support for compiling plain AVR C files. Fix issue #63
|
100
|
+
- Add an example to show how to compile AVR C files. Fix issue #73
|
101
|
+
|
102
|
+
### 0.10.6 (2013-06-14)
|
103
|
+
- Fix whitespace and add /dev/null redirection (https://github.com/sej7278)
|
104
|
+
- Change the way AUTO_ARDUINO_VERSION is computed (https://github.com/sej7278)
|
105
|
+
- Make serial monitor baudrate detection work in Mac as well(https://github.com/sej7278)
|
106
|
+
- Fix directory creation for library source files (https://github.com/matthijskooijman)
|
107
|
+
- Rewrite ard-leonardo-reset script in perl (https://github.com/sej7278)
|
108
|
+
|
109
|
+
### 0.10.5 (2013-06-11)
|
110
|
+
- Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo.
|
111
|
+
- Allow adding extra common dependencies (COMMON_DEPS) (https://github.com/gaftech)
|
112
|
+
- Added ifndef ARDUINO_VAR_PATH for compiling for the attiny (https://github.com/danielesteban)
|
113
|
+
- Strip extra whitespace from the `BOARD_TAG` variable
|
114
|
+
- Enhanced support for programming using Arduino as ISP
|
115
|
+
- Added example to show how to program using Arduino as ISP
|
116
|
+
- Add support for Leonardo boards. Took code from (https://github.com/guicho271828)
|
117
|
+
|
118
|
+
### 0.10.4 (2013-05-31) @matthijskooijman
|
119
|
+
- Improved BAUD_RATE detection logic
|
120
|
+
- Added logic to check if there is only .ino or .pde file
|
121
|
+
- Compile .ino/.pde files directly
|
122
|
+
- Output configuration only once
|
123
|
+
- Try to read Version.txt file only if it is present
|
124
|
+
- Refactored dependency code
|
125
|
+
|
126
|
+
### 0.10.3 16.xii 2012 gaftech
|
127
|
+
- Enabling creation of EEPROM file (.eep)
|
128
|
+
- EEPROM upload: eeprom and raw_eeprom targets
|
129
|
+
- Auto EEPROM upload with isp mode: ISP_EEPROM option.
|
130
|
+
- Allow custom OBJDIR
|
131
|
+
|
132
|
+
### 0.10.2 15.xii.2012 Sudar
|
133
|
+
- Added sketch size verification. (https://github.com/fornellas)
|
134
|
+
- Show original line number for error messages (https://github.com/WizenedEE)
|
135
|
+
- Removed -w from CPPFLAGS to show warnings (https://github.com/gaftech)
|
136
|
+
- Changed shebang to use /usr/bin/env (https://github.com/anm)
|
137
|
+
- set USB_VID and USB_PID only for leonardo boards(https://github.com/alohr)
|
138
|
+
- Updated Readme (https://github.com/fr0sty1/)
|
139
|
+
|
140
|
+
### 0.10.1 15.xii.2012 Sudar
|
141
|
+
- Merged all changes from Upstream and the following changes from https://github.com/rpavlik
|
142
|
+
- Allow passing extra flags
|
143
|
+
- Make listing files more useful
|
144
|
+
- Add knowledge of device-specific assembler
|
145
|
+
- Use variables instead of hardcoded commands
|
146
|
+
- Make disasm more helpful
|
147
|
+
- Change .sym output
|
148
|
+
- Provide symbol_sizes and generated_assembly targets.
|
149
|
+
- Be able to silence configuration output
|
150
|
+
- Make everybody depend on the makefile, in case cflags are changed, etc.
|
151
|
+
- Make the makefile error if the arduino port is not present.
|
152
|
+
|
153
|
+
### 0.10 17.ix.12 M J Oldfield
|
154
|
+
- Added installation notes for Fedora (ex Rickard Lindberg).
|
155
|
+
- Changed size target so that it looks at the ELF object,
|
156
|
+
not the hexfile (ex Jared Szechy and Scott Howard).
|
157
|
+
- Fixed ARDUNIO typo in README.md (ex Kalin Kozhuharov).
|
158
|
+
- Tweaked OBJDIR handling (ex Matthias Urlichs and Scott Howard).
|
159
|
+
- Changed the name of the Debian/Ubuntu package (ex
|
160
|
+
Scott Howard).
|
161
|
+
- Only set AVRDUDE_CONF if it's not set (ex Tom Hall).
|
162
|
+
- Added support for USB_PID/VID used by the Leonardo (ex Dan
|
163
|
+
Villiom Podlaski Christiansen and Marc Plano-Lesay).
|
164
|
+
|
165
|
+
### 0.9.3.2 10.ix.2012 Sudar
|
166
|
+
- Fixed a typo in README. Issue reported at upstream (https://github.com/mjoldfield/Arduino-Makefile/issues/21)
|
167
|
+
|
168
|
+
### 0.9.3.1 18.viii.2012 jeffkowalski
|
169
|
+
|
170
|
+
- Autodetect ARDUINO_LIBS from includes in LOCAL_SRCS
|
171
|
+
- Autodetect ARDUINO_SKETCHBOOK from file set by Arduino IDE
|
172
|
+
- Autodetect ARDMK_DIR based on location of this file
|
173
|
+
- Added support for utility directory within SYS and USER libraries
|
174
|
+
|
175
|
+
### 0.9.3 13.vi.2012
|
176
|
+
|
177
|
+
- Auto detect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
|
178
|
+
- Categorize libs into user and system (https://github.com/rpavlik/)
|
179
|
+
- Dump size at the end of the build (https://github.com/rpavlik/)
|
180
|
+
- Lots and lots of improvements (https://github.com/rpavlik/)
|
181
|
+
- Changed bytes option for the head shell command, so that it works in Mac as well
|
182
|
+
- Auto detect Serial Baud rate from sketch if possible
|
183
|
+
|
184
|
+
### 0.9.2 06.vi.2012
|
185
|
+
|
186
|
+
- Allow user to choose source files (LOCAL_*_SRCS flags) (https://github.com/Gaftech)
|
187
|
+
- Modified "make size" behavior: using --mcu option and targeting .elf file instead of .hex file.(https://github.com/Gaftech)
|
188
|
+
|
189
|
+
### 0.9.1 06.vi.2012
|
190
|
+
|
191
|
+
- Corrected the ubuntu package names
|
192
|
+
- Prevent the *file-not-found* error if the depends.mk file is not needed
|
193
|
+
- Delete the build-cli folder as well while doing make clean
|
194
|
+
- Added support for compiling .pde files in Arduino 1.0 environment
|
195
|
+
- Replaced = with += in CPPFLAGS assignment so that we can set CPPFLAGS per sketch if needed
|
196
|
+
- Changed AVRDUDE_CONF so it can be defined in per-project makefile (https://github.com/WizenedEE)
|
197
|
+
- Cleaner way to delete the build-cli directory when make clean is invoked
|
198
|
+
- The package name in Debian and Ubuntu is arduino-mk (https://github.com/maqifrnswa)
|
199
|
+
|
200
|
+
### 2012-02-12, version 0.8
|
201
|
+
- Patches for version 1.0 of the Arduino IDE. Older versions might still work, but I’ve not tested it.
|
202
|
+
- 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.
|
203
|
+
- If TARGET isn’t explicitly set, default to the current directory name. Thanks to Daniele Vergini for this patch.
|
204
|
+
- 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.
|
205
|
+
- Added a size target as suggested by Alex Satrapa.
|
206
|
+
|
207
|
+
### Unreleased, version 0.7
|
208
|
+
- Added -lm to the linker options, and -F to stty.
|
209
|
+
|
210
|
+
### 2011-06-23, version 0.6
|
211
|
+
- Added ard-parse-boards. Mark Sproul suggested doing something like this ages ago, but I’ve only recently looked at it in detail.
|
212
|
+
- 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).
|
213
|
+
|
214
|
+
### 2011-06-23, version 0.5
|
215
|
+
- Imported changes from Debian/Ubuntu, which incorporate a patch from Stefan Tomanek so that libraries would be compiled too.
|
216
|
+
|
217
|
+
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.
|
218
|
+
|
219
|
+
### 2010-05-24, version 0.4
|
220
|
+
Tweaked rules for the reset target on Philip Hands’ advice.
|
221
|
+
|
222
|
+
### 2010-05-21, version 0.3
|
223
|
+
- Tidied up the licensing, making it clear that it’s released under LGPL 2.1.
|
224
|
+
- [Philip Hands](http://hands.com/~phil/) sent me some code to reset the Arduino by dropping DTR for 100ms, and I added it.
|
225
|
+
- 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.
|
@@ -0,0 +1,189 @@
|
|
1
|
+
# A Makefile for Arduino Sketches
|
2
|
+
|
3
|
+
This is a very simple Makefile which knows how to build Arduino sketches. It defines entire workflows for compiling code, flashing it to Arduino and even communicating through Serial monitor. You don't need to change anything in the Arduino sketches.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- Very robust
|
8
|
+
- Highly customizable
|
9
|
+
- Supports all official AVR-based Arduino boards
|
10
|
+
- Supports chipKIT
|
11
|
+
- Works on all three major OS (Mac, Linux, Windows)
|
12
|
+
- Auto detects serial baud rate and libraries used
|
13
|
+
- Support for `*.ino` and `*.pde` sketches as well as raw `*.c` and `*.cpp`
|
14
|
+
- Support for Arduino Software versions 1.0.x as well as 0.x.
|
15
|
+
Support for Arduino 1.5.x is still work in progress
|
16
|
+
- Automatic dependency tracking. Referred libraries are automatically included
|
17
|
+
in the build process. Changes in `*.h` files lead to recompilation of sources which include them
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
### Through package
|
22
|
+
|
23
|
+
If you're using FreeBSD, Debian or Ubuntu, you can find this in the `arduino-mk`
|
24
|
+
package and can be installed using `apt-get` or `aptitude`.
|
25
|
+
|
26
|
+
### From source
|
27
|
+
|
28
|
+
- Download the latest release
|
29
|
+
- Or clone it from Github using the command `git clone git@github.com:sudar/Arduino-Makefile.git`
|
30
|
+
- Check the [usage section](https://github.com/sudar/Arduino-Makefile#usage) in this readme about setting usage options
|
31
|
+
|
32
|
+
## Requirements
|
33
|
+
|
34
|
+
You need to have the Arduino IDE. You can either install it through the
|
35
|
+
installer or download the distribution zip file and extract it.
|
36
|
+
|
37
|
+
The Makefile also delegates resetting the board to a short Python program.
|
38
|
+
You'll need to install `pySerial` to use it though.
|
39
|
+
|
40
|
+
On Debian or Ubuntu:
|
41
|
+
|
42
|
+
apt-get install python-serial
|
43
|
+
|
44
|
+
On Fedora:
|
45
|
+
|
46
|
+
yum install pyserial
|
47
|
+
|
48
|
+
On openSUSE:
|
49
|
+
|
50
|
+
zypper install python-serial
|
51
|
+
|
52
|
+
On Mac using MacPorts:
|
53
|
+
|
54
|
+
sudo port install py27-serial
|
55
|
+
|
56
|
+
On Windows:
|
57
|
+
|
58
|
+
You need to install Cygwin and its packages for Make, Perl and the next Serial library.
|
59
|
+
|
60
|
+
pySerial can be downloaded from PyPi
|
61
|
+
|
62
|
+
On other systems:
|
63
|
+
|
64
|
+
pip install pyserial
|
65
|
+
|
66
|
+
or
|
67
|
+
|
68
|
+
easy_install -U pyserial
|
69
|
+
|
70
|
+
## Usage
|
71
|
+
|
72
|
+
You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile).
|
73
|
+
|
74
|
+
You can also checkout the sample makefiles inside the `examples/` folder or take a look at a *real* [Makefile-example](examples/MakefileExample/Makefile-example.mk).
|
75
|
+
|
76
|
+
Download a copy of this repo some where in your system or install it through a package.
|
77
|
+
|
78
|
+
On the Mac you might want to set:
|
79
|
+
|
80
|
+
ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
|
81
|
+
ARDMK_DIR = /usr/local
|
82
|
+
AVR_TOOLS_DIR = /usr
|
83
|
+
MONITOR_PORT = /dev/ttyACM0
|
84
|
+
BOARD_TAG = mega2560
|
85
|
+
|
86
|
+
On Linux (if you have installed through package), you shouldn't need to set anything other than your board type and port:
|
87
|
+
|
88
|
+
BOARD_TAG = mega2560
|
89
|
+
MONITOR_PORT = /dev/ttyACM0
|
90
|
+
|
91
|
+
On Windows (using cygwin), you might want to set:
|
92
|
+
|
93
|
+
ARDUINO_DIR = ../../arduino
|
94
|
+
ARDMK_DIR = path/to/mkfile
|
95
|
+
MONITOR_PORT = com3
|
96
|
+
BOARD_TAG = mega2560
|
97
|
+
|
98
|
+
It is recommended in Windows that you create a symbolic link directory for avoiding problem with folder naming conventions on Windows. Specially if your your Arduino folder is in:
|
99
|
+
|
100
|
+
c:\Program Files (x86)\Arduino
|
101
|
+
|
102
|
+
You will get problem for the special characters on the folder name. More details about this can be found on https://github.com/sudar/Arduino-Makefile/issues/94
|
103
|
+
|
104
|
+
For creating a symbolic link you have to use the command “mklink” on Windows, e.g.
|
105
|
+
|
106
|
+
mklink /d c:\Arduino c:\Program Files (x86)\Arduino
|
107
|
+
|
108
|
+
At the end the variables end up being.
|
109
|
+
|
110
|
+
ARDUINO_DIR=../../../../../Arduino
|
111
|
+
|
112
|
+
Instead of
|
113
|
+
|
114
|
+
ARDUINO_DIR=../../../../../Program\ Files\ \(x86\)/Arduino
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
- `BOARD_TAG` - Type of board, for a list see boards.txt or `make show_boards`
|
119
|
+
- `MONITOR_PORT` - The port where your Arduino is plugged in, usually `/dev/ttyACM0` or `/dev/ttyUSB0` in Linux or Mac OS X and `com3`, `com4`, etc. in Windows.
|
120
|
+
- `ARDUINO_DIR` - Path to Arduino installation. In Cygwin in Windows this path must be
|
121
|
+
relative, not absolute (e.g. "../../arduino" and not "/c/cygwin/Arduino").
|
122
|
+
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`
|
123
|
+
- `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. Otherwise set it realtive and not absolute.
|
124
|
+
|
125
|
+
The list of all variables that can be overridden is available at [arduino-mk-vars.md](arduino-mk-vars.md) file.
|
126
|
+
|
127
|
+
## Including Libraries
|
128
|
+
|
129
|
+
You can specify space separated list of libraries that are needed for your sketch to the variable `ARDUINO_LIBS`.
|
130
|
+
|
131
|
+
`ARDUINO_LIBS = Wire SoftwareSerial`
|
132
|
+
|
133
|
+
The libraries will be searched in the following places in the following order.
|
134
|
+
|
135
|
+
- `/libraries` folder inside your sketchbook folder. Sketchbook folder will be auto detected from your Arduino preference file. You can also manually set it through `ARDUINO_SKETCHBOOK`.
|
136
|
+
- `/libraries` folder inside your Arduino folder, which is read from `ARDUINO_DIR`.
|
137
|
+
|
138
|
+
The libraries inside user folder will take precedence over libraries present in Arduino core folder.
|
139
|
+
|
140
|
+
The makefile can autodetect the libraries that are included from your sketch and can include them automatically. But it can't detect libraries that are included from other libraries. (see [issue #93](https://github.com/sudar/Arduino-Makefile/issues/93))
|
141
|
+
|
142
|
+
## avrdude
|
143
|
+
|
144
|
+
To upload compiled files, `avrdude` is used. This Makefile tries to find `avrdude` and it's config (`avrdude.conf`) below `ARDUINO_DIR`. If you like to use the one installed on your system instead of the one which came with Arduino, you can try to set the variables `AVRDUDE` and `AVRDUDE_CONF`. On a typical Linux system these could be set to
|
145
|
+
|
146
|
+
AVRDDUDE = /usr/bin/avrdude
|
147
|
+
AVRDUDE_CONF = /etc/avrdude.conf
|
148
|
+
|
149
|
+
## Colorgcc
|
150
|
+
|
151
|
+
It is possible to use [`colorgcc`](https://github.com/colorgcc/colorgcc) with this makefile. Check out [this comment](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile#comment-1408) to find usage instructions.
|
152
|
+
|
153
|
+
## Versioning
|
154
|
+
|
155
|
+
The current version of the makefile is `1.3.3`. You can find the full history in the [HISTORY.md](HISTORY.md) file
|
156
|
+
|
157
|
+
This project adheres to Semantic [Versioning 2.0](http://semver.org/).
|
158
|
+
|
159
|
+
## License
|
160
|
+
|
161
|
+
This makefile and the related documentation and examples are free software; you can redistribute it and/or modify it
|
162
|
+
under the terms of the GNU Lesser General Public License as
|
163
|
+
published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
164
|
+
|
165
|
+
## Contribution
|
166
|
+
|
167
|
+
All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
|
168
|
+
Also checkout the [contribution guide](CONTRIBUTING.md) for more details.
|
169
|
+
|
170
|
+
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/).
|
171
|
+
|
172
|
+
## Limitations / Know Issues / TODO's
|
173
|
+
|
174
|
+
- Doesn't work with Arduino 1.5.x yet. Follow [issue #45](https://github.com/sudar/Arduino-Makefile/issues/45) for progress.
|
175
|
+
- Since it doesn't do any pre processing like Arduino IDE, you have to declare all methods before you use them ([issue #59](https://github.com/sudar/Arduino-Makefile/issues/59))
|
176
|
+
- More than one .ino or .pde file is not supported yet ([issue #49](https://github.com/sudar/Arduino-Makefile/issues/49))
|
177
|
+
- When you compile for the first time, it builds all libs inside Arduino directory even if it is not needed. But while linking only the relevant files are linked. ([issue #29](https://github.com/sudar/Arduino-Makefile/issues/29)). Even Arduino IDE does the same thing though.
|
178
|
+
|
179
|
+
If you find an issue or have an idea for a feature then log them in the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/)
|
180
|
+
|
181
|
+
## Credits
|
182
|
+
|
183
|
+
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.
|
184
|
+
From May 2013, it is maintained by [Sudar](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile)
|
185
|
+
|
186
|
+
## Similar works
|
187
|
+
- 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).
|
188
|
+
- Alan's Makefile was used in a [Pragmatic Programmer's article](http://pragprog.com/magazines/2011-04/advanced-arduino-hacking).
|
189
|
+
- Rei Vilo wrote to tell me that he's using the Makefile ina Xcode 4 template called [embedXcode](http://embedxcode.weebly.com/). Apparently it supports many platforms and boards, including AVR-based Arduino, AVR-based Wiring, PIC32-based chipKIT, MSP430-based LaunchPad and ARM3-based Maple.
|