Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 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 | |
| 5 | include common.mk |
| 6 | |
| 7 | PC_DEPS = libdrm |
| 8 | PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PC_DEPS)) |
| 9 | PC_LIBS := $(shell $(PKG_CONFIG) --libs $(PC_DEPS)) |
| 10 | |
Stéphane Marchesin | 3aa3dc8 | 2016-11-29 15:22:04 -0800 | [diff] [blame] | 11 | CPPFLAGS += -D_GNU_SOURCE=1 |
| 12 | CFLAGS += -std=c99 -Wall -Wsign-compare -Wpointer-arith -Wcast-qual \ |
| 13 | -Wcast-align -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 14 | |
Akshu Agrawal | 0337d9b | 2016-07-28 15:35:45 +0530 | [diff] [blame] | 15 | ifdef DRV_AMDGPU |
| 16 | CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_amdgpu) |
Satyajit | cdcebd8 | 2018-01-12 14:49:05 +0530 | [diff] [blame] | 17 | LDLIBS += -ldrm_amdgpu -ldl |
Akshu Agrawal | 0337d9b | 2016-07-28 15:35:45 +0530 | [diff] [blame] | 18 | endif |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 19 | ifdef DRV_EXYNOS |
Stéphane Marchesin | eeac2ff | 2014-09-18 14:42:42 -0700 | [diff] [blame] | 20 | CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_exynos) |
| 21 | endif |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 22 | ifdef DRV_I915 |
Stéphane Marchesin | eeac2ff | 2014-09-18 14:42:42 -0700 | [diff] [blame] | 23 | CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_intel) |
| 24 | endif |
Sergey Volk | 6eca368 | 2018-03-06 13:29:32 -0800 | [diff] [blame] | 25 | ifdef DRV_MESON |
| 26 | CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_meson) |
| 27 | endif |
giri | 3f25951 | 2017-08-02 12:01:33 -0400 | [diff] [blame] | 28 | ifdef DRV_RADEON |
| 29 | CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_radeon) |
| 30 | endif |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 31 | ifdef DRV_ROCKCHIP |
Stéphane Marchesin | eeac2ff | 2014-09-18 14:42:42 -0700 | [diff] [blame] | 32 | CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_rockchip) |
| 33 | endif |
Jeremy Grosser | 7cfcc28 | 2018-03-30 01:19:41 -0700 | [diff] [blame] | 34 | ifdef DRV_VC4 |
| 35 | CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_vc4) |
| 36 | endif |
Stéphane Marchesin | eeac2ff | 2014-09-18 14:42:42 -0700 | [diff] [blame] | 37 | |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 38 | CPPFLAGS += $(PC_CFLAGS) |
| 39 | LDLIBS += $(PC_LIBS) |
| 40 | |
Stéphane Marchesin | 85afac4 | 2014-09-15 15:38:37 -0700 | [diff] [blame] | 41 | LIBDIR ?= /usr/lib/ |
| 42 | |
Michael Spang | de93efd | 2015-01-30 13:05:35 -0500 | [diff] [blame] | 43 | GBM_VERSION_MAJOR := 1 |
| 44 | MINIGBM_VERSION := $(GBM_VERSION_MAJOR).0.0 |
| 45 | MINIGBM_FILENAME := libminigbm.so.$(MINIGBM_VERSION) |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 46 | |
Michael Spang | de93efd | 2015-01-30 13:05:35 -0500 | [diff] [blame] | 47 | CC_LIBRARY($(MINIGBM_FILENAME)): LDFLAGS += -Wl,-soname,libgbm.so.$(GBM_VERSION_MAJOR) |
| 48 | CC_LIBRARY($(MINIGBM_FILENAME)): $(C_OBJECTS) |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 49 | |
Michael Spang | de93efd | 2015-01-30 13:05:35 -0500 | [diff] [blame] | 50 | all: CC_LIBRARY($(MINIGBM_FILENAME)) |
| 51 | |
| 52 | clean: CLEAN($(MINIGBM_FILENAME)) |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 53 | |
| 54 | install: all |
Stéphane Marchesin | 85afac4 | 2014-09-15 15:38:37 -0700 | [diff] [blame] | 55 | mkdir -p $(DESTDIR)/$(LIBDIR) |
Michael Spang | de93efd | 2015-01-30 13:05:35 -0500 | [diff] [blame] | 56 | install -D -m 755 $(OUT)/$(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR) |
| 57 | ln -sf $(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR)/libgbm.so |
| 58 | ln -sf $(MINIGBM_FILENAME) $(DESTDIR)/$(LIBDIR)/libgbm.so.$(GBM_VERSION_MAJOR) |
Dominik Behr | 59c7fe7 | 2014-11-11 16:49:10 -0800 | [diff] [blame] | 59 | install -D -m 0644 $(SRC)/gbm.pc $(DESTDIR)$(LIBDIR)/pkgconfig/gbm.pc |
Stéphane Marchesin | 8c7039c | 2014-09-18 18:27:41 -0700 | [diff] [blame] | 60 | install -D -m 0644 $(SRC)/gbm.h $(DESTDIR)/usr/include/gbm.h |