1# Copyright © 2012 Intel Corporation
2#
3# Permission is hereby granted, free of charge, to any person obtaining a
4# copy of this software and associated documentation files (the "Software"),
5# to deal in the Software without restriction, including without limitation
6# the rights to use, copy, modify, merge, publish, distribute, sublicense,
7# and/or sell copies of the Software, and to permit persons to whom the
8# Software is furnished to do so, subject to the following conditions:
9#
10# The above copyright notice and this permission notice (including the next
11# paragraph) shall be included in all copies or substantial portions of the
12# Software.
13#
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20# IN THE SOFTWARE.
21
22SUBDIRS = . main/tests
23
24# state tracker tests depend on libmesagallium.la
25if HAVE_GALLIUM
26SUBDIRS += state_tracker/tests
27endif
28
29if HAVE_XLIB_GLX
30SUBDIRS += drivers/x11
31endif
32
33if HAVE_DRICOMMON
34SUBDIRS += drivers/dri
35endif
36
37if HAVE_OSMESA
38SUBDIRS += drivers/osmesa
39endif
40
41include Makefile.sources
42
43EXTRA_DIST = \
44	drivers/SConscript \
45	main/meson.build \
46	program/meson.build \
47	meson.build \
48	main/format_fallback.py \
49	main/format_info.py \
50	main/format_pack.py \
51	main/format_parser.py \
52	main/format_unpack.py \
53	main/formats.csv \
54	main/get_hash_generator.py \
55	main/get_hash_params.py \
56	program/program_lexer.l \
57	program/program_parse.y \
58	SConscript \
59	swrast/NOTES \
60	swrast_setup/NOTES \
61	tnl/NOTES \
62	tnl_dd
63
64BUILT_SOURCES = \
65	main/get_hash.h \
66	main/format_fallback.c \
67	main/format_info.h \
68	main/format_pack.c \
69	main/format_unpack.c \
70	program/program_parse.tab.c \
71	program/lex.yy.c
72CLEANFILES = \
73	$(BUILT_SOURCES) \
74	program/program_parse.tab.h
75
76PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
77
78main/get_hash.h: ../mapi/glapi/gen/gl_and_es_API.xml main/get_hash_params.py \
79                 main/get_hash_generator.py
80	$(PYTHON_GEN) $(srcdir)/main/get_hash_generator.py \
81		-f $(srcdir)/../mapi/glapi/gen/gl_and_es_API.xml > $@
82
83main/format_fallback.c: main/format_fallback.py \
84                        main/format_parser.py \
85	                main/formats.csv
86	$(PYTHON_GEN) $(srcdir)/main/format_fallback.py $(srcdir)/main/formats.csv $@
87
88main/format_info.h: main/formats.csv \
89                    main/format_parser.py main/format_info.py
90	$(PYTHON_GEN) $(srcdir)/main/format_info.py $(srcdir)/main/formats.csv > $@
91
92main/format_pack.c: main/format_pack.py main/formats.csv \
93                    main/format_parser.py
94	$(PYTHON_GEN) $(srcdir)/main/format_pack.py $(srcdir)/main/formats.csv > $@
95
96main/format_unpack.c: main/format_unpack.py main/formats.csv	\
97                      main/format_parser.py
98	$(PYTHON_GEN) $(srcdir)/main/format_unpack.py $(srcdir)/main/formats.csv > $@
99
100main/formats.c: main/format_info.h
101
102noinst_LTLIBRARIES = $(ARCH_LIBS)
103if NEED_LIBMESA
104noinst_LTLIBRARIES += libmesa.la
105else
106check_LTLIBRARIES = libmesa.la
107endif
108if HAVE_GALLIUM
109noinst_LTLIBRARIES += libmesagallium.la
110endif
111
112AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
113AM_CFLAGS = \
114	$(VDPAU_CFLAGS) \
115	$(LLVM_CFLAGS) \
116	$(VISIBILITY_CFLAGS) \
117	$(MSVC2013_COMPAT_CFLAGS)
118AM_CXXFLAGS = \
119	$(LLVM_CFLAGS) \
120	$(VISIBILITY_CXXFLAGS) \
121	$(MSVC2013_COMPAT_CXXFLAGS)
122
123ARCH_LIBS =
124
125if SSE41_SUPPORTED
126ARCH_LIBS += libmesa_sse41.la
127endif
128
129MESA_ASM_FILES_FOR_ARCH =
130
131if HAVE_X86_ASM
132noinst_PROGRAMS = gen_matypes
133
134gen_matypes_SOURCES = x86/gen_matypes.c
135BUILT_SOURCES += matypes.h
136
137if HAVE_X86_64_ASM
138MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
139AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
140else
141MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
142AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
143endif
144endif
145if HAVE_SPARC_ASM
146MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
147AM_CPPFLAGS += -I$(builddir)/sparc -I$(srcdir)/sparc
148endif
149
150libmesa_la_SOURCES = \
151	$(MESA_FILES) \
152	$(PROGRAM_FILES) \
153	$(PROGRAM_NIR_FILES) \
154	$(MESA_ASM_FILES_FOR_ARCH)
155
156libmesa_la_LIBADD = \
157	$(top_builddir)/src/compiler/glsl/libglsl.la \
158	$(ARCH_LIBS)
159
160libmesagallium_la_SOURCES = \
161	$(MESA_GALLIUM_FILES) \
162	$(PROGRAM_FILES) \
163	$(PROGRAM_NIR_FILES) \
164	$(MESA_ASM_FILES_FOR_ARCH)
165
166libmesagallium_la_LIBADD = \
167	$(top_builddir)/src/compiler/glsl/libglsl.la \
168	$(ARCH_LIBS)
169
170libmesa_sse41_la_SOURCES = \
171	$(X86_SSE41_FILES)
172
173libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS)
174
175MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
176YACC_GEN = $(AM_V_GEN)$(YACC) $(YFLAGS)
177LEX_GEN = $(AM_V_GEN)$(LEX) $(LFLAGS)
178
179program/lex.yy.c: program/program_lexer.l
180	$(MKDIR_GEN)
181	$(LEX_GEN) -o $@ $(srcdir)/program/program_lexer.l
182
183program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
184	$(MKDIR_GEN)
185	$(YACC_GEN) -o $@ -p "_mesa_program_" --defines=$(builddir)/program/program_parse.tab.h $(srcdir)/program/program_parse.y
186
187if GEN_ASM_OFFSETS
188matypes.h: $(gen_matypes_SOURCES)
189	$(AM_V_GEN)$(COMPILE) $< -DASM_OFFSETS -S -o - | \
190		sed -n '/^->/{s:^->::;/[$$]/{s:^:#define :;s:[$$]::};p}' > $@
191else
192matypes.h: gen_matypes
193	$(AM_V_GEN)./gen_matypes > $@
194endif
195
196# Emacs tags
197tags:
198	etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h
199