This repository has been archived on 2025-04-02. You can view files and clone it, but cannot push or open issues or pull requests.
controller-hart/User/hart/Makefile

83 lines
1.9 KiB
Makefile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#指定32位python路径,python版本需要3.8以下
# C:\Users\xushenghao\AppData\Local\Programs\Python\Python37-32\python.exe
PYTHON = python
# 变量BIN: 给定的是我们想要生成的可执行文件的名称
BIN = hart.dll
INC= -I lib/inc -I lib/flow
# 变量SRC中给的是所有的想要编译的.c源文件与makefile在同一目录下可直接写如这里的main.c否则需要写明相对路径如这里的其余源文件都在目录src下
# 多文件时,选择用"\"进行分行处理
SRC = \
lib/flow/flow_core.c \
lib/src/aes.c \
lib/src/cmac.c \
lib/src/malloc.c \
lib/src/debug.c \
lib/src/sqqueue.c \
lib/src/lib.c \
hart.c \
hart_frame.c \
hart_cache.c \
master/src/hart_master_frame.c \
master/src/hart_master_req_user.c \
master/src/hart_master_req.c \
master/src/hart_master_rsp.c \
master/src/hart_master.c \
slave/src/hart_slave_frame.c \
slave/src/hart_slave_req_user.c \
slave/src/hart_slave_req.c \
slave/src/hart_slave_frame_mock.c \
slave/src/hart_slave.c \
TEST = \
test/src/run.py
TEST_SIMPLE = \
test/src/test_hart_slave_req.py
# 变量CC给定编译器名gcc
# 变量CFLAGS传给编译器的某些编译参数看需求添加
CC = gcc
CFLAGS = -m32 -shared -std=c99 -DMASTER -DSLAVE
# 变量GDB给定debugger名gdb
# 变量RM给定删除文件方式用于后面删除所有编译所得的.o文件,linux下使用rm -rf
GDB = gdb
RM = rm -rf
# 变量OBJS将变量SRC中所有的.c文件替换成以.o结尾即将.c源文件编译成.o文件
OBJS = $(SRC:%.c=%.o)
all: so test clean
so: $(BIN)
$(BIN): $(OBJS)
$(CC) $(CFLAGS) $^ -o $@
# pull in dependencies for .o files
-include $(OBJS:.o=.d)
%.o: %.c
$(CC) $(CFLAGS) $(INC) -c $< -o $@
.PHONY: so test clean
ss: so test_simple clean
dev:
$(PYTHON) main.py
test:
$(PYTHON) $(TEST)
test_simple:
$(PYTHON) $(TEST_SIMPLE)
clean:
$(RM) $(BIN) $(OBJS)