about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 6 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 143ffa7..cb04172 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,10 @@
+include deps/nanopb/extra/nanopb.mk
 include config.mk
 
 SRC += $(shell find src/ -type f -name '*.c')
+PROTO = $(shell find src/ -type f -name '*.proto')
 OBJ = $(SRC:%=$(BUILD_DIR)/%.o)
+OBJ += $(PROTO:%.proto=$(BUILD_DIR)/%.pb.c.o)
 H = include/libumumble.h
 
 .PHONY: all static shared clean install-static install-shared install
@@ -12,7 +15,7 @@ static: $(SNAME)
 
 shared: $(DNAME)
 
-$(OBJ): config.h config.mk
+$(OBJ): config.mk $(PROTO)
 
 $(SNAME): $(OBJ)
 	ar -rcs $@ $^
@@ -21,15 +24,12 @@ $(DNAME): LDFLAGS += -shared
 $(DNAME): $(OBJ)
 	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
 
-config.h:
-	cp config.def.h $@
-
 $(BUILD_DIR)/%.c.o: %.c
 	mkdir -p '$(@D)'
-	$(CC) -c -o $@ $(INCLUDES) $(CFLAGS) $*.c
+	$(CC) -c -o $@ $(INCLUDES) $(CFLAGS) $<
 
 clean:
-	rm -rf $(SNAME) $(DNAME) $(BUILD_DIR)
+	rm -rf $(SNAME) $(DNAME) $(BUILD_DIR) src/*.pb.h src/*.pb.c
 
 install-header:
 	install -m 644 $(H)