-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
110 lines (91 loc) · 2.78 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#
# Makefile to build mbed library
#
DIR=.
DUMMY=$(shell )
OBJDIR=build
KERNELDIR=../..
HRP2_LIBRARY_FILE=libmbed-hrp2.a
HRP3_LIBRARY_FILE=libmbed-hrp3.a
ifneq ("$(wildcard $(KERNELDIR)/kernel/kernel.tf)","")
LIBRARY_FILE=$(HRP2_LIBRARY_FILE)
CFLAGS += -DBUILD_HRP2_LIBRARY
else
LIBRARY_FILE=$(HRP3_LIBRARY_FILE)
CFLAGS += -DBUILD_HRP3_LIBRARY
endif
# Tools
GCC_TARGET = arm-none-eabi
AR = $(GCC_TARGET)-ar
CC = $(GCC_TARGET)-gcc -O2 -nostdlib -std=gnu99 -fno-strict-aliasing -mcpu=arm926ej-s -mlittle-endian
CXX = $(GCC_TARGET)-g++ -O2 -nostdlib -std=gnu++11 -fno-strict-aliasing -mcpu=arm926ej-s -mlittle-endian -fpermissive
ALL_OBJS +=
# FIXME: dummy
CFLAGS += -I${DIR}/dummy
#ALL_CXX_OBJS += dummy/dummy.o dummy/rt_CMSIS.o dummy/Thread.o
ALL_CXX_OBJS += dummy/rt_CMSIS.o dummy/Thread.o
ALL_OBJS += dummy/syscall.o dummy/us_ticker.o
CFLAGS += -DTOPPERS_OMIT_TECS -I${KERNELDIR}/include
# FIXME: hard-coded files for EV3RT
CFLAGS += -I${KERNELDIR}/target/ev3_gcc \
-I${KERNELDIR}/arch \
-I${KERNELDIR}/arch/gcc \
-I${KERNELDIR}/arch/arm_gcc/am1808 \
-I${KERNELDIR}/arch/arm_gcc/common \
-I${KERNELDIR}/modules/btstack/platforms/ev3rt \
-I${KERNELDIR} \
-I${DIR}/arch/ev3rt
ALL_OBJS += ${DIR}/arch/ev3rt/btstack_emac.o \
${DIR}/arch/ev3rt/lwip_httpd_handler.o
ALL_CXX_OBJS += ${DIR}/arch/ev3rt/mbed-interface.o
# mbed-os
CFLAGS += -I${DIR}/mbed-os \
-I${DIR}/mbed-os/hal \
-I${DIR}/mbed-os/hal/hal \
-I${DIR}/mbed-os/platform \
-I${DIR}/mbed-os/rtos \
-I${DIR}/mbed-os/drivers
ALL_CXX_OBJS += mbed-os/platform/retarget.o \
mbed-os/drivers/FileBase.o \
mbed-os/drivers/FileLike.o \
mbed-os/drivers/FilePath.o \
mbed-os/drivers/FileSystemLike.o \
mbed-os/drivers/Stream.o \
mbed-os/rtos/Mutex.o \
mbed-os/rtos/Semaphore.o
ALL_OBJS += mbed-os/platform/mbed_error.o \
mbed-os/platform/mbed_interface.o
#include Makefile.USBHost
include Makefile.lwIP
#
# Include header and source files
#
vpath %.c $(SRCDIRS)
all: prepare-obj-folder $(LIBRARY_FILE)
clean:
cd ${OBJDIR}; \
rm -f ${ALL_OBJS} dummy.o
realclean: clean
cd ${OBJDIR}; \
rm -f $(HRP2_LIBRARY_FILE) $(HRP3_LIBRARY_FILE)
dummy: dummy.o $(ALL_OBJS)
$(CC) -o dummy dummy.o $(ALL_OBJS)
define print_cmd
@printf " %-7s %s\n" $1 $2 1>&2
endef
$(LIBRARY_FILE): $(ALL_OBJS) $(ALL_CXX_OBJS)
$(call print_cmd, "AR", $@)
@cd $(OBJDIR) && \
$(AR) -rcs $@ $(ALL_OBJS) $(ALL_CXX_OBJS)
@#arm-none-eabi-g++ $(ALL_OBJS) $(ALL_CXX_OBJS)
$(ALL_OBJS): %.o: %.c
$(call print_cmd, "CC", $<)
@mkdir -p $(shell dirname $(OBJDIR)/$@)
@$(CC) -c $(CFLAGS) -c $< -o $(OBJDIR)/$@
$(ALL_CXX_OBJS): %.o: %.cpp
$(call print_cmd, "CXX", $<)
@mkdir -p $(shell dirname $(OBJDIR)/$@)
@$(CXX) -c $(CFLAGS) -c $< -o $(OBJDIR)/$@
prepare-obj-folder:
@mkdir -p $(OBJDIR)
.PHONY: prepare-obj-folder