e593e7f0e136349d68ffa8778e47598c550c4641
[mesa.git] / Makefile
1 # Top-level Mesa makefile
2
3 TOP = .
4
5 SUBDIRS = src
6
7
8 # The git command below generates an empty string when we're not
9 # building in a GIT tree (i.e., building from a release tarball).
10 default: $(TOP)/configs/current
11 @$(TOP)/bin/extract_git_sha1
12 @for dir in $(SUBDIRS) ; do \
13 if [ -d $$dir ] ; then \
14 (cd $$dir && $(MAKE)) || exit 1 ; \
15 fi \
16 done
17
18 all: default
19
20
21 doxygen:
22 cd doxygen && $(MAKE)
23
24 check:
25 cd src/glsl && $(MAKE) check
26 cd src/glsl/tests/ && ./optimization-test
27 make -C tests check
28
29 clean:
30 -@touch $(TOP)/configs/current
31 -@for dir in $(SUBDIRS) ; do \
32 if [ -d $$dir ] ; then \
33 (cd $$dir && $(MAKE) clean) ; \
34 fi \
35 done
36 -@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current
37
38
39 realclean: clean
40 -rm -rf lib*
41 -rm -f $(TOP)/configs/current
42 -rm -f $(TOP)/configs/autoconf
43 -rm -rf autom4te.cache
44 -find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
45 -name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
46
47
48 distclean: realclean
49
50
51 install:
52 @for dir in $(SUBDIRS) ; do \
53 if [ -d $$dir ] ; then \
54 (cd $$dir && $(MAKE) install) || exit 1 ; \
55 fi \
56 done
57
58
59 .PHONY: default doxygen clean realclean distclean install check
60
61 # If there's no current configuration file
62 $(TOP)/configs/current:
63 @echo
64 @echo
65 @echo "Please choose a configuration from the following list:"
66 @ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*"
67 @echo
68 @echo "Then type 'make <config>' (ex: 'make linux-x86')"
69 @echo
70 @echo "Or, run './configure' then 'make'"
71 @echo "See './configure --help' for details"
72 @echo
73 @echo "(ignore the following error message)"
74 @exit 1
75
76
77 # Rules to set/install a specific build configuration
78 aix \
79 aix-64 \
80 aix-64-static \
81 aix-gcc \
82 aix-static \
83 autoconf \
84 bluegene-osmesa \
85 bluegene-xlc-osmesa \
86 catamount-osmesa-pgi \
87 darwin \
88 darwin-fat-32bit \
89 darwin-fat-all \
90 freebsd \
91 freebsd-dri \
92 freebsd-dri-amd64 \
93 freebsd-dri-x86 \
94 hpux10 \
95 hpux10-gcc \
96 hpux10-static \
97 hpux11-32 \
98 hpux11-32-static \
99 hpux11-32-static-nothreads \
100 hpux11-64 \
101 hpux11-64-static \
102 hpux11-ia64 \
103 hpux11-ia64-static \
104 hpux9 \
105 hpux9-gcc \
106 irix6-64 \
107 irix6-64-static \
108 irix6-n32 \
109 irix6-n32-static \
110 irix6-o32 \
111 irix6-o32-static \
112 linux \
113 linux-i965 \
114 linux-alpha \
115 linux-alpha-static \
116 linux-debug \
117 linux-dri \
118 linux-dri-debug \
119 linux-dri-x86 \
120 linux-dri-x86-64 \
121 linux-dri-ppc \
122 linux-dri-xcb \
123 linux-egl \
124 linux-indirect \
125 linux-fbdev \
126 linux-ia64-icc \
127 linux-ia64-icc-static \
128 linux-icc \
129 linux-icc-static \
130 linux-llvm \
131 linux-llvm-debug \
132 linux-opengl-es \
133 linux-osmesa \
134 linux-osmesa-static \
135 linux-osmesa16 \
136 linux-osmesa16-static \
137 linux-osmesa32 \
138 linux-ppc \
139 linux-ppc-static \
140 linux-profile \
141 linux-sparc \
142 linux-sparc5 \
143 linux-static \
144 linux-ultrasparc \
145 linux-tcc \
146 linux-x86 \
147 linux-x86-debug \
148 linux-x86-32 \
149 linux-x86-64 \
150 linux-x86-64-debug \
151 linux-x86-64-profile \
152 linux-x86-64-static \
153 linux-x86-profile \
154 linux-x86-static \
155 netbsd \
156 openbsd \
157 osf1 \
158 osf1-static \
159 solaris-x86 \
160 solaris-x86-gcc \
161 solaris-x86-gcc-static \
162 sunos4 \
163 sunos4-gcc \
164 sunos4-static \
165 sunos5 \
166 sunos5-gcc \
167 sunos5-64-gcc \
168 sunos5-smp \
169 sunos5-v8 \
170 sunos5-v8-static \
171 sunos5-v9 \
172 sunos5-v9-static \
173 sunos5-v9-cc-g++ \
174 ultrix-gcc:
175 @ if test -f configs/current -o -L configs/current; then \
176 if ! cmp configs/$@ configs/current > /dev/null; then \
177 echo "Please run 'make realclean' before changing configs" ; \
178 exit 1 ; \
179 fi ; \
180 else \
181 cd configs && rm -f current && ln -s $@ current ; \
182 fi
183 $(MAKE) default
184
185
186 # Rules for making release tarballs
187
188 PACKAGE_VERSION=8.0-devel
189 PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
190 PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
191
192 EXTRA_FILES = \
193 aclocal.m4 \
194 configure \
195 tests/Makefile.in \
196 tests/glx/Makefile.in \
197 src/glsl/glsl_parser.cpp \
198 src/glsl/glsl_parser.h \
199 src/glsl/glsl_lexer.cpp \
200 src/glsl/glcpp/glcpp-lex.c \
201 src/glsl/glcpp/glcpp-parse.c \
202 src/glsl/glcpp/glcpp-parse.h \
203 src/mesa/program/lex.yy.c \
204 src/mesa/program/program_parse.tab.c \
205 src/mesa/program/program_parse.tab.h
206
207 IGNORE_FILES = \
208 -x autogen.sh
209
210
211 parsers: configure
212 -@touch $(TOP)/configs/current
213 $(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp
214 $(MAKE) -C src/glsl/glcpp glcpp-lex.c glcpp-parse.c glcpp-parse.h
215 $(MAKE) -C src/mesa program/lex.yy.c program/program_parse.tab.c program/program_parse.tab.h
216
217 # Everything for new a Mesa release:
218 ARCHIVES = $(PACKAGE_NAME).tar.gz \
219 $(PACKAGE_NAME).tar.bz2 \
220 $(PACKAGE_NAME).zip \
221
222 tarballs: md5
223 rm -f ../$(PACKAGE_DIR) $(PACKAGE_NAME).tar
224
225 # Helper for autoconf builds
226 ACLOCAL = aclocal
227 ACLOCAL_FLAGS =
228 AUTOCONF = autoconf
229 AC_FLAGS =
230 aclocal.m4: configure.ac acinclude.m4
231 $(ACLOCAL) $(ACLOCAL_FLAGS)
232 configure: configure.ac aclocal.m4 acinclude.m4
233 $(AUTOCONF) $(AC_FLAGS)
234
235 manifest.txt: .git
236 ( \
237 ls -1 $(EXTRA_FILES) ; \
238 git ls-files $(IGNORE_FILES) \
239 ) | sed -e '/^\(.*\/\)\?\./d' -e "s@^@$(PACKAGE_DIR)/@" > $@
240
241 ../$(PACKAGE_DIR):
242 ln -s $(PWD) $@
243
244 $(PACKAGE_NAME).tar: parsers ../$(PACKAGE_DIR) manifest.txt
245 cd .. ; tar -cf $(PACKAGE_DIR)/$(PACKAGE_NAME).tar -T $(PACKAGE_DIR)/manifest.txt
246
247 $(PACKAGE_NAME).tar.gz: $(PACKAGE_NAME).tar ../$(PACKAGE_DIR)
248 gzip --stdout --best $(PACKAGE_NAME).tar > $(PACKAGE_NAME).tar.gz
249
250 $(PACKAGE_NAME).tar.bz2: $(PACKAGE_NAME).tar
251 bzip2 --stdout --best $(PACKAGE_NAME).tar > $(PACKAGE_NAME).tar.bz2
252
253 $(PACKAGE_NAME).zip: parsers ../$(PACKAGE_DIR) manifest.txt
254 rm -f $(PACKAGE_NAME).zip ; \
255 cd .. ; \
256 zip -q -@ $(PACKAGE_NAME).zip < $(PACKAGE_DIR)/manifest.txt ; \
257 mv $(PACKAGE_NAME).zip $(PACKAGE_DIR)
258
259 md5: $(ARCHIVES)
260 @-md5sum $(PACKAGE_NAME).tar.gz
261 @-md5sum $(PACKAGE_NAME).tar.bz2
262 @-md5sum $(PACKAGE_NAME).zip
263
264 .PHONY: tarballs md5