forked from gaph-pucrs/MA-Memphis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (29 loc) · 883 Bytes
/
Makefile
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
YELLOW = \033[0;33m
NC = \033[0m # No Color
SRCDIR = src
INCDIR = src/include
CC = riscv64-elf-gcc
OBJDUMP = riscv64-elf-objdump
OBJCOPY = riscv64-elf-objcopy
CFLAGS = -march=rv32im -mabi=ilp32 -Os -std=c11 -fdata-sections -ffunction-sections -Wall -I$(INCDIR)
SRCC = $(wildcard $(SRCDIR)/*.c)
SRCS = $(wildcard $(SRCDIR)/*.S)
OBJ = $(patsubst %.c, %.o, $(SRCC)) $(patsubst %.S, %.o, $(SRCS))
all: libmemphis.a
libmemphis.a: $(OBJ)
@riscv64-elf-ar rcs $@ $^
$(SRCDIR)/%.o: $(SRCDIR)/%.c
@printf "${YELLOW}Compiling lib: %s ...${NC}\n" "$<"
@$(CC) -c $< -o $@ $(CFLAGS)
$(SRCDIR)/%.o: $(SRCDIR)/%.S
@printf "${YELLOW}Compiling lib: %s ...${NC}\n" "$<"
@$(CC) -c $< -o $@ $(CFLAGS)
clean:
@rm -f $(SRCDIR)/*.o
@rm -f *.a
install: libmemphis.a
@mkdir -p ../include
@mkdir -p ../lib
@cp -r $(INCDIR)/* ../include
@cp libmemphis.a ../lib/libmemphis.a
.PHONY: clean