aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-07-16 13:48:42 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-07-16 13:48:42 +0200
commit37d1e657e5e79bc240ea036cfb8da377b1640490 (patch)
tree0d0f6e37db5e1c22caa2efb44a74303964b828a6 /Makefile
parent0883ee7ce77df4649f8a4fc10bd22164649e2883 (diff)
Makefile cosmetics and example protobuffer recreated with a newer protoc-c executable.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 16 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 998f7aa..e02b4f5 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,9 @@ endif
include $(DPP_ROOT)/Makefile.inc
+PROTOBUF_OBJECT = protobuf-build/protobuf-c.o
+PROTOBUF_CFLAGS_PRIVATE = -Wno-unused-but-set-variable
+
FLATBUFFERS_LIB = flatbuffers-build/lib/libflatccrt.a
FLATBUFFERS_CFLAGS = -Iflatbuffers-build/include -Wno-misleading-indentation
FLATBUFFERS_FLATC = flatbuffers-flatcc-build/bin/flatcc
@@ -13,11 +16,11 @@ DRIVER0_OBJECTS = examples/$(DRIVER0_NAME).o ksocket/ksocket.o ksocket/berkeley.
DRIVER0_TARGET = $(DRIVER0_NAME).sys
DRIVER1_NAME = driver-protobuf-c
-DRIVER1_OBJECTS = examples/$(DRIVER1_NAME).o protobuf-c/protobuf-c.o examples/example.pb-c.o
+DRIVER1_OBJECTS = examples/$(DRIVER1_NAME).o examples/example.pb-c.o $(PROTOBUF_OBJECT)
DRIVER1_TARGET = $(DRIVER1_NAME).sys
DRIVER2_NAME = driver-protobuf-c-tcp
-DRIVER2_OBJECTS = examples/$(DRIVER2_NAME).o ksocket/ksocket.o ksocket/berkeley.o protobuf-c/protobuf-c.o examples/example.pb-c.o
+DRIVER2_OBJECTS = examples/$(DRIVER2_NAME).o ksocket/ksocket.o ksocket/berkeley.o examples/example.pb-c.o $(PROTOBUF_OBJECT)
DRIVER2_TARGET = $(DRIVER2_NAME).sys
DRIVER3_NAME = driver-flatbuffers
@@ -29,12 +32,12 @@ USERSPACE0_OBJECTS = examples/$(USERSPACE0_NAME).o
USERSPACE0_TARGET = $(USERSPACE0_NAME).exe
USERSPACE1_NAME = userspace_client_protobuf
-USERSPACE1_OBJECTS = examples/$(USERSPACE1_NAME).o protobuf-c/protobuf-c.o examples/example.pb-c.o
+USERSPACE1_OBJECTS = examples/$(USERSPACE1_NAME).o examples/example.pb-c.o $(PROTOBUF_OBJECT)
USERSPACE1_TARGET = $(USERSPACE1_NAME).exe
# mingw-w64-dpp related
-CFLAGS_protobuf-c/protobuf-c.o = -Wno-unused-but-set-variable
-CUSTOM_CFLAGS = -I. -Iexamples $(FLATBUFFERS_CFLAGS) -Wl,--exclude-all-symbols -DNDEBUG
+CFLAGS_$(PROTOBUF_OBJECT) = $(PROTOBUF_CFLAGS_PRIVATE)
+CUSTOM_CFLAGS = -I. -Iexamples -Werror $(FLATBUFFERS_CFLAGS) -Wl,--exclude-all-symbols -DNDEBUG
DRIVER_LIBS += -lnetio
USER_LIBS += -lws2_32
@@ -46,6 +49,10 @@ all: deps $(DRIVER0_TARGET) $(DRIVER1_TARGET) $(DRIVER2_TARGET) $(DRIVER3_TARGET
%.o: %.c
$(call BUILD_C_OBJECT,$<,$@)
+$(PROTOBUF_OBJECT): protobuf-c/protobuf-c.c
+ mkdir -p '$(dir $(PROTOBUF_OBJECT))'
+ $(call BUILD_C_OBJECT,$<,$@)
+
$(DRIVER0_TARGET): $(DRIVER0_OBJECTS)
$(call LINK_CPP_KERNEL_TARGET,$(DRIVER0_OBJECTS),$@)
@@ -71,7 +78,7 @@ $(FLATBUFFERS_LIB):
-DCMAKE_INSTALL_PREFIX=/ \
-DCMAKE_C_COMPILER="$(realpath $(CC))" \
-DCMAKE_SYSTEM_NAME="Windows" \
- -DCMAKE_C_FLAGS='$(CFLAGS)' \
+ -DCMAKE_C_FLAGS='$(CFLAGS) $(FLATBUFFERS_CFLAGS_PRIVATE)' \
-DCMAKE_BUILD_TYPE=Release \
-DFLATCC_ALLOW_WERROR=ON -DFLATCC_COVERAGE=OFF -DFLATCC_CXX_TEST=OFF \
-DFLATCC_REFLECTION=OFF -DFLATCC_RTONLY=ON -DFLATCC_TEST=OFF -DFLATCC_INSTALL=ON \
@@ -88,7 +95,9 @@ $(FLATBUFFERS_FLATC):
cmake --build flatbuffers-flatcc-build
make -C flatbuffers-flatcc-build install DESTDIR="$(realpath .)/flatbuffers-flatcc-build"
-generate:
+generate: $(FLATBUFFERS_FLATC)
+ @echo 'Generating flatbuffer files..'
+ $(FLATBUFFERS_FLATC) -a -o examples examples/monster.fbs
@echo '=========================================='
@echo '= You need protobuf-c to make this work! ='
@echo '=========================================='