1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# Copyright © 2012 Intel Corporation
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# Permission is hereby granted, free of charge, to any person obtaining a
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# copy of this software and associated documentation files (the "Software"),
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# to deal in the Software without restriction, including without limitation
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# the rights to use, copy, modify, merge, publish, distribute, sublicense,
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# and/or sell copies of the Software, and to permit persons to whom the
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# Software is furnished to do so, subject to the following conditions:
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# The above copyright notice and this permission notice (including the next
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# paragraph) shall be included in all copies or substantial portions of the
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# Software.
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# IN THE SOFTWARE.
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgif NEED_LIBDRICORE
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgDRICORE_SUBDIR = libdricore
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgendif
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgSUBDIRS = x86 x86-64 . $(DRICORE_SUBDIR) drivers
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggldir = $(includedir)/GL
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orggl_HEADERS = $(top_srcdir)/include/GL/*.h
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org.PHONY: main/git_sha1.h.tmp
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgmain/git_sha1.h.tmp:
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	@touch main/git_sha1.h.tmp
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	@if test -d ../../.git; then \
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		if which git > /dev/null; then \
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		    git log -n 1 --oneline | \
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org			sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org			> main/git_sha1.h.tmp ; \
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		fi \
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	fi
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgmain/git_sha1.h: main/git_sha1.h.tmp
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	@echo "updating main/git_sha1.h"
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	@if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		mv main/git_sha1.h.tmp main/git_sha1.h ;\
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	else \
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		rm main/git_sha1.h.tmp ;\
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	fi
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# include glapi_gen.mk for generating glapi headers for GLES
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgGLAPI = $(top_srcdir)/src/mapi/glapi/gen
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orginclude $(GLAPI)/glapi_gen.mk
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgBUILT_SOURCES = \
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	main/git_sha1.h \
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	main/api_exec_es1_dispatch.h \
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	main/api_exec_es1_remap_helper.h \
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	main/api_exec_es1.c \
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	program/program_parse.tab.c \
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	program/program_parse.tab.h \
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	program/lex.yy.c
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgCLEANFILES = \
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(BUILT_SOURCES) \
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	git_sha1.h.tmp
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgmain/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(call glapi_gen_dispatch,$<,es1)
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgmain/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(call glapi_gen_remap,$<,es1)
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgmain/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgmain/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	  -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgprogram/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(MKDIR_P) program
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $<
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgprogram/lex.yy.c: program/program_lexer.l
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(MKDIR_P) program
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnoinst_LTLIBRARIES =
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgif NEED_LIBMESA
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnoinst_LTLIBRARIES += libmesa.la
89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgelse
90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgcheck_LTLIBRARIES = libmesa.la
91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgendif
92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgif HAVE_GALLIUM
93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnoinst_LTLIBRARIES += libmesagallium.la
94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgendif
95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgSRCDIR = $(top_srcdir)/src/mesa/
97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgBUILDDIR = $(top_builddir)/src/mesa/
98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orginclude sources.mak
99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# cannot just add $(MESA_ASM_FILES) to libmesa_la_SOURCES as it contains a configure substitution
105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgMESA_ASM_FILES_FOR_ARCH =
106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgif HAVE_X86_ASM
108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgMESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAM_CPPFLAGS += \
110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        -I$(top_builddir)/src/mesa/x86 \
111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        -I$(top_srcdir)/src/mesa/x86
112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgendif
113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgif HAVE_X86_64_ASM
114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgMESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAM_CPPFLAGS += \
116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        -I$(top_builddir)/src/mesa/x86-64 \
117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        -I$(top_srcdir)/src/mesa/x86-64
118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgendif
119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgif HAVE_SPARC_ASM
120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgMESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAM_CPPFLAGS += \
122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        -I$(top_builddir)/src/mesa/sparc \
123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        -I$(top_srcdir)/src/mesa/sparc
124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgendif
125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglibmesa_la_SOURCES = \
127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(MESA_FILES) \
128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(MESA_CXX_FILES) \
129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        $(MESA_ASM_FILES_FOR_ARCH)
130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglibmesa_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglibmesa_la_LDFLAGS =
133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglibmesagallium_la_SOURCES = \
135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(MESA_GALLIUM_FILES) \
136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	$(MESA_GALLIUM_CXX_FILES) \
137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        $(MESA_ASM_FILES_FOR_ARCH)
138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglibmesagallium_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglibmesagallium_la_LDFLAGS =
141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgif HAVE_GALLIUM
143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# Provide compatibility with scripts for the old Mesa build system for
144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# a while by putting a link to the library in the current directory.
145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgall-local: $(noinst_LTLIBRARIES)
146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ln -f .libs/libmesagallium.a .
147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgendif
148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgCLEANFILES += libmesagallium.a
150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgpkgconfigdir = $(libdir)/pkgconfig
152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgpkgconfig_DATA = gl.pc
153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org# Emacs tags
155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtags:
156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
157