New 'draw' module for primitive drawing (clipping, culling, etc).
[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
94 STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
95
96 STAND_ALONE_OBJECTS = \
97 $(CORE_OBJECTS) \
98 $(STAND_ALONE_DRIVER_OBJECTS)
99
100 # For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library,
101 # not just the osmesa.o object (i.e. we don't have a libGL).
102 OSMESA16_OBJECTS = \
103 $(CORE_OBJECTS) \
104 $(COMMON_DRIVER_OBJECTS) \
105 $(OSMESA_DRIVER_OBJECTS)
106
107
108 stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
109
110 osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
111
112 # Make the GL library
113 $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
114 @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
115 -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
116 -install $(TOP)/$(LIB_DIR) \
117 $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS)
118
119 # Make the OSMesa library
120 $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
121 @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
122 $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
123 -major $(MESA_MAJOR) \
124 -minor $(MESA_MINOR) -patch $(MESA_TINY) \
125 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
126 $(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
127 else \
128 $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \
129 -major $(MESA_MAJOR) \
130 -minor $(MESA_MINOR) -patch $(GL_TINY) \
131 -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
132 $(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \
133 fi
134
135
136 ######################################################################
137 # Generic stuff
138
139 depend: $(ALL_SOURCES)
140 @ echo "running $(MKDEP)"
141 @ touch depend
142 @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
143 > /dev/null 2>/dev/null
144
145
146 subdirs:
147 @ (cd x86 ; $(MAKE))
148 @ (cd x86-64 ; $(MAKE))
149
150
151 install: default
152 $(INSTALL) -d $(INSTALL_DIR)/include/GL
153 $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
154 $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL
155 @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
156 $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \
157 fi
158 @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
159 $(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(INSTALL_DIR)/$(LIB_DIR); \
160 fi
161 @if [ "${DRIVER_DIRS}" = "dri" ] ; then \
162 cd drivers/dri ; $(MAKE) install ; \
163 fi
164
165 ## NOT INSTALLED YET:
166 ## $(INSTALL) -d $(INSTALL_DIR)/include/GLES
167 ## $(INSTALL) -m 644 include/GLES/*.h $(INSTALL_DIR)/include/GLES
168
169
170 # Emacs tags
171 tags:
172 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
173
174 clean:
175 -rm -f */*.o
176 -rm -f */*/*.o
177 -rm -f depend depend.bak libmesa.a
178 -rm -f drivers/*/*.o
179 (cd drivers/dri && $(MAKE) clean)
180 (cd x86 && $(MAKE) clean)
181 (cd x86-64 && $(MAKE) clean)
182
183
184 include depend