Moving files around
[apps/agl-service-can-low-level.git] / examples / using_union_messages / Makefile
1 CFLAGS = -ansi -Wall -Werror -g -O0
2
3 # Path to the nanopb root folder
4 NANOPB_DIR = ../..
5 DEPS = $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \
6        $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h $(NANOPB_DIR)/pb.h
7 CFLAGS += -I$(NANOPB_DIR)
8
9 all: encode decode
10         ./encode 1 | ./decode
11         ./encode 2 | ./decode
12         ./encode 3 | ./decode
13
14 clean:
15         rm -f encode unionproto.pb.h unionproto.pb.c
16
17 %: %.c $(DEPS) unionproto.pb.h unionproto.pb.c
18         $(CC) $(CFLAGS) -o $@ $< $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c unionproto.pb.c
19
20 unionproto.pb.h unionproto.pb.c: unionproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py
21         protoc -ounionproto.pb $<
22         python $(NANOPB_DIR)/generator/nanopb_generator.py unionproto.pb