-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
44 lines (33 loc) · 1.15 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
CC ?= gcc
#---------------------------------------------
# Uncomment exactly one of the lines labelled (A), (B), and (C) below
# to switch between compilation modes.
OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode)
# OPT ?= -g2 # (B) Debug mode, w/ full line-level debugging symbols
# OPT ?= -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols
#---------------------------------------------
CFLAGS = -c -I./include $(OPT)
LIBOBJECTS = ./src/decode.o ./src/encode.o
LIBRARY = ./lib/libpb.a
SUBDIRS = example tests docs
all: $(LIBRARY)
clean:
-rm -rf ./lib/ ./src/*.o
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean || exit $$?; \
done
$(LIBRARY): $(LIBOBJECTS)
test -d lib || mkdir lib
$(AR) -rs $@ $(LIBOBJECTS)
# for libpb developer
descriptor:
-rm -f ./generator/pb_pb2.py
protoc -I./include/pb -I/usr/include --python_out=./generator/ ./include/pb/pb.proto
.c.o:
$(CC) $(CFLAGS) $< -o $@
install:
cp -vf $(LIBRARY) /usr/local/lib/
cp -vrf ./include/pb /usr/local/include/
cp -vf ./generator/pbgen.py /usr/local/bin/
chmod +x /usr/local/bin/pbgen.py
cp -vf ./generator/pb_pb2.py /usr/local/bin/