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