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