-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.app
21 lines (17 loc) · 963 Bytes
/
Makefile.app
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$(APP_NAME)_SRC_DIR ?= $(ROOT_DIR)/app/$(APP_NAME)
$(APP_NAME)_BIN_DIR ?= $(BIN_DIR)/app/$(APP_NAME)
$(APP_NAME)_SRC ?= $(wildcard $($(APP_NAME)_SRC_DIR)/*.c)
$(APP_NAME)_OBJ ?= $($(APP_NAME)_SRC:$($(APP_NAME)_SRC_DIR)/%.c=$($(APP_NAME)_BIN_DIR)/%.o)
$(APP_NAME)_DEPS ?= $($(APP_NAME)_OBJ:.o=.d)
$(APP_NAME)_INCLUDE ?= -I $($(APP_NAME)_SRC_DIR)/include
-include $($(APP_NAME)_DEPS)
$($(APP_NAME)_BIN_DIR) :
mkdir -p $($(APP_NAME)_BIN_DIR)
$($(APP_NAME)_BIN_DIR)/%.o: APP_NAME:=$(APP_NAME)
$($(APP_NAME)_BIN_DIR)/%.o: APP_INCLUDES:=$(APP_INCLUDES)
$($(APP_NAME)_BIN_DIR)/%.o: $($(APP_NAME)_SRC_DIR)/%.c | $($(APP_NAME)_BIN_DIR)
$(CC) $(CFLAGS) $($(APP_NAME)_INCLUDE) $(APP_INCLUDES) -MMD -MP -c $< -o $@
$(APP_NAME): APP_NAME:=$(APP_NAME)
$(APP_NAME): APP_ARCHIVES:=$(APP_ARCHIVES)
$(APP_NAME): $($(APP_NAME)_OBJ) $(APP_ARCHIVES) | $($(APP_NAME)_BIN_DIR)
$(CC) $($(APP_NAME)_OBJ) $(APP_ARCHIVES) $(LDFLAGS) $(MBEDTLS_LIBS) $(NANOCBOR_LIBS) -o $(BIN_DIR)/$@