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