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)
9 SOURCES = $(filter-out ../gbm%, $(SRCS))
10 PKG_CONFIG ?= pkg-config
12 VPATH = $(dir $(SOURCES))
13 LIBDRM_CFLAGS := $(shell $(PKG_CONFIG) --cflags libdrm)
14 LIBDRM_LIBS := $(shell $(PKG_CONFIG) --libs libdrm)
16 CPPFLAGS += -Wall -fPIC -Werror -flto $(LIBDRM_CFLAGS)
17 CXXFLAGS += -std=c++11
19 LIBS += -shared -lcutils -lhardware $(LIBDRM_LIBS)
21 OBJS = $(foreach source, $(SOURCES), $(addsuffix .o, $(basename $(source))))
23 OBJECTS = $(addprefix $(TARGET_DIR), $(notdir $(OBJS)))
24 LIBRARY = $(addprefix $(TARGET_DIR), $(GRALLOC))
30 $(LIBRARY): $(OBJECTS)
37 $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ $(LIBS)
39 $(TARGET_DIR)%.o: %.cc
40 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^ -o $@ -MMD
43 $(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@ -MMD