haiku: Add files to distribution.
[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: $(BUILDDIR)main/git_sha1.h.tmp
40 $(BUILDDIR)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 $(BUILDDIR)main/git_sha1.h: $(BUILDDIR)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 glapi_gen.mk for generating glapi headers for GLES
59 GLAPI = $(top_srcdir)/src/mapi/glapi/gen
60 include $(GLAPI)/glapi_gen.mk
61
62 BUILDDIR = $(builddir)/
63 include Makefile.sources
64
65 EXTRA_DIST = \
66 drivers/haiku \
67 main/format_info.py \
68 main/format_parser.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 tnl_dd
75
76 BUILT_SOURCES = \
77 main/get_hash.h \
78 main/format_info.c \
79 $(BUILDDIR)main/git_sha1.h \
80 $(BUILDDIR)program/program_parse.tab.c \
81 $(BUILDDIR)program/lex.yy.c
82 CLEANFILES = \
83 $(BUILT_SOURCES) \
84 $(BUILDDIR)program/program_parse.tab.h \
85 $(BUILDDIR)main/git_sha1.h.tmp
86
87 GET_HASH_GEN = main/get_hash_generator.py
88
89 main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py \
90 $(GET_HASH_GEN) Makefile
91 $(AM_V_GEN)set -e; \
92 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN) \
93 -f $< > $@.tmp; \
94 mv $@.tmp $@;
95
96 main/format_info.c: main/formats.csv \
97 main/format_parser.py main/format_info.py
98 $(AM_V_GEN)set -e; \
99 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/format_info.py \
100 $< > $@.tmp; \
101 mv $@.tmp $@;
102
103 main/formats.c: main/format_info.c
104
105 noinst_LTLIBRARIES = $(ARCH_LIBS)
106 if NEED_LIBMESA
107 noinst_LTLIBRARIES += libmesa.la
108 else
109 check_LTLIBRARIES = libmesa.la
110 endif
111 if HAVE_GALLIUM
112 noinst_LTLIBRARIES += libmesagallium.la
113 endif
114
115 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
116 AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
117 AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
118
119 ARCH_LIBS =
120
121 if SSE41_SUPPORTED
122 ARCH_LIBS += libmesa_sse41.la
123 endif
124
125 MESA_ASM_FILES_FOR_ARCH =
126
127 if HAVE_X86_ASM
128 noinst_PROGRAMS = gen_matypes
129
130 gen_matypes_SOURCES = x86/gen_matypes.c
131 BUILT_SOURCES += matypes.h
132
133 if HAVE_X86_64_ASM
134 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
135 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
136 else
137 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
138 AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
139 endif
140 endif
141 if HAVE_SPARC_ASM
142 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
143 AM_CPPFLAGS += -I$(builddir)/sparc -I$(srcdir)/sparc
144 endif
145
146 libmesa_la_SOURCES = \
147 $(MESA_FILES) \
148 $(PROGRAM_FILES) \
149 $(MESA_ASM_FILES_FOR_ARCH)
150
151 libmesa_la_LIBADD = \
152 $(top_builddir)/src/glsl/libglsl.la \
153 $(ARCH_LIBS)
154
155 libmesagallium_la_SOURCES = \
156 $(MESA_GALLIUM_FILES) \
157 $(PROGRAM_FILES) \
158 $(MESA_ASM_FILES_FOR_ARCH)
159
160 libmesagallium_la_LIBADD = \
161 $(top_builddir)/src/glsl/libglsl.la \
162 $(ARCH_LIBS)
163
164 libmesa_sse41_la_SOURCES = \
165 main/streaming-load-memcpy.c \
166 main/streaming-load-memcpy.h \
167 main/sse_minmax.c \
168 main/sse_minmax.h
169 libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS)
170
171 pkgconfigdir = $(libdir)/pkgconfig
172 pkgconfig_DATA = gl.pc
173
174 $(BUILDDIR)program/lex.yy.c: program/program_lexer.l
175 $(AM_V_at)$(MKDIR_P) program
176 $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
177
178 $(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: program/program_parse.y
179 $(AM_V_at)$(MKDIR_P) program
180 $(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=$(BUILDDIR)program/program_parse.tab.c $<
181
182 if GEN_ASM_OFFSETS
183 matypes.h: $(gen_matypes_SOURCES)
184 $(AM_V_GEN)$(COMPILE) $< -DASM_OFFSETS -S -o - | \
185 sed -n '/^->/{s:^->::;/[$$]/{s:^:#define :;s:[$$]::};p}' > $@
186 else
187 matypes.h: gen_matypes
188 $(AM_V_GEN)./gen_matypes > $@
189 endif
190
191 # Emacs tags
192 tags:
193 etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h