-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
56 lines (40 loc) · 1007 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
PREFIX:=$(shell cat prefix.txt)
OUTBIN:= \
btcwatch \
src/main \
src/main.o \
src/lib/libbtcapi/btcapi.o \
src/btcutil.o
OUTCONF:= \
autom4te.cache \
prefix.txt \
config.log \
config.status \
src/include/config.h
CURLLIBS:=$(shell pkg-config libcurl --libs)
JANSSONLIBS:=$(shell pkg-config jansson --libs)
CURLFLAGS:=$(shell pkg-config libcurl --cflags)
JANSSONFLAGS:=$(shell pkg-config jansson --cflags)
LDFLAGS:=$(JANSSONLIBS) $(CURLLIBS)
MCFLAGS:=-Wall -Wextra -Wpedantic -std=gnu11 -pipe -D_GNU_SOURCE $(JANSSONFLAGS) $(CURLFLAGS)
MCFLAGS+=$(CFLAGS)
CFLAGS:=$(MCFLAGS)
all: btcwatch
btcwatch: src/main
cp $^ $@
src/main: src/main.o src/lib/libbtcapi/btcapi.o src/btcutil.o
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^
# (un)installation
install:
mkdir -p $(PREFIX)/bin
install -m777 btcwatch $(PREFIX)/bin
install-strip: install
strip -s $(PREFIX)/bin/btcwatch
uninstall:
rm -rf $(PREFIX)/bin/btcwatch
# cleaning
clean:
$(RM) -f $(OUTBIN)
distclean: clean
$(RM) -rf $(OUTCONF)