-
Notifications
You must be signed in to change notification settings - Fork 2
/
emul.mk
46 lines (35 loc) · 1.23 KB
/
emul.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
# Copyright (C) 2017 GreenWaves Technologies
# All rights reserved.
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
ifndef GAP_SDK_HOME
$(error Source sourceme in gap_sdk first)
endif
include common.mk
include $(RULES_DIR)/at_common_decl.mk
include common/model_decl.mk
MODEL_GEN_EXTRA_FLAGS= -f $(MODEL_BUILD)
CC = gcc
CFLAGS += -g -m32 -O0 -D__EMUL__ -DAT_MODEL_PREFIX=$(MODEL_PREFIX) $(MODEL_SIZE_CFLAGS)
INCLUDES = -I. -I$(MODEL_COMMON_INC) -I$(TILER_EMU_INC) -I$(TILER_INC) $(CNN_LIB_INCLUDE) -I$(MODEL_BUILD)
LFLAGS =
LIBS = -lm
SRCS = $(MODEL_PREFIX).c $(MODEL_GEN_C) $(MODEL_COMMON_SRCS) $(CNN_LIB)
$(info CNN_LIB++ $(CNN_LIB))
$(info SRCS++ $(SRCS))
BUILD_DIR = BUILD_EMUL
OBJS = $(patsubst %.c, $(BUILD_DIR)/%.o, $(SRCS))
MAIN = $(MODEL_PREFIX)_emul
all: model $(MAIN)
$(OBJS) : $(BUILD_DIR)/%.o : %.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< $(INCLUDES) -MD -MF $(basename $@).d -o $@
$(MAIN): $(OBJS)
$(CC) $(CFLAGS) -MMD -MP $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
clean: clean_model
$(RM) -r $(BUILD_DIR)
$(RM) $(MAIN)
.PHONY: depend clean
include common/model_rules.mk
$(info APP_SRCS... $(APP_SRCS))
$(info APP_CFLAGS... $(APP_CFLAGS))