summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Arduino.mk12
1 files changed, 8 insertions, 4 deletions
diff --git a/Arduino.mk b/Arduino.mk
index a70d5ce..e55b683 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -247,11 +247,12 @@ CORE_CPP_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o)
CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, \
$(OBJDIR)/%,$(CORE_OBJ_FILES))
+CORE_ARCHIVE = $(OBJDIR)/core.a
endif
endif
# all the objects!
-OBJS = $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS)
+OBJS = $(LOCAL_OBJS) $(LIB_OBJS)
########################################################################
# Rules for making stuff
@@ -410,8 +411,11 @@ all: $(OBJDIR) $(TARGET_HEX)
$(OBJDIR):
mkdir $(OBJDIR)
-$(TARGET_ELF): $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(SYS_OBJS) -lc
+$(CORE_ARCHIVE): $(CORE_OBJS)
+ $(AR) rcs $@ $^
+
+$(TARGET_ELF): $(OBJS) $(CORE_ARCHIVE)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(CORE_ARCHIVE) $(SYS_OBJS) -lc
$(DEP_FILE): $(OBJDIR) $(DEPS)
cat $(DEPS) > $(DEP_FILE)
@@ -445,7 +449,7 @@ ispload: $(TARGET_HEX)
-U lock:w:$(ISP_LOCK_FUSE_POST):m
clean:
- $(REMOVE) $(OBJS) $(TARGETS) $(DEP_FILE) $(DEPS)
+ $(REMOVE) $(OBJS) $(CORE_OBJS) $(TARGETS) $(DEP_FILE) $(DEPS) $(CORE_ARCHIVE)
depends: $(DEPS)
cat $(DEPS) > $(DEP_FILE)