Merge branch 'master' of git+ssh://keithw@git.freedesktop.org/git/mesa/mesa into...
[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 @if [ "${DRIVER_DIRS}" = "dri" ] ; then \
29 $(MAKE) linux-solo ; \
30 elif [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
31 $(MAKE) osmesa-only ; \
32 elif [ "$(DRIVER_DIRS)" = "beos" ]; then \
33 $(MAKE) beos ; \
34 elif [ "$(DRIVER_DIRS)" = "directfb" ]; then \
35 $(MAKE) directfb ; \
36 elif [ "$(DRIVER_DIRS)" = "fbdev osmesa" ]; then \
37 $(MAKE) fbdev ; $(MAKE) osmesa-only ; \
38 else \
39 $(MAKE) stand-alone ; \
40 fi
41
42
43 ######################################################################
44 # BeOS driver target
45
46 beos: depend subdirs libmesa.a
47 cd drivers/beos; $(MAKE)
48
49
50 ######################################################################
51 # Linux DRI drivers
52
53 # Make archive of core object files
54 libmesa.a: $(SOLO_OBJECTS)
55 @ $(TOP)/bin/mklib -o mesa -static $(SOLO_OBJECTS);
56 @if [ "${CONFIG_NAME}" = "beos" ] ; then \
57 mimeset -f "$@" ; \
58 fi
59
60 linux-solo: depend subdirs libmesa.a
61 cd drivers/dri ; $(MAKE)
62
63
64 #####################################################################
65 # Stand-alone Mesa libGL, no built-in drivers (DirectFB)
66
67 libgl-core: $(CORE_OBJECTS)
68 @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
69 -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
70 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
71 $(GL_LIB_DEPS)
72
73 directfb: depend subdirs libgl-core
74 cd drivers/directfb ; $(MAKE)
75
76
77 #####################################################################
78 # fbdev Mesa driver (libGL.so)
79
80 fbdev: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS)
81 @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
82 -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
83 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
84 $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) \
85 $(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS)
86
87
88 ######################################################################
89 # Stand-alone Mesa libGL and libOSMesa
90 STAND_ALONE_DRIVER_SOURCES = \
91 $(COMMON_DRIVER_SOURCES) \
92 $(X11_DRIVER_SOURCES) \
93 $(GLIDE_DRIVER_SOURCES) \
94 $(SVGA_DRIVER_SOURCES)
95
96 STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
97
98 STAND_ALONE_OBJECTS = \
99 $(CORE_OBJECTS) \
100 $(STAND_ALONE_DRIVER_OBJECTS)
101
102 # For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library,
103 # not just the osmesa.o object (i.e. we don't have a libGL).
104 OSMESA16_OBJECTS = \
105 $(CORE_OBJECTS) \
106 $(COMMON_DRIVER_OBJECTS) \
107 $(OSMESA_DRIVER_OBJECTS)
108
109
110 stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
111
112 osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
113
114 # Make the GL library
115 $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
116 @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
117 -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
118 -install $(TOP)/$(LIB_DIR) \
119 $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS)
120
121 # Make the OSMesa library
122 $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
123 @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
124 $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
125 -major $(MESA_MAJOR) \
126 -minor $(MESA_MINOR) -patch $(MESA_TINY) \
127 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
128 $(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
129 else \
130 $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
131 -major $(MESA_MAJOR) \
132 -minor $(MESA_MINOR) -patch $(GL_TINY) \
133 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
134 $(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \
135 fi
136
137
138 ######################################################################
139 # Generic stuff
140
141 depend: $(ALL_SOURCES)
142 @ echo "running $(MKDEP)"
143 @ touch depend
144 @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
145 > /dev/null 2>/dev/null
146
147
148 subdirs:
149 @ (cd x86 ; $(MAKE))
150 @ (cd x86-64 ; $(MAKE))
151
152
153 install: default
154 $(INSTALL) -d $(INSTALL_DIR)/include/GL
155 $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
156 $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL
157 @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
158 $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \
159 fi
160 @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
161 $(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(INSTALL_DIR)/$(LIB_DIR); \
162 fi
163 @if [ "${DRIVER_DIRS}" = "dri" ] ; then \
164 cd drivers/dri ; $(MAKE) install ; \
165 fi
166
167 ## NOT INSTALLED YET:
168 ## $(INSTALL) -d $(INSTALL_DIR)/include/GLES
169 ## $(INSTALL) -m 644 include/GLES/*.h $(INSTALL_DIR)/include/GLES
170
171
172 # Emacs tags
173 tags:
174 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
175
176 clean:
177 -rm -f */*.o
178 -rm -f */*/*.o
179 -rm -f depend depend.bak libmesa.a
180 -rm -f drivers/*/*.o
181 (cd drivers/dri ; $(MAKE) clean)
182 (cd x86 ; $(MAKE) clean)
183 (cd x86-64 ; $(MAKE) clean)
184
185
186 include depend