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