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