-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
55 lines (40 loc) · 1.13 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
51
52
53
54
55
CC=gcc
LDFLAGS=-lm
# Debug
CFLAGS=-g -O0 -Werror
# Release
# CFLAGS=-O2
# OS X
#CFLAGS+=-pipe -Wall
#CFLAGS+=-pipe -Wall -D_GNU_SOURCE
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wunreachable-code
CFLAGS += -Wwrite-strings -Wpointer-arith -Wbad-function-cast -Wcast-align -Wcast-qual
# libcurl and json-c
ifeq ($(shell pkg-config --exists json-c libcurl && echo 0),0)
CFLAGS += $(shell pkg-config --cflags json-c libcurl)
LDFLAGS += $(shell pkg-config --libs json-c libcurl)
else
$(error json-c and libcurl is required)
endif
# libmosquitto MQTT Support
ifeq ($(shell pkg-config --exists libmosquitto && echo 0),0)
CFLAGS += $(shell pkg-config --cflags libmosquitto)
LDFLAGS += $(shell pkg-config --libs libmosquitto)
else
$(warning assuming libmosquitto exists in the system)
LDFLAGS+=-lmosquitto
endif
COBJ=json.o http.o mqtt.o racks.o
TKUFTOP=tkuftop.o $(COBJ)
TKUFSTOP=tkufstop.o $(COBJ)
DESTDIR=/
all: tkuftop tkufstop
tkuftop: $(TKUFTOP)
$(CC) $(TKUFTOP) $(LDFLAGS) -o tkuftop
tkufstop: $(TKUFSTOP)
$(CC) $(TKUFSTOP) $(LDFLAGS) -o tkufstop
clean:
-rm tkuftop tkufstop *.o
install:
install -m 755 tkuftop tkufstop $(DESTDIR)/usr/bin