|
|
|
@ -27,9 +27,9 @@ rwildcard=$(strip $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)$(filter $ |
|
|
|
|
CC=gcc
|
|
|
|
|
CXX=g++
|
|
|
|
|
CFLAGS=-std=c99
|
|
|
|
|
INCLUDE=-Idescriptor -Icore -Itests -Istream -I.
|
|
|
|
|
INCLUDE=-Idescriptor -Isrc -Itests -I.
|
|
|
|
|
CPPFLAGS=-Wall -Wextra -Wno-missing-field-initializers -g $(INCLUDE) $(strip $(shell test -f perf-cppflags && cat perf-cppflags))
|
|
|
|
|
LDLIBS=-lpthread core/libupb.a
|
|
|
|
|
LDLIBS=-lpthread src/libupb.a
|
|
|
|
|
ifeq ($(shell uname), Darwin) |
|
|
|
|
CPPFLAGS += -I/usr/include/lua5.1
|
|
|
|
|
LDFLAGS += -L/usr/local/lib -llua
|
|
|
|
@ -38,14 +38,14 @@ else |
|
|
|
|
LDFLAGS += $(strip $(shell pkg-config --silence-errors --libs lua || pkg-config --libs lua5.1))
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
LIBUPB=core/libupb.a
|
|
|
|
|
LIBUPB_PIC=core/libupb_pic.a
|
|
|
|
|
LIBUPB_SHARED=core/libupb.so
|
|
|
|
|
LIBUPB=src/libupb.a
|
|
|
|
|
LIBUPB_PIC=src/libupb_pic.a
|
|
|
|
|
LIBUPB_SHARED=src/libupb.so
|
|
|
|
|
ALL=deps $(OBJ) $(LIBUPB) $(LIBUPB_PIC)
|
|
|
|
|
all: $(ALL) |
|
|
|
|
clean: |
|
|
|
|
rm -rf $(LIBUPB) $(LIBUPB_PIC)
|
|
|
|
|
rm -rf $(call rwildcard,,*.o) $(call rwildcard,,*.lo) $(call rwildcard,,*.gc*)
|
|
|
|
|
rm -rf $(call rwildcard,,*.o) $(call rwildcard,,*.lo) $(call rwildcard,,*.gcno) $(call rwildcard,,*.dSYM)
|
|
|
|
|
rm -rf benchmark/google_messages.proto.pb benchmark/google_messages.pb.* benchmarks/b.* benchmarks/*.pb*
|
|
|
|
|
rm -rf $(TESTS) tests/t.*
|
|
|
|
|
rm -rf descriptor/descriptor.pb
|
|
|
|
@ -59,20 +59,20 @@ deps: gen-deps.sh Makefile $(call rwildcard,,*.c) $(call rwildcard,,*.h) |
|
|
|
|
# The core library -- the absolute minimum you must compile in to successfully
|
|
|
|
|
# bootstrap.
|
|
|
|
|
CORE= \
|
|
|
|
|
core/upb.c \
|
|
|
|
|
core/upb_table.c \
|
|
|
|
|
core/upb_string.c \
|
|
|
|
|
core/upb_def.c \
|
|
|
|
|
src/upb.c \
|
|
|
|
|
src/upb_table.c \
|
|
|
|
|
src/upb_string.c \
|
|
|
|
|
src/upb_def.c \
|
|
|
|
|
descriptor/descriptor.c
|
|
|
|
|
|
|
|
|
|
# Common encoders/decoders and upb_msg -- you're almost certain to want these.
|
|
|
|
|
STREAM= \
|
|
|
|
|
stream/upb_decoder.c \
|
|
|
|
|
stream/upb_stdio.c \
|
|
|
|
|
stream/upb_textprinter.c \
|
|
|
|
|
stream/upb_strstream.c \
|
|
|
|
|
core/upb_msg.c \
|
|
|
|
|
core/upb_glue.c \
|
|
|
|
|
src/upb_decoder.c \
|
|
|
|
|
src/upb_stdio.c \
|
|
|
|
|
src/upb_textprinter.c \
|
|
|
|
|
src/upb_strstream.c \
|
|
|
|
|
src/upb_msg.c \
|
|
|
|
|
src/upb_glue.c \
|
|
|
|
|
|
|
|
|
|
SRC=$(CORE) $(STREAM)
|
|
|
|
|
|
|
|
|
@ -81,13 +81,13 @@ $(SRC): perf-cppflags |
|
|
|
|
OTHERSRC=src/upb_encoder.c src/upb_text.c
|
|
|
|
|
# Override the optimization level for upb_def.o, because it is not in the
|
|
|
|
|
# critical path but gets very large when -O3 is used.
|
|
|
|
|
core/upb_def.o: core/upb_def.c |
|
|
|
|
src/upb_def.o: src/upb_def.c |
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -Os -c -o $@ $<
|
|
|
|
|
core/upb_def.lo: core/upb_def.c |
|
|
|
|
src/upb_def.lo: src/upb_def.c |
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -Os -c -o $@ $< -fPIC
|
|
|
|
|
|
|
|
|
|
lang_ext/lua/upb.so: lang_ext/lua/upb.lo |
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -o $@ $< core/libupb_pic.a
|
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -o $@ $< src/libupb_pic.a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STATICOBJ=$(patsubst %.c,%.o,$(SRC))
|
|
|
|
@ -171,10 +171,10 @@ tests/test_table: tests/test_table.cc |
|
|
|
|
# Includes <hash_set> which is a deprecated header.
|
|
|
|
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -Wno-deprecated -o $@ $< $(LIBUPB)
|
|
|
|
|
|
|
|
|
|
tests/tests: core/libupb.a |
|
|
|
|
tests/tests: src/libupb.a |
|
|
|
|
|
|
|
|
|
# Tools
|
|
|
|
|
tools/upbc: core/libupb.a |
|
|
|
|
tools/upbc: src/libupb.a |
|
|
|
|
|
|
|
|
|
# Benchmarks
|
|
|
|
|
#UPB_BENCHMARKS=benchmarks/b.parsetostruct_googlemessage1.upb_table \
|
|
|
|
|