Merge branch 'gles2-2'
[mesa.git] / src / mesa / Makefile
1 # src/mesa/Makefile
2
3 TOP = ../..
4 include $(TOP)/configs/current
5
6 include sources.mak
7
8 .SUFFIXES : .cpp
9
10 .c.o:
11 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
12
13 .cpp.o:
14 $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
15
16 .S.o:
17 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
18
19 CFLAGS += $(API_DEFINES)
20
21
22 # Default: build dependencies, then asm_subdirs, GLSL built-in lib,
23 # then convenience libs (.a) and finally the device drivers:
24 default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
25 libglapi.a driver_subdirs
26
27
28 main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
29 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
30
31 main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
32 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
33
34 main/get_es1.c: main/get_gen_es.py
35 $(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
36
37 main/get_es2.c: main/get_gen_es.py
38 $(PYTHON2) $(PYTHON_FLAGS) $< 2 > $@
39
40 ######################################################################
41 # Helper libraries used by many drivers:
42
43 # Make archive of core mesa object files
44 libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
45 @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
46
47 # Make archive of subset of core mesa object files for gallium
48 libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
49 @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
50
51 # Make archive of gl* API dispatcher functions only
52 libglapi.a: $(GLAPI_OBJECTS)
53 @ $(MKLIB) -o glapi -static $(GLAPI_OBJECTS)
54
55 ######################################################################
56 # Device drivers
57 driver_subdirs: libmesa.a libglapi.a libmesagallium.a
58 @ (cd drivers && $(MAKE))
59
60
61 ######################################################################
62 # Assembly subdirs
63 asm_subdirs:
64 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
65 (cd x86 && $(MAKE)) || exit 1 ; \
66 fi
67 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
68 (cd x86 && $(MAKE)) || exit 1 ; \
69 (cd x86-64 && $(MAKE)) || exit 1 ; \
70 fi
71
72
73 ######################################################################
74 # GLSL built-in library
75 glsl_builtin:
76 (cd shader/slang/library && $(MAKE)) || exit 1 ;
77
78
79 ######################################################################
80 # Dependency generation
81
82 depend: $(ALL_SOURCES)
83 @ echo "running $(MKDEP)"
84 @ touch depend
85 @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
86 > /dev/null 2>/dev/null
87
88
89 ######################################################################
90 # Installation rules
91
92 # this isn't fleshed out yet but is probably the way to go in the future
93 new_install:
94 (cd drivers && $(MAKE) install)
95
96
97 # XXX replace this with new_install above someday
98 install: default
99 @for driver in $(DRIVER_DIRS) ; do \
100 case "$$driver" in \
101 osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \
102 $(MAKE) install-headers install-osmesa || exit 1 ; \
103 else \
104 $(MAKE) install-osmesa || exit 1 ; \
105 fi ;; \
106 dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
107 *) $(MAKE) install-libgl || exit 1 ;; \
108 esac ; \
109 done; \
110 for api in $(APIS) ; do \
111 case "$$api" in \
112 es1) $(MAKE) install-es1 || exit 1;; \
113 es2) $(MAKE) install-es2 || exit 1;; \
114 esac; \
115 done
116
117 pcedit = \
118 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
119 -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
120 -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
121 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
122
123
124 gl_pcedit = sed \
125 $(pcedit) \
126 -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
127 -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
128 -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
129 -e 's,@GL_LIB@,$(GL_LIB),'
130
131 gl.pc: gl.pc.in
132 $(gl_pcedit) $< > $@
133
134 glesv2_pcedit = sed \
135 $(pcedit) \
136 -e 's,@GLESv2_PC_LIB_PRIV@,$(GLESv2_PC_LIB_PRIV),' \
137 -e 's,@GLESv2_LIB@,$(GLESv2_LIB),'
138
139 glesv2.pc: glesv2.pc.in
140 $(glesv2_pcedit) $< > $@
141
142 glesv1_cm_pcedit = sed \
143 $(pcedit) \
144 -e 's,@GLESv1_CM_PC_LIB_PRIV@,$(GLESv1_CM_PC_LIB_PRIV),' \
145 -e 's,@GLESv1_CM_LIB@,$(GLESv1_CM_LIB),'
146
147 glesv1_cm.pc: glesv1_cm.pc.in
148 $(glesv1_cm_pcedit) $< > $@
149
150 osmesa_pcedit = sed \
151 $(pcedit) \
152 -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
153 -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
154 -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
155
156 osmesa.pc: osmesa.pc.in
157 $(osmesa_pcedit) $< > $@
158
159 install-headers:
160 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
161 $(INSTALL) -m 644 $(TOP)/include/GL/*.h \
162 $(DESTDIR)$(INSTALL_INC_DIR)/GL
163
164 install-libgl: default gl.pc install-headers
165 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
166 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
167 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
168 $(DESTDIR)$(INSTALL_LIB_DIR)
169 $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
170
171 install-headers-es1:
172 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES
173 $(INSTALL) -m 644 $(TOP)/include/GLES/*.h \
174 $(DESTDIR)$(INSTALL_INC_DIR)/GLES
175
176 install-es1: default glesv1_cm.pc install-headers-es1
177 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
178 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
179 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB) \
180 $(DESTDIR)$(INSTALL_LIB_DIR)
181 $(INSTALL) -m 644 glesv1_cm.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
182
183 install-headers-es2:
184 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES2
185 $(INSTALL) -m 644 $(TOP)/include/GLES2/*.h \
186 $(DESTDIR)$(INSTALL_INC_DIR)/GLES2
187
188 install-es2: default glesv2.pc install-headers-es2
189 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
190 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
191 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB) \
192 $(DESTDIR)$(INSTALL_LIB_DIR)
193 $(INSTALL) -m 644 glesv2.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
194
195 install-osmesa: default osmesa.pc
196 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
197 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
198 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
199 $(DESTDIR)$(INSTALL_LIB_DIR)
200 $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
201
202 install-dri: default
203 cd drivers/dri && $(MAKE) install
204
205
206
207 # Emacs tags
208 tags:
209 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
210
211
212 clean:
213 -rm -f */*.o
214 -rm -f */*/*.o
215 -rm -f depend depend.bak libmesa.a libglapi.a libmesagallium.a
216 -rm -f drivers/*/*.o
217 -rm -f *.pc
218 -rm -f shader/slang/library/*_gc.h
219 -@cd drivers/dri && $(MAKE) clean
220 -@cd drivers/x11 && $(MAKE) clean
221 -@cd drivers/osmesa && $(MAKE) clean
222 -@cd x86 && $(MAKE) clean
223 -@cd x86-64 && $(MAKE) clean
224
225
226 -include depend