build systems: uniformize git_sha1.h generation
[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_XLIB_GLX
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 include Makefile.sources
37
38 EXTRA_DIST = \
39 drivers/SConscript \
40 main/format_fallback.py \
41 main/format_info.py \
42 main/format_pack.py \
43 main/format_parser.py \
44 main/format_unpack.py \
45 main/formats.csv \
46 main/get_hash_generator.py \
47 main/get_hash_params.py \
48 program/program_lexer.l \
49 program/program_parse.y \
50 SConscript \
51 swrast/NOTES \
52 swrast_setup/NOTES \
53 tnl/NOTES \
54 tnl_dd
55
56 BUILT_SOURCES = \
57 main/get_hash.h \
58 main/format_fallback.c \
59 main/format_info.h \
60 main/format_pack.c \
61 main/format_unpack.c \
62 program/program_parse.tab.c \
63 program/lex.yy.c
64 CLEANFILES = \
65 $(BUILT_SOURCES) \
66 program/program_parse.tab.h
67
68 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
69
70 main/get_hash.h: ../mapi/glapi/gen/gl_and_es_API.xml main/get_hash_params.py \
71 main/get_hash_generator.py
72 $(PYTHON_GEN) $(srcdir)/main/get_hash_generator.py \
73 -f $(srcdir)/../mapi/glapi/gen/gl_and_es_API.xml > $@
74
75 main/format_fallback.c: main/format_fallback.py \
76 main/format_parser.py \
77 main/formats.csv
78 $(PYTHON_GEN) $(srcdir)/main/format_fallback.py $(srcdir)/main/formats.csv $@
79
80 main/format_info.h: main/formats.csv \
81 main/format_parser.py main/format_info.py
82 $(PYTHON_GEN) $(srcdir)/main/format_info.py $(srcdir)/main/formats.csv > $@
83
84 main/format_pack.c: main/format_pack.py main/formats.csv \
85 main/format_parser.py
86 $(PYTHON_GEN) $(srcdir)/main/format_pack.py $(srcdir)/main/formats.csv > $@
87
88 main/format_unpack.c: main/format_unpack.py main/formats.csv \
89 main/format_parser.py
90 $(PYTHON_GEN) $(srcdir)/main/format_unpack.py $(srcdir)/main/formats.csv > $@
91
92 main/formats.c: main/format_info.h
93
94 noinst_LTLIBRARIES = $(ARCH_LIBS)
95 if NEED_LIBMESA
96 noinst_LTLIBRARIES += libmesa.la
97 else
98 check_LTLIBRARIES = libmesa.la
99 endif
100 if HAVE_GALLIUM
101 noinst_LTLIBRARIES += libmesagallium.la
102 endif
103
104 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
105 AM_CFLAGS = \
106 $(VDPAU_CFLAGS) \
107 $(LLVM_CFLAGS) \
108 $(VISIBILITY_CFLAGS) \
109 $(MSVC2013_COMPAT_CFLAGS)
110 AM_CXXFLAGS = \
111 $(LLVM_CFLAGS) \
112 $(VISIBILITY_CXXFLAGS) \
113 $(MSVC2013_COMPAT_CXXFLAGS)
114
115 ARCH_LIBS =
116
117 if SSE41_SUPPORTED
118 ARCH_LIBS += libmesa_sse41.la
119 endif
120
121 MESA_ASM_FILES_FOR_ARCH =
122
123 if HAVE_X86_ASM
124 noinst_PROGRAMS = gen_matypes
125
126 gen_matypes_SOURCES = x86/gen_matypes.c
127 BUILT_SOURCES += matypes.h
128
129 if HAVE_X86_64_ASM
130 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
131 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
132 else
133 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
134 AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
135 endif
136 endif
137 if HAVE_SPARC_ASM
138 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
139 AM_CPPFLAGS += -I$(builddir)/sparc -I$(srcdir)/sparc
140 endif
141
142 libmesa_la_SOURCES = \
143 $(MESA_FILES) \
144 $(PROGRAM_FILES) \
145 $(PROGRAM_NIR_FILES) \
146 $(MESA_ASM_FILES_FOR_ARCH)
147
148 libmesa_la_LIBADD = \
149 $(top_builddir)/src/compiler/glsl/libglsl.la \
150 $(ARCH_LIBS)
151
152 libmesagallium_la_SOURCES = \
153 $(MESA_GALLIUM_FILES) \
154 $(PROGRAM_FILES) \
155 $(PROGRAM_NIR_FILES) \
156 $(MESA_ASM_FILES_FOR_ARCH)
157
158 libmesagallium_la_LIBADD = \
159 $(top_builddir)/src/compiler/glsl/libglsl.la \
160 $(ARCH_LIBS)
161
162 libmesa_sse41_la_SOURCES = \
163 $(X86_SSE41_FILES)
164
165 libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS)
166
167 MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
168 YACC_GEN = $(AM_V_GEN)$(YACC) $(YFLAGS)
169 LEX_GEN = $(AM_V_GEN)$(LEX) $(LFLAGS)
170
171 program/lex.yy.c: program/program_lexer.l
172 $(MKDIR_GEN)
173 $(LEX_GEN) -o $@ $(srcdir)/program/program_lexer.l
174
175 program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
176 $(MKDIR_GEN)
177 $(YACC_GEN) -o $@ -p "_mesa_program_" --defines=$(builddir)/program/program_parse.tab.h $(srcdir)/program/program_parse.y
178
179 if GEN_ASM_OFFSETS
180 matypes.h: $(gen_matypes_SOURCES)
181 $(AM_V_GEN)$(COMPILE) $< -DASM_OFFSETS -S -o - | \
182 sed -n '/^->/{s:^->::;/[$$]/{s:^:#define :;s:[$$]::};p}' > $@
183 else
184 matypes.h: gen_matypes
185 $(AM_V_GEN)./gen_matypes > $@
186 endif
187
188 # Emacs tags
189 tags:
190 etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h