198
198
TARGET := $(if $(TARGET),$(TARGET),a.out)
199
199
OBJECTS := $(addsuffix .o, $(basename $(SOURCES)))
200
DEPFILES := $(patsubst %, .dep/%.dep, $(SOURCES))
200
201
ARDUINOCOREDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino
201
202
ARDUINOLIB := .lib/arduino.a
202
203
ARDUINOLIBLIBSDIR := $(ARDUINODIR)/libraries
247
CPPFLAGS_S := -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections
248
CPPFLAGS_S += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
249
CPPFLAGS_S += -mmcu=$(BOARD_BUILD_MCU)
250
CPPFLAGS_S += -DF_CPU=$(BOARD_BUILD_FCPU) -DARDUINO=$(ARDUINOCONST)
251
CPPFLAGS_S += -I. -Iutil -Iutility -I$(ARDUINOCOREDIR)
252
CPPFLAGS_S += -I$(ARDUINODIR)/hardware/arduino/variants/$(BOARD_BUILD_VARIANT)/
253
CPPFLAGS_S += $(addprefix -I$(ARDUINODIR)/libraries/, $(LIBRARIES))
254
CPPFLAGS_S += $(patsubst %, -I$(ARDUINODIR)/libraries/%/utility, $(LIBRARIES))
255
CPPFLAGS = $(CPPFLAGS_S)
248
CPPFLAGS := -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections
249
CPPFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
250
CPPFLAGS += -mmcu=$(BOARD_BUILD_MCU)
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))
256
CPPDEPFLAGS = -MMD -MP -MF .dep/$<.dep
257
CPPINOFLAGS := -x c++ -include $(ARDUINOCOREDIR)/Arduino.h
256
258
AVRDUDEFLAGS := $(addprefix -C , $(AVRDUDECONF)) -DV
257
259
AVRDUDEFLAGS += -p $(BOARD_BUILD_MCU) -P $(SERIALDEV)
258
260
AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED)
289
296
rm -f $(TARGET).elf $(TARGET).hex $(ARDUINOLIB) *~
293
300
@echo Available values for BOARD:
294
@sed -ne '/^#/d;s/^\(.*\).name=\(.*\)/\1 \2/;T' \
295
-e 's/\(.\{12\}\) *\(.*\)/\1 \2/;p' $(BOARDS_FILE)
301
@sed -nEe '/^#/d; /^[^.]+\.name=/p' $(BOARDS_FILE) | \
302
sed -Ee 's/([^.]+)\.name=(.*)/\1 \2/' \
303
-e 's/(.{12}) *(.*)/\1 \2/'
298
306
@test -n "$(SERIALDEV)" || { \
319
327
$(TARGET).elf: $(ARDUINOLIB) $(OBJECTS)
320
328
$(CC) $(LINKFLAGS) $(OBJECTS) $(ARDUINOLIB) -o $@
323
# $(COMPILE.c) -o $@ $<
331
mkdir -p .dep/$(dir $<)
332
$(COMPILE.c) $(CPPDEPFLAGS) -o $@ $<
335
mkdir -p .dep/$(dir $<)
336
$(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $<
339
mkdir -p .dep/$(dir $<)
340
$(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $<
343
mkdir -p .dep/$(dir $<)
344
$(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $<
326
$(COMPILE.cpp) -o $@ -x c++ -include $(ARDUINOCOREDIR)/Arduino.h $<
347
mkdir -p .dep/$(dir $<)
348
$(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $<
329
$(COMPILE.cpp) -o $@ -x c++ -include $(ARDUINOCOREDIR)/Arduino.h $<
351
mkdir -p .dep/$(dir $<)
352
$(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ -x c++ -include $(ARDUINOCOREDIR)/Arduino.h $<
331
354
# building the arduino library