summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2024-10-28 18:03:34 +0100
committerThomas Schmucker <ts@its1.de>2024-10-28 18:03:34 +0100
commit2458e6aa1658b2cc5b6349b89f1276873554ad6f (patch)
tree751ca4be139d1e0ce28d4300eb381ed4843fa39f
parent8859b6b8c78beca455e1273b5a31f09e165eed03 (diff)
downloaduse-mosquitto-2458e6aa1658b2cc5b6349b89f1276873554ad6f.tar.gz
use-mosquitto-2458e6aa1658b2cc5b6349b89f1276873554ad6f.tar.bz2
use-mosquitto-2458e6aa1658b2cc5b6349b89f1276873554ad6f.zip
Verschiebe die Konfiguration nach 'src'
-rw-r--r--.gitignore2
-rw-r--r--compile_flags.txt2
-rw-r--r--config.h.in39
-rw-r--r--config.mk2
-rw-r--r--makefile4
-rw-r--r--src/main.c1
6 files changed, 37 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index fa770c6..bc22094 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
1bin/ 1bin/
2obj/ 2obj/
3include/config.h 3src/config.h
diff --git a/compile_flags.txt b/compile_flags.txt
index 8e3330c..255b429 100644
--- a/compile_flags.txt
+++ b/compile_flags.txt
@@ -5,4 +5,4 @@
5-Wdouble-promotion 5-Wdouble-promotion
6-pedantic 6-pedantic
7-std=c17 7-std=c17
8-Iinclude 8-Isrc
diff --git a/config.h.in b/config.h.in
index a622aad..0cf0d70 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,10 +1,33 @@
1#pragma once 1#pragma once
2 2
3#define CLIENT_ID "my-client-id" 3#ifndef CLIENT_ID
4#define HOST "localhost" 4# define CLIENT_ID "my-client-id"
5#define PORT 1883 5#endif
6#define USERNAME "user" 6
7#define PASSWORD "password" 7#ifndef HOST
8#define TOPIC "topic" 8# define HOST "localhost"
9#define KEEPALIVE 10 9#endif
10#define WAIT_UNTIL_RECONNECT 10 10
11#ifndef PORT
12# define PORT 1883
13#endif
14
15#ifndef USERNAME
16# define USERNAME "user"
17#endif
18
19#ifndef PASSWORD
20# define PASSWORD "password"
21#endif
22
23#ifndef TOPIC
24# define TOPIC "topic"
25#endif
26
27#ifndef KEEPALIVE
28# define KEEPALIVE 10
29#endif
30
31#ifndef WAIT_UNTIL_RECONNECT
32# define WAIT_UNTIL_RECONNECT 10
33#endif
diff --git a/config.mk b/config.mk
index 8ca0709..d733c58 100644
--- a/config.mk
+++ b/config.mk
@@ -1,2 +1,2 @@
1CFLAGS=-Wall -Werror -Wextra -Wconversion -Wdouble-promotion -pedantic -std=c17 -Iinclude 1CFLAGS=-Wall -Werror -Wextra -Wconversion -Wdouble-promotion -pedantic -std=c17 -Isrc
2LDFLAGS=-lmosquitto 2LDFLAGS=-lmosquitto
diff --git a/makefile b/makefile
index 536bcd2..2365415 100644
--- a/makefile
+++ b/makefile
@@ -14,10 +14,10 @@ debug: CFLAGS+=-g
14$(BINARY): $(OBJ_FILES) | bin 14$(BINARY): $(OBJ_FILES) | bin
15 cc $(LDFLAGS) $^ -o $@ 15 cc $(LDFLAGS) $^ -o $@
16 16
17obj/%.o: src/%.c include/config.h | obj 17obj/%.o: src/%.c src/config.h | obj
18 cc $(CFLAGS) -c $< -o $@ 18 cc $(CFLAGS) -c $< -o $@
19 19
20include/config.h: 20src/config.h:
21 cp config.h.in $@ 21 cp config.h.in $@
22 22
23bin obj: 23bin obj:
diff --git a/src/main.c b/src/main.c
index 16deb68..a181171 100644
--- a/src/main.c
+++ b/src/main.c
@@ -9,6 +9,7 @@
9 9
10// Project 10// Project
11#include <mosquitto.h> 11#include <mosquitto.h>
12
12#include "config.h" 13#include "config.h"
13 14
14#ifndef UNUSED 15#ifndef UNUSED