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 5 GPURESET = gpureset 6 SOURCES += gpureset.c 7 8 OBJS = $(SOURCES:.c=.o) 9 DEPS = $(SOURCES:.c=.d) 10 11 PKG_CONFIG ?= pkg-config 12 CCFLAGS += -g -O2 -Wall -Werror 13 CCFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm) 14 CCFLAGS += $(shell $(PKG_CONFIG) --cflags glib-2.0) 15 CCFLAGS += $(shell $(PKG_CONFIG) --cflags libudev) 16 LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L libudev) 17 LDLIBS += $(PC_LIBS) 18 LDLIBS += $(shell $(PKG_CONFIG) --libs-only-l libudev) 19 INTEL_GPU := $(shell $(PKG_CONFIG) --exists libdrm_intel && echo "1" || echo "0") 20 ifeq ($(INTEL_GPU), 1) 21 CCFLAGS += -D__INTEL_GPU__ 22 LDLIBS += $(shell $(PKG_CONFIG) --libs-only-l libdrm_intel) 23 endif 24 25 .PHONY: all clean 26 27 all: $(GPURESET) 28 29 $(GPURESET): $(OBJS) 30 31 clean: 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