/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: Tim Marston
  • Date: 2013-07-18 17:57:12 UTC
  • Revision ID: tim@ed.am-20130718175712-nxoqb246mfgfh811
updated regex that detects #included libraries

Show diffs side-by-side

added added

removed removed

242
242
# automatically determine sources and targeet
243
243
TARGET := $(basename $(INOFILE))
244
244
SOURCES := $(INOFILE) \
245
 
        $(wildcard *.c *.cc *.cpp *.C *.s *.S) \
246
 
        $(wildcard $(addprefix util/, *.c *.cc *.cpp *.C *.s *.S)) \
247
 
        $(wildcard $(addprefix utility/, *.c *.cc *.cpp *.C *.s *.S))
 
245
        $(wildcard *.c *.cc *.cpp *.C) \
 
246
        $(wildcard $(addprefix util/, *.c *.cc *.cpp *.C)) \
 
247
        $(wildcard $(addprefix utility/, *.c *.cc *.cpp *.C))
248
248
 
249
249
# automatically determine included libraries
250
250
LIBRARIES := $(filter $(notdir $(wildcard $(addsuffix /*, $(LIBRARYPATH)))), \
259
259
CXX := $(call findsoftware,avr-g++)
260
260
LD := $(call findsoftware,avr-ld)
261
261
AR := $(call findsoftware,avr-ar)
262
 
AS := $(call findsoftware,avr-as)
263
262
OBJCOPY := $(call findsoftware,avr-objcopy)
264
263
AVRDUDE := $(call findsoftware,avrdude)
265
264
AVRSIZE := $(call findsoftware,avr-size)
276
275
DEPFILES := $(patsubst %, .dep/%.dep, $(SOURCES))
277
276
ARDUINOLIB := .lib/arduino.a
278
277
ARDUINOLIBOBJS := $(foreach dir, $(ARDUINOCOREDIR) $(LIBRARYDIRS), \
279
 
        $(patsubst %, .lib/%.o, $(wildcard $(addprefix $(dir)/, \
280
 
                *.c *.cc *.cpp *.C *.s *.S))))
 
278
        $(patsubst %, .lib/%.o, $(wildcard $(addprefix $(dir)/, *.c *.cpp))))
281
279
BOOTLOADERHEX := $(addprefix \
282
280
        $(ARDUINODIR)/hardware/arduino/bootloaders/$(BOARD_BOOTLOADER_PATH)/, \
283
281
        $(BOARD_BOOTLOADER_FILE))
400
398
$(TARGET).elf: $(ARDUINOLIB) $(OBJECTS)
401
399
        $(CC) $(LINKFLAGS) $(OBJECTS) $(ARDUINOLIB) -lm -o $@
402
400
 
403
 
%.o: %.ino
404
 
        mkdir -p .dep/$(dir $<)
405
 
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $<
406
 
 
407
 
%.o: %.pde
408
 
        mkdir -p .dep/$(dir $<)
409
 
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $<
410
 
 
411
401
%.o: %.c
412
402
        mkdir -p .dep/$(dir $<)
413
403
        $(COMPILE.c) $(CPPDEPFLAGS) -o $@ $<
424
414
        mkdir -p .dep/$(dir $<)
425
415
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $<
426
416
 
427
 
%.o: %.S
428
 
        mkdir -p .dep/$(dir $<)
429
 
        $(COMPILE.S) $(CPPDEPFLAGS) -o $@ $<
 
417
%.o: %.ino
 
418
        mkdir -p .dep/$(dir $<)
 
419
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $<
 
420
 
 
421
%.o: %.pde
 
422
        mkdir -p .dep/$(dir $<)
 
423
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $<
430
424
 
431
425
# building the arduino library
432
426
 
449
443
        mkdir -p $(dir $@)
450
444
        $(COMPILE.cpp) -o $@ $<
451
445
 
452
 
.lib/%.s.o: %.s
453
 
        mkdir -p $(dir $@)
454
 
        $(COMPILE.s) -o $@ $<
455
 
 
456
 
.lib/%.S.o: %.S
457
 
        mkdir -p $(dir $@)
458
 
        $(COMPILE.S) -o $@ $<
459
 
 
460
446
# Local Variables:
461
447
# mode: makefile
462
448
# tab-width: 4