├── Templates └── Arduino.tmTemplate │ ├── sketch.ino │ └── info.plist ├── AUTHORS ├── Snippets ├── loop.tmSnippet └── setup.tmSnippet ├── Commands ├── Open Arduino Libraries.tmCommand ├── Watch serial port.tmCommand ├── Show Assembly.tmCommand ├── Watch Serial Port With iTerm.tmCommand ├── Clean.tmCommand ├── Compile.tmCommand ├── Local Help.tmCommand └── Upload.tmCommand ├── COPYING ├── Support ├── Monitor └── Makefile ├── Syntaxes └── Arduino.tmLanguage ├── info.plist ├── Preferences └── Completions.tmPreferences └── README.md /Templates/Arduino.tmTemplate/sketch.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ${TM_NEW_FILE_BASENAME} 3 | Created ${TM_DATE} by ${TM_FULLNAME} 4 | */ 5 | 6 | void setup () { 7 | 8 | } 9 | 10 | void loop() { 11 | 12 | } -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Ramsey Nasser ram@nas.sr 2 | Michael Hurni michael.hurni@gmail.com 3 | Aaron Wallis aaron.wallis@gmail.com 4 | Carl Drinkwater @carldr 5 | Nicky Gerritsen @nickygerritsen 6 | Ryan C. Payne rpayne-oss@bullittsystems.com -------------------------------------------------------------------------------- /Snippets/loop.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | void loop() { 7 | ${1:/* code */} 8 | } 9 | name 10 | loop 11 | scope 12 | source.c++.arduino 13 | tabTrigger 14 | loop 15 | uuid 16 | 66C4786C-646E-45C4-9F3F-DE8F62A937B1 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/setup.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | void setup() { 7 | ${1:/* code */} 8 | } 9 | name 10 | setup 11 | scope 12 | source.c++.arduino 13 | tabTrigger 14 | setup 15 | uuid 16 | 991677A0-34C3-4AD8-A679-B8F41870362E 17 | 18 | 19 | -------------------------------------------------------------------------------- /Templates/Arduino.tmTemplate/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | command 6 | if [[ ! -f "$TM_NEW_FILE" ]]; then 7 | TM_YEAR=`date +%Y` \ 8 | TM_DATE=`date +%Y-%m-%d` \ 9 | perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \ 10 | < sketch.ino > "$TM_NEW_FILE" 11 | fi 12 | extension 13 | ino 14 | name 15 | Basic Sketch 16 | uuid 17 | 1E20D9D4-3FD4-457E-8FD6-808A7CEF04D1 18 | 19 | 20 | -------------------------------------------------------------------------------- /Commands/Open Arduino Libraries.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | open /Applications/Arduino.app/Contents/Resources/Java/libraries/ 9 | input 10 | none 11 | name 12 | Open Arduino Libraries 13 | output 14 | discard 15 | scope 16 | source.c++.arduino 17 | uuid 18 | 370DC329-CFB3-4663-81F3-753F56E3C1E8 19 | 20 | 21 | -------------------------------------------------------------------------------- /Commands/Watch serial port.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | TM_BUNDLE_SUPPORT_ESC=$(echo $TM_BUNDLE_SUPPORT | sed '/Support/s/ /\\\\ /') 9 | osascript -e "tell application \"Terminal\" to do script \"${TM_BUNDLE_SUPPORT_ESC}/Monitor\"" 10 | input 11 | none 12 | name 13 | Terminal 14 | output 15 | discard 16 | scope 17 | source.c++.arduino 18 | uuid 19 | CA52EB7C-9E55-41E7-8A3B-922497F95BD1 20 | 21 | 22 | -------------------------------------------------------------------------------- /Commands/Show Assembly.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveModifiedFiles 7 | command 8 | #!/bin/bash 9 | 10 | TM_FILENAME_NO_EXT=$(echo $TM_FILENAME | sed /\.ino$/s///) 11 | 12 | /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-objdump -d $TM_DIRECTORY/applet/$TM_FILENAME_NO_EXT.elf 13 | input 14 | none 15 | keyEquivalent 16 | @B 17 | name 18 | Show Assembly 19 | output 20 | openAsNewDocument 21 | scope 22 | source.c++.arduino 23 | uuid 24 | 6CD0AE16-8CB5-4019-82D6-39C45933A5E9 25 | 26 | 27 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Ramsey Nasser 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Support/Monitor: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -- /dev/*usb* 3 | # make sure there's a usb port 4 | if [ -r "$1" ]; then 5 | 6 | # get the list of USB ports 7 | dev_list=(`ls /dev/*usb*`) 8 | 9 | # echo them out with their index 10 | counter=0 11 | for filename in "${dev_list[@]}"; do 12 | echo "${counter}. ${filename:5}" 13 | counter=`expr $counter + 1` 14 | done 15 | 16 | # ask the user which port they'd like to monitor 17 | echo "Which port would you like to monitor? [enter digit then enter, defaults to zero]:" 18 | read dev_port 19 | 20 | # if they didn't supply one, just use zero 21 | if [ -n dev_port ]; then 22 | dev_port=0 23 | fi 24 | 25 | # ask them what baud they'd like to use 26 | echo "Enter the baud rate [defaults to 9600]:" 27 | read dev_baud 28 | 29 | # if they didn't supply one, just use 9600 30 | if [ -n dev_baud ]; then 31 | dev_baud=9600 32 | fi 33 | 34 | # give them a heads up 35 | echo "Monitoring ${dev_list[$dev_port]:5} on ${dev_baud}" 36 | 37 | # start monitoring 38 | screen ${dev_list[$dev_port]} ${dev_baud} 39 | 40 | else 41 | echo "No USB ports found" 42 | fi -------------------------------------------------------------------------------- /Commands/Watch Serial Port With iTerm.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | TM_BUNDLE_SUPPORT_ESC=$(echo $TM_BUNDLE_SUPPORT | sed '/Support/s/ /\\\\ /') 9 | osascript -e "tell application \"iTerm\" 10 | activate 11 | 12 | try 13 | set _term to first terminal 14 | on error 15 | set _term to (make new terminal) 16 | end try 17 | 18 | tell _term 19 | launch session \"Default\" 20 | set _session to last session 21 | end tell 22 | 23 | tell _session 24 | set name to \"Arduino Monitor\" 25 | write text \"${TM_BUNDLE_SUPPORT_ESC}/Monitor\" 26 | end tell 27 | 28 | end tell" 29 | 30 | input 31 | none 32 | name 33 | iTerm 34 | output 35 | discard 36 | scope 37 | source.c++.arduino 38 | uuid 39 | BFCDD012-5C16-4C84-A4E1-08523EE50D76 40 | 41 | 42 | -------------------------------------------------------------------------------- /Commands/Clean.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | nop 9 | command 10 | #!/usr/bin/env ruby18 -wKU 11 | require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" 12 | 13 | script_args = ["-e","-f","#{ENV['TM_BUNDLE_SUPPORT']}/Makefile","clean"] 14 | 15 | TextMate::Executor.run("/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/make", :script_args => script_args) 16 | 17 | input 18 | none 19 | inputFormat 20 | text 21 | keyEquivalent 22 | ^@c 23 | name 24 | Clean 25 | outputCaret 26 | afterOutput 27 | outputFormat 28 | html 29 | outputLocation 30 | newWindow 31 | scope 32 | source.c++.arduino 33 | uuid 34 | A39EFEA0-67CB-4666-BD90-3A735CBB42A2 35 | version 36 | 2 37 | 38 | 39 | -------------------------------------------------------------------------------- /Commands/Compile.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | saveModifiedFiles 9 | command 10 | #!/usr/bin/env ruby18 -wKU 11 | require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" 12 | 13 | script_args = ["-e","-f","#{ENV['TM_BUNDLE_SUPPORT']}/Makefile"] 14 | 15 | TextMate::Executor.run("/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/make", :script_args => script_args) 16 | 17 | input 18 | none 19 | inputFormat 20 | text 21 | keyEquivalent 22 | @b 23 | name 24 | Compile 25 | outputCaret 26 | afterOutput 27 | outputFormat 28 | html 29 | outputLocation 30 | newWindow 31 | scope 32 | source.c++.arduino 33 | uuid 34 | B901B2C1-83A7-48E6-BA88-00220566836C 35 | version 36 | 2 37 | 38 | 39 | -------------------------------------------------------------------------------- /Commands/Local Help.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby 9 | 10 | tm_word = STDIN.read 11 | html_file = nil 12 | 13 | arduino_dir = "/Applications/Arduino.app/Contents/Resources/Java" 14 | reference_dir = "#{arduino_dir}/reference" 15 | keywords_file = "#{arduino_dir}/lib/keywords.txt" 16 | 17 | keywords = open(keywords_file).each_line.map {|line| line.split} 18 | keywords.reject! do |kw| 19 | kw.size < 2 or kw.first == "#" 20 | end 21 | keywords.each {|kw| html_file = "#{reference_dir}/#{kw.last}.html" if tm_word == kw.first } 22 | 23 | if html_file 24 | begin 25 | css = <<-NEWCSS 26 | iframe { 27 | width: 100%; 28 | height: 100%; 29 | border: none; 30 | } 31 | NEWCSS 32 | html = "<html><head><style>#{css}</style></head><body><iframe src='file://#{html_file}'></body>" 33 | puts html 34 | 35 | rescue Errno::ENOENT 36 | # do nothing 37 | end 38 | 39 | exit 40 | end 41 | 42 | puts "No documentation found for '#{tm_word}'!" 43 | fallbackInput 44 | word 45 | input 46 | selection 47 | keyEquivalent 48 | ^~@h 49 | name 50 | Local Help 51 | output 52 | showAsHTML 53 | scope 54 | source.c++.arduino 55 | uuid 56 | 26732C56-E39B-419D-8D1F-815CD9FA7C32 57 | 58 | 59 | -------------------------------------------------------------------------------- /Syntaxes/Arduino.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | pde 8 | ino 9 | 10 | foldingStartMarker 11 | /\*\*|\{\s*$ 12 | foldingStopMarker 13 | \*\*/|^\s*\} 14 | name 15 | Arduino 16 | patterns 17 | 18 | 19 | include 20 | #special_block 21 | 22 | 23 | include 24 | source.c++ 25 | 26 | 27 | match 28 | \b(HIGH|LOW|INPUT|OUTPUT|DEC|BIN|HEX|OCT|BYTE|PI|HALF_PI|TWO_PI|LSBFIRST|MSBFIRST|CHANGE|FALLING|RISING|DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56|null)\b 29 | name 30 | constant.c++.arduino 31 | 32 | 33 | match 34 | \b(boolean|byte|word)\b 35 | name 36 | storage.c++.arduino 37 | 38 | 39 | match 40 | \b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan|bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte|analogReference|analogRead|analogWrite|attachInterrupt|detachInterrupt|delay|delayMicroseconds|digitalWrite|digitalRead|interrupts|millis|micros|noInterrupts|noTone|pinMode|pulseIn|shiftOut|tone|begin|end|read|print|println|available|flush|setup|loop)\b 41 | name 42 | support.function.c++.arduino 43 | 44 | 45 | match 46 | \b(Serial\d?)\b 47 | name 48 | support.class.c++.arduino 49 | 50 | 51 | match 52 | \b(private|protected|public) 53 | name 54 | storage.modifier.c++.arduino 55 | 56 | 57 | scopeName 58 | source.c++.arduino 59 | uuid 60 | 65E5AFAE-4AE7-4DAE-837B-1B99810E464C 61 | 62 | 63 | -------------------------------------------------------------------------------- /Commands/Upload.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | saveModifiedFiles 9 | command 10 | #!/usr/bin/env ruby18 -wKU 11 | require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" 12 | 13 | def saveTempINOFile(contents) 14 | require 'tmpdir' 15 | require 'fileutils' 16 | 17 | dir = Dir.mktmpdir(); 18 | at_exit { FileUtils.remove_entry dir } 19 | project_folder = FileUtils.mkdir_p "#{dir}/Sketch" 20 | 21 | file = File.new("#{project_folder}/Sketch.ino", File::RDWR|File::CREAT|File::EXCL, 0600) 22 | file.write(contents) 23 | file.close() 24 | 25 | return file.path 26 | end 27 | 28 | # from version 1.5.0 arduino has its own official CLI, 29 | if `/usr/libexec/PlistBuddy -c "print CFBundleVersion" /Applications/Arduino.app/Contents/Info.plist` >= "1.5" 30 | 31 | filepath = ENV['TM_FILEPATH'] || saveTempINOFile(STDIN.read) 32 | arduino_IDE = "/Applications/Arduino.app/Contents/MacOS/JavaApplicationStub" 33 | scr_args = ["--upload", filepath] 34 | ver_args = ["--get-pref", "dummy"] # skip version check 35 | 36 | TextMate::Executor.run(arduino_IDE, :script_args => scr_args, :version_args => ver_args, :verb => "Compiling & uploading") 37 | else 38 | script_args = ["-e", "-f", "#{ENV['TM_BUNDLE_SUPPORT']}/Makefile", "upload"] 39 | TextMate::Executor.run("/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/make", :script_args => script_args) 40 | end 41 | 42 | input 43 | document 44 | inputFormat 45 | text 46 | keyEquivalent 47 | @u 48 | name 49 | Upload 50 | outputCaret 51 | afterOutput 52 | outputFormat 53 | html 54 | outputLocation 55 | newWindow 56 | scope 57 | source.c++.arduino 58 | uuid 59 | 66F3D8A7-5A16-4D87-9962-3A25328DC71A 60 | version 61 | 2 62 | 63 | 64 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | deleted 6 | 7 | 9E4C55D6-850D-43DB-945B-8A85456D768E 8 | 9 | mainMenu 10 | 11 | items 12 | 13 | 66F3D8A7-5A16-4D87-9962-3A25328DC71A 14 | B901B2C1-83A7-48E6-BA88-00220566836C 15 | A39EFEA0-67CB-4666-BD90-3A735CBB42A2 16 | ------------------------------------ 17 | 66C4786C-646E-45C4-9F3F-DE8F62A937B1 18 | 991677A0-34C3-4AD8-A679-B8F41870362E 19 | ------------------------------------ 20 | 370DC329-CFB3-4663-81F3-753F56E3C1E8 21 | ------------------------------------ 22 | B450333C-28C7-43D2-BBD5-EC495D4F691E 23 | ------------------------------------ 24 | E0E814C3-E161-4198-9D42-8CB3B78510C8 25 | 26 | submenus 27 | 28 | B450333C-28C7-43D2-BBD5-EC495D4F691E 29 | 30 | items 31 | 32 | BFCDD012-5C16-4C84-A4E1-08523EE50D76 33 | CA52EB7C-9E55-41E7-8A3B-922497F95BD1 34 | 35 | name 36 | Watch Serial Port with... 37 | 38 | 39 | 40 | name 41 | Arduino 42 | ordering 43 | 44 | 5DFED922-173F-4FAE-BB91-9A06868E6A6E 45 | 370DC329-CFB3-4663-81F3-753F56E3C1E8 46 | CA52EB7C-9E55-41E7-8A3B-922497F95BD1 47 | BFCDD012-5C16-4C84-A4E1-08523EE50D76 48 | 65E5AFAE-4AE7-4DAE-837B-1B99810E464C 49 | 1E20D9D4-3FD4-457E-8FD6-808A7CEF04D1 50 | B901B2C1-83A7-48E6-BA88-00220566836C 51 | 66F3D8A7-5A16-4D87-9962-3A25328DC71A 52 | 6CD0AE16-8CB5-4019-82D6-39C45933A5E9 53 | 26732C56-E39B-419D-8D1F-815CD9FA7C32 54 | 66C4786C-646E-45C4-9F3F-DE8F62A937B1 55 | 991677A0-34C3-4AD8-A679-B8F41870362E 56 | 57 | uuid 58 | 756D4112-6F27-4633-A716-66EA39794282 59 | 60 | 61 | -------------------------------------------------------------------------------- /Preferences/Completions.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Completions 7 | scope 8 | source.c++.arduino 9 | settings 10 | 11 | completions 12 | 13 | HIGH 14 | LOW 15 | INPUT 16 | OUTPUT 17 | DEC 18 | BIN 19 | HEX 20 | OCT 21 | BYTE 22 | PI 23 | HALF_PI 24 | TWO_PI 25 | LSBFIRST 26 | MSBFIRST 27 | CHANGE 28 | FALLING 29 | RISING 30 | DEFAULT 31 | EXTERNAL 32 | INTERAL 33 | boolean 34 | break 35 | byte 36 | case 37 | char 38 | class 39 | continue 40 | default 41 | do 42 | double 43 | else 44 | false 45 | float 46 | for 47 | if 48 | int 49 | long 50 | new 51 | null 52 | private 53 | protected 54 | public 55 | return 56 | short 57 | signed 58 | static 59 | switch 60 | this 61 | throw 62 | try 63 | true 64 | unsigned 65 | void 66 | while 67 | word 68 | boolean 69 | byte 70 | char 71 | float 72 | int 73 | long 74 | word 75 | abs 76 | acos 77 | asin 78 | atan 79 | atan2 80 | ceil 81 | constrain 82 | cos 83 | degrees 84 | exp 85 | floor 86 | log 87 | map 88 | max 89 | min 90 | radians 91 | random 92 | randomSeed 93 | round 94 | sin 95 | sq 96 | sqrt 97 | tan 98 | bitRead 99 | bitWrite 100 | bitSet 101 | bitClear 102 | bit 103 | highByte 104 | lowByte 105 | analogReference 106 | analogRead 107 | analogWrite 108 | attachInterrupt 109 | detachInterrupt 110 | delay 111 | delayMicroseconds 112 | digitalWrite 113 | digitalRead 114 | interrupts 115 | millis 116 | micros 117 | noInterrupts 118 | noTone 119 | pinMode 120 | pulseIn 121 | shiftOut 122 | tone 123 | Serial 124 | Serial1 125 | Serial2 126 | Serial3 127 | begin 128 | end 129 | read 130 | print 131 | println 132 | available 133 | flush 134 | setup 135 | loop 136 | 137 | 138 | uuid 139 | 5DFED922-173F-4FAE-BB91-9A06868E6A6E 140 | 141 | 142 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Arduino TextMate Bundle 1.0a 2 | ============================ 3 | [TextMate](http://macromates.com) is the best editor in human history. [Arduino](http://arduino.cc) is the easiest embedded platform to dive into. Why don't the two work together? The Arduino TextMate Bundle solves that glaring error, and the universe is thus balanced. 4 | 5 | There are other TextMate bundles out there, but they're mostly over two years old and don't work with new Arduino versions. This project aims to remain up-to-date and make embedded as enjoyable as everything else in TextMate. 6 | 7 | The little 'a' in '1.0a' stands for 'alpha'. Read that as "might not work for you". It will grow and improve with time, but for now brace yourself for bugs. That means bug reports, feature requests and patches! 8 | 9 | As of 1.0a, the bundle can compiles and uploads to the device, provides access to the documentation and highlights syntax correctly. 10 | 11 | Installation 12 | ============ 13 | 1. [Get the latest Arduino](http://arduino.cc/en/Guide/MacOSX). Version 1.0 and later is supported, and it must be installed to /Applications 14 | 2. [Get TextMate](http://macromates.com/). 15 | 3. [Get the latest Arduino TextMate bundle](https://github.com/nasser/arduino.tmbundle/zipball/v1.0a). 16 | 4. Extract the zip file to `~/Library/Application Support/TextMate/Bundles/Arduino.tmbundle` 17 | 5. If TextMate was open during this process, click Bundles>Bundle Editor>Reload Bundles 18 | 6. Check the 'Default Environment vars' near the top of `~/Library/Application Support/TextMate/Bundles/Arduino.tmbundle/Support/Makefile`. Any you need to override - especially check the ARDUINO_MCU var - can be added in TextMate's Preferences => Advanced => Shell Variables. 19 | 20 | 21 | Usage 22 | ===== 23 | * **⌘U** Compiles and uploads your sketch to the connected Arduino 24 | * **⌃⌥⌘H** Opens up local HTML documentation on to current word 25 | * **Bundles > Arduino > Watch Serial Port** Opens a terminal window monitoring the serial port. 26 | * **File > New From Template > Arduino > Basic Sketch** Creates a file with a blank basic sketch. 27 | 28 | Shell Variables 29 | =============== 30 | The compile/upload process can be finely controlled using TextMate's shell variables. 31 | 32 | Textmate > Preferences > Advanced > Shell Variables 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
VariableValue
BOARDThe Arduino variant being used. See table below.
SERIALDEVWe try to guess the correct serial port. If that is not possible, you have to set the correct serial port.
Like: /dev/tty.usbmodem1411
48 | 49 | Supported Arduino Boards 50 | ======================== 51 | Value | Description 52 | ------|------------ 53 | uno |Arduino Uno 54 | atmega328 |Arduino Duemilanove w/ ATmega328 55 | diecimila |Arduino Diecimila or Duemilanove w/ ATmega168 56 | nano328 |Arduino Nano w/ ATmega328 57 | nano |Arduino Nano w/ ATmega168 58 | mega2560 |Arduino Mega 2560 or Mega ADK 59 | mega |Arduino Mega (ATmega1280) 60 | leonardo |Arduino Leonardo 61 | esplora |Arduino Esplora 62 | micro |Arduino Micro 63 | mini328 |Arduino Mini w/ ATmega328 64 | mini |Arduino Mini w/ ATmega168 65 | ethernet |Arduino Ethernet 66 | fio |Arduino Fio 67 | bt328 |Arduino BT w/ ATmega328 68 | bt |Arduino BT w/ ATmega168 69 | LilyPadUSB |LilyPad Arduino USB 70 | lilypad328 |LilyPad Arduino w/ ATmega328 71 | lilypad |LilyPad Arduino w/ ATmega168 72 | pro5v328 |Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328 73 | pro5v |Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168 74 | pro328 |Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328 75 | pro |Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168 76 | atmega168 |Arduino NG or older w/ ATmega168 77 | atmega8 |Arduino NG or older w/ ATmega8 78 | robotControl |Arduino Robot Control 79 | robotMotor |Arduino Robot Motor 80 | 81 | Bleeding Edge 82 | ============= 83 | For the adventurous 84 | 85 | git clone git://github.com/nasser/arduino.tmbundle.git ~/Library/Application\ Support/TextMate/Bundles/Arduino.tmbundle 86 | 87 | Changes 88 | ======= 89 | 1.0a 90 | ---- 91 | * Fixed for Arduino 1.0 92 | * Improved local help command 93 | * Changed versioning scheme to match Arduino's. This bundle's version will always be equal to the version of Arduino it is most compatible with. 94 | 95 | 0.21a 96 | ---- 97 | * Added snippets for common methods 98 | * Added an Arduino project template 99 | * Altered the monitor script - it's now aware of your USB ports 100 | 101 | 0.2a 102 | ---- 103 | * Compile/upload bug fixed 104 | * Syntax highlighting added 105 | * Local help added 106 | * Initial Watch Serial Port implementation 107 | * More intelligent Makefile with environment variable overrides 108 | 109 | 0.1a 110 | ---- 111 | * Initial release, basic implementation of compiling/uploading -------------------------------------------------------------------------------- /Support/Makefile: -------------------------------------------------------------------------------- 1 | #_______________________________________________________________________________ 2 | # 3 | # edam's Arduino makefile 4 | #_______________________________________________________________________________ 5 | # version 0.5 6 | # 7 | # Copyright (C) 2011, 2012, 2013 Tim Marston . 8 | # 9 | # Permission is hereby granted, free of charge, to any person obtaining a copy 10 | # of this software and associated documentation files (the "Software"), to deal 11 | # in the Software without restriction, including without limitation the rights 12 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | # copies of the Software, and to permit persons to whom the Software is 14 | # furnished to do so, subject to the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included in 17 | # all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | # SOFTWARE. 26 | # 27 | #_______________________________________________________________________________ 28 | # 29 | # 30 | # This is a general purpose makefile for use with Arduino hardware and 31 | # software. It works with the arduino-1.0 and later software releases. It 32 | # should work GNU/Linux and OS X. To download the latest version of this 33 | # makefile visit the following website where you can also find documentation on 34 | # it's use. (The following text can only really be considered a reference.) 35 | # 36 | # http://ed.am/dev/make/arduino-mk 37 | # 38 | # This makefile can be used as a drop-in replacement for the Arduino IDE's 39 | # build system. To use it, just copy arduino.mk in to your project directory. 40 | # Or, you could save it somewhere (I keep mine at ~/src/arduino.mk) and create 41 | # a symlink to it in your project directory, named "Makefile". For example: 42 | # 43 | # $ ln -s ~/src/arduino.mk Makefile 44 | # 45 | # The Arduino software (version 1.0 or later) is required. On GNU/Linux you 46 | # can probably install the software from your package manager. If you are 47 | # using Debian (or a derivative), try `apt-get install arduino`. Otherwise, 48 | # you can download the Arduino software manually from http://arduino.cc/. It 49 | # is suggested that you install it at ~/opt/arduino (or /Applications on OS X) 50 | # if you are unsure. 51 | # 52 | # If you downloaded the Arduino software manually and unpacked it somewhere 53 | # other than ~/opt/arduino (or /Applications), you will need to set up the 54 | # ARDUINODIR environment variable to be the path where you unpacked it. (If 55 | # unset, ARDUINODIR defaults to some sensible places). You could set this in 56 | # your ~/.profile by adding something like this: 57 | # 58 | # export ARDUINODIR=~/somewhere/arduino-1.0 59 | # 60 | # For each project, you will also need to set BOARD to the type of Arduino 61 | # you're building for. Type `make boards` for a list of acceptable values. 62 | # For example: 63 | # 64 | # $ export BOARD=uno 65 | # $ make 66 | # 67 | # You may also need to set SERIALDEV if it is not detected correctly. 68 | # 69 | # The presence of a .ino (or .pde) file causes the arduino.mk to automatically 70 | # determine values for SOURCES, TARGET and LIBRARIES. Any .c, .cc and .cpp 71 | # files in the project directory (or any "util" or "utility" subdirectories) 72 | # are automatically included in the build and are scanned for Arduino libraries 73 | # that have been #included. Note, there can only be one .ino (or .pde) file in 74 | # a project directory and if you want to be compatible with the Arduino IDE, it 75 | # should be called the same as the directory name. 76 | # 77 | # Alternatively, if you want to manually specify build variables, create a 78 | # Makefile that defines SOURCES and LIBRARIES and then includes arduino.mk. 79 | # (There is no need to define TARGET). You can also specify the BOARD here, if 80 | # the project has a specific one. Here is an example Makefile: 81 | # 82 | # SOURCES := main.cc other.cc 83 | # LIBRARIES := EEPROM 84 | # BOARD := pro5v 85 | # include ~/src/arduino.mk 86 | # 87 | # Here is a complete list of configuration parameters: 88 | # 89 | # ARDUINODIR The path where the Arduino software is installed on your system. 90 | # 91 | # ARDUINOCONST The Arduino software version, as an integer, used to define the 92 | # ARDUINO version constant. This defaults to 100 if undefined. 93 | # 94 | # AVRDUDECONF The avrdude.conf to use. If undefined, this defaults to a guess 95 | # based on where avrdude is. If set empty, no avrdude.conf is 96 | # passed to avrdude (so the system default is used). 97 | # 98 | # AVRDUDEFLAGS Specify any additional flags for avrdude. The usual flags, 99 | # required to build the project, will be appended to this. 100 | # 101 | # AVRTOOLSPATH A space-separated list of directories that is searched in order 102 | # when looking for the avr build tools. This defaults to PATH, 103 | # followed by subdirectories in ARDUINODIR. 104 | # 105 | # BOARD Specify a target board type. Run `make boards` to see available 106 | # board types. 107 | # 108 | # CPPFLAGS Specify any additional flags for the compiler. The usual flags, 109 | # required to build the project, will be appended to this. 110 | # 111 | # LINKFLAGS Specify any additional flags for the linker. The usual flags, 112 | # required to build the project, will be appended to this. 113 | # 114 | # LIBRARIES A list of Arduino libraries to build and include. This is set 115 | # automatically if a .ino (or .pde) is found. 116 | # 117 | # LIBRARYPATH A space-separated list of directories that is searched in order 118 | # when looking for Arduino libraries. This defaults to "libs", 119 | # "libraries" (in the project directory), then your sketchbook 120 | # "libraries" directory, then the Arduino libraries directory. 121 | # 122 | # SERIALDEV The POSIX device name of the serial device that is the Arduino. 123 | # If unspecified, an attempt is made to guess the name of a 124 | # connected Arduino's serial device, which may work in some cases. 125 | # 126 | # SOURCES A list of all source files of whatever language. The language 127 | # type is determined by the file extension. This is set 128 | # automatically if a .ino (or .pde) is found. 129 | # 130 | # TARGET The name of the target file. This is set automatically if a 131 | # .ino (or .pde) is found, but it is not necessary to set it 132 | # otherwise. 133 | # 134 | # This makefile also defines the following goals for use on the command line 135 | # when you run make: 136 | # 137 | # all This is the default if no goal is specified. It builds the 138 | # target. 139 | # 140 | # target Builds the target. 141 | # 142 | # upload Uploads the target (building it, as necessary) to an attached 143 | # Arduino. 144 | # 145 | # clean Deletes files created during the build. 146 | # 147 | # boards Display a list of available board names, so that you can set the 148 | # BOARD environment variable appropriately. 149 | # 150 | # monitor Start `screen` on the serial device. This is meant to be an 151 | # equivalent to the Arduino serial monitor. 152 | # 153 | # size Displays size information about the built target. 154 | # 155 | # bootloader Burns the bootloader for your board to it. 156 | # 157 | # Builds the specified file, either an object file or the target, 158 | # from those that that would be built for the project. 159 | #_______________________________________________________________________________ 160 | # 161 | 162 | # default arduino software directory, check software exists 163 | ifndef ARDUINODIR 164 | ARDUINODIR := $(firstword $(wildcard ~/opt/arduino /usr/share/arduino \ 165 | /Applications/Arduino.app/Contents/Resources/Java \ 166 | $(HOME)/Applications/Arduino.app/Contents/Resources/Java)) 167 | endif 168 | ifeq "$(wildcard $(ARDUINODIR)/hardware/arduino/boards.txt)" "" 169 | $(error ARDUINODIR is not set correctly; arduino software not found) 170 | endif 171 | 172 | # default arduino version 173 | ARDUINOCONST ?= 100 174 | 175 | # default path for avr tools 176 | AVRTOOLSPATH ?= $(subst :, , $(PATH)) $(ARDUINODIR)/hardware/tools \ 177 | $(ARDUINODIR)/hardware/tools/avr/bin 178 | 179 | # default path to find libraries 180 | LIBRARYPATH ?= libraries libs $(SKETCHBOOKDIR)/libraries $(ARDUINODIR)/libraries 181 | 182 | # default serial device to a poor guess (something that might be an arduino) 183 | SERIALDEVGUESS := 0 184 | ifndef SERIALDEV 185 | SERIALDEV := $(firstword $(wildcard \ 186 | /dev/ttyACM? /dev/ttyUSB? /dev/tty.usbserial* /dev/tty.usbmodem*)) 187 | SERIALDEVGUESS := 1 188 | endif 189 | 190 | # no board? 191 | ifndef BOARD 192 | ifneq "$(MAKECMDGOALS)" "boards" 193 | ifneq "$(MAKECMDGOALS)" "clean" 194 | $(error BOARD is unset. Type 'make boards' to see possible values) 195 | endif 196 | endif 197 | endif 198 | 199 | # obtain board parameters from the arduino boards.txt file 200 | BOARDSFILE := $(ARDUINODIR)/hardware/arduino/boards.txt 201 | readboardsparam = $(shell sed -ne "s/$(BOARD).$(1)=\(.*\)/\1/p" $(BOARDSFILE)) 202 | BOARD_BUILD_MCU := $(call readboardsparam,build.mcu) 203 | BOARD_BUILD_FCPU := $(call readboardsparam,build.f_cpu) 204 | BOARD_BUILD_VARIANT := $(call readboardsparam,build.variant) 205 | BOARD_UPLOAD_SPEED := $(call readboardsparam,upload.speed) 206 | BOARD_UPLOAD_PROTOCOL := $(call readboardsparam,upload.protocol) 207 | BOARD_USB_VID := $(call readboardsparam,build.vid) 208 | BOARD_USB_PID := $(call readboardsparam,build.pid) 209 | BOARD_BOOTLOADER_UNLOCK := $(call readboardsparam,bootloader.unlock_bits) 210 | BOARD_BOOTLOADER_LOCK := $(call readboardsparam,bootloader.lock_bits) 211 | BOARD_BOOTLOADER_LFUSES := $(call readboardsparam,bootloader.low_fuses) 212 | BOARD_BOOTLOADER_HFUSES := $(call readboardsparam,bootloader.high_fuses) 213 | BOARD_BOOTLOADER_EFUSES := $(call readboardsparam,bootloader.extended_fuses) 214 | BOARD_BOOTLOADER_PATH := $(call readboardsparam,bootloader.path) 215 | BOARD_BOOTLOADER_FILE := $(call readboardsparam,bootloader.file) 216 | 217 | # obtain preferences from the IDE's preferences.txt 218 | PREFERENCESFILE := $(firstword $(wildcard \ 219 | $(HOME)/.arduino/preferences.txt $(HOME)/Library/Arduino/preferences.txt)) 220 | ifneq "$(PREFERENCESFILE)" "" 221 | readpreferencesparam = $(shell sed -ne "s/$(1)=\(.*\)/\1/p" $(PREFERENCESFILE)) 222 | SKETCHBOOKDIR := $(call readpreferencesparam,sketchbook.path) 223 | endif 224 | 225 | # invalid board? 226 | ifeq "$(BOARD_BUILD_MCU)" "" 227 | ifneq "$(MAKECMDGOALS)" "boards" 228 | ifneq "$(MAKECMDGOALS)" "clean" 229 | $(error BOARD is invalid. Type 'make boards' to see possible values) 230 | endif 231 | endif 232 | endif 233 | 234 | # auto mode? 235 | INOFILE := $(wildcard *.ino *.pde) 236 | ifdef INOFILE 237 | ifneq "$(words $(INOFILE))" "1" 238 | $(error There is more than one .pde or .ino file in this directory!) 239 | endif 240 | 241 | # automatically determine sources and targeet 242 | TARGET := $(basename $(INOFILE)) 243 | SOURCES := $(INOFILE) \ 244 | $(wildcard *.c *.cc *.cpp *.C) \ 245 | $(wildcard $(addprefix util/, *.c *.cc *.cpp *.C)) \ 246 | $(wildcard $(addprefix utility/, *.c *.cc *.cpp *.C)) 247 | 248 | # automatically determine included libraries 249 | LIBRARIES := $(filter $(notdir $(wildcard $(addsuffix /*, $(LIBRARYPATH)))), \ 250 | $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(SOURCES))) 251 | 252 | endif 253 | 254 | # software 255 | findsoftware = $(firstword $(wildcard $(addsuffix /$(1), $(AVRTOOLSPATH)))) 256 | CC := $(call findsoftware,avr-gcc) 257 | CXX := $(call findsoftware,avr-g++) 258 | LD := $(call findsoftware,avr-ld) 259 | AR := $(call findsoftware,avr-ar) 260 | OBJCOPY := $(call findsoftware,avr-objcopy) 261 | AVRDUDE := $(call findsoftware,avrdude) 262 | AVRSIZE := $(call findsoftware,avr-size) 263 | 264 | # directories 265 | ARDUINOCOREDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino 266 | LIBRARYDIRS := $(foreach lib, $(LIBRARIES), \ 267 | $(firstword $(wildcard $(addsuffix /$(lib), $(LIBRARYPATH))))) 268 | LIBRARYDIRS += $(addsuffix /utility, $(LIBRARYDIRS)) 269 | 270 | # files 271 | TARGET := $(if $(TARGET),$(TARGET),a.out) 272 | OBJECTS := $(addsuffix .o, $(basename $(SOURCES))) 273 | DEPFILES := $(patsubst %, .dep/%.dep, $(SOURCES)) 274 | ARDUINOLIB := .lib/arduino.a 275 | ARDUINOLIBOBJS := $(foreach dir, $(ARDUINOCOREDIR) $(LIBRARYDIRS), \ 276 | $(patsubst %, .lib/%.o, $(wildcard $(addprefix $(dir)/, *.c *.cpp)))) 277 | BOOTLOADERHEX := $(addprefix \ 278 | $(ARDUINODIR)/hardware/arduino/bootloaders/$(BOARD_BOOTLOADER_PATH)/, \ 279 | $(BOARD_BOOTLOADER_FILE)) 280 | 281 | # avrdude confifuration 282 | ifeq "$(AVRDUDECONF)" "" 283 | ifeq "$(AVRDUDE)" "$(ARDUINODIR)/hardware/tools/avr/bin/avrdude" 284 | AVRDUDECONF := $(ARDUINODIR)/hardware/tools/avr/etc/avrdude.conf 285 | else 286 | AVRDUDECONF := $(wildcard $(AVRDUDE).conf) 287 | endif 288 | endif 289 | 290 | # flags 291 | CPPFLAGS += -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections 292 | CPPFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums 293 | CPPFLAGS += -mmcu=$(BOARD_BUILD_MCU) 294 | CPPFLAGS += -DF_CPU=$(BOARD_BUILD_FCPU) -DARDUINO=$(ARDUINOCONST) 295 | CPPFLAGS += -DUSB_VID=$(BOARD_USB_VID) -DUSB_PID=$(BOARD_USB_PID) 296 | CPPFLAGS += -I. -Iutil -Iutility -I $(ARDUINOCOREDIR) 297 | CPPFLAGS += -I $(ARDUINODIR)/hardware/arduino/variants/$(BOARD_BUILD_VARIANT)/ 298 | CPPFLAGS += $(addprefix -I , $(LIBRARYDIRS)) 299 | CPPDEPFLAGS = -MMD -MP -MF .dep/$<.dep 300 | CPPINOFLAGS := -x c++ -include $(ARDUINOCOREDIR)/Arduino.h 301 | AVRDUDEFLAGS += $(addprefix -C , $(AVRDUDECONF)) -DV 302 | AVRDUDEFLAGS += -p $(BOARD_BUILD_MCU) -P $(SERIALDEV) 303 | AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED) 304 | LINKFLAGS += -Os -Wl,--gc-sections -mmcu=$(BOARD_BUILD_MCU) 305 | 306 | # figure out which arg to use with stty (for OS X, GNU and busybox stty) 307 | STTYFARG := $(shell stty --help 2>&1 | \ 308 | grep -q 'illegal option' && echo -f || echo -F) 309 | 310 | # include dependencies 311 | ifneq "$(MAKECMDGOALS)" "clean" 312 | -include $(DEPFILES) 313 | endif 314 | 315 | # default rule 316 | .DEFAULT_GOAL := all 317 | 318 | #_______________________________________________________________________________ 319 | # RULES 320 | 321 | .PHONY: all target upload clean boards monitor size bootloader 322 | 323 | all: target 324 | 325 | target: $(TARGET).hex 326 | 327 | upload: target 328 | @echo "\nUploading to board..." 329 | @test -n "$(SERIALDEV)" || { \ 330 | echo "error: SERIALDEV could not be determined automatically." >&2; \ 331 | exit 1; } 332 | @test 0 -eq $(SERIALDEVGUESS) || { \ 333 | echo "*GUESSING* at serial device:" $(SERIALDEV); \ 334 | echo; } 335 | #ifeq "$(BOARD_BOOTLOADER_PATH)" "caterina" 336 | # stty $(STTYFARG) $(SERIALDEV) speed 1200 337 | # sleep 1 338 | #else 339 | # stty $(STTYFARG) $(SERIALDEV) hupcl 340 | #endif 341 | $(AVRDUDE) $(AVRDUDEFLAGS) -U flash:w:$(TARGET).hex:i 342 | 343 | clean: 344 | rm -f $(OBJECTS) 345 | rm -f $(TARGET).elf $(TARGET).hex $(ARDUINOLIB) *~ 346 | rm -rf .lib .dep 347 | 348 | boards: 349 | @echo "Available values for BOARD:" 350 | @sed -nEe '/^#/d; /^[^.]+\.name=/p' $(BOARDSFILE) | \ 351 | sed -Ee 's/([^.]+)\.name=(.*)/\1 \2/' \ 352 | -e 's/(.{12}) *(.*)/\1 \2/' 353 | 354 | monitor: 355 | @test -n "$(SERIALDEV)" || { \ 356 | echo "error: SERIALDEV could not be determined automatically." >&2; \ 357 | exit 1; } 358 | @test -n `which screen` || { \ 359 | echo "error: can't find GNU screen, you might need to install it." >&2 \ 360 | exit 1; } 361 | @test 0 -eq $(SERIALDEVGUESS) || { \ 362 | echo "*GUESSING* at serial device:" $(SERIALDEV); \ 363 | echo; } 364 | screen $(SERIALDEV) 365 | 366 | size: $(TARGET).elf 367 | echo && $(AVRSIZE) --format=avr --mcu=$(BOARD_BUILD_MCU) $(TARGET).elf 368 | 369 | bootloader: 370 | @echo "Burning bootloader to board..." 371 | @test -n "$(SERIALDEV)" || { \ 372 | echo "error: SERIALDEV could not be determined automatically." >&2; \ 373 | exit 1; } 374 | @test 0 -eq $(SERIALDEVGUESS) || { \ 375 | echo "*GUESSING* at serial device:" $(SERIALDEV); \ 376 | echo; } 377 | stty $(STTYFARG) $(SERIALDEV) hupcl 378 | $(AVRDUDE) $(AVRDUDEFLAGS) -U lock:w:$(BOARD_BOOTLOADER_UNLOCK):m 379 | $(AVRDUDE) $(AVRDUDEFLAGS) -eU lfuse:w:$(BOARD_BOOTLOADER_LFUSES):m 380 | $(AVRDUDE) $(AVRDUDEFLAGS) -U hfuse:w:$(BOARD_BOOTLOADER_HFUSES):m 381 | ifneq "$(BOARD_BOOTLOADER_EFUSES)" "" 382 | $(AVRDUDE) $(AVRDUDEFLAGS) -U efuse:w:$(BOARD_BOOTLOADER_EFUSES):m 383 | endif 384 | ifneq "$(BOOTLOADERHEX)" "" 385 | $(AVRDUDE) $(AVRDUDEFLAGS) -U flash:w:$(BOOTLOADERHEX):i 386 | endif 387 | $(AVRDUDE) $(AVRDUDEFLAGS) -U lock:w:$(BOARD_BOOTLOADER_LOCK):m 388 | 389 | # building the target 390 | 391 | $(TARGET).hex: $(TARGET).elf 392 | $(OBJCOPY) -O ihex -R .eeprom $< $@ 393 | 394 | .INTERMEDIATE: $(TARGET).elf 395 | 396 | $(TARGET).elf: $(ARDUINOLIB) $(OBJECTS) 397 | $(CC) $(LINKFLAGS) $(OBJECTS) $(ARDUINOLIB) -lm -o $@ 398 | 399 | %.o: %.c 400 | mkdir -p .dep/$(dir $<) 401 | $(COMPILE.c) $(CPPDEPFLAGS) -o $@ $< 402 | 403 | %.o: %.cpp 404 | mkdir -p .dep/$(dir $<) 405 | $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $< 406 | 407 | %.o: %.cc 408 | mkdir -p .dep/$(dir $<) 409 | $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $< 410 | 411 | %.o: %.C 412 | mkdir -p .dep/$(dir $<) 413 | $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $< 414 | 415 | %.o: %.ino 416 | mkdir -p .dep/$(dir $<) 417 | $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $< 418 | 419 | %.o: %.pde 420 | mkdir -p .dep/$(dir $<) 421 | $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $< 422 | 423 | # building the arduino library 424 | 425 | $(ARDUINOLIB): $(ARDUINOLIBOBJS) 426 | $(AR) rcs $@ $? 427 | 428 | .lib/%.c.o: %.c 429 | mkdir -p $(dir $@) 430 | $(COMPILE.c) -o $@ $< 431 | 432 | .lib/%.cpp.o: %.cpp 433 | mkdir -p $(dir $@) 434 | $(COMPILE.cpp) -o $@ $< 435 | 436 | .lib/%.cc.o: %.cc 437 | mkdir -p $(dir $@) 438 | $(COMPILE.cpp) -o $@ $< 439 | 440 | .lib/%.C.o: %.C 441 | mkdir -p $(dir $@) 442 | $(COMPILE.cpp) -o $@ $< 443 | 444 | # Local Variables: 445 | # mode: makefile 446 | # tab-width: 4 447 | # End: 448 | --------------------------------------------------------------------------------