2020-08-17 12:45:53 +03:00
|
|
|
TARGET = target_lo
|
|
|
|
|
|
|
|
|
|
|
|
######################################
|
|
|
|
# building variables
|
|
|
|
######################################
|
|
|
|
# debug build?
|
|
|
|
DEBUG = 1
|
|
|
|
# optimization
|
|
|
|
OPT = -Og
|
|
|
|
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# paths
|
|
|
|
#######################################
|
|
|
|
# Build path
|
|
|
|
BUILD_DIR = build
|
|
|
|
|
|
|
|
######################################
|
|
|
|
# source
|
|
|
|
######################################
|
2020-08-26 11:43:18 +03:00
|
|
|
C_SOURCES =
|
|
|
|
CPP_SOURCES =
|
|
|
|
C_DEFS =
|
2020-08-17 12:45:53 +03:00
|
|
|
|
2020-08-26 11:43:18 +03:00
|
|
|
# Target
|
2020-08-17 12:45:53 +03:00
|
|
|
|
2020-08-26 11:43:18 +03:00
|
|
|
C_SOURCES += Src/main.c
|
|
|
|
C_SOURCES += Src/flipper_hal.c
|
|
|
|
C_SOURCES += Src/lo_os.c
|
|
|
|
C_SOURCES += Src/lo_hal.c
|
|
|
|
|
|
|
|
C_DEFS += -DFURI_DEBUG
|
2020-08-26 04:56:33 +03:00
|
|
|
# Core
|
|
|
|
|
2020-08-26 11:43:18 +03:00
|
|
|
CPP_SOURCES += ../core/app.cpp
|
|
|
|
|
2020-08-24 18:31:22 +03:00
|
|
|
C_SOURCES += ../core/debug.c
|
|
|
|
C_SOURCES += ../core/furi.c
|
|
|
|
C_SOURCES += ../core/furi_ac.c
|
2020-08-26 04:56:33 +03:00
|
|
|
|
|
|
|
# System applications
|
|
|
|
|
|
|
|
ifeq ($(TEST), 1)
|
2020-08-24 18:31:22 +03:00
|
|
|
C_SOURCES += ../applications/tests/furiac_test.c
|
|
|
|
C_SOURCES += ../applications/tests/furi_record_test.c
|
|
|
|
C_SOURCES += ../applications/tests/test_index.c
|
2020-08-26 04:56:33 +03:00
|
|
|
C_DEFS += -DTEST
|
|
|
|
endif
|
|
|
|
|
2020-08-26 11:43:18 +03:00
|
|
|
# Examples
|
2020-08-26 04:56:33 +03:00
|
|
|
|
|
|
|
ifeq ($(EXAMPLE_BLINK), 1)
|
|
|
|
C_SOURCES += ../applications/examples/blink.c
|
|
|
|
C_DEFS += -DEXAMPLE_BLINK
|
|
|
|
endif
|
2020-08-24 18:31:22 +03:00
|
|
|
|
2020-08-26 11:43:18 +03:00
|
|
|
# User application
|
|
|
|
|
|
|
|
# Add C_SOURCES +=, C_DEFS += or CPP_SOURCES += here
|
|
|
|
|
2020-08-17 12:45:53 +03:00
|
|
|
#######################################
|
|
|
|
# binaries
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
CPP = g++
|
|
|
|
AS =
|
|
|
|
CP = objcopy
|
|
|
|
SZ = size
|
|
|
|
HEX = $(CP) -O ihex
|
|
|
|
BIN = $(CP) -O binary -S
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# CFLAGS
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
|
|
|
|
# C includes
|
|
|
|
C_INCLUDES = \
|
|
|
|
-IInc \
|
2020-08-24 18:31:22 +03:00
|
|
|
-I../applications \
|
|
|
|
-I../core
|
2020-08-17 12:45:53 +03:00
|
|
|
|
|
|
|
# compile gcc flags
|
2020-08-24 18:31:22 +03:00
|
|
|
CFLAGS = $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections -pthread
|
2020-08-17 12:45:53 +03:00
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -g -gdwarf-2
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Generate dependency information
|
|
|
|
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
|
|
|
|
|
|
|
CPPFLAGS = -fno-threadsafe-statics
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# LDFLAGS
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
# libraries
|
|
|
|
LIBS = -lc -lm
|
|
|
|
LIBDIR =
|
2020-08-24 18:31:22 +03:00
|
|
|
LDFLAGS = $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections -pthread
|
2020-08-17 12:45:53 +03:00
|
|
|
|
|
|
|
# default action: build all
|
|
|
|
all: $(BUILD_DIR)/$(TARGET)
|
2020-08-26 04:56:33 +03:00
|
|
|
|
|
|
|
example_blink:
|
|
|
|
EXAMPLE_BLINK=1 make
|
|
|
|
$(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
test:
|
|
|
|
TEST=1 make
|
|
|
|
$(BUILD_DIR)/$(TARGET)
|
2020-08-17 12:45:53 +03:00
|
|
|
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# build the application
|
|
|
|
#######################################
|
|
|
|
# list of objects
|
|
|
|
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
|
|
|
vpath %.c $(sort $(dir $(C_SOURCES)))
|
|
|
|
|
|
|
|
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
|
|
|
|
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
|
|
|
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
|
|
|
|
$(CPP) -c $(CFLAGS) $(CPPFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
|
|
|
|
|
|
|
$(BUILD_DIR)/$(TARGET): $(OBJECTS) Makefile
|
|
|
|
$(CPP) $(OBJECTS) $(LDFLAGS) -o $@
|
|
|
|
$(SZ) $@
|
|
|
|
|
|
|
|
$(BUILD_DIR):
|
|
|
|
mkdir $@
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# clean up
|
|
|
|
#######################################
|
|
|
|
clean:
|
|
|
|
-rm -fR $(BUILD_DIR)
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# dependencies
|
|
|
|
#######################################
|
|
|
|
-include $(wildcard $(BUILD_DIR)/*.d)
|
|
|
|
|
|
|
|
# *** EOF ***
|