forked from protocolbuffers/upb
/
Makefile
38 lines (30 loc) · 1.03 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
# Function to expand a wildcard pattern recursively.
rwildcard=$(strip $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)$(filter $(subst *,%,$2),$d)))
.PHONY: all clean
CC=gcc
CXX=g++
CFLAGS=-std=c99
INCLUDE=-Idescriptor -Isrc -Itests -I.
CPPFLAGS=-O3 -fomit-frame-pointer -Wall -Wextra -g -DNDEBUG $(INCLUDE)
ALL=deps $(OBJ) src/libupb.a tests/test_table tests/tests tools/upbc
all: $(ALL)
clean:
rm -f $(call rwildcard,,*.o) $(ALL) benchmark/google_messages.proto.pb benchmark/google_messages.pb.* benchmark/b_*
# The core library (src/libupb.a)
OBJ=src/upb_parse.o src/upb_table.o src/upb_msg.o src/upb_enum.o src/upb_context.o \
src/upb_string.o src/upb_text.o src/upb_serialize.o descriptor/descriptor.o
SRC=$(call rwildcard,,*.c)
HEADERS=$(call rwildcard,,*.h)
src/libupb.a: $(OBJ)
ar rcs src/libupb.a $(OBJ)
# Tests
test: tests/tests
./tests/tests
tests/test_table: src/libupb.a
tests/tests: src/libupb.a
# Tools
tools/upbc: src/libupb.a
# Benchmarks
-include deps
deps: $(SRC) $(HEADERS) gen-deps.sh Makefile
./gen-deps.sh $(SRC)