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