-
Notifications
You must be signed in to change notification settings - Fork 218
/
build-targets.mk
48 lines (39 loc) · 1.6 KB
/
build-targets.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Sources to compile
SRC_FILES = main.cpp
OBJ_FILES = $(addprefix $(BUILD_PATH)/,$(SRC_FILES:.cpp=.o))
$(BUILD_PATH)/%.o: %.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/libmaple.a: $(BUILDDIRS) $(TGT_BIN)
- rm -f $@
$(AR) crv $(BUILD_PATH)/libmaple.a $(TGT_BIN)
library: $(BUILD_PATH)/libmaple.a
.PHONY: library
$(BUILD_PATH)/$(BOARD).elf: $(BUILDDIRS) $(TGT_BIN) $(OBJ_FILES)
$(SILENT_LD) $(CXX) $(LDFLAGS) -o $@ $(TGT_BIN) $(BUILD_PATH)/main.o -Wl,-Map,$(BUILD_PATH)/$(BOARD).map
$(BUILD_PATH)/$(BOARD).hex: $(BUILD_PATH)/$(BOARD).elf
$(SILENT_OBJCOPY) $(OBJCOPY) -v -Oihex $(BUILD_PATH)/$(BOARD).elf $@ 1>/dev/null
$(BUILD_PATH)/$(BOARD).bin: $(BUILD_PATH)/$(BOARD).elf
$(SILENT_OBJCOPY) $(OBJCOPY) -v -Obinary $(BUILD_PATH)/$(BOARD).elf $@ 1>/dev/null
$(SILENT_DISAS) $(DISAS) -d $(BUILD_PATH)/$(BOARD).elf > $(BUILD_PATH)/$(BOARD).disas
@echo " "
@echo "Object file sizes:"
@find $(BUILD_PATH) -iname *.o | xargs $(SIZE) -t > $(BUILD_PATH)/$(BOARD).sizes
@cat $(BUILD_PATH)/$(BOARD).sizes
@echo " "
@echo "Final Size:"
@$(SIZE) $<
@echo $(MEMORY_TARGET) > $(BUILD_PATH)/build-type
$(BUILDDIRS):
@mkdir -p $@
MSG_INFO:
@echo "================================================================================"
@echo ""
@echo " Build info:"
@echo " BOARD: " $(BOARD)
@echo " MCU: " $(MCU)
@echo " MEMORY_TARGET: " $(MEMORY_TARGET)
@echo ""
@echo " See 'make help' for all possible targets"
@echo ""
@echo "================================================================================"
@echo ""