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_I915 20 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_intel) 21endif 22ifdef DRV_MESON 23 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_meson) 24endif 25ifdef DRV_MSM 26 CFLAGS += -ldl 27endif 28ifdef DRV_RADEON 29 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_radeon) 30endif 31ifdef DRV_ROCKCHIP 32 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_rockchip) 33endif 34ifdef DRV_VC4 35 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_vc4) 36endif 37 38CPPFLAGS += $(PC_CFLAGS) 39LDLIBS += $(PC_LIBS) 40 41LIBDIR ?= /usr/lib/ 42 43GBM_VERSION_MAJOR := 1 44MINIGBM_VERSION := $(GBM_VERSION_MAJOR).0.0 45MINIGBM_FILENAME := libminigbm.so.$(MINIGBM_VERSION) 46 47CC_LIBRARY($(MINIGBM_FILENAME)): LDFLAGS += -Wl,-soname,libgbm.so.$(GBM_VERSION_MAJOR) 48CC_LIBRARY($(MINIGBM_FILENAME)): $(C_OBJECTS) 49CC_STATIC_LIBRARY(libminigbm.pie.a): $(C_OBJECTS) 50 51all: CC_LIBRARY($(MINIGBM_FILENAME)) 52 53clean: CLEAN($(MINIGBM_FILENAME)) 54 55install: all 56 mkdir -p $(DESTDIR)/$(LIBDIR) 57 install -D -m 755 $(OUT)/$(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR) 58 ln -sf $(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR)/libgbm.so 59 ln -sf $(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR)/libgbm.so.$(GBM_VERSION_MAJOR) 60 install -D -m 0644 $(SRC)/gbm.pc $(DESTDIR)$(LIBDIR)/pkgconfig/gbm.pc 61 install -D -m 0644 $(SRC)/gbm.h $(DESTDIR)/usr/include/gbm.h 62 install -D -m 0644 $(SRC)/minigbm_helpers.h $(DESTDIR)/usr/include/minigbm/minigbm_helpers.h 63