blob: b5ee9c88ca675d92f75f99c146af8adb61d028c7 (
plain) (
blame)
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
|
include deps/nanopb/extra/nanopb.mk
include config.mk
SRC += $(shell find src/ -type f -name '*.c')
SRC += $(NANOPB_DIR)/pb_encode.c
SRC += $(NANOPB_DIR)/pb_decode.c
SRC += $(NANOPB_DIR)/pb_common.c
PROTO = $(shell find src/ -type f -name '*.proto')
OBJ = $(PROTO:%.proto=$(BUILD_DIR)/%.pb.c.o)
OBJ += $(SRC:%=$(BUILD_DIR)/%.o)
H = include/libumumble.h
.PHONY: all static shared tests clean install-static install-shared install
all: static shared
static: $(SNAME)
shared: $(DNAME)
$(OBJ): config.mk $(PROTO)
$(SNAME): $(OBJ)
ar rcs $@ $?
$(DNAME): LDFLAGS += -shared
$(DNAME): $(OBJ)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
$(BUILD_DIR)/%.c.o: %.c
mkdir -p '$(@D)'
$(CC) -c -o $@ $(INCLUDES) $(CFLAGS) $<
tests:
$(MAKE) -C tests
clean:
rm -rf $(SNAME) $(DNAME) $(BUILD_DIR) src/*.pb.h src/*.pb.c
$(MAKE) -C tests clean
install-header:
install -m 644 $(H)
install-static: $(SNAME)
install -m 755 $(SNAME) $(PREFIX)/lib64
install-shared: $(DNAME)
install -m 755 $(DNAME) $(PREFIX)/lib64
install: install-header install-static install-shared
|