1# Copyright 2014 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 5include common.mk 6 7PC_DEPS = libdrm 8PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PC_DEPS)) 9PC_LIBS := $(shell $(PKG_CONFIG) --libs $(PC_DEPS)) 10 11CPPFLAGS += -D_GNU_SOURCE=1 12CFLAGS += -std=c99 -Wall -Wsign-compare -Wpointer-arith -Wcast-qual \ 13 -Wcast-align -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 14 15ifdef DRV_AMDGPU 16 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_amdgpu) 17 LDLIBS += -ldrm_amdgpu -ldl 18endif 19ifdef DRV_EXYNOS 20 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_exynos) 21endif 22ifdef DRV_I915 23 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_intel) 24endif 25ifdef DRV_MESON 26 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_meson) 27endif 28ifdef DRV_MSM 29 CFLAGS += -ldl 30endif 31ifdef DRV_RADEON 32 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_radeon) 33endif 34ifdef DRV_ROCKCHIP 35 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_rockchip) 36endif 37ifdef DRV_VC4 38 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_vc4) 39endif 40 41CPPFLAGS += $(PC_CFLAGS) 42LDLIBS += $(PC_LIBS) 43 44LIBDIR ?= /usr/lib/ 45 46GBM_VERSION_MAJOR := 1 47MINIGBM_VERSION := $(GBM_VERSION_MAJOR).0.0 48MINIGBM_FILENAME := libminigbm.so.$(MINIGBM_VERSION) 49 50CC_LIBRARY($(MINIGBM_FILENAME)): LDFLAGS += -Wl,-soname,libgbm.so.$(GBM_VERSION_MAJOR) 51CC_LIBRARY($(MINIGBM_FILENAME)): $(C_OBJECTS) 52 53all: CC_LIBRARY($(MINIGBM_FILENAME)) 54 55clean: CLEAN($(MINIGBM_FILENAME)) 56 57install: all 58 mkdir -p $(DESTDIR)/$(LIBDIR) 59 install -D -m 755 $(OUT)/$(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR) 60 ln -sf $(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR)/libgbm.so 61 ln -sf $(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR)/libgbm.so.$(GBM_VERSION_MAJOR) 62 install -D -m 0644 $(SRC)/gbm.pc $(DESTDIR)$(LIBDIR)/pkgconfig/gbm.pc 63 install -D -m 0644 $(SRC)/gbm.h $(DESTDIR)/usr/include/gbm.h 64