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