llvm: we need custom rules so had to redo the build a little bit
[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 PIPE_LIB = \
15 $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a \
16 $(TOP)/src/mesa/pipe/i965simple/libi965simple.a
17
18 ifeq ($(CONFIG_NAME), linux-cell)
19 CELL_LIB = $(TOP)/src/mesa/pipe/cell/ppu/libcell.a
20 CELL_LIB_SPU = $(TOP)/src/mesa/pipe/cell/spu/g3d_spu.a
21 endif
22
23 ifeq ($(CONFIG_NAME), linux-llvm)
24 LLVM_LIB = $(TOP)/src/mesa/pipe/llvm/libgallivm.a
25 endif
26
27 .SUFFIXES : .cpp
28
29 .c.o:
30 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
31
32 .cpp.o:
33 $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
34
35 .S.o:
36 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
37
38
39 # Figure out what to make here
40 default:
41 @if [ "${DRIVER_DIRS}" = "dri" ] ; then \
42 $(MAKE) linux-solo ; \
43 elif [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
44 $(MAKE) osmesa-only ; \
45 elif [ "$(DRIVER_DIRS)" = "beos" ]; then \
46 $(MAKE) beos ; \
47 elif [ "$(DRIVER_DIRS)" = "directfb" ]; then \
48 $(MAKE) directfb ; \
49 elif [ "$(DRIVER_DIRS)" = "fbdev osmesa" ]; then \
50 $(MAKE) fbdev ; $(MAKE) osmesa-only ; \
51 else \
52 $(MAKE) stand-alone ; \
53 fi
54
55
56 ######################################################################
57 # BeOS driver target
58
59 beos: depend subdirs libmesa.a
60 cd drivers/beos; $(MAKE)
61
62
63 ######################################################################
64 # Linux DRI drivers
65
66 # Make archive of core object files
67 libmesa.a: $(SOLO_OBJECTS)
68 @ $(TOP)/bin/mklib -o mesa -static $(SOLO_OBJECTS);
69 @if [ "${CONFIG_NAME}" = "beos" ] ; then \
70 mimeset -f "$@" ; \
71 fi
72
73 linux-solo: depend subdirs libmesa.a
74 cd drivers/dri ; $(MAKE)
75
76
77 #####################################################################
78 # Stand-alone Mesa libGL, no built-in drivers (DirectFB)
79
80 libgl-core: $(CORE_OBJECTS)
81 @ $(TOP)/bin/mklib -o $(GL_LIB) \
82 -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
83 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
84 $(GL_LIB_DEPS)
85
86 directfb: depend subdirs libgl-core
87 cd drivers/directfb ; $(MAKE)
88
89
90 #####################################################################
91 # fbdev Mesa driver (libGL.so)
92
93 fbdev: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS)
94 @ $(TOP)/bin/mklib -o $(GL_LIB) \
95 -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
96 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
97 $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) \
98 $(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS)
99
100
101 ######################################################################
102 # Stand-alone Mesa libGL and libOSMesa
103 STAND_ALONE_DRIVER_SOURCES = \
104 $(COMMON_DRIVER_SOURCES) \
105 $(X11_DRIVER_SOURCES)
106
107 STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
108
109 STAND_ALONE_OBJECTS = \
110 $(CORE_OBJECTS) \
111 $(STAND_ALONE_DRIVER_OBJECTS)
112
113 # For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library,
114 # not just the osmesa.o object (i.e. we don't have a libGL).
115 OSMESA16_OBJECTS = \
116 $(CORE_OBJECTS) \
117 $(COMMON_DRIVER_OBJECTS) \
118 $(OSMESA_DRIVER_OBJECTS)
119
120
121 stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
122
123 osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
124
125 # Make the GL library
126 $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(PIPE_LIB) $(CELL_LIB) $(CELL_LIB_SPU) $(LLVM_LIB)
127 @ $(TOP)/bin/mklib -o $(GL_LIB) \
128 -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
129 -install $(TOP)/$(LIB_DIR) \
130 $(MKLIB_OPTIONS) $(STAND_ALONE_OBJECTS) \
131 $(PIPE_LIB) $(CELL_LIB) $(CELL_LIB_SPU) $(LLVM_LIB) $(GL_LIB_DEPS)
132
133 # Make the OSMesa library
134 $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
135 @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
136 $(TOP)/bin/mklib -o $(OSMESA_LIB) \
137 -major $(MESA_MAJOR) \
138 -minor $(MESA_MINOR) -patch $(MESA_TINY) \
139 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
140 $(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
141 else \
142 $(TOP)/bin/mklib -o $(OSMESA_LIB) \
143 -major $(MESA_MAJOR) \
144 -minor $(MESA_MINOR) -patch $(GL_TINY) \
145 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
146 $(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \
147 fi
148
149
150 ######################################################################
151 # Generic stuff
152
153 depend: $(ALL_SOURCES)
154 @ echo "running $(MKDEP)"
155 @ rm -f depend # workaround oops on gutsy?!?
156 @ touch depend
157 @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
158 > /dev/null 2>/dev/null
159
160
161 subdirs:
162 @ (cd x86 ; $(MAKE))
163 @ (cd x86-64 ; $(MAKE))
164 (cd pipe ; $(MAKE))
165
166 install: default
167 $(INSTALL) -d $(INSTALL_DIR)/include/GL
168 $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
169 $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL
170 @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
171 $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \
172 fi
173 @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
174 $(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(INSTALL_DIR)/$(LIB_DIR); \
175 fi
176 @if [ "${DRIVER_DIRS}" = "dri" ] ; then \
177 cd drivers/dri ; $(MAKE) install ; \
178 fi
179
180 ## NOT INSTALLED YET:
181 ## $(INSTALL) -d $(INSTALL_DIR)/include/GLES
182 ## $(INSTALL) -m 644 include/GLES/*.h $(INSTALL_DIR)/include/GLES
183
184
185 # Emacs tags
186 tags:
187 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
188
189 clean:
190 -rm -f */*.o
191 -rm -f */*/*.o
192 -rm -f depend depend.bak libmesa.a
193 -rm -f drivers/*/*.o
194 (cd drivers/dri && $(MAKE) clean)
195 (cd x86 && $(MAKE) clean)
196 (cd x86-64 && $(MAKE) clean)
197 (cd pipe ; $(MAKE) clean )
198
199
200 include depend