15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# Copyright © 2012 Intel Corporation
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# Permission is hereby granted, free of charge, to any person obtaining a
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# copy of this software and associated documentation files (the "Software"),
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# to deal in the Software without restriction, including without limitation
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# the rights to use, copy, modify, merge, publish, distribute, sublicense,
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# and/or sell copies of the Software, and to permit persons to whom the
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# Software is furnished to do so, subject to the following conditions:
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# The above copyright notice and this permission notice (including the next
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# paragraph) shall be included in all copies or substantial portions of the
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# Software.
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# IN THE SOFTWARE.
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)if NEED_LIBDRICORE
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)DRICORE_SUBDIR = libdricore
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)endif
25effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)SUBDIRS = x86 x86-64 . $(DRICORE_SUBDIR) drivers
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)gldir = $(includedir)/GL
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)gl_HEADERS = $(top_srcdir)/include/GL/*.h
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles).PHONY: main/git_sha1.h.tmp
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)main/git_sha1.h.tmp:
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	@touch main/git_sha1.h.tmp
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	@if test -d ../../.git; then \
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)		if which git > /dev/null; then \
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)		    git log -n 1 --oneline | \
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)			> main/git_sha1.h.tmp ; \
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)		fi \
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	fi
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
42main/git_sha1.h: main/git_sha1.h.tmp
43	@echo "updating main/git_sha1.h"
44	@if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
45		mv main/git_sha1.h.tmp main/git_sha1.h ;\
46	else \
47		rm main/git_sha1.h.tmp ;\
48	fi
49
50# include glapi_gen.mk for generating glapi headers for GLES
51GLAPI = $(top_srcdir)/src/mapi/glapi/gen
52include $(GLAPI)/glapi_gen.mk
53
54BUILT_SOURCES = \
55	main/git_sha1.h \
56	main/api_exec_es1_dispatch.h \
57	main/api_exec_es1_remap_helper.h \
58	main/api_exec_es1.c \
59	program/program_parse.tab.c \
60	program/program_parse.tab.h \
61	program/lex.yy.c
62CLEANFILES = \
63	$(BUILT_SOURCES) \
64	git_sha1.h.tmp
65
66main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
67	$(call glapi_gen_dispatch,$<,es1)
68
69main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
70	$(call glapi_gen_remap,$<,es1)
71
72main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
73
74main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
75	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
76	  -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
77
78program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
79	$(MKDIR_P) program
80	$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $<
81
82program/lex.yy.c: program/program_lexer.l
83	$(MKDIR_P) program
84	$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
85
86noinst_LTLIBRARIES =
87if NEED_LIBMESA
88noinst_LTLIBRARIES += libmesa.la
89else
90check_LTLIBRARIES = libmesa.la
91endif
92if HAVE_GALLIUM
93noinst_LTLIBRARIES += libmesagallium.la
94endif
95
96SRCDIR = $(top_srcdir)/src/mesa/
97BUILDDIR = $(top_builddir)/src/mesa/
98include sources.mak
99
100AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
101AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
102AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
103
104# cannot just add $(MESA_ASM_FILES) to libmesa_la_SOURCES as it contains a configure substitution
105MESA_ASM_FILES_FOR_ARCH =
106
107if HAVE_X86_ASM
108MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
109AM_CPPFLAGS += \
110        -I$(top_builddir)/src/mesa/x86 \
111        -I$(top_srcdir)/src/mesa/x86
112endif
113if HAVE_X86_64_ASM
114MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
115AM_CPPFLAGS += \
116        -I$(top_builddir)/src/mesa/x86-64 \
117        -I$(top_srcdir)/src/mesa/x86-64
118endif
119if HAVE_SPARC_ASM
120MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
121AM_CPPFLAGS += \
122        -I$(top_builddir)/src/mesa/sparc \
123        -I$(top_srcdir)/src/mesa/sparc
124endif
125
126libmesa_la_SOURCES = \
127	$(MESA_FILES) \
128	$(MESA_CXX_FILES) \
129        $(MESA_ASM_FILES_FOR_ARCH)
130
131libmesa_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
132libmesa_la_LDFLAGS =
133
134libmesagallium_la_SOURCES = \
135	$(MESA_GALLIUM_FILES) \
136	$(MESA_GALLIUM_CXX_FILES) \
137        $(MESA_ASM_FILES_FOR_ARCH)
138
139libmesagallium_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
140libmesagallium_la_LDFLAGS =
141
142if HAVE_GALLIUM
143# Provide compatibility with scripts for the old Mesa build system for
144# a while by putting a link to the library in the current directory.
145all-local: $(noinst_LTLIBRARIES)
146	ln -f .libs/libmesagallium.a .
147endif
148
149CLEANFILES += libmesagallium.a
150
151pkgconfigdir = $(libdir)/pkgconfig
152pkgconfig_DATA = gl.pc
153
154# Emacs tags
155tags:
156	etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
157