c-capnproto/Makefile
Baruch Even 20bd625dc2 Fix build
Renamed gtest/include to gtest/gtest since that's what the include files
expected.

Adjusted the Makefile to work through it all.
2014-08-03 22:18:08 +03:00

43 lines
1.1 KiB
Makefile

.PHONY: all clean test
LDFLAGS=-O2 -Wall -fPIC
CFLAGS=-O2 -Wall -fPIC --std=gnu11 -I. -Wno-unused-function
OBJS=capn-malloc.o capn-stream.o capn.o
prefix = /usr
all: capn.a capn.so capnpc-c test
clean:
rm -f *.o *.so capnpc-c compiler/*.o *.a gtest/src/*.o
%.o: %.c *.h *.inc compiler/*.h
$(CC) $(CFLAGS) -c $< -o $@
capn.so: $(OBJS)
$(CC) -shared $(LDFLAGS) $^ -o $@
capn.a: $(OBJS)
$(AR) rcs $@ $^
capnpc-c: compiler/capnpc-c.o compiler/schema.capnp.o compiler/str.o capn.a
$(CC) $(LDFLAGS) $^ -o $@
test: capn-test
./capn-test
%-test.o: %-test.cpp *.h *.c *.inc
$(CXX) --std=c++11 -g -I. -Igtest -o $@ -c $<
gtest/src/%.o: gtest/src/%.cc gtest/src/*.h
$(CXX) --std=c++11 -g -I. -Igtest -o $@ -c $<
gtest-all.a: $(patsubst %.cc,%.o,$(wildcard gtest/src/*.cc))
$(AR) rcs $@ $^
capn-test: capn-test.o capn-stream-test.o compiler/test.capnp.o compiler/schema-test.o compiler/schema.capnp.o capn.a gtest-all.a -lpthread
$(CXX) -std=c++11 -g -I. -o $@ $^
install:
install -c capnpc-c $(prefix)/bin/capnpc-c
install -c capn.so $(prefix)/lib/capn.so
install -c capn.a $(prefix)/lib/capn.a