blob: 82380265fadc35c1a3f5d26d42526c7875443789 [file] [log] [blame]
Stéphane Marchesin25a26062014-09-12 16:18:59 -07001# 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
Stéphane Marchesin3aa3dc82016-11-29 15:22:04 -080011CPPFLAGS += -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
Stéphane Marchesin25a26062014-09-12 16:18:59 -070014
Akshu Agrawal0337d9b2016-07-28 15:35:45 +053015ifdef DRV_AMDGPU
16 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_amdgpu)
Satyajitcdcebd82018-01-12 14:49:05 +053017 LDLIBS += -ldrm_amdgpu -ldl
Akshu Agrawal0337d9b2016-07-28 15:35:45 +053018endif
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070019ifdef DRV_EXYNOS
Stéphane Marchesineeac2ff2014-09-18 14:42:42 -070020 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_exynos)
21endif
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070022ifdef DRV_I915
Stéphane Marchesineeac2ff2014-09-18 14:42:42 -070023 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_intel)
24endif
Sergey Volk6eca3682018-03-06 13:29:32 -080025ifdef DRV_MESON
26 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_meson)
27endif
Rob Clarke48e4d72020-08-07 08:08:30 -070028ifdef DRV_MSM
29 CFLAGS += -ldl
30endif
giri3f259512017-08-02 12:01:33 -040031ifdef DRV_RADEON
32 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_radeon)
33endif
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070034ifdef DRV_ROCKCHIP
Stéphane Marchesineeac2ff2014-09-18 14:42:42 -070035 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_rockchip)
36endif
Jeremy Grosser7cfcc282018-03-30 01:19:41 -070037ifdef DRV_VC4
38 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_vc4)
39endif
Stéphane Marchesineeac2ff2014-09-18 14:42:42 -070040
Stéphane Marchesin25a26062014-09-12 16:18:59 -070041CPPFLAGS += $(PC_CFLAGS)
42LDLIBS += $(PC_LIBS)
43
Stéphane Marchesin85afac42014-09-15 15:38:37 -070044LIBDIR ?= /usr/lib/
45
Michael Spangde93efd2015-01-30 13:05:35 -050046GBM_VERSION_MAJOR := 1
47MINIGBM_VERSION := $(GBM_VERSION_MAJOR).0.0
48MINIGBM_FILENAME := libminigbm.so.$(MINIGBM_VERSION)
Stéphane Marchesin25a26062014-09-12 16:18:59 -070049
Michael Spangde93efd2015-01-30 13:05:35 -050050CC_LIBRARY($(MINIGBM_FILENAME)): LDFLAGS += -Wl,-soname,libgbm.so.$(GBM_VERSION_MAJOR)
51CC_LIBRARY($(MINIGBM_FILENAME)): $(C_OBJECTS)
Stéphane Marchesin25a26062014-09-12 16:18:59 -070052
Michael Spangde93efd2015-01-30 13:05:35 -050053all: CC_LIBRARY($(MINIGBM_FILENAME))
54
55clean: CLEAN($(MINIGBM_FILENAME))
Stéphane Marchesin25a26062014-09-12 16:18:59 -070056
57install: all
Stéphane Marchesin85afac42014-09-15 15:38:37 -070058 mkdir -p $(DESTDIR)/$(LIBDIR)
Michael Spangde93efd2015-01-30 13:05:35 -050059 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)
Dominik Behr59c7fe72014-11-11 16:49:10 -080062 install -D -m 0644 $(SRC)/gbm.pc $(DESTDIR)$(LIBDIR)/pkgconfig/gbm.pc
Stéphane Marchesin8c7039c2014-09-18 18:27:41 -070063 install -D -m 0644 $(SRC)/gbm.h $(DESTDIR)/usr/include/gbm.h