Browse files

change Makefile for Arduino 1.0

  • Loading branch information...
1 parent 6487935 commit 8c7c315aca7dd6800fa177a24f9f992abbdd9c10 @wertarbyte committed Mar 1, 2012
Showing with 13 additions and 6 deletions.
  1. +13 −6 Arduino.mk
View
19 Arduino.mk
@@ -139,6 +139,7 @@ endif
ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
+ARDUINO_VARIANT_PATH = $(ARDUINO_DIR)/hardware/arduino/variants/standard
endif
@@ -201,23 +202,26 @@ CAT = cat
ECHO = echo
# General arguments
-SYS_LIBS = $(patsubst %,$(ARDUINO_LIB_PATH)/%,$(ARDUINO_LIBS))
+SYS_LIBS = $(patsubst %,$(ARDUINO_LIB_PATH)/%,$(ARDUINO_LIBS)) $(patsubst %,$(ARDUINO_LIB_PATH)/%/utility,$(ARDUINO_LIBS))
SYS_INCLUDES = $(patsubst %,-I%,$(SYS_LIBS))
SYS_OBJS = $(wildcard $(patsubst %,%/*.o,$(SYS_LIBS)))
-LIB_SRC = $(wildcard $(patsubst %,%/*.cpp,$(SYS_LIBS)))
-LIB_OBJS = $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_SRC))
+LIB_C_SRC = $(wildcard $(patsubst %,%/*.c,$(SYS_LIBS)))
+LIB_CPP_SRC = $(wildcard $(patsubst %,%/*.cpp,$(SYS_LIBS)))
+LIB_SRC = $(LIB_C_SRC) $(LIB_CPP_SRC)
+LIB_OBJS = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(LIB_C_SRC)) \
+ $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_CPP_SRC))
CPPFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
- -I. -I$(ARDUINO_CORE_PATH) \
+ -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VARIANT_PATH) \
$(SYS_INCLUDES) -g -Os -w -Wall \
-ffunction-sections -fdata-sections
-CFLAGS = -std=gnu99
+CFLAGS = -std=gnu99 $(CPPFLAGS)
CXXFLAGS = -fno-exceptions
ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp
LDFLAGS = -mmcu=$(MCU) -lm -Wl,--gc-sections -Os
# Rules for making a CPP file from the main sketch (.cpe)
-PDEHEADER = \\\#include \"WProgram.h\"
+PDEHEADER = \\\#include \"Arduino.h\"
# Expand and pick the first port
ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT)))
@@ -234,6 +238,9 @@ ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT)))
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp
mkdir -p $(dir $@)
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
+$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.c
+ mkdir -p $(dir $@)
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
# normal local sources
# .o rules are for objects, .d for dependency tracking

0 comments on commit 8c7c315

Please sign in to comment.