Remove the old, complicated default build rule; use the new driver_subdirs rule
[mesa.git] / src / mesa / Makefile
index c4d151822acc6259d6e78926e459efd72626f514..06b4e9ccebade0c9d9738d04e63ad61cbb97dab5 100644 (file)
@@ -6,11 +6,6 @@ include $(TOP)/configs/current
 include sources
 
 
-GL_MAJOR = 1
-GL_MINOR = 5
-GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
-
-
 .SUFFIXES : .cpp
 
 .c.o:
@@ -23,20 +18,18 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
        $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
 
 
-# Figure out what to make here
-default: depend
-       @for driver in $(DRIVER_DIRS) ; do \
-         case "$$driver" in \
-           x11)      $(MAKE) xlib-driver || exit 1 ;; \
-           dri)      $(MAKE) dri-drivers || exit 1 ;; \
-           osmesa)   $(MAKE) osmesa-driver || exit 1 ;; \
-           beos)     $(MAKE) beos-driver || exit 1 ;; \
-           directfb) $(MAKE) directfb-driver || exit 1 ;; \
-           fbdev)    $(MAKE) fbdev-driver || exit 1 ;; \
-           *) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \
-         esac ; \
-       done
 
+# Default: build dependencies, then mesa subdirs, then convenience
+# libs (.a) and finally the device drivers:
+default: depend subdirs libmesa.a libglapi.a driver_subdirs
+
+
+# this doesn't work yet but is probably the way to go in the future
+new_install:
+       (cd drivers && $(MAKE) install)
+
+
+# XXX replace this with new_install above someday
 install: default
        @for driver in $(DRIVER_DIRS) ; do \
          case "$$driver" in \
@@ -51,6 +44,7 @@ install: default
        done
 
 
+
 ######################################################################
 # Helper libraries used by many drivers:
 
@@ -66,63 +60,26 @@ libglapi.a: $(GLAPI_OBJECTS)
        @ $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS)
 
 
-
 ######################################################################
-# BeOS driver target
-
-beos-driver: depend subdirs libmesa.a
-       cd drivers/beos && $(MAKE)
+# Device drivers
+driver_subdirs:
+       (cd drivers && $(MAKE))
 
 
 ######################################################################
-# DRI drivers
-
-dri-drivers: depend subdirs libmesa.a
-       cd drivers/dri && $(MAKE)
-
-
-#####################################################################
-# DirectFB driver (libGL.so)
-
-directfb-libgl: $(CORE_OBJECTS)
-       @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-               -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
-               $(GL_LIB_DEPS)
-
-directfb-driver: depend subdirs directfb-libgl
-       cd drivers/directfb && $(MAKE)
-
-
-#####################################################################
-# fbdev driver (libGL.so)
-
-fbdev-driver: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS)
-       @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-               -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
-               $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) \
-               $(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS)
-
-
-######################################################################
-# Xlib driver (libGL.so)
-
-xlib-driver: depend subdirs libmesa.a libglapi.a
-       cd drivers/x11 && $(MAKE)
-
-
-######################################################################
-# osmesa driver (libOSMesa.so)
-
-osmesa-driver: depend subdirs libmesa.a libglapi.a
-       cd drivers/osmesa && $(MAKE)
-
-
+# Assembly subdirs
+subdirs:
+       @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
+               (cd x86 && $(MAKE)) || exit 1 ; \
+       fi
+       @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
+               (cd x86 && $(MAKE)) || exit 1 ; \
+               (cd x86-64 && $(MAKE)) || exit 1 ; \
+       fi
 
 
 ######################################################################
-# Generic stuff
+# Dependency generation
 
 depend: $(ALL_SOURCES)
        @ echo "running $(MKDEP)"
@@ -131,14 +88,8 @@ depend: $(ALL_SOURCES)
                > /dev/null 2>/dev/null
 
 
-subdirs:
-       @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
-               (cd x86 && $(MAKE)) || exit 1 ; \
-       fi
-       @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
-               (cd x86 && $(MAKE)) || exit 1 ; \
-               (cd x86-64 && $(MAKE)) || exit 1 ; \
-       fi
+######################################################################
+# Installation rules
 
 pcedit = sed \
        -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
@@ -168,15 +119,13 @@ install-osmesa: default
 install-dri:
        cd drivers/dri && $(MAKE) install
 
-## NOT INSTALLED YET:
-## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES
-## $(INSTALL) -m 644 include/GLES/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES
 
 
 # Emacs tags
 tags:
        etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
 
+
 clean:
        -rm -f */*.o
        -rm -f */*/*.o
@@ -184,6 +133,8 @@ clean:
        -rm -f drivers/*/*.o
        -@cd drivers/dri && $(MAKE) clean
        -@cd drivers/xorg && $(MAKE) clean
+       -@cd drivers/x11 && $(MAKE) clean
+       -@cd drivers/osmesa && $(MAKE) clean
        -@cd x86 && $(MAKE) clean
        -@cd x86-64 && $(MAKE) clean