forked from errordeveloper/mqtt-codec
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
45 lines (33 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
MQTT_ENABLE_SERVER ?= 1
MQTT_ENABLE_CLIENT ?= 1
LIB_FOLDER ?=.
CFLAGS = -Wall -Werror -pedantic -std=c99 -DMQTT_ENABLE_SERVER=$(MQTT_ENABLE_SERVER) -DMQTT_ENABLE_CLIENT=$(MQTT_ENABLE_CLIENT) $(CFLAGS_EXTRA)
ifdef DEBUG
CFLAGS += -Og -ggdb -DDEBUG
else
CFLAGS += -Os
endif
LIB = $(LIB_FOLDER)/libmqttc.a
all: test
src/errors.o: src/errors.c src/errors.h
src/buffer.o: src/buffer.c src/buffer.h
src/message.o: src/message.c src/message.h
src/parser.o: src/parser.c src/parser.h
src/serialiser.o: src/serialiser.c src/serialiser.h
bin/test.o: bin/test.c
$(CC) -c $(CFLAGS) -Isrc/ -o bin/test.o bin/test.c
test: bin/test
bin/test: src/errors.o src/buffer.o src/message.o src/parser.o src/serialiser.o bin/test.o
$(CC) $(CFLAGS) $(LDFLAGS) -I../src -o bin/test.exe src/errors.o src/buffer.o src/message.o src/parser.o src/serialiser.o bin/test.o
$(LIB): src/errors.o src/buffer.o src/message.o src/parser.o src/serialiser.o
$(AR) rcs $@ $^
lib: $(LIB)
clean:
rm -f src/*.o bin/*.o bin/test.exe $(LIB)
# Files that should follow our coding standards
CS_FILES := $(shell find . -name '*.c' -or -name '*.h')
cs:
for FILE in $(CS_FILES); do \
clang-format -i -style=file $$FILE; \
done
.PHONY: all lib test clean