c86ded979b962727ed507cc5b26dbb4631ad7516
[mesa.git] / src / mesa / Makefile.am
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
22 SUBDIRS = . main/tests
23
24 if HAVE_X11_DRIVER
25 SUBDIRS += drivers/x11
26 endif
27
28 if HAVE_DRICOMMON
29 SUBDIRS += drivers/dri
30 endif
31
32 if HAVE_OSMESA
33 SUBDIRS += drivers/osmesa
34 endif
35
36 gldir = $(includedir)/GL
37 gl_HEADERS = $(top_srcdir)/include/GL/*.h
38
39 .PHONY: main/git_sha1.h.tmp
40 main/git_sha1.h.tmp:
41 @touch main/git_sha1.h.tmp
42 @if test -d $(top_srcdir)/.git; then \
43 if which git > /dev/null; then \
44 git --git-dir=$(top_srcdir)/.git log -n 1 --oneline | \
45 sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
46 > main/git_sha1.h.tmp ; \
47 fi \
48 fi
49
50 main/git_sha1.h: main/git_sha1.h.tmp
51 @echo "updating main/git_sha1.h"
52 @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
53 mv main/git_sha1.h.tmp main/git_sha1.h ;\
54 else \
55 rm main/git_sha1.h.tmp ;\
56 fi
57
58 include Makefile.sources
59
60 EXTRA_DIST = \
61 drivers/SConscript \
62 main/format_info.py \
63 main/format_pack.py \
64 main/format_parser.py \
65 main/format_unpack.py \
66 main/formats.csv \
67 main/get_hash_generator.py \
68 main/get_hash_params.py \
69 program/program_lexer.l \
70 program/program_parse.y \
71 SConscript \
72 swrast/NOTES \
73 swrast_setup/NOTES \
74 tnl/NOTES \
75 tnl_dd
76
77 BUILT_SOURCES = \
78 main/get_hash.h \
79 main/format_info.h \
80 main/git_sha1.h \
81 main/format_pack.c \
82 main/format_unpack.c \
83 program/program_parse.tab.c \
84 program/lex.yy.c
85 CLEANFILES = \
86 $(BUILT_SOURCES) \
87 program/program_parse.tab.h \
88 main/git_sha1.h.tmp
89
90 GET_HASH_GEN = main/get_hash_generator.py
91
92 main/get_hash.h: ../mapi/glapi/gen/gl_and_es_API.xml main/get_hash_params.py \
93 $(GET_HASH_GEN)
94 $(AM_V_GEN)set -e; \
95 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN) \
96 -f $< > $@.tmp; \
97 mv $@.tmp $@;
98
99 main/format_info.h: main/formats.csv \
100 main/format_parser.py main/format_info.py
101 $(AM_V_GEN)set -e; \
102 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/format_info.py \
103 $< > $@.tmp; \
104 mv $@.tmp $@;
105
106 main/format_pack.c: main/format_pack.py main/formats.csv \
107 main/format_parser.py
108 $(AM_V_GEN)set -e; \
109 $(PYTHON2) $(PYTHON_FLAGS) \
110 $(srcdir)/main/format_pack.py \
111 $(srcdir)/main/formats.csv \
112 | $(INDENT) $(INDENT_FLAGS) > $@;
113
114 main/format_unpack.c: main/format_unpack.py main/formats.csv \
115 main/format_parser.py
116 $(AM_V_GEN)set -e; \
117 $(PYTHON2) $(PYTHON_FLAGS) \
118 $(srcdir)/main/format_unpack.py \
119 $(srcdir)/main/formats.csv \
120 | $(INDENT) $(INDENT_FLAGS) > $@;
121
122 main/formats.c: main/format_info.h
123
124 noinst_LTLIBRARIES = $(ARCH_LIBS)
125 if NEED_LIBMESA
126 noinst_LTLIBRARIES += libmesa.la
127 else
128 check_LTLIBRARIES = libmesa.la
129 endif
130 if HAVE_GALLIUM
131 noinst_LTLIBRARIES += libmesagallium.la
132 endif
133
134 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
135 AM_CFLAGS = \
136 $(LLVM_CFLAGS) \
137 $(VISIBILITY_CFLAGS) \
138 $(MSVC2013_COMPAT_CFLAGS)
139 AM_CXXFLAGS = \
140 $(LLVM_CFLAGS) \
141 $(VISIBILITY_CXXFLAGS) \
142 $(MSVC2013_COMPAT_CXXFLAGS)
143
144 ARCH_LIBS =
145
146 if SSE41_SUPPORTED
147 ARCH_LIBS += libmesa_sse41.la
148 endif
149
150 MESA_ASM_FILES_FOR_ARCH =
151
152 if HAVE_X86_ASM
153 noinst_PROGRAMS = gen_matypes
154
155 gen_matypes_SOURCES = x86/gen_matypes.c
156 BUILT_SOURCES += matypes.h
157
158 if HAVE_X86_64_ASM
159 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
160 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
161 else
162 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
163 AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
164 endif
165 endif
166 if HAVE_SPARC_ASM
167 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
168 AM_CPPFLAGS += -I$(builddir)/sparc -I$(srcdir)/sparc
169 endif
170
171 libmesa_la_SOURCES = \
172 $(MESA_FILES) \
173 $(PROGRAM_FILES) \
174 $(PROGRAM_NIR_FILES) \
175 $(MESA_ASM_FILES_FOR_ARCH)
176
177 libmesa_la_LIBADD = \
178 $(top_builddir)/src/glsl/libglsl.la \
179 $(ARCH_LIBS)
180
181 libmesagallium_la_SOURCES = \
182 $(MESA_GALLIUM_FILES) \
183 $(PROGRAM_FILES) \
184 $(PROGRAM_NIR_FILES) \
185 $(MESA_ASM_FILES_FOR_ARCH)
186
187 libmesagallium_la_LIBADD = \
188 $(top_builddir)/src/glsl/libglsl.la \
189 $(ARCH_LIBS)
190
191 libmesa_sse41_la_SOURCES = \
192 main/streaming-load-memcpy.c \
193 main/streaming-load-memcpy.h \
194 main/sse_minmax.c \
195 main/sse_minmax.h
196 libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS)
197
198 pkgconfigdir = $(libdir)/pkgconfig
199 pkgconfig_DATA = gl.pc
200
201 program/lex.yy.c: program/program_lexer.l
202 $(AM_V_at)$(MKDIR_P) program
203 $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
204
205 program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
206 $(AM_V_at)$(MKDIR_P) program
207 $(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $<
208
209 if GEN_ASM_OFFSETS
210 matypes.h: $(gen_matypes_SOURCES)
211 $(AM_V_GEN)$(COMPILE) $< -DASM_OFFSETS -S -o - | \
212 sed -n '/^->/{s:^->::;/[$$]/{s:^:#define :;s:[$$]::};p}' > $@
213 else
214 matypes.h: gen_matypes
215 $(AM_V_GEN)./gen_matypes > $@
216 endif
217
218 # Emacs tags
219 tags:
220 etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h