• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2015 Intel Corporation.   All Rights Reserved.
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
22include Makefile.sources
23include $(top_srcdir)/src/gallium/Automake.inc
24
25AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) $(SWR_CXX11_CXXFLAGS)
26
27noinst_LTLIBRARIES = libmesaswr.la
28
29libmesaswr_la_SOURCES = $(LOADER_SOURCES)
30
31COMMON_CXXFLAGS = \
32	-fno-strict-aliasing \
33	$(GALLIUM_DRIVER_CFLAGS) \
34	$(LLVM_CXXFLAGS) \
35	$(SWR_CXX11_CXXFLAGS) \
36	-I$(builddir)/rasterizer/scripts \
37	-I$(builddir)/rasterizer/jitter \
38	-I$(builddir)/rasterizer/archrast \
39	-I$(srcdir)/rasterizer \
40	-I$(srcdir)/rasterizer/core \
41	-I$(srcdir)/rasterizer/scripts \
42	-I$(srcdir)/rasterizer/jitter \
43	-I$(srcdir)/rasterizer/archrast
44
45COMMON_SOURCES = \
46	$(CXX_SOURCES) \
47	$(ARCHRAST_CXX_SOURCES) \
48	$(COMMON_CXX_SOURCES) \
49	$(CORE_CXX_SOURCES) \
50	$(JITTER_CXX_SOURCES) \
51	$(MEMORY_CXX_SOURCES) \
52	$(BUILT_SOURCES)
53
54BUILT_SOURCES = \
55	swr_context_llvm.h \
56	rasterizer/scripts/gen_knobs.cpp \
57	rasterizer/scripts/gen_knobs.h \
58	rasterizer/jitter/state_llvm.h \
59	rasterizer/jitter/builder_x86.h \
60	rasterizer/jitter/builder_x86.cpp \
61	rasterizer/archrast/gen_ar_event.h \
62	rasterizer/archrast/gen_ar_event.cpp \
63	rasterizer/archrast/gen_ar_eventhandler.h \
64	rasterizer/archrast/gen_ar_eventhandlerfile.h
65
66MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
67PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
68swr_context_llvm.h: rasterizer/jitter/scripts/gen_llvm_types.py swr_context.h
69	$(PYTHON_GEN) \
70		$(srcdir)/rasterizer/jitter/scripts/gen_llvm_types.py \
71		--input $(srcdir)/swr_context.h \
72		--output swr_context_llvm.h
73
74rasterizer/scripts/gen_knobs.cpp: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template
75	$(MKDIR_GEN)
76	$(PYTHON_GEN) \
77		$(srcdir)/rasterizer/scripts/gen_knobs.py \
78		--input $(srcdir)/rasterizer/scripts/templates/knobs.template \
79		--output rasterizer/scripts/gen_knobs.cpp \
80		--gen_cpp
81
82rasterizer/scripts/gen_knobs.h: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template
83	$(MKDIR_GEN)
84	$(PYTHON_GEN) \
85		$(srcdir)/rasterizer/scripts/gen_knobs.py \
86		--input $(srcdir)/rasterizer/scripts/templates/knobs.template \
87		--output rasterizer/scripts/gen_knobs.h \
88		--gen_h
89
90rasterizer/jitter/state_llvm.h: rasterizer/jitter/scripts/gen_llvm_types.py rasterizer/core/state.h
91	$(MKDIR_GEN)
92	$(PYTHON_GEN) \
93		$(srcdir)/rasterizer/jitter/scripts/gen_llvm_types.py \
94		--input $(srcdir)/rasterizer/core/state.h \
95		--output rasterizer/jitter/state_llvm.h
96
97rasterizer/jitter/builder_gen.h: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
98	$(MKDIR_GEN)
99	$(PYTHON_GEN) \
100		$(srcdir)/rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
101		--input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
102		--output rasterizer/jitter/builder_gen.h \
103		--gen_h
104
105rasterizer/jitter/builder_gen.cpp: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
106	$(MKDIR_GEN)
107	$(PYTHON_GEN) \
108		$(srcdir)/rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
109		--input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
110		--output rasterizer/jitter/builder_gen.cpp \
111		--gen_cpp
112
113rasterizer/jitter/builder_x86.h: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
114	$(MKDIR_GEN)
115	$(PYTHON_GEN) \
116		$(srcdir)/rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
117		--output rasterizer/jitter/builder_x86.h \
118		--gen_x86_h
119
120rasterizer/jitter/builder_x86.cpp: rasterizer/jitter/scripts/gen_llvm_ir_macros.py
121	$(MKDIR_GEN)
122	$(PYTHON_GEN) \
123		$(srcdir)/rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
124		--output rasterizer/jitter/builder_x86.cpp \
125		--gen_x86_cpp
126
127rasterizer/archrast/gen_ar_event.h: rasterizer/scripts/gen_archrast.py rasterizer/scripts/templates/ar_event_h.template rasterizer/archrast/events.proto
128	$(MKDIR_GEN)
129	$(PYTHON_GEN) \
130		$(srcdir)/rasterizer/scripts/gen_archrast.py \
131		--proto $(srcdir)/rasterizer/archrast/events.proto \
132		--output rasterizer/archrast/gen_ar_event.h \
133		--gen_event_h
134
135rasterizer/archrast/gen_ar_event.cpp: rasterizer/scripts/gen_archrast.py rasterizer/scripts/templates/ar_event_cpp.template rasterizer/archrast/events.proto
136	$(MKDIR_GEN)
137	$(PYTHON_GEN) \
138		$(srcdir)/rasterizer/scripts/gen_archrast.py \
139		--proto $(srcdir)/rasterizer/archrast/events.proto \
140		--output rasterizer/archrast/gen_ar_event.cpp \
141		--gen_event_cpp
142
143rasterizer/archrast/gen_ar_eventhandler.h: rasterizer/scripts/gen_archrast.py rasterizer/scripts/templates/ar_eventhandler_h.template rasterizer/archrast/events.proto
144	$(MKDIR_GEN)
145	$(PYTHON_GEN) \
146		$(srcdir)/rasterizer/scripts/gen_archrast.py \
147		--proto $(srcdir)/rasterizer/archrast/events.proto \
148		--output rasterizer/archrast/gen_ar_eventhandler.h \
149		--gen_eventhandler_h
150
151rasterizer/archrast/gen_ar_eventhandlerfile.h: rasterizer/scripts/gen_archrast.py rasterizer/scripts/templates/ar_eventhandlerfile_h.template rasterizer/archrast/events.proto
152	$(MKDIR_GEN)
153	$(PYTHON_GEN) \
154		$(srcdir)/rasterizer/scripts/gen_archrast.py \
155		--proto $(srcdir)/rasterizer/archrast/events.proto \
156		--output rasterizer/archrast/gen_ar_eventhandlerfile.h \
157		--gen_eventhandlerfile_h
158
159COMMON_LIBADD = \
160	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
161	$(top_builddir)/src/mesa/libmesagallium.la \
162	$(LLVM_LIBS)
163
164COMMON_LDFLAGS = \
165	-shared \
166	-module \
167	-no-undefined \
168	$(GC_SECTIONS) \
169	$(NO_UNDEFINED) \
170	$(LLVM_LDFLAGS)
171
172
173# XXX: As we cannot use BUILT_SOURCES (the files will end up in the dist
174# tarball) just annotate the dependency directly.
175# As the single direct user of builder_gen.h is a header (builder.h) trace all
176# the translusive users (one that use the latter header).
177rasterizer/jitter/blend_jit.cpp: rasterizer/jitter/builder_gen.h
178rasterizer/jitter/builder.cpp: rasterizer/jitter/builder_gen.h
179rasterizer/jitter/builder_gen.cpp: rasterizer/jitter/builder_gen.h
180rasterizer/jitter/builder_x86.cpp: rasterizer/jitter/builder_gen.h
181rasterizer/jitter/builder_misc.cpp: rasterizer/jitter/builder_gen.h
182rasterizer/jitter/fetch_jit.cpp: rasterizer/jitter/builder_gen.h
183rasterizer/jitter/streamout_jit.cpp: rasterizer/jitter/builder_gen.h
184swr_shader.cpp: rasterizer/jitter/builder_gen.h
185
186CLEANFILES = \
187	rasterizer/jitter/builder_gen.h \
188	rasterizer/jitter/builder_gen.cpp
189
190# XXX: Due to the funky dependencies above, the builder_x86.cpp file gets
191# generated (copied) into builddir when building from release tarball.
192# Add a temporary workaround to remove it, until the above issue is resolved.
193distclean-local:
194	( test $(top_srcdir) != $(top_builddir) && \
195		rm $(builddir)/rasterizer/jitter/builder_x86.cpp ) || true
196
197lib_LTLIBRARIES = libswrAVX.la libswrAVX2.la
198
199libswrAVX_la_CXXFLAGS = \
200	$(SWR_AVX_CXXFLAGS) \
201	-DKNOB_ARCH=KNOB_ARCH_AVX \
202	$(COMMON_CXXFLAGS)
203
204libswrAVX_la_SOURCES = \
205	$(COMMON_SOURCES)
206
207# XXX: Don't ship these generated sources for now, since they are specific
208# to the LLVM version they are generated from. Thus a release tarball
209# containing the said files, generated against eg. LLVM 3.8 will fail to build
210# on systems with other versions of LLVM eg. 3.7 or 3.6.
211# Move these back to BUILT_SOURCES once that is resolved.
212nodist_libswrAVX_la_SOURCES = \
213	rasterizer/jitter/builder_gen.h \
214	rasterizer/jitter/builder_gen.cpp
215
216libswrAVX_la_LIBADD = \
217	$(COMMON_LIBADD)
218
219libswrAVX_la_LDFLAGS = \
220	$(COMMON_LDFLAGS)
221
222libswrAVX2_la_CXXFLAGS = \
223	$(SWR_AVX2_CXXFLAGS) \
224	-DKNOB_ARCH=KNOB_ARCH_AVX2 \
225	$(COMMON_CXXFLAGS)
226
227libswrAVX2_la_SOURCES = \
228	$(COMMON_SOURCES)
229
230# XXX: Don't ship these generated sources for now, since they are specific
231# to the LLVM version they are generated from. Thus a release tarball
232# containing the said files, generated against eg. LLVM 3.8 will fail to build
233# on systems with other versions of LLVM eg. 3.7 or 3.6.
234# Move these back to BUILT_SOURCES once that is resolved.
235nodist_libswrAVX2_la_SOURCES = \
236	rasterizer/jitter/builder_gen.h \
237	rasterizer/jitter/builder_gen.cpp
238
239libswrAVX2_la_LIBADD = \
240	$(COMMON_LIBADD)
241
242libswrAVX2_la_LDFLAGS = \
243	$(COMMON_LDFLAGS)
244
245include $(top_srcdir)/install-gallium-links.mk
246
247EXTRA_DIST = \
248	SConscript \
249	rasterizer/archrast/events.proto \
250	rasterizer/jitter/scripts/gen_llvm_ir_macros.py \
251	rasterizer/jitter/scripts/gen_llvm_types.py \
252	rasterizer/scripts/gen_archrast.py \
253	rasterizer/scripts/gen_knobs.py \
254	rasterizer/scripts/knob_defs.py \
255	rasterizer/scripts/mako/ast.py \
256	rasterizer/scripts/mako/_ast_util.py \
257	rasterizer/scripts/mako/cache.py \
258	rasterizer/scripts/mako/cmd.py \
259	rasterizer/scripts/mako/codegen.py \
260	rasterizer/scripts/mako/compat.py \
261	rasterizer/scripts/mako/exceptions.py \
262	rasterizer/scripts/mako/filters.py \
263	rasterizer/scripts/mako/__init__.py \
264	rasterizer/scripts/mako/lexer.py \
265	rasterizer/scripts/mako/lookup.py \
266	rasterizer/scripts/mako/parsetree.py \
267	rasterizer/scripts/mako/pygen.py \
268	rasterizer/scripts/mako/pyparser.py \
269	rasterizer/scripts/mako/runtime.py \
270	rasterizer/scripts/mako/template.py \
271	rasterizer/scripts/mako/util.py \
272	rasterizer/scripts/templates/knobs.template \
273	rasterizer/scripts/templates/ar_event_h.template \
274	rasterizer/scripts/templates/ar_event_cpp.template \
275	rasterizer/scripts/templates/ar_eventhandler_h.template \
276	rasterizer/scripts/templates/ar_eventhandlerfile_h.template
277