mesa: added new libglslpp.a and libglslcl.a to libGL build
[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
20
21 # Default: build dependencies, then asm_subdirs, GLSL built-in lib,
22 # then convenience libs (.a) and finally the device drivers:
23 default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
24 libglapi.a driver_subdirs
25
26
27
28 ######################################################################
29 # Helper libraries used by many drivers:
30
31 # Make archive of core mesa object files
32 libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
33 @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
34
35 # Make archive of subset of core mesa object files for gallium
36 libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
37 @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
38
39 # Make archive of gl* API dispatcher functions only
40 libglapi.a: $(GLAPI_OBJECTS)
41 @if [ "${WINDOW_SYSTEM}" = "dri" ] ; then \
42 touch libglapi.a ; \
43 else \
44 $(MKLIB) -o glapi -static $(GLAPI_OBJECTS) ; \
45 fi
46
47 ######################################################################
48 # Device drivers
49 driver_subdirs: libmesa.a libglapi.a
50 @ (cd drivers && $(MAKE))
51
52
53 ######################################################################
54 # Assembly subdirs
55 asm_subdirs:
56 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
57 (cd x86 && $(MAKE)) || exit 1 ; \
58 fi
59 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
60 (cd x86 && $(MAKE)) || exit 1 ; \
61 (cd x86-64 && $(MAKE)) || exit 1 ; \
62 fi
63
64
65 ######################################################################
66 # GLSL built-in library
67 glsl_builtin:
68 (cd shader/slang/library && $(MAKE)) || exit 1 ;
69
70
71 ######################################################################
72 # Dependency generation
73
74 depend: $(ALL_SOURCES)
75 @ echo "running $(MKDEP)"
76 @ touch depend
77 @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
78 > /dev/null 2>/dev/null
79
80
81 ######################################################################
82 # Installation rules
83
84 # this isn't fleshed out yet but is probably the way to go in the future
85 new_install:
86 (cd drivers && $(MAKE) install)
87
88
89 # XXX replace this with new_install above someday
90 install: default
91 @for driver in $(DRIVER_DIRS) ; do \
92 case "$$driver" in \
93 osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \
94 $(MAKE) install-headers install-osmesa || exit 1 ; \
95 else \
96 $(MAKE) install-osmesa || exit 1 ; \
97 fi ;; \
98 dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
99 *) $(MAKE) install-libgl || exit 1 ;; \
100 esac ; \
101 done
102
103
104 gl_pcedit = sed \
105 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
106 -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
107 -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
108 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
109 -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
110 -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
111 -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
112 -e 's,@GL_LIB@,$(GL_LIB),'
113
114 gl.pc: gl.pc.in
115 $(gl_pcedit) $< > $@
116
117 osmesa_pcedit = sed \
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 -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
123 -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
124 -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
125
126 osmesa.pc: osmesa.pc.in
127 $(osmesa_pcedit) $< > $@
128
129 install-headers:
130 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
131 $(INSTALL) -m 644 $(TOP)/include/GL/*.h \
132 $(DESTDIR)$(INSTALL_INC_DIR)/GL
133
134 install-libgl: default gl.pc install-headers
135 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
136 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
137 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
138 $(DESTDIR)$(INSTALL_LIB_DIR)
139 $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
140
141 install-osmesa: default osmesa.pc
142 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
143 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
144 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
145 $(DESTDIR)$(INSTALL_LIB_DIR)
146 $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
147
148 install-dri: default
149 cd drivers/dri && $(MAKE) install
150
151
152
153 # Emacs tags
154 tags:
155 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
156
157
158 clean:
159 -rm -f */*.o
160 -rm -f */*/*.o
161 -rm -f depend depend.bak libmesa.a libglapi.a
162 -rm -f drivers/*/*.o
163 -rm -f *.pc
164 -rm -f shader/slang/library/*_gc.h
165 -@cd drivers/dri && $(MAKE) clean
166 -@cd drivers/x11 && $(MAKE) clean
167 -@cd drivers/osmesa && $(MAKE) clean
168 -@cd x86 && $(MAKE) clean
169 -@cd x86-64 && $(MAKE) clean
170
171
172 -include depend