OSDN Git Service

9e1be9e117ecd710ee484bc5064e88b2cae47b4c
[android-x86/external-minigbm.git] / cros_gralloc / Makefile
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.
4
5 GRALLOC = gralloc.cros.so
6
7 SRCS    = $(wildcard *.cc)
8 SRCS   += $(wildcard ../*.c)
9 SOURCES = $(filter-out ../gbm%, $(SRCS))
10 PKG_CONFIG ?= pkg-config
11
12 VPATH = $(dir $(SOURCES))
13 LIBDRM_CFLAGS := $(shell $(PKG_CONFIG) --cflags libdrm)
14 LIBDRM_LIBS := $(shell $(PKG_CONFIG) --libs libdrm)
15
16 CPPFLAGS += -Wall -fPIC -Werror -flto $(LIBDRM_CFLAGS)
17 CXXFLAGS += -std=c++11
18 CFLAGS   += -std=c99
19 LIBS     += -shared -lcutils -lhardware $(LIBDRM_LIBS)
20
21 OBJS =  $(foreach source, $(SOURCES), $(addsuffix .o, $(basename $(source))))
22
23 OBJECTS = $(addprefix $(TARGET_DIR), $(notdir $(OBJS)))
24 LIBRARY = $(addprefix $(TARGET_DIR), $(GRALLOC))
25
26 .PHONY: all clean
27
28 all: $(LIBRARY)
29
30 $(LIBRARY): $(OBJECTS)
31
32 clean:
33         $(RM) $(LIBRARY)
34         $(RM) $(OBJECTS)
35
36 $(LIBRARY):
37         $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ $(LIBS)
38
39 $(TARGET_DIR)%.o: %.cc
40         $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^ -o $@ -MMD
41
42 $(TARGET_DIR)%.o: %.c
43         $(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@ -MMD