gles: Build libGLESv1_CM.so and libGLESv2.so from glapi files
[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
111
112 gl_pcedit = sed \
113 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
114 -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
115 -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
116 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
117 -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
118 -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
119 -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
120 -e 's,@GL_LIB@,$(GL_LIB),'
121
122 gl.pc: gl.pc.in
123 $(gl_pcedit) $< > $@
124
125 osmesa_pcedit = sed \
126 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
127 -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
128 -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
129 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
130 -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
131 -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
132 -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
133
134 osmesa.pc: osmesa.pc.in
135 $(osmesa_pcedit) $< > $@
136
137 install-headers:
138 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
139 $(INSTALL) -m 644 $(TOP)/include/GL/*.h \
140 $(DESTDIR)$(INSTALL_INC_DIR)/GL
141
142 install-libgl: default gl.pc install-headers
143 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
144 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
145 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
146 $(DESTDIR)$(INSTALL_LIB_DIR)
147 $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
148
149 install-headers-es1:
150 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES
151 $(INSTALL) -m 644 $(TOP)/include/GLES/*.h \
152 $(DESTDIR)$(INSTALL_INC_DIR)/GLES
153
154 install-es1: default glesv1_cm.pc install-headers-es1
155 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
156 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
157 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB) \
158 $(DESTDIR)$(INSTALL_LIB_DIR)
159 $(INSTALL) -m 644 glesv1_cm.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
160
161 install-headers-es2:
162 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES2
163 $(INSTALL) -m 644 $(TOP)/include/GLES2/*.h \
164 $(DESTDIR)$(INSTALL_INC_DIR)/GLES2
165
166 install-es2: default glesv2.pc install-headers-es2
167 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
168 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
169 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB) \
170 $(DESTDIR)$(INSTALL_LIB_DIR)
171 $(INSTALL) -m 644 glesv2.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
172
173 install-osmesa: default osmesa.pc
174 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
175 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
176 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
177 $(DESTDIR)$(INSTALL_LIB_DIR)
178 $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
179
180 install-dri: default
181 cd drivers/dri && $(MAKE) install
182
183
184
185 # Emacs tags
186 tags:
187 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
188
189
190 clean:
191 -rm -f */*.o
192 -rm -f */*/*.o
193 -rm -f depend depend.bak libmesa.a libglapi.a libmesagallium.a
194 -rm -f drivers/*/*.o
195 -rm -f *.pc
196 -rm -f shader/slang/library/*_gc.h
197 -@cd drivers/dri && $(MAKE) clean
198 -@cd drivers/x11 && $(MAKE) clean
199 -@cd drivers/osmesa && $(MAKE) clean
200 -@cd x86 && $(MAKE) clean
201 -@cd x86-64 && $(MAKE) clean
202
203
204 -include depend