mesa: Clean up use of top_srcdir/top_builddir.
[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 = program x86 x86-64 . main/tests
23
24 if HAVE_X11_DRIVER
25 SUBDIRS += drivers/x11
26 endif
27
28 if HAVE_DRI
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: main/git_sha1.h.tmp
40 main/git_sha1.h.tmp:
41 @touch main/git_sha1.h.tmp
42 @if test -d ../../.git; then \
43 if which git > /dev/null; then \
44 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 main/git_sha1.h: 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 BUILT_SOURCES = \
63 main/git_sha1.h \
64 main/get_hash.h
65 CLEANFILES = \
66 $(BUILT_SOURCES) \
67 git_sha1.h.tmp
68
69 GET_HASH_GEN = main/get_hash_generator.py
70
71 main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py \
72 $(GET_HASH_GEN) Makefile
73 $(AM_V_GEN)set -e; \
74 $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN) \
75 -f $< > $@.tmp; \
76 mv $@.tmp $@;
77
78 noinst_LTLIBRARIES =
79 if NEED_LIBMESA
80 noinst_LTLIBRARIES += libmesa.la
81 else
82 check_LTLIBRARIES = libmesa.la
83 endif
84 if HAVE_GALLIUM
85 noinst_LTLIBRARIES += libmesagallium.la
86 endif
87
88 BUILDDIR = $(builddir)/
89 include Makefile.sources
90
91 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
92 AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
93 AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
94
95 MESA_ASM_FILES_FOR_ARCH =
96
97 if HAVE_X86_ASM
98 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
99 AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
100 endif
101 if HAVE_X86_64_ASM
102 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
103 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
104 endif
105 if HAVE_SPARC_ASM
106 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
107 AM_CPPFLAGS += -I$(builddir)/sparc -I$(srcdir)/sparc
108 endif
109
110 libmesa_la_SOURCES = \
111 $(MESA_FILES) \
112 $(MESA_ASM_FILES_FOR_ARCH)
113
114 libmesa_la_LIBADD = \
115 $(top_builddir)/src/glsl/libglsl.la \
116 $(top_builddir)/src/mesa/program/libprogram.la \
117 $()
118 libmesa_la_LDFLAGS =
119
120 libmesagallium_la_SOURCES = \
121 $(MESA_GALLIUM_FILES) \
122 $(MESA_ASM_FILES_FOR_ARCH)
123
124 libmesagallium_la_LIBADD = \
125 $(top_builddir)/src/glsl/libglsl.la \
126 $(top_builddir)/src/mesa/program/libprogram.la \
127 $()
128
129 pkgconfigdir = $(libdir)/pkgconfig
130 pkgconfig_DATA = gl.pc
131
132 # Emacs tags
133 tags:
134 etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h