From 668a4470548514b96311a976d6b3527a5a532f38 Mon Sep 17 00:00:00 2001 From: tinyladi Date: Thu, 27 Feb 2014 20:57:43 +0100 Subject: [PATCH] Add a reference makefile, with real-world example --- HISTORY.md | 3 +- README.md | 4 +- examples/MakefileExample/Makefile-example.mk | 55 ++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 examples/MakefileExample/Makefile-example.mk diff --git a/HISTORY.md b/HISTORY.md index 99711e5..b40aa21 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Add avr-libc/malloc.c and realloc.c to included core files. Fixes issue #163 (https://github.com/sej7278) - Fix: Add "gpio" to the list of isp that don't have a port. (Issue #165, #166) (https://github.com/sej7278) - Fix: Add "-D__PROG_TYPES_COMPAT__" to the avr-g++ compiler flags to match IDE. (https://github.com/sej7278) +- New: Create `Makefile-example-mk`, a *real life* `Makefile` example, to be used as a reference. (https://github.com/tinyladi) ### 1.3.1 (2014-02-04) - Fix: BUNDLED_AVR_TOOLS_DIR is now set properly when using only arduino-core and not the whole arduino package. (https://github.com/sej7278) @@ -21,7 +22,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Tweak: Don't hard code MONITOR_PORT in examples, for more flexible testing. (Issue #157) (https://github.com/peplin) - Tweak: Silence the stderr output from call to `which`. (Issue #158) (https://github.com/peplin) - Fix: Override complete compiler tool paths for chipKIT. (Issue #159) (https://github.com/peplin) -- New: The makefile is compatible with Windows +- New: The makefile is compatible with Windows - New: Update `README.md` file about usage and Windows compatibility ### 1.2.0 (2014-01-14) diff --git a/README.md b/README.md index 28d85e6..d658789 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,9 @@ On other systems: ## Usage -You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile) or also checkout the sample makefiles inside the examples/ folder +You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile). + +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). Download a copy of this repo some where in your system or install it through a package. diff --git a/examples/MakefileExample/Makefile-example.mk b/examples/MakefileExample/Makefile-example.mk new file mode 100644 index 0000000..8d64a83 --- /dev/null +++ b/examples/MakefileExample/Makefile-example.mk @@ -0,0 +1,55 @@ +### DISCLAIMER +### This is an example Makefile and it MUST be configured to suit your needs. +### For detailled explanations about all the avalaible options, +### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md + +### PROJECT_DIR +### This is the path to where you have created/cloned your project +PROJECT_DIR = /Users/Ladislas/dev/leka/moti + +### ARDMK_DIR +### Path to the Arduino-Makefile directory. +ARDMK_DIR = $(PROJECT_DIR)/arduino-mk + +### ARDUINO_DIR +### Path to the Arduino application and ressources directory. +ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java + +### USER_LIB_PATH +### Path to where the your project's libraries are stored. +USER_LIB_PATH := $(PROJECT_DIR)/lib + +### BOARD_TAG +### It must be set to the board you are currently using. (i.e uno, mega2560, etc.) +BOARD_TAG = mega2560 + +### MONITOR_BAUDRATE +### It must be set to Serial baudrate value you are using. +MONITOR_BAUDRATE = 115200 + +### AVR_TOOLS_DIR +### Path to the AVR tools directory such as avr-gcc, avr-g++, etc. +AVR_TOOLS_DIR = /usr/local + +### AVRDDUDE +### Path to avrdude directory. +AVRDDUDE = /usr/local/bin/avrdude + +### CPPFLAGS +### Flags you might want to set for debugging purpose. Comment to stop. +CPPFLAGS = -pedantic -Wall -Wextra + +### MONITOR_PORT +### The port your board is connected to. Using an '*' tries all the ports and finds the right one. +MONITOR_PORT = /dev/tty.usbmodem* + +### don't touch this +CURRENT_DIR = $(shell basename $(CURDIR)) + +### OBJDIR +### This is were you put the binaries you just compile using 'make' +OBJDIR = $(PROJECT_DIR)/bin/$(BOARD_TAG)/$(CURRENT_DIR) + +### path to Arduino.mk, inside the ARDMK_DIR, don't touch. +include $(ARDMK_DIR)/Arduino.mk +