Remove the old, complicated default build rule; use the new driver_subdirs rule
[mesa.git] / src / mesa / Makefile
1 # src/mesa/Makefile
2
3 TOP = ../..
4 include $(TOP)/configs/current
5
6 include sources
7
8
9 .SUFFIXES : .cpp
10
11 .c.o:
12 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
13
14 .cpp.o:
15 $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
16
17 .S.o:
18 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
19
20
21
22 # Default: build dependencies, then mesa subdirs, then convenience
23 # libs (.a) and finally the device drivers:
24 default: depend subdirs libmesa.a libglapi.a driver_subdirs
25
26
27 # this doesn't work yet but is probably the way to go in the future
28 new_install:
29 (cd drivers && $(MAKE) install)
30
31
32 # XXX replace this with new_install above someday
33 install: default
34 @for driver in $(DRIVER_DIRS) ; do \
35 case "$$driver" in \
36 osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \
37 $(MAKE) install-headers install-osmesa || exit 1 ; \
38 else \
39 $(MAKE) install-osmesa || exit 1 ; \
40 fi ;; \
41 dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
42 *) $(MAKE) install-libgl || exit 1 ;; \
43 esac ; \
44 done
45
46
47
48 ######################################################################
49 # Helper libraries used by many drivers:
50
51 # Make archive of core mesa 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 # Make archive of gl* API dispatcher functions only
59 libglapi.a: $(GLAPI_OBJECTS)
60 @ $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS)
61
62
63 ######################################################################
64 # Device drivers
65 driver_subdirs:
66 (cd drivers && $(MAKE))
67
68
69 ######################################################################
70 # Assembly subdirs
71 subdirs:
72 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
73 (cd x86 && $(MAKE)) || exit 1 ; \
74 fi
75 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
76 (cd x86 && $(MAKE)) || exit 1 ; \
77 (cd x86-64 && $(MAKE)) || exit 1 ; \
78 fi
79
80
81 ######################################################################
82 # Dependency generation
83
84 depend: $(ALL_SOURCES)
85 @ echo "running $(MKDEP)"
86 @ touch depend
87 @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
88 > /dev/null 2>/dev/null
89
90
91 ######################################################################
92 # Installation rules
93
94 pcedit = sed \
95 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
96 -e 's,@LIB_DIR@,$(LIB_DIR),' \
97 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
98
99 gl.pc: gl.pc.in
100 $(pcedit) $< > $@
101
102 install-headers:
103 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
104 $(INSTALL) -m 644 $(TOP)/include/GL/*.h \
105 $(DESTDIR)$(INSTALL_DIR)/include/GL
106
107 install-libgl: default gl.pc install-headers
108 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
109 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
110 $(INSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)* \
111 $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
112 $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
113
114 install-osmesa: default
115 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
116 $(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)* \
117 $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
118
119 install-dri:
120 cd drivers/dri && $(MAKE) install
121
122
123
124 # Emacs tags
125 tags:
126 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
127
128
129 clean:
130 -rm -f */*.o
131 -rm -f */*/*.o
132 -rm -f depend depend.bak libmesa.a libglapi.a
133 -rm -f drivers/*/*.o
134 -@cd drivers/dri && $(MAKE) clean
135 -@cd drivers/xorg && $(MAKE) clean
136 -@cd drivers/x11 && $(MAKE) clean
137 -@cd drivers/osmesa && $(MAKE) clean
138 -@cd x86 && $(MAKE) clean
139 -@cd x86-64 && $(MAKE) clean
140
141
142 -include depend