Fix build on Windows
[apps/agl-service-can-low-level.git] / extra / nanopb.mk
index b52c78c..7576bae 100644 (file)
@@ -7,6 +7,14 @@ NANOPB_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../)
 # Files for the nanopb core
 NANOPB_CORE = $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_decode.c
 
+# Check if we are running on Windows
+ifdef windir
+WINDOWS = 1
+endif
+ifdef WINDIR
+WINDOWS = 1
+endif
+
 # Check whether to use binary version of nanopb_generator or the
 # system-supplied python interpreter.
 ifneq "$(wildcard $(NANOPB_DIR)/generator-bin)" ""
@@ -16,10 +24,10 @@ ifneq "$(wildcard $(NANOPB_DIR)/generator-bin)" ""
 else
        # Source only or git checkout
        PROTOC = protoc
-       ifdef windir
-               PROTOC_OPTS = --plugin=nanopb=$(NANOPB_DIR)/generator/protoc-gen-nanopb.bat
+       ifdef WINDOWS
+               PROTOC_OPTS = --plugin=protoc-gen-nanopb=$(NANOPB_DIR)/generator/protoc-gen-nanopb.bat
        else
-               PROTOC_OPTS = --plugin=nanopb=$(NANOPB_DIR)/generator/protoc-gen-nanopb
+               PROTOC_OPTS = --plugin=protoc-gen-nanopb=$(NANOPB_DIR)/generator/protoc-gen-nanopb
        endif
 endif