-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
57 lines (41 loc) · 1.21 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
include ./Makefile.inc
INCLUDES = \
-I. \
-I./source \
-I./arch \
-I./cfg \
CFLAGS = \
$(WARNINGS) $(INCLUDES) \
-fomit-frame-pointer -fno-strict-aliasing -fno-builtin \
-D__gracefulExit -mcmodel=medany -O2 #-fPIC
GCCVER = $(shell $(GCC) --version | grep gcc | cut -d" " -f9)
#
# Define all object files.
#
OBJS = ./arch/start.o ./arch/init.o ./source/ucos_ii.o ./cfg/app_hooks.o ./cfg/os_cpu_a.o ./cfg/os_cpu_c.o ./arch/time.o ./arch/host.o ./arch/trap.o main.o
LDFLAGS = -T arch/link.ld -nostartfiles -static -nostdlib
LIBS = -L$(CCPATH)/lib/gcc/$(TARGET)/$(GCCVER) \
-L$(CCPATH)/$(TARGET)/lib \
-lc -lgcc
%.o: %.c
@echo " CC $<"
@$(GCC) -c $(CFLAGS) -o $@ $<
%.o: %.S
@echo " CC $<"
@$(GCC) -c $(CFLAGS) -o $@ $<
all: $(PROG).elf
$(PROG).elf : $(OBJS) Makefile
@echo Linking....
@$(GCC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
@$(OBJDUMP) -S $(PROG).elf > $(PROG).asm
@echo Completed $@
clean :
-find . -name "*.o" | xargs rm
-find . -name "*.elf" | xargs rm
-find . -name "*.out" | xargs rm
-rm $(PROG).asm
force_true:
@true
#-------------------------------------------------------------
sim: all
spike -l $(PROG).elf