build: Only build libmesagallium.la if building Gallium
[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 = x86 x86-64 . libdricore drivers
23
24 gldir = $(includedir)/GL
25 gl_HEADERS = $(top_srcdir)/include/GL/*.h
26
27 .PHONY: main/git_sha1.h.tmp
28 main/git_sha1.h.tmp:
29 @touch main/git_sha1.h.tmp
30 @if test -d ../../.git; then \
31 if which git > /dev/null; then \
32 git log -n 1 --oneline | \
33 sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
34 > main/git_sha1.h.tmp ; \
35 fi \
36 fi
37
38 main/git_sha1.h: main/git_sha1.h.tmp
39 @echo "updating main/git_sha1.h"
40 @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
41 mv main/git_sha1.h.tmp main/git_sha1.h ;\
42 fi
43
44 # include glapi_gen.mk for generating glapi headers for GLES
45 GLAPI = $(top_srcdir)/src/mapi/glapi/gen
46 include $(GLAPI)/glapi_gen.mk
47
48 BUILT_SOURCES = \
49 main/git_sha1.h \
50 main/api_exec_es1_dispatch.h \
51 main/api_exec_es1_remap_helper.h \
52 main/api_exec_es2_dispatch.h \
53 main/api_exec_es2_remap_helper.h \
54 main/api_exec_es1.c \
55 main/api_exec_es2.c \
56 program/program_parse.tab.c \
57 program/program_parse.tab.h \
58 program/lex.yy.c
59 CLEANFILES = \
60 $(BUILT_SOURCES) \
61 git_sha1.h.tmp
62
63 main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
64 $(call glapi_gen_dispatch,$<,es1)
65
66 main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
67 $(call glapi_gen_remap,$<,es1)
68
69 main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
70
71 main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
72 $(call glapi_gen_dispatch,$<,es2)
73
74 main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
75 $(call glapi_gen_remap,$<,es2)
76
77 main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h
78
79 main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
80 $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
81 -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
82
83 main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
84 $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
85 -S $(srcdir)/main/APIspec.xml -V GLES2.0 > $@
86
87 program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
88 $(MKDIR_P) program
89 $(AM_V_GEN) $(YACC) -v -d --output=program/program_parse.tab.c $<
90
91 program/lex.yy.c: program/program_lexer.l
92 $(MKDIR_P) program
93 $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
94
95 noinst_LTLIBRARIES = libmesa.la
96 if HAVE_GALLIUM
97 noinst_LTLIBRARIES += libmesagallium.la
98 endif
99
100 SRCDIR = $(top_srcdir)/src/mesa/
101 BUILDDIR = $(top_builddir)/src/mesa/
102 include sources.mak
103
104 AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
105 AM_CFLAGS = $(LLVM_CFLAGS)
106 AM_CXXFLAGS = $(LLVM_CFLAGS)
107
108 # cannot just add $(MESA_ASM_FILES) to libmesa_la_SOURCES as it contains a configure substitution
109 MESA_ASM_FILES_FOR_ARCH =
110
111 if HAVE_X86_ASM
112 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
113 AM_CPPFLAGS += \
114 -I$(top_builddir)/src/mesa/x86 \
115 -I$(top_srcdir)/src/mesa/x86
116 endif
117 if HAVE_X86_64_ASM
118 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
119 AM_CPPFLAGS += \
120 -I$(top_builddir)/src/mesa/x86-64 \
121 -I$(top_srcdir)/src/mesa/x86-64
122 endif
123 if HAVE_SPARC_ASM
124 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
125 AM_CPPFLAGS += \
126 -I$(top_builddir)/src/mesa/sparc \
127 -I$(top_srcdir)/src/mesa/sparc
128 endif
129
130 libmesa_la_SOURCES = \
131 $(MESA_FILES) \
132 $(MESA_CXX_FILES) \
133 $(MESA_ASM_FILES_FOR_ARCH)
134
135 libmesa_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
136 libmesa_la_LDFLAGS =
137
138 libmesagallium_la_SOURCES = \
139 $(MESA_GALLIUM_FILES) \
140 $(MESA_GALLIUM_CXX_FILES) \
141 $(MESA_ASM_FILES_FOR_ARCH)
142
143 libmesagallium_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
144 libmesagallium_la_LDFLAGS =
145
146 # Provide compatibility with scripts for the old Mesa build system for
147 # a while by putting a link to the library in the current directory.
148 all-local: $(noinst_LTLIBRARIES)
149 ln -f .libs/libmesa.a .
150 if HAVE_GALLIUM
151 ln -f .libs/libmesagallium.a .
152 endif
153
154 CLEANFILES += libmesa.a libmesagallium.a
155
156 pkgconfigdir = $(libdir)/pkgconfig
157 pkgconfig_DATA = gl.pc
158
159 # Emacs tags
160 tags:
161 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h