-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
50 lines (41 loc) · 1.2 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
# Author : Vaibhav Bansal
AR = xtensa-lx106-elf-ar
CC = xtensa-lx106-elf-gcc
CCFLAGS += \
-Os \
-g \
-Wpointer-arith \
-fno-aggressive-loop-optimizations \
-Wundef \
-Werror \
-Wl,-EL \
-fno-inline-functions \
-DMEMLEAK_DEBUG \
-fdata-sections \
-nostdlib \
-mlongcalls \
-mtext-section-literals \
-ffunction-sections \
-fno-builtin-printf
SDK_LIBDIR = lib
SDK_LDDIR = ld
SUBDIRS = MQTTClient
# Include
SDK_INCDIR = extra_include include include/espressif include/freertos include/json include/udhcp include/lwip include/lwip/lwip include/lwip/ipv4 include/lwip/ipv6
LIB_INCDIR = lib/MQTTClient/include lib/MQTTPacket/include
SDK_INCDIR := $(addprefix -I $(SDK_PATH)/,$(SDK_INCDIR))
LIB_INCDIR := $(addprefix -I ,$(LIB_INCDIR))
SRC_DIR=lib/MQTTClient lib/MQTTPacket
SRCS := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c))
OBJECTS := $(patsubst %.c,%.o,$(SRCS))
.PHONY: all
all: $(OBJECTS)
$(OBJECTS): %.o: %.c
$(CC) -o $@ -c $^ $(CCFLAGS) $(SDK_INCDIR) $(LIB_INCDIR) $(LIBS)
$(AR) ru libmqtt.a $@
install:
cp libmqtt.a $(SDK_PATH)/lib
cp -a lib/MQTTClient/include/. $(SDK_PATH)/include/mqtt
cp -a lib/MQTTPacket/include/. $(SDK_PATH)/include/mqtt
clean:
rm -f $(OBJECTS) *.a