• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2011 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# TODO(ihf): When X on Nyan is gone, simplify this makefile,
6#            specifically the *_PORTABLE and *_X_ONLY bits.
7
8USE_X = $(filter X, $(USE))
9ifeq ($(GRAPHICS_BACKEND),OPENGLES)
10    USE_GLES = y
11else
12    USE_GLES = $(filter opengles, $(USE))
13endif
14
15ifneq ($(USE_X),)
16    ifneq ($(USE_GLES),)
17        PLATFORM = PLATFORM_X11_EGL
18    else
19        PLATFORM = PLATFORM_GLX
20    endif
21else
22    PLATFORM = PLATFORM_NULL
23endif
24
25SOURCES_GL_BENCH = main.cc yuvtest.cc testbase.cc
26SOURCES_GL_BENCH += glinterfacetest.cc contexttest.cc swaptest.cc
27SOURCES_GL_BENCH += readpixeltest.cc
28SOURCES_GL_BENCH += attributefetchtest.cc varyingsandddxytest.cc cleartest.cc
29SOURCES_GL_BENCH += texturetest.cc texturereusetest.cc textureupdatetest.cc
30SOURCES_GL_BENCH += textureuploadtest.cc trianglesetuptest.cc fillratetest.cc
31SOURCES_GL_BENCH += windowmanagercompositingtest.cc
32SOURCES_GL_BENCH += md5.cc png_helper.cc utils.cc waffle_stuff.cc
33
34SOURCES_WINDOWMANAGERTEST = windowmanagertest.cc utils.cc waffle_stuff.cc
35
36PKG_CONFIG ?= pkg-config
37BASE_VER ?= 369476
38PC_DEPS = libchrome-$(BASE_VER) libpng
39PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PC_DEPS))
40PC_LIBS := $(shell $(PKG_CONFIG) --libs $(PC_DEPS))
41
42CXXFLAGS = -g -Wall -Werror -std=gnu++11
43CPPFLAGS += $(PC_CFLAGS)
44LDLIBS = $(PC_LIBS) -lgflags
45# To compile outside of chroot or with newest libchrome, use the following two lines:
46#CPPFLAGS += -I$(HOME)/chromium/src -DWORKAROUND_CROSBUG14304
47#LDLIBS += -lbase_static -L$(HOME)/chromium/src/out/Release/obj.target/base
48
49GL_BENCH = ../glbench
50WINDOWMANAGERTEST = ../windowmanagertest
51
52PLATFORM_PKGS = waffle-1
53ifeq ($(PLATFORM),PLATFORM_GLX)
54    PLATFORM_PKGS += x11
55endif
56PLATFORM_CFLAGS = -DPLATFORM=$(PLATFORM)
57PLATFORM_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(PLATFORM_PKGS))
58PLATFORM_LIBS = $(shell $(PKG_CONFIG) --libs $(PLATFORM_PKGS))
59
60ifneq ($(USE_GLES),)
61CPPFLAGS += -DUSE_OPENGLES
62LDLIBS += -lGLESv2 -lEGL
63else
64CPPFLAGS += -DUSE_OPENGL
65LDLIBS += -lGL
66endif
67
68SOURCES_ALL = $(sort $(SOURCES_GL_BENCH) \
69                     $(SOURCES_WINDOWMANAGERTEST))
70
71OBJS_GL_BENCH = $(SOURCES_GL_BENCH:.cc=.o)
72OBJS_WINDOWMANAGERTEST = $(SOURCES_WINDOWMANAGERTEST:.cc=.o)
73OBJS_ALL = $(SOURCES_ALL:.cc=.o)
74DEPS_ALL = $(SOURCES_ALL:.cc=.d)
75
76.PHONY: all clean
77
78EXE_PORTABLE = $(GL_BENCH) $(WINDOWMANAGERTEST)
79OBJ_PORTABLE = $(sort $(OBJS_GL_BENCH) $(OBJS_WINDOWMANAGERTEST))
80
81all:: $(EXE_PORTABLE)
82ifneq ($(USE_X),)
83all:: $(EXE_X_ONLY)
84endif
85
86$(GL_BENCH): $(OBJS_GL_BENCH)
87$(WINDOWMANAGERTEST): $(OBJS_WINDOWMANAGERTEST)
88
89clean:
90	$(RM) $(GL_BENCH) $(WINDOWMANAGERTEST)
91	$(RM) $(OBJS_ALL) $(DEPS_ALL)
92	$(RM) *.o *.d .version
93
94$(EXE_PORTABLE):
95	$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(PLATFORM_LIBS)
96
97$(EXE_X_ONLY):
98	$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS) -lX11 -lrt
99
100$(OBJ_PORTABLE): %.o: %.cc
101	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(PLATFORM_CFLAGS) -c $< -o $@ -MMD
102
103$(OBJS_X_ONLY): %.o: %.cc
104	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ -MMD
105
106-include $(DEPS_ALL)
107