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) $(PREFIX)/include 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