1# Copyright (c) 2010 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# To dynamically link to GLES libs, export IMPORTGL=1
6IMPORTGL = 0
7
8OPTIONS = -O3 -Wall
9FLAGS = -D SUPERSHAPE_HIGH_RES
10
11TARGET_GL = SanOGL
12TARGET_ES = SanOGLES
13TARGET_ES_S = SanOGLES_S
14
15ifeq ($(GRAPHICS_BACKEND), OPENGL)
16    LDFLAGS = -lm -lGL
17    SRCS = demo.c app-linux.c importvbo.c
18    TARGET = $(TARGET_GL)
19else ifeq ($(GRAPHICS_BACKEND), OPENGLES)
20    FLAGS += -D SAN_ANGELES_OBSERVATION_GLES
21    ifeq ($(IMPORTGL), 0)
22        LDFLAGS = -lm -lGLESv2 -lEGL
23        TARGET = $(TARGET_ES_S)
24        FLAGS += -D DISABLE_IMPORTGL
25    else
26        LDFLAGS = -lm -ldl
27        TARGET = $(TARGET_ES)
28    endif
29    SRCS = demo.c app-linux.c importgl.c matrixop.c shader.c
30else
31    $(error GRAPHICS_BACKEND has to be either OPENGL or OPENGLES)
32endif
33
34ifdef PKG_CONFIG
35    FLAGS += $(shell $(PKG_CONFIG) --cflags waffle-1)
36    LDFLAGS += $(shell $(PKG_CONFIG) --libs waffle-1)
37endif
38
39all: $(TARGET)
40
41$(TARGET): $(SRCS)
42	$(CC) $(FLAGS) -o $@ $^ $(LDFLAGS) $(OPTIONS)
43
44clean:
45	$(RM) $(TARGET_GL)
46	$(RM) $(TARGET_ES)
47	$(RM) $(TARGET_ES_S)
48