forked from nightseas/libarduino_uno
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
75 lines (61 loc) · 1.93 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
#
# Assume standlone toolchain
#
#CC = arm-linux-gnueabihf-gcc
#CXX = arm-linux-gnueabihf-g++
#AR = arm-linux-gnueabihf-ar
DIR=$(shell pwd)
INCLUDES = \
-I$(DIR) \
-I$(DIR)/hardware \
-I$(DIR)/hardware/arduino \
-I$(DIR)/hardware/arduino/cores \
-I$(DIR)/hardware/arduino/cores/arduino \
-I$(DIR)/hardware/arduino/variants \
-I$(DIR)/hardware/arduino/variants/sunxi \
-I$(DIR)/libraries \
-I$(DIR)/libraries/SPI \
-I$(DIR)/libraries/Wire \
-I$(DIR)/libraries/PN532_SPI
CFLAGS = -fPIC
#CFLAGS = $(INCLUDES)
#CFLAGS += -march=armv7-a -mfpu=neon
SRCS = \
hardware/arduino/cores/arduino/main.cpp \
hardware/arduino/cores/arduino/platform.cpp \
hardware/arduino/cores/arduino/Print.cpp \
hardware/arduino/cores/arduino/Stream.cpp \
hardware/arduino/cores/arduino/Tone.cpp \
hardware/arduino/cores/arduino/WInterrupts.c \
hardware/arduino/cores/arduino/wiring.c \
hardware/arduino/cores/arduino/wiring_analog.c \
hardware/arduino/cores/arduino/wiring_digital.c \
hardware/arduino/cores/arduino/wiring_pulse.c \
hardware/arduino/cores/arduino/wiring_shift.c \
hardware/arduino/cores/arduino/WMath.cpp \
hardware/arduino/cores/arduino/WString.cpp \
hardware/arduino/cores/arduino/Serial.cpp \
libraries/Wire/Wire.cpp \
libraries/SPI/SPI.cpp \
libraries/LiquidCrystal/Dyrobot_MCP23008.cpp \
libraries/LiquidCrystal/LiquidCrystal.cpp \
libraries/PN532_SPI/PN532.cpp \
#OBJS = $(SRCS:%.c=%.o)
OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SRCS)))
%.o: %.cpp
@rm -f $@
$(CXX) $(CFLAGS) $(INCLUDES) -c $< -o $@ -Wno-deprecated-declarations
%.o: %.c
@rm -f $@
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ -Wno-deprecated-declarations
LIB_STATIC = libarduino.a
LIB_SHARE = libarduino.so
LIB = $(LIB_STATIC) $(LIB_SHARE)
all: $(LIB)
make -C samples/
$(LIB): $(OBJS)
$(AR) cq $(LIB_STATIC) $(OBJS)
$(CXX) -shared -Wl,-soname,$(LIB_SHARE) -o $(LIB_SHARE) $(OBJS)
clean:
rm -f $(LIB_STATIC) $(LIB_SHARE) $(OBJS)
make -C samples/ clean