forked from mwarning/dhtd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (38 loc) · 1.08 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
CFLAGS += -Wall -Wwrite-strings -pedantic -std=gnu99
LDFLAGS += -lc
FEATURES ?= cli lpd debug
OBJS = build/kad.o build/log.o build/results.o \
build/conf.o build/net.o build/utils.o \
build/announces.o build/peerfile.o
ifeq ($(OS),Windows_NT)
OBJS += build/unix.o build/windows.o
else
OBJS += build/unix.o
endif
.PHONY: all clean strip install \
dhtd install uninstall
all: dhtd
ifeq ($(findstring cli,$(FEATURES)),cli)
OBJS += build/ext-cli.o
CFLAGS += -DCLI
endif
ifeq ($(findstring lpd,$(FEATURES)),lpd)
OBJS += build/ext-lpd.o
CFLAGS += -DLPD
endif
ifeq ($(findstring debug,$(FEATURES)),debug)
CFLAGS += -g -DDEBUG
endif
build/%.o : src/%.c src/%.h
$(CC) $(CFLAGS) -c -o $@ $<
dhtd: build/main.o $(OBJS) $(EXTRA)
$(CC) $(CFLAGS) build/main.o $(OBJS) $(LDFLAGS) -o build/dhtd
ln -s dhtd build/dhtd-ctl 2> /dev/null || true
clean:
rm -rf build/*
install:
cp build/dhtd $(DESTDIR)/usr/bin/ 2> /dev/null || true
ln -s dhtd $(DESTDIR)/usr/bin/dhtd-ctl || true
uninstall:
rm $(DESTDIR)/usr/bin/dhtd 2> /dev/null || true
rm $(DESTDIR)/usr/bin/dhtd-ctl 2> /dev/null || true