1.SUFFIXES: .proto .cpp .cc .o
2
3.DEFAULT: foo
4
5CC=gcc
6CPLUSPLUSC=g++
7PROTOC=protoc
8RM=rm
9SWIPL=swipl
10
11CFLAGS=-Wall -O3
12LDFLAGS=-lprotobuf -lpthread
13
14.cpp.o:
15	$(CPLUSPLUSC) -c $(CFLAGS) $*.cpp
16
17.cc.o:
18	$(CPLUSPLUSC) -c $(CFLAGS) $*.cc
19
20.c.o:
21	$(CC) -c $(CFLAGS) $*.c
22
23pb-vector.pb.o: pb-vector.proto
24	$(PROTOC) --cpp_out=. $?
25	$(CPLUSPLUSC) -c $(CFLAGS) $*.cc
26
27OBJS=pb-vector.pb.o foo.o
28
29foo: $(OBJS)
30	$(CPLUSPLUSC) -o $@ $(OBJS) $(LDFLAGS)
31
32tmp99.tmp: vector_demo.pl
33	$(SWIPL) -s vector_demo.pl -g make_tmp99 --
34
35check: foo tmp99.tmp
36	foo <tmp99.tmp
37
38clean:
39	$(RM) foo $(OBJS) *.pb.cc *.pb.h *.tmp
40