summaryrefslogtreecommitdiffstats
path: root/examples/network_server/Makefile
blob: 981f2cf92b5e1268f38e037f96ac1a80a44b8d08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
CFLAGS = -ansi -Wall -Werror -g -O0

# Path to the nanopb root folder
NANOPB_DIR = ../..
DEPS = $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \
       $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h $(NANOPB_DIR)/pb.h
CFLAGS += -I$(NANOPB_DIR)

all: server client

clean:
	rm -f server client fileproto.pb.c fileproto.pb.h

%: %.c $(DEPS) fileproto.pb.h fileproto.pb.c
	$(CC) $(CFLAGS) -o $@ $< $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c fileproto.pb.c common.c

fileproto.pb.c fileproto.pb.h: fileproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py
	protoc -ofileproto.pb $<
	python $(NANOPB_DIR)/generator/nanopb_generator.py fileproto.pb