-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (29 loc) · 1.91 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
CC = gcc
CFLAGS = -g -w -lrt -m64 -lm -Wl,-z,relro,-z,now,-z,noexecstack -fno-strict-aliasing -fno-omit-frame-pointer -pipe -Wall -fPIC -MD -MP -fno-common -freg-struct-return -fno-inline -fno-exceptions -Wfloat-equal -Wshadow -Wformat=2 -Wextra -rdynamic -Wl,-z,relro,-z,noexecstack -fstrength-reduce -fno-builtin -fsigned-char -ffunction-sections -fdata-sections -Wpointer-arith -Wcast-qual -Waggregate-return -Winline -Wunreachable-code -Wcast-align -Wundef -Wredundant-decls -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
# -D _SYS_LOG=1 -shared -fPIC
#-D Linux=1
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -lrt -m64 -Wl,-z,relro,-z,now,-z,noexecstack -fno-strict-aliasing -fno-omit-frame-pointer -pipe -Wall -fPIC -MD -MP -fno-common -freg-struct-return -fno-inline -fno-exceptions -Wfloat-equal -Wshadow -Wformat=2 -Wextra -rdynamic -Wl,-z,relro,-z,noexecstack -fstack-protector-strong -fstrength-reduce -fno-builtin -fsigned-char -ffunction-sections -fdata-sections -Wpointer-arith -Wcast-qual -Waggregate-return -Winline -Wunreachable-code -Wcast-align -Wundef -Wredundant-decls -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
OBJS = string_util.o mqtt_c_demo.o
#$(warning "OS $(OS)")
#$(warning "OSTYPE $(OSTYPE)")
HEADER_PATH = -I./include
LIB_PATH = -L./lib
SRC_PATH = ./src
LIBS = $(LIB_PATH) -lpaho-mqtt3as -lssl -lcrypto
#$(LIB_PATH) -lHWMQTT
#$(LIB_PATH) -lpaho-mqtt3cs $(LIB_PATH)
ifeq ($(OS), Windows_NT)
TARGET = MQTT_Demo.exe
else
# TARGET = libHWMQTT.so
TARGET = MQTT_Demo.o
endif
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
string_util.o: $(SRC_PATH)/util/string_util.c
$(CC) $(CFLAGS) -c $(SRC_PATH)/util/string_util.c -o string_util.o $(HEADER_PATH)/util/
mqtt_c_demo.o: $(SRC_PATH)/mqtt_c_demo.c
$(CC) $(CFLAGS) -c $(SRC_PATH)/mqtt_c_demo.c -o mqtt_c_demo.o $(HEADER_PATH)/util/ $(HEADER_PATH)/base/ $(HEADER_PATH)
all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET) *.d