mesa: fix emit_clamp() so that we don't use an output register as temporary
[mesa.git] / src / mesa / Makefile
1 # src/mesa/Makefile
2
3 TOP = ../..
4 include $(TOP)/configs/current
5
6 include sources
7
8
9 GL_MAJOR = 1
10 GL_MINOR = 5
11 GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
12
13
14 .SUFFIXES : .cpp
15
16 .c.o:
17 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
18
19 .cpp.o:
20 $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
21
22 .S.o:
23 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
24
25
26 # Figure out what to make here
27 default:
28 @for driver in $(DRIVER_DIRS) ; do \
29 case "$$driver" in \
30 x11) $(MAKE) stand-alone ;; \
31 dri) $(MAKE) linux-solo ;; \
32 osmesa) $(MAKE) osmesa-only ;; \
33 beos) $(MAKE) beos ;; \
34 directfb) $(MAKE) directfb ;; \
35 fbdev) $(MAKE) fbdev ;; \
36 *) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \
37 esac ; \
38 done
39
40
41 ######################################################################
42 # BeOS driver target
43
44 beos: depend subdirs libmesa.a
45 cd drivers/beos; $(MAKE)
46
47
48 ######################################################################
49 # Linux DRI drivers
50
51 # Make archive of core object files
52 libmesa.a: $(SOLO_OBJECTS)
53 @ $(TOP)/bin/mklib -o mesa -static $(SOLO_OBJECTS);
54 @if [ "${CONFIG_NAME}" = "beos" ] ; then \
55 mimeset -f "$@" ; \
56 fi
57
58 linux-solo: depend subdirs libmesa.a
59 cd drivers/dri ; $(MAKE)
60
61
62 #####################################################################
63 # Stand-alone Mesa libGL, no built-in drivers (DirectFB)
64
65 libgl-core: $(CORE_OBJECTS)
66 @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
67 -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
68 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
69 $(GL_LIB_DEPS)
70
71 directfb: depend subdirs libgl-core
72 cd drivers/directfb ; $(MAKE)
73
74
75 #####################################################################
76 # fbdev Mesa driver (libGL.so)
77
78 fbdev: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS)
79 @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
80 -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
81 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
82 $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) \
83 $(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS)
84
85
86 ######################################################################
87 # Stand-alone Mesa libGL and libOSMesa
88 STAND_ALONE_DRIVER_SOURCES = \
89 $(COMMON_DRIVER_SOURCES) \
90 $(X11_DRIVER_SOURCES)
91
92 STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
93
94 STAND_ALONE_OBJECTS = \
95 $(CORE_OBJECTS) \
96 $(STAND_ALONE_DRIVER_OBJECTS)
97
98 # For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library,
99 # not just the osmesa.o object (i.e. we don't have a libGL).
100 OSMESA16_OBJECTS = \
101 $(CORE_OBJECTS) \
102 $(COMMON_DRIVER_OBJECTS) \
103 $(OSMESA_DRIVER_OBJECTS)
104
105
106 stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
107
108 osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
109
110 # Make the GL library
111 $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
112 @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
113 -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
114 -install $(TOP)/$(LIB_DIR) \
115 $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS)
116
117 # Make the OSMesa library
118 $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
119 @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
120 $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
121 -ldflags '$(LDFLAGS)' -major $(MESA_MAJOR) \
122 -minor $(MESA_MINOR) -patch $(MESA_TINY) \
123 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
124 $(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
125 else \
126 $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
127 -ldflags '$(LDFLAGS)' -major $(MESA_MAJOR) \
128 -minor $(MESA_MINOR) -patch $(GL_TINY) \
129 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
130 $(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \
131 fi
132
133
134 ######################################################################
135 # Generic stuff
136
137 depend: $(ALL_SOURCES)
138 @ echo "running $(MKDEP)"
139 @ touch depend
140 @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
141 > /dev/null 2>/dev/null
142
143
144 subdirs:
145 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
146 (cd x86 ; $(MAKE)) ; \
147 fi
148 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
149 (cd x86 ; $(MAKE)) ; \
150 (cd x86-64 ; $(MAKE)) ; \
151 fi
152
153 pcedit = sed \
154 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
155 -e 's,@LIB_DIR@,$(LIB_DIR),' \
156 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
157
158 gl.pc: gl.pc.in
159 $(pcedit) $< > $@
160
161 install-libgl: gl.pc
162 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
163 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
164 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
165 $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL
166 @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
167 $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* \
168 $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
169 fi
170 $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
171
172 install-osmesa:
173 @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
174 $(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* \
175 $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
176 fi
177
178 install-drivers:
179 @for target in $(DRIVER_DIRS); do \
180 case "$$target" in \
181 dri) cd drivers/dri ; $(MAKE) install ;; \
182 esac; \
183 done
184
185 install: default install-libgl install-osmesa install-drivers
186
187 ## NOT INSTALLED YET:
188 ## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES
189 ## $(INSTALL) -m 644 include/GLES/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES
190
191
192 # Emacs tags
193 tags:
194 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
195
196 clean:
197 -rm -f */*.o
198 -rm -f */*/*.o
199 -rm -f depend depend.bak libmesa.a
200 -rm -f drivers/*/*.o
201 (cd drivers/dri && $(MAKE) clean)
202 (cd x86 && $(MAKE) clean)
203 (cd x86-64 && $(MAKE) clean)
204
205
206 -include depend