• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5PUFFIN_SOURCES = \
6	bit_reader.cc \
7	bit_writer.cc \
8	extent_stream.cc \
9	file_stream.cc \
10	huffer.cc \
11	huffman_table.cc \
12	memory_stream.cc \
13	puffer.cc \
14	puff_reader.cc \
15	puff_writer.cc \
16	puffin_stream.cc \
17	utils.cc
18
19UNITTEST_SOURCES = \
20	bit_io_unittest.cc \
21	puff_io_unittest.cc \
22	puffin_unittest.cc \
23	stream_unittest.cc \
24	testrunner.cc \
25	utils_unittest.cc
26
27OBJDIR = obj
28SRCDIR = src
29PUFFIN_OBJECTS = $(addprefix $(OBJDIR)/, $(PUFFIN_SOURCES:.cc=.o))
30UNITTEST_OBJECTS = $(addprefix $(OBJDIR)/, $(UNITTEST_SOURCES:.cc=.o))
31
32LIBPUFFIN = libpuffin.so
33UNITTESTS = puffin_unittests
34
35CXXFLAGS ?= -O3 -ggdb
36CXXFLAGS += -Wall -fPIC -std=c++14
37CPPFLAGS += -I../ -Isrc/include
38LDLIBS = -lgflags -lglog -lprotobuf-lite -lgtest -lpthread
39
40VPATH = $(SRCDIR)
41
42all: $(LIBPUFFIN)
43
44$(OBJDIR):
45	mkdir -p $@
46
47$(PUFFIN_OBJECTS): | $(OBJDIR)
48
49$(LIBPUFFIN): $(PUFFIN_OBJECTS)
50	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $^ -o $@ $(LDLIBS)
51
52$(UNITTESTS): $(UNITTEST_OBJECTS)
53	$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBPUFFIN) $(LDLIBS)
54
55test: $(LIBPUFFIN) $(UNITTESTS)
56
57clean:
58	rm -rf $(OBJDIR) $(LIBPUFFIN) $(UNITTESTS)
59
60$(OBJDIR)/%.o: %.cc
61	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
62
63.PHONY: all clean test
64