1 # Copyright 2016 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.
5 GRALLOC = gralloc.cros.so
7 SRCS = $(wildcard *.cc)
8 SRCS += $(wildcard ../*.c)
10 SRCS += $(wildcard gralloc0/*.cc)
12 SOURCES = $(filter-out ../gbm%, $(SRCS))
13 PKG_CONFIG ?= pkg-config
15 VPATH = $(dir $(SOURCES))
16 LIBDRM_CFLAGS := $(shell $(PKG_CONFIG) --cflags libdrm)
17 LIBDRM_LIBS := $(shell $(PKG_CONFIG) --libs libdrm)
19 CPPFLAGS += -Wall -fPIC -Werror -flto $(LIBDRM_CFLAGS)
20 CXXFLAGS += -std=c++14
22 LIBS += -shared -lcutils -lhardware $(LIBDRM_LIBS)
24 OBJS = $(foreach source, $(SOURCES), $(addsuffix .o, $(basename $(source))))
26 OBJECTS = $(addprefix $(TARGET_DIR), $(notdir $(OBJS)))
27 LIBRARY = $(addprefix $(TARGET_DIR), $(GRALLOC))
33 $(LIBRARY): $(OBJECTS)
40 $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ $(LIBS)
42 $(TARGET_DIR)%.o: %.cc
43 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^ -o $@ -MMD
46 $(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@ -MMD