OSDN Git Service

minigbm: Link amdgpuaddr for DRV_AMDGPU.
[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
10 SRCS   += $(wildcard gralloc0/*.cc)
11
12 SOURCES = $(filter-out ../gbm%, $(SRCS))
13 PKG_CONFIG ?= pkg-config
14
15 VPATH = $(dir $(SOURCES))
16 LIBDRM_CFLAGS := $(shell $(PKG_CONFIG) --cflags libdrm)
17 LIBDRM_LIBS := $(shell $(PKG_CONFIG) --libs libdrm)
18
19 CPPFLAGS += -Wall -fPIC -Werror -flto $(LIBDRM_CFLAGS)
20 CXXFLAGS += -std=c++14
21 CFLAGS   += -std=c99
22 LIBS     += -shared -lcutils -lhardware -lsync $(LIBDRM_LIBS)
23
24 ifdef DRV_AMDGPU
25         LIBS += -lamdgpuaddr
26 endif
27
28 OBJS =  $(foreach source, $(SOURCES), $(addsuffix .o, $(basename $(source))))
29
30 OBJECTS = $(addprefix $(TARGET_DIR), $(notdir $(OBJS)))
31 LIBRARY = $(addprefix $(TARGET_DIR), $(GRALLOC))
32
33 .PHONY: all clean
34
35 all: $(LIBRARY)
36
37 $(LIBRARY): $(OBJECTS)
38
39 clean:
40         $(RM) $(LIBRARY)
41         $(RM) $(OBJECTS)
42
43 $(LIBRARY):
44         $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ $(LIBS)
45
46 $(TARGET_DIR)%.o: %.cc
47         $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^ -o $@ -MMD
48
49 $(TARGET_DIR)%.o: %.c
50         $(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@ -MMD