• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2012 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
5GPURESET = gpureset
6SOURCES += gpureset.c
7
8OBJS = $(SOURCES:.c=.o)
9DEPS = $(SOURCES:.c=.d)
10
11PKG_CONFIG ?= pkg-config
12CCFLAGS += -g -O2 -Wall -Werror
13CCFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm)
14CCFLAGS += $(shell $(PKG_CONFIG) --cflags glib-2.0)
15CCFLAGS += $(shell $(PKG_CONFIG) --cflags libudev)
16LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L libudev)
17LDLIBS += $(PC_LIBS)
18LDLIBS += $(shell $(PKG_CONFIG) --libs-only-l libudev)
19INTEL_GPU := $(shell $(PKG_CONFIG) --exists libdrm_intel && echo "1" || echo "0")
20ifeq ($(INTEL_GPU), 1)
21  CCFLAGS += -D__INTEL_GPU__
22  LDLIBS += $(shell $(PKG_CONFIG) --libs-only-l libdrm_intel)
23endif
24
25.PHONY: all clean
26
27all: $(GPURESET)
28
29$(GPURESET): $(OBJS)
30
31clean:
32	$(RM) $(GPURESET)
33	$(RM) $(OBJS) $(DEPS)
34	$(RM) *.o *.d .version
35
36$(GPURESET):
37	$(CC) $(CCFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
38
39$(OBJS): %.o: %.c
40	$(CC) $(CCFLAGS) -c $< -o $@ -MMD
41
42-include $(DEPS)
43