1417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# Copyright © 2012 Intel Corporation
2417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt#
3417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# Permission is hereby granted, free of charge, to any person obtaining a
4417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# copy of this software and associated documentation files (the "Software"),
5417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# to deal in the Software without restriction, including without limitation
6417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# the rights to use, copy, modify, merge, publish, distribute, sublicense,
7417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# and/or sell copies of the Software, and to permit persons to whom the
8417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# Software is furnished to do so, subject to the following conditions:
9417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt#
10417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# The above copyright notice and this permission notice (including the next
11417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# paragraph) shall be included in all copies or substantial portions of the
12417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# Software.
13417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt#
14417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt# IN THE SOFTWARE.
21417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt
22ddb9ecca3b0f820feb4dee6bd8901f8b6e3ee0d8Matt Turnerif NEED_LIBDRICORE
23ddb9ecca3b0f820feb4dee6bd8901f8b6e3ee0d8Matt TurnerDRICORE_SUBDIR = libdricore
24ddb9ecca3b0f820feb4dee6bd8901f8b6e3ee0d8Matt Turnerendif
25ddb9ecca3b0f820feb4dee6bd8901f8b6e3ee0d8Matt Turner
26ddb9ecca3b0f820feb4dee6bd8901f8b6e3ee0d8Matt TurnerSUBDIRS = x86 x86-64 . $(DRICORE_SUBDIR) drivers
271bbd22ada0b3fb2b1ad83a6c93a5a12e2d3c26dbEric Anholt
282d51ac84fd4c6d0fcf4d5112af2eb2c12e186b63Eric Anholtgldir = $(includedir)/GL
292d51ac84fd4c6d0fcf4d5112af2eb2c12e186b63Eric Anholtgl_HEADERS = $(top_srcdir)/include/GL/*.h
302d51ac84fd4c6d0fcf4d5112af2eb2c12e186b63Eric Anholt
314113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt.PHONY: main/git_sha1.h.tmp
324113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtmain/git_sha1.h.tmp:
334113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	@touch main/git_sha1.h.tmp
344113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	@if test -d ../../.git; then \
354113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt		if which git > /dev/null; then \
364113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt		    git log -n 1 --oneline | \
374113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt			sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
384113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt			> main/git_sha1.h.tmp ; \
394113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt		fi \
404113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	fi
414113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
424113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtmain/git_sha1.h: main/git_sha1.h.tmp
434113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	@echo "updating main/git_sha1.h"
444113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	@if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
454113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt		mv main/git_sha1.h.tmp main/git_sha1.h ;\
46e84d45fdb73687019a6798cfb37b01291b212f4dVadim Girlin	else \
47e84d45fdb73687019a6798cfb37b01291b212f4dVadim Girlin		rm main/git_sha1.h.tmp ;\
484113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	fi
494113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
504113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt# include glapi_gen.mk for generating glapi headers for GLES
51b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse RogersGLAPI = $(top_srcdir)/src/mapi/glapi/gen
524113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtinclude $(GLAPI)/glapi_gen.mk
534113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
544113ac6a0f13338ee5f9c5fa0be13f37b515108dEric AnholtBUILT_SOURCES = \
554113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	main/git_sha1.h \
564113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	main/api_exec_es1_dispatch.h \
574113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	main/api_exec_es1_remap_helper.h \
584113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	main/api_exec_es1.c \
594113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	program/program_parse.tab.c \
604113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	program/program_parse.tab.h \
614113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	program/lex.yy.c
624113ac6a0f13338ee5f9c5fa0be13f37b515108dEric AnholtCLEANFILES = \
634113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	$(BUILT_SOURCES) \
644113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	git_sha1.h.tmp
654113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
664113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtmain/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
674113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	$(call glapi_gen_dispatch,$<,es1)
684113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
694113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtmain/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
704113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt	$(call glapi_gen_remap,$<,es1)
714113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
724113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtmain/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
734113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
744113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtmain/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
7502f52e8df58aad16e6b59fe35ac0c10b46dad36eMatt Turner	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
76261b1389eb7cc268eb90402753ca52cc481d542aDylan Noblesmith	  -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
774113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
784113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtprogram/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
7979e9e1b32f54f4fb6d752643fc9843c45eddd2f6Matt Turner	$(MKDIR_P) program
80a834381506d5be80251953666198fc3b9bc4b731Dave Airlie	$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $<
814113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
824113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholtprogram/lex.yy.c: program/program_lexer.l
8379e9e1b32f54f4fb6d752643fc9843c45eddd2f6Matt Turner	$(MKDIR_P) program
8402f52e8df58aad16e6b59fe35ac0c10b46dad36eMatt Turner	$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
854113ac6a0f13338ee5f9c5fa0be13f37b515108dEric Anholt
868cdce6c136799aa75310086c078d8cd5f19b84ceMatt Turnernoinst_LTLIBRARIES =
878cdce6c136799aa75310086c078d8cd5f19b84ceMatt Turnerif NEED_LIBMESA
888cdce6c136799aa75310086c078d8cd5f19b84ceMatt Turnernoinst_LTLIBRARIES += libmesa.la
898cdce6c136799aa75310086c078d8cd5f19b84ceMatt Turnerelse
908cdce6c136799aa75310086c078d8cd5f19b84ceMatt Turnercheck_LTLIBRARIES = libmesa.la
918cdce6c136799aa75310086c078d8cd5f19b84ceMatt Turnerendif
92bfd7d6f58b47984853cf0831057e84a617de25edMatt Turnerif HAVE_GALLIUM
93bfd7d6f58b47984853cf0831057e84a617de25edMatt Turnernoinst_LTLIBRARIES += libmesagallium.la
94bfd7d6f58b47984853cf0831057e84a617de25edMatt Turnerendif
95a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
96948c8f502a3b3144588a6e707b0ea60afa766ebbDaniel CharlesSRCDIR = $(top_srcdir)/src/mesa/
97b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse RogersBUILDDIR = $(top_builddir)/src/mesa/
98a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYinclude sources.mak
99a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
100d80fd04639a6e378c6e13c8ffaa91d43decf58a8Jon TURNEYAM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
101a1f1add42d5ee0122627df3b2b5f4ab12e49752bMatt TurnerAM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
102a1f1add42d5ee0122627df3b2b5f4ab12e49752bMatt TurnerAM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
103a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
104a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY# cannot just add $(MESA_ASM_FILES) to libmesa_la_SOURCES as it contains a configure substitution
105a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYMESA_ASM_FILES_FOR_ARCH =
106a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
107a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYif HAVE_X86_ASM
108a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYMESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
109b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse RogersAM_CPPFLAGS += \
110b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse Rogers        -I$(top_builddir)/src/mesa/x86 \
111b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse Rogers        -I$(top_srcdir)/src/mesa/x86
112a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYendif
113a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYif HAVE_X86_64_ASM
114a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYMESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
115b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse RogersAM_CPPFLAGS += \
116b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse Rogers        -I$(top_builddir)/src/mesa/x86-64 \
117b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse Rogers        -I$(top_srcdir)/src/mesa/x86-64
118a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYendif
119a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYif HAVE_SPARC_ASM
120a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYMESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
121b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse RogersAM_CPPFLAGS += \
122b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse Rogers        -I$(top_builddir)/src/mesa/sparc \
123b2ecaab7ad671f97840867c26869e0accf25592cChristopher James Halse Rogers        -I$(top_srcdir)/src/mesa/sparc
124a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYendif
125a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
126a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYlibmesa_la_SOURCES = \
127a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY	$(MESA_FILES) \
128a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY	$(MESA_CXX_FILES) \
129a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY        $(MESA_ASM_FILES_FOR_ARCH)
130a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
131a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYlibmesa_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
132a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYlibmesa_la_LDFLAGS =
133a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
134a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYlibmesagallium_la_SOURCES = \
135a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY	$(MESA_GALLIUM_FILES) \
136a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY	$(MESA_GALLIUM_CXX_FILES) \
137a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY        $(MESA_ASM_FILES_FOR_ARCH)
138a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
139a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYlibmesagallium_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
140a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEYlibmesagallium_la_LDFLAGS =
141417c1a642141abac2f0a58d044893c93576bb9a3Eric Anholt
1428cdce6c136799aa75310086c078d8cd5f19b84ceMatt Turnerif HAVE_GALLIUM
143a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY# Provide compatibility with scripts for the old Mesa build system for
144a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY# a while by putting a link to the library in the current directory.
145bfd7d6f58b47984853cf0831057e84a617de25edMatt Turnerall-local: $(noinst_LTLIBRARIES)
146a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY	ln -f .libs/libmesagallium.a .
147bfd7d6f58b47984853cf0831057e84a617de25edMatt Turnerendif
148a112ca5d5f8504310bf157d440c859676aae7753Jon TURNEY
1498cdce6c136799aa75310086c078d8cd5f19b84ceMatt TurnerCLEANFILES += libmesagallium.a
15039785488e6a3f6beeb58372b88d49274a76d02f4Eric Anholt
15139785488e6a3f6beeb58372b88d49274a76d02f4Eric Anholtpkgconfigdir = $(libdir)/pkgconfig
15239785488e6a3f6beeb58372b88d49274a76d02f4Eric Anholtpkgconfig_DATA = gl.pc
153f9089f40224b8680bd5cfc2cba509d2c709cf403Jon TURNEY
154f9089f40224b8680bd5cfc2cba509d2c709cf403Jon TURNEY# Emacs tags
155f9089f40224b8680bd5cfc2cba509d2c709cf403Jon TURNEYtags:
156f9089f40224b8680bd5cfc2cba509d2c709cf403Jon TURNEY	etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
157