/make/arduino-mk

To get this branch, use:
bzr branch http://bzr.ed.am/make/arduino-mk

« back to all changes in this revision

Viewing changes to arduino.mk

  • Committer: edam
  • Date: 2012-04-24 12:10:14 UTC
  • Revision ID: tim@ed.am-20120424121014-1auighcivq8hf7p3
Tags: 0.3
update NEWS and THANKS

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
#                         edam's Arduino makefile
4
4
#_______________________________________________________________________________
5
 
#                                                                 version 0.4dev
 
5
#                                                                    version 0.3
6
6
#
7
7
# Copyright (C) 2011, 1012 Tim Marston <tim@ed.am>.
8
8
#
249
249
CPPFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
250
250
CPPFLAGS += -mmcu=$(BOARD_BUILD_MCU)
251
251
CPPFLAGS += -DF_CPU=$(BOARD_BUILD_FCPU) -DARDUINO=$(ARDUINOCONST)
252
 
CPPFLAGS += -I. -Iutil -Iutility -I $(ARDUINOCOREDIR)
253
 
CPPFLAGS += -I $(ARDUINODIR)/hardware/arduino/variants/$(BOARD_BUILD_VARIANT)/
254
 
CPPFLAGS += $(addprefix -I $(ARDUINODIR)/libraries/, $(LIBRARIES))
255
 
CPPFLAGS += $(patsubst %, -I $(ARDUINODIR)/libraries/%/utility, $(LIBRARIES))
 
252
CPPFLAGS += -I. -Iutil -Iutility -I$(ARDUINOCOREDIR)
 
253
CPPFLAGS += -I$(ARDUINODIR)/hardware/arduino/variants/$(BOARD_BUILD_VARIANT)/
 
254
CPPFLAGS += $(addprefix -I$(ARDUINODIR)/libraries/, $(LIBRARIES))
 
255
CPPFLAGS += $(patsubst %, -I$(ARDUINODIR)/libraries/%/utility, $(LIBRARIES))
256
256
CPPDEPFLAGS = -MMD -MP -MF .dep/$<.dep
257
257
CPPINOFLAGS := -x c++ -include $(ARDUINOCOREDIR)/Arduino.h
258
258
AVRDUDEFLAGS := $(addprefix -C , $(AVRDUDECONF)) -DV
260
260
AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED)
261
261
LINKFLAGS := -Os -Wl,--gc-sections -mmcu=$(BOARD_BUILD_MCU)
262
262
 
263
 
# figure out which arg to use with stty (for OS X, GNU and busybox stty)
264
 
STTYFARG := $(shell stty --help 2>&1 | \
265
 
        grep -q 'illegal option' && echo -f || echo -F)
 
263
# figure out which arg to use with stty
 
264
STTYFARG := $(shell stty --help > /dev/null 2>&1 && echo -F || echo -f)
266
265
 
267
266
# include dependencies
268
267
ifneq "$(MAKECMDGOALS)" "clean"
281
280
 
282
281
target: $(TARGET).hex
283
282
 
284
 
upload: target
 
283
upload:
285
284
        @echo "\nUploading to board..."
286
285
        @test -n "$(SERIALDEV)" || { \
287
286
                echo "error: SERIALDEV could not be determined automatically." >&2; \
299
298
 
300
299
boards:
301
300
        @echo Available values for BOARD:
302
 
        @sed -nEe '/^#/d; /^[^.]+\.name=/p' $(BOARDS_FILE) | \
303
 
                sed -Ee 's/([^.]+)\.name=(.*)/\1            \2/' \
304
 
                        -e 's/(.{12}) *(.*)/\1 \2/'
 
301
        @sed -ne '/^#/d; /^[^.]\+\.name=/p' $(BOARDS_FILE) | \
 
302
                sed -e 's/\([^.]\+\)\.name=\(.*\)/\1            \2/' \
 
303
                        -e 's/\(.\{12\}\) *\(.*\)/\1 \2/'
305
304
 
306
305
monitor:
307
306
        @test -n "$(SERIALDEV)" || { \
326
325
.INTERMEDIATE: $(TARGET).elf
327
326
 
328
327
$(TARGET).elf: $(ARDUINOLIB) $(OBJECTS)
329
 
        $(CC) $(LINKFLAGS) $(OBJECTS) $(ARDUINOLIB) -lm -o $@
 
328
        $(CC) $(LINKFLAGS) $(OBJECTS) $(ARDUINOLIB) -o $@
330
329
 
331
330
%.o: %.c
332
331
        mkdir -p .dep/$(dir $<)