dri/nouveau: Fix build with --enable-shared-dricore.
authorJohannes Obermayr <johannesobermayr@gmx.de>
Thu, 2 Jun 2011 23:15:44 +0000 (17:15 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 2 Jun 2011 23:21:26 +0000 (17:21 -0600)
- Based on the work of Себастьян Gliţa Κατινα <cglita@yahoo.com>
- Split Makefile.template into Makefile.defines and Makefile.targets
- Adapt other drivers to new situation
- Fixes https://bugs.freedesktop.org/show_bug.cgi?id=35441

Signed-off-by: Brian Paul <brianp@vmware.com>
21 files changed:
configs/autoconf.in
configs/linux-dri
configure.ac
src/gallium/targets/Makefile.dri
src/mesa/drivers/dri/Makefile.template [deleted file]
src/mesa/drivers/dri/i810/Makefile
src/mesa/drivers/dri/i915/Makefile
src/mesa/drivers/dri/i965/Makefile
src/mesa/drivers/dri/mach64/Makefile
src/mesa/drivers/dri/mga/Makefile
src/mesa/drivers/dri/nouveau/Makefile
src/mesa/drivers/dri/r128/Makefile
src/mesa/drivers/dri/r200/Makefile
src/mesa/drivers/dri/r300/Makefile
src/mesa/drivers/dri/r600/Makefile
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/savage/Makefile
src/mesa/drivers/dri/sis/Makefile
src/mesa/drivers/dri/swrast/Makefile
src/mesa/drivers/dri/tdfx/Makefile
src/mesa/drivers/dri/unichrome/Makefile

index a484bcff996e433e64ddc0f531c643bcedf5be50..abc01b1b2dd5b7a2174abd20ea95b9ca607588cb 100644 (file)
@@ -26,6 +26,8 @@ LDFLAGS = @LDFLAGS@
 EXTRA_LIB_PATH = @EXTRA_LIB_PATH@
 RADEON_CFLAGS = @RADEON_CFLAGS@
 RADEON_LDFLAGS = @RADEON_LDFLAGS@
+NOUVEAU_CFLAGS = @NOUVEAU_CFLAGS@
+NOUVEAU_LIBS = @NOUVEAU_LIBS@
 INTEL_LIBS = @INTEL_LIBS@
 INTEL_CFLAGS = @INTEL_CFLAGS@
 X11_LIBS = @X11_LIBS@
index 7ee007e35276f3263d5f7ca8e5096c56b2e7b2f4..c4132f47271cf021fb8c6f3b6662ce470f0d1bb8 100644 (file)
@@ -63,11 +63,16 @@ GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
 GALLIUM_TARGET_DIRS = 
 GALLIUM_STATE_TRACKERS_DIRS = egl
 
-DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
+DRI_DIRS = i810 i915 i965 mach64 mga nouveau r128 r200 r300 r600 radeon \
        savage sis tdfx unichrome swrast
 
-INTEL_LIBS = `pkg-config --libs libdrm_intel`
-INTEL_CFLAGS = `pkg-config --cflags libdrm_intel`
+INTEL_LIBS = $(shell pkg-config --libs libdrm_intel)
+INTEL_CFLAGS = $(shell pkg-config --cflags libdrm_intel)
 
-RADEON_LIBS = `pkg-config --libs libdrm_radeon`
-RADEON_CFLAGS = `pkg-config --cflags libdrm_radeon`
+NOUVEAU_LIBS = $(shell pkg-config --libs libdrm_nouveau)
+NOUVEAU_CFLAGS = $(shell pkg-config --cflags libdrm_nouveau)
+
+LIBDRM_RADEON_LIBS = $(shell pkg-config --libs libdrm_radeon)
+LIBDRM_RADEON_CFLAGS = $(shell pkg-config --cflags libdrm_radeon)
+RADEON_CFLAGS = "-DHAVE_LIBDRM_RADEON=1 $(LIBDRM_RADEON_CFLAGS)"
+RADEON_LDFLAGS = $(LIBDRM_RADEON_LIBS)
index 510d23f41bc6dcf325f228a92b61e5d2820f2450..1e5f9cec9991ab2aa07985bf71711c34f4fee708 100644 (file)
@@ -21,6 +21,7 @@ dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
+LIBDRM_NOUVEAU_REQUIRED=0.6
 DRI2PROTO_REQUIRED=2.1
 GLPROTO_REQUIRED=1.4.11
 LIBDRM_XORG_REQUIRED=2.4.24
@@ -1004,8 +1005,8 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
             # the new interface.  i810 are missing because there is no
             # x86-64 system where they could *ever* be used.
             if test "x$DRI_DIRS" = "xyes"; then
-                DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
-                    savage tdfx unichrome swrast"
+                DRI_DIRS="i915 i965 mach64 mga nouveau r128 r200 r300 r600 \
+                    radeon savage tdfx unichrome swrast"
             fi
             ;;
         powerpc*)
@@ -1032,8 +1033,8 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
         fi
 
         if test "x$DRI_DIRS" = "xyes"; then
-            DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
-                unichrome savage sis swrast"
+            DRI_DIRS="i810 i915 i965 mach64 mga nouveau r128 r200 r300 r600 \
+                radeon tdfx unichrome savage sis swrast"
         fi
         ;;
     gnu*)
@@ -1061,7 +1062,7 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
 
     # default drivers
     if test "x$DRI_DIRS" = "xyes"; then
-        DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
+        DRI_DIRS="i810 i915 i965 mach64 mga nouveau r128 r200 r300 r600 radeon \
             savage sis tdfx unichrome swrast"
     fi
 
@@ -1097,6 +1098,12 @@ case $DRI_DIRS in
     ;;
 esac
 
+case $DRI_DIRS in
+*nouveau*)
+    PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
+    ;;
+esac
+
 case $DRI_DIRS in
 *radeon*|*r200*|*r300*|*r600*)
     if test "x$HAVE_LIBDRM_RADEON" = xyes; then
index 3fb4cc6b8615a48a408063e58017bf222d10a4c7..6c6ad184fabefa81d3bc6cbd7f90baab47bc210d 100644 (file)
@@ -75,7 +75,7 @@ LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
 
 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \
-               $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o
+               $(TOP)/src/mesa/drivers/dri/Makefile.targets $(TOP)/src/mesa/drivers/dri/common/dri_test.o
        $(MKLIB) -o $@.tmp -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
                $(OBJECTS) $(PIPE_DRIVERS) \
                 -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template
deleted file mode 100644 (file)
index d1a1193..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-# -*-makefile-*-
-
-COMMON_GALLIUM_SOURCES = \
-        ../common/utils.c \
-        ../common/vblank.c \
-        ../common/dri_util.c \
-        ../common/xmlconfig.c
-
-COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
-        ../../common/driverfuncs.c \
-        ../common/texmem.c \
-        ../common/drirenderbuffer.c
-
-INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
-
-OBJECTS = $(C_SOURCES:.c=.o) \
-         $(CXX_SOURCES:.cpp=.o) \
-         $(ASM_SOURCES:.S=.o) 
-
-
-### Include directories
-SHARED_INCLUDES = \
-       -I. \
-       -I$(TOP)/src/mesa/drivers/dri/common \
-       -Iserver \
-       -I$(TOP)/include \
-       -I$(TOP)/src/mapi \
-       -I$(TOP)/src/mesa \
-       -I$(TOP)/src/egl/main \
-       -I$(TOP)/src/egl/drivers/dri \
-       $(LIBDRM_CFLAGS)
-
-CFLAGS += $(API_DEFINES)
-CXXFLAGS += $(API_DEFINES)
-
-##### RULES #####
-
-.c.o:
-       $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.cpp.o:
-       $(CC) -c $(INCLUDES) $(DRI_CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.S.o:
-       $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: subdirs lib
-
-
-.PHONY: lib
-lib: symlinks subdirs depend
-       @$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
-
-$(LIBNAME): $(OBJECTS) $(EXTRA_MODULES) $(MESA_MODULES) Makefile \
-               $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o
-       $(MKLIB) -o $@.tmp -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
-               $(OBJECTS) $(EXTRA_MODULES) $(DRI_LIB_DEPS)
-       $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS)
-       @rm -f $@.test
-       mv -f $@.tmp $@
-
-
-$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
-       $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR) 
-
-
-# If the Makefile defined SUBDIRS, run make in each
-.PHONY: subdirs
-subdirs:
-       @if test -n "$(SUBDIRS)" ; then \
-               for dir in $(SUBDIRS) ; do \
-                       if [ -d $$dir ] ; then \
-                               (cd $$dir && $(MAKE)) || exit 1; \
-                       fi \
-               done \
-       fi
-
-
-.PHONY: symlinks
-symlinks:
-
-
-depend: $(C_SOURCES) $(CXX_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
-       @ echo "running $(MKDEP)"
-       @ rm -f depend
-       @ touch depend
-       @ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) \
-               $(C_SOURCES) $(CXX_SOURCES) \
-               $(ASM_SOURCES) > /dev/null 2>/dev/null
-
-
-# Emacs tags
-tags:
-       etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean:
-       -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-       -rm -f depend depend.bak
-
-
-install: $(LIBNAME)
-       $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
-       $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
-
-
--include depend
index 54a837d5ea9a5be8f5181bb4caebea1188f288b4..edc6dd217322054023af4d64b21e36ebb837ac13 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = i810_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        i810context.c \
        i810ioctl.c \
@@ -24,5 +26,5 @@ C_SOURCES = \
 
 ASM_SOURCES = 
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 65fd658c047cbeaec843236cf1063c829e4fd71d..79e03f2f1d1b6d988d1639c982fd5f9aa7d561ed 100644 (file)
@@ -4,6 +4,8 @@ include $(TOP)/configs/current
 
 LIBNAME = i915_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        i830_context.c \
        i830_state.c \
@@ -63,7 +65,7 @@ DRIVER_DEFINES = -I../intel -DI915 \
 INCLUDES += $(INTEL_CFLAGS)
 DRI_LIB_DEPS += $(INTEL_LIBS)
 
-include ../Makefile.template
+include ../Makefile.targets
 
 intel_decode.o: ../intel/intel_decode.c
 
index d80628b1e776ffc96f0aed7b14531c8e3d0288bc..44f28cd9d15214a76984d0dab9dae7e092c89961 100644 (file)
@@ -4,6 +4,8 @@ include $(TOP)/configs/current
 
 LIBNAME = i965_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        intel_batchbuffer.c \
        intel_blit.c \
@@ -131,7 +133,7 @@ DRIVER_DEFINES = -I../intel
 INCLUDES += $(INTEL_CFLAGS)
 DRI_LIB_DEPS += $(INTEL_LIBS)
 
-include ../Makefile.template
+include ../Makefile.targets
 
 intel_decode.o: ../intel/intel_decode.c
 intel_tex_layout.o: ../intel/intel_tex_layout.c
index c20fdece29725b1ba76949811517a18230539121..0474c1a165fa4694873e7b75b99c0e03615833db 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = mach64_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        mach64_context.c \
        mach64_ioctl.c \
@@ -25,5 +27,5 @@ C_SOURCES = \
 
 ASM_SOURCES = 
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 92533bccc292448674c5682599636eb8044336ff..9948ee767ac87745cfcf50495e2ec6e1a48d18c6 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = mga_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        mgadd.c \
        mgaioctl.c \
@@ -27,5 +29,5 @@ C_SOURCES = \
 
 ASM_SOURCES = 
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 3b506a91ffa14f33f23fc19ac904d64308640be3..e485a98761f6ac7fcce83258cfc083582966c1ec 100644 (file)
@@ -3,11 +3,10 @@
 TOP = ../../../../..
 include $(TOP)/configs/current
 
-CFLAGS += $(shell pkg-config libdrm libdrm_nouveau --cflags)
-DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
-
 LIBNAME = nouveau_vieux_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        nouveau_screen.c \
        nouveau_context.c \
@@ -51,7 +50,9 @@ C_SOURCES = \
 
 ASM_SOURCES =
 
+INCLUDES += $(NOUVEAU_CFLAGS)
+DRI_LIB_DEPS += $(NOUVEAU_LIBS)
 
-include ../Makefile.template
+include ../Makefile.targets
 
 symlinks:
index 8144c9b43ff28f9cc09375df603cfe5949b12c4a..8b23ccc8cbebb0a231486cd64ce0bd4c15a9f0f2 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = r128_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        r128_context.c \
        r128_lock.c \
@@ -25,5 +27,5 @@ C_SOURCES = \
 ASM_SOURCES = 
 
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 8013768e9fbfbd84ff8595d1c8e28848de51b267..4547f7e2ee09909454b26946bc0e93a855635ee8 100644 (file)
@@ -3,10 +3,10 @@
 TOP = ../../../../..
 include $(TOP)/configs/current
 
-CFLAGS += $(RADEON_CFLAGS)
-
 LIBNAME = r200_dri.so
 
+include ../Makefile.defines
+
 ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
@@ -55,12 +55,13 @@ X86_SOURCES =
 
 DRIVER_DEFINES = -DRADEON_R200
 
+INCLUDES += $(RADEON_CFLAGS)
 DRI_LIB_DEPS += $(RADEON_LDFLAGS)
 
 ##### TARGETS #####
 
 
-include ../Makefile.template
+include ../Makefile.targets
 
 #INCLUDES += -I../radeon/server
 
index 2245998c952332faea7b1b1c2bc1f0e9c1ba4a4a..9f23a8496aa83de41953ea55ef19700914a58064 100644 (file)
@@ -3,17 +3,17 @@
 TOP = ../../../../..
 include $(TOP)/configs/current
 
-CFLAGS += $(RADEON_CFLAGS)
-
 LIBNAME = r300_dri.so
 
+include ../Makefile.defines
+
 ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
 
 COMMON_SOURCES = \
        ../../common/driverfuncs.c \
-       ../common/mm.c \
+       ../common/drirenderbuffer.c \
        ../common/utils.c \
        ../common/texmem.c \
        ../common/vblank.c \
@@ -64,6 +64,7 @@ C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
 DRIVER_DEFINES = -DRADEON_R300
 #      -DRADEON_BO_TRACK \
 
+INCLUDES += $(RADEON_CFLAGS)
 DRI_LIB_DEPS += $(RADEON_LDFLAGS)
 
 SUBDIRS = compiler
@@ -73,5 +74,5 @@ EXTRA_MODULES = compiler/libr300compiler.a
 
 ##### TARGETS #####
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 200bc20f64727e348c55e122c6e38bbaaca15735..bec0b5a53fe71b34f75d086b471c579cf794092e 100644 (file)
@@ -3,17 +3,17 @@
 TOP = ../../../../..
 include $(TOP)/configs/current
 
-CFLAGS += $(RADEON_CFLAGS)
-
 LIBNAME = r600_dri.so
 
+include ../Makefile.defines
+
 ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
 
 COMMON_SOURCES = \
        ../../common/driverfuncs.c \
-       ../common/mm.c \
+       ../common/drirenderbuffer.c \
        ../common/utils.c \
        ../common/texmem.c \
        ../common/vblank.c \
@@ -78,9 +78,10 @@ C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
 DRIVER_DEFINES = -DRADEON_R600
 #      -DRADEON_BO_TRACK \
 
+INCLUDES += $(RADEON_CFLAGS)
 DRI_LIB_DEPS += $(RADEON_LDFLAGS)
 
 ##### TARGETS #####
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 93219e40afda599e0907d3cbc56e000ba4ef0c6e..6b5d33354523cac063d4da401a78a9e1d1f7b737 100644 (file)
@@ -4,10 +4,10 @@
 TOP = ../../../../..
 include $(TOP)/configs/current
 
-CFLAGS += $(RADEON_CFLAGS)
-
 LIBNAME = radeon_dri.so
 
+include ../Makefile.defines
+
 ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
@@ -53,9 +53,10 @@ C_SOURCES = \
 
 DRIVER_DEFINES = -DRADEON_R100
 
+INCLUDES += $(RADEON_CFLAGS)
 DRI_LIB_DEPS += $(RADEON_LDFLAGS)
 
 X86_SOURCES = 
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 53511552c6d3c335c27d9f2645e4054395b4b0fa..03be3468da9e6463eb5b9ba1f03f144d83e6d289 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = savage_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        savage_xmesa.c \
        savagedd.c \
@@ -22,5 +24,5 @@ C_SOURCES = \
 ASM_SOURCES = 
 
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 6b4f938bab3a553ec5376ef0c5a0da4e2f3603dc..0e0bf0d4eac1f2aaeea3a743cd47b3a06bc38c92 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = sis_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        sis6326_state.c \
        sis6326_clear.c \
@@ -28,5 +30,5 @@ C_SOURCES = \
 
 ASM_SOURCES = 
 
-include ../Makefile.template
+include ../Makefile.targets
 
index d2cf6dbc55b1893cb6c39c0e7070d6d5ee4b271d..4cb99fd0eb7233731e8bd5ae233d939e6dedf057 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = swrast_dri.so
 
+include ../Makefile.defines
+
 DRIVER_DEFINES = -D__NOT_HAVE_DRM_H
 
 DRIVER_SOURCES = \
@@ -22,5 +24,5 @@ SWRAST_COMMON_SOURCES = \
        ../common/utils.c \
        ../common/drisw_util.c
 
-include ../Makefile.template
+include ../Makefile.targets
 
index 96bd8f8202f493a57a273328ef52b31e5df7340d..ed84df2092553913be87aec54b071cb4e70996d8 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = tdfx_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        tdfx_context.c \
        tdfx_dd.c \
@@ -27,6 +29,6 @@ C_SOURCES = \
 
 ASM_SOURCES = 
 
-include ../Makefile.template
+include ../Makefile.targets
 
 
index 14cf9f3038641e8e76b5f93bd7beda95af499aed..373da6016e484b6c0e9c9487adeac3aafea9068b 100644 (file)
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
 
 LIBNAME = unichrome_dri.so
 
+include ../Makefile.defines
+
 DRIVER_SOURCES = \
        via_context.c \
        via_fb.c \
@@ -25,5 +27,5 @@ C_SOURCES = \
 ASM_SOURCES = 
 
 
-include ../Makefile.template
+include ../Makefile.targets