blob: 32aadd2e4a9d9a5562a3ad09abb665be5740ce31 (
plain)
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
|
SOURCES = $(wildcard *.c)
INCLUDES = $(wildcard *.h) gitversion.h
OBJECTS = $(SOURCES:.c=.o)
DEPS = libtoxcore
CFLAGS += $(shell pkg-config --cflags $(DEPS))
LDFLAGS += $(shell pkg-config --libs $(DEPS))
LDFLAGS_STATIC += -static -pthread -Wl,-Bstatic $(LDFLAGS)
# Targets
all: tuntox
gitversion.h: .git/HEAD .git/index
@echo " GEN $@"
@echo "#define GITVERSION \"$(shell git rev-parse HEAD)\"" > $@
%.o: %.c $(INCLUDES)
@echo " CC $@"
@$(CC) -c $(CFLAGS) $< -o $@
tuntox: $(OBJECTS) $(INCLUDES)
@echo " LD $@"
@$(CC) $(LDFLAGS) $(OBJECTS) -o $@
tuntox_static: $(OBJECTS) $(INCLUDES)
@echo " LD tuntox"
@$(CC) $(OBJECTS) $(LDFLAGS_STATIC) -o tuntox
cscope.out:
@echo " GEN $@"
@cscope -bv ./*.[ch] &> /dev/null
clean:
rm -f *.o tuntox cscope.out gitversion.h
.PHONY: all clean tuntox_static
|