forked from LiamBindle/MQTT-C
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
31 lines (21 loc) · 980 Bytes
/
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
CC = gcc
CFLAGS = -Wextra -Wall -std=gnu99 -Iinclude -Wno-unused-parameter -Wno-unused-variable -Wno-duplicate-decl-specifier
MQTT_C_SOURCES = src/mqtt.c src/mqtt_pal.c
MQTT_C_EXAMPLES = bin/simple_publisher bin/simple_subscriber bin/reconnect_subscriber bin/bio_publisher bin/openssl_publisher
MQTT_C_UNITTESTS = bin/tests
BINDIR = bin
all: $(BINDIR) $(MQTT_C_UNITTESTS) $(MQTT_C_EXAMPLES)
bin/simple_%: examples/simple_%.c $(MQTT_C_SOURCES)
$(CC) $(CFLAGS) $^ -lpthread -o $@
bin/reconnect_%: examples/reconnect_%.c $(MQTT_C_SOURCES)
$(CC) $(CFLAGS) $^ -lpthread -o $@
bin/bio_%: examples/bio_%.c $(MQTT_C_SOURCES)
$(CC) $(CFLAGS) -D MQTT_USE_BIO $^ -lpthread `pkg-config --libs openssl` -o $@
bin/openssl_%: examples/openssl_%.c $(MQTT_C_SOURCES)
$(CC) $(CFLAGS) -D MQTT_USE_BIO $^ -lpthread `pkg-config --libs openssl` -o $@
$(BINDIR):
mkdir -p $(BINDIR)
$(MQTT_C_UNITTESTS): tests.c $(MQTT_C_SOURCES)
$(CC) $(CFLAGS) $^ -lcmocka -o $@
clean:
rm -rf $(BINDIR)