Mesa (master): gallium: Improve makefiles for libraries

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Fri Feb 20 11:26:08 UTC 2009


Module: Mesa
Branch: master
Commit: d9602e5144bc76b9791fa3382ca38c880df96198
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d9602e5144bc76b9791fa3382ca38c880df96198

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Fri Feb 20 00:14:00 2009 +0100

gallium: Improve makefiles for libraries

	The template makefile that most libraries in
	gallium included was based on dri and had a bunch
	unrelevant junk in it.

	Update it and improve the depending makefiles.

---

 src/gallium/Makefile.template                |   74 +++++++++++++------------
 src/gallium/auxiliary/cso_cache/Makefile     |    3 -
 src/gallium/auxiliary/draw/Makefile          |    4 --
 src/gallium/auxiliary/indices/Makefile       |    4 --
 src/gallium/auxiliary/pipebuffer/Makefile    |    3 -
 src/gallium/auxiliary/rtasm/Makefile         |    3 -
 src/gallium/auxiliary/sct/Makefile           |    3 -
 src/gallium/auxiliary/tgsi/Makefile          |    3 -
 src/gallium/auxiliary/translate/Makefile     |    3 -
 src/gallium/auxiliary/util/Makefile          |    3 -
 src/gallium/drivers/failover/Makefile        |    3 -
 src/gallium/drivers/i915simple/Makefile      |    3 -
 src/gallium/drivers/i965simple/Makefile      |    2 -
 src/gallium/drivers/nv04/Makefile            |   11 +----
 src/gallium/drivers/nv10/Makefile            |   11 +----
 src/gallium/drivers/nv20/Makefile            |   11 +----
 src/gallium/drivers/nv30/Makefile            |   11 +----
 src/gallium/drivers/nv40/Makefile            |   11 +----
 src/gallium/drivers/nv50/Makefile            |   11 +----
 src/gallium/drivers/r300/Makefile            |    2 -
 src/gallium/drivers/softpipe/Makefile        |    3 -
 src/gallium/drivers/trace/Makefile           |    6 +--
 src/gallium/state_trackers/glx/xlib/Makefile |   18 ++-----
 23 files changed, 50 insertions(+), 156 deletions(-)

diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template
index 655e949..98487d4 100644
--- a/src/gallium/Makefile.template
+++ b/src/gallium/Makefile.template
@@ -1,64 +1,66 @@
-# -*-makefile-*-
+# src/gallium/Makefile.template
 
-
-# We still have a dependency on the "dri" buffer manager.  Most likely
-# the interface can be reused in non-dri environments, and also as a
-# frontend to simpler memory managers.
+# Template makefile for gallium libraries.
+#
+# Usage:
+#   The minimum that the including makefile needs to define
+#   is TOP, LIBNAME and one of of the *_SOURCES.
 #
-COMMON_SOURCES = 
+# Optional defines:
+#   LIBRARY_INCLUDES are appended to the list of includes directories.
+#   LIBRARY_DEFINES is not used for makedepend, but for compilation.
 
-OBJECTS = $(C_SOURCES:.c=.o) \
-          $(CPP_SOURCES:.cpp=.o) \
-	  $(ASM_SOURCES:.S=.o) 
+### Basic defines ###
 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	$(CPP_SOURCES:.cpp=.o) \
+	$(ASM_SOURCES:.S=.o)
 
-### Include directories
 INCLUDES = \
 	-I. \
 	-I$(TOP)/src/gallium/include \
 	-I$(TOP)/src/gallium/auxiliary \
 	-I$(TOP)/src/gallium/drivers \
-	-I$(TOP)/include \
-        $(DRIVER_INCLUDES)
-
-
-##### RULES #####
-
-.c.o:
-	$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.cpp.o:
-	$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
-
-.S.o:
-	$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES)  $< -o $@
+	-I$(GALLIUM)/src/gallium/include \
+	-I$(GALLIUM)/src/gallium/auxiliary \
+	-I$(GALLIUM)/src/gallium/drivers \
+	$(LIBRARY_INCLUDES)
 
 
 ##### TARGETS #####
 
-default: depend symlinks lib$(LIBNAME).a
-
+default: depend lib$(LIBNAME).a
 
 lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template
-	$(TOP)/bin/mklib -o $(LIBNAME) -static $(OBJECTS) $(DRIVER_LIBS)
-
+	$(MKLIB) -o $(LIBNAME) -static $(OBJECTS)
 
 depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
 	rm -f depend
 	touch depend
-	$(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) \
-		$(ASM_SOURCES) 2> /dev/null
-
+	$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) 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
+clean:
+	rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak
+
+# Dummy target
+install:
+	@echo -n ""
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
+
+.cpp.o:
+	$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES)  $< -o $@
 
 
-include depend
+sinclude depend
diff --git a/src/gallium/auxiliary/cso_cache/Makefile b/src/gallium/auxiliary/cso_cache/Makefile
index 6bd6602..8726afc 100644
--- a/src/gallium/auxiliary/cso_cache/Makefile
+++ b/src/gallium/auxiliary/cso_cache/Makefile
@@ -9,6 +9,3 @@ C_SOURCES = \
 	cso_hash.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/draw/Makefile b/src/gallium/auxiliary/draw/Makefile
index bdbf5a0..5041dcc 100644
--- a/src/gallium/auxiliary/draw/Makefile
+++ b/src/gallium/auxiliary/draw/Makefile
@@ -43,8 +43,4 @@ C_SOURCES = \
 	draw_vs_ppc.c  \
 	draw_vs_sse.c 
 
-
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/indices/Makefile b/src/gallium/auxiliary/indices/Makefile
index 8fa61d2..25ee899 100644
--- a/src/gallium/auxiliary/indices/Makefile
+++ b/src/gallium/auxiliary/indices/Makefile
@@ -10,7 +10,3 @@ include ../../Makefile.template
 
 u_indices_gen.c: u_indices_gen.py
 	python $< > $@
-
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/pipebuffer/Makefile b/src/gallium/auxiliary/pipebuffer/Makefile
index 3b501c5..1c00ba8 100644
--- a/src/gallium/auxiliary/pipebuffer/Makefile
+++ b/src/gallium/auxiliary/pipebuffer/Makefile
@@ -17,6 +17,3 @@ C_SOURCES = \
 	pb_validate.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/rtasm/Makefile b/src/gallium/auxiliary/rtasm/Makefile
index 252dc52..ab8ea46 100644
--- a/src/gallium/auxiliary/rtasm/Makefile
+++ b/src/gallium/auxiliary/rtasm/Makefile
@@ -11,6 +11,3 @@ C_SOURCES = \
 	rtasm_ppc_spe.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/sct/Makefile b/src/gallium/auxiliary/sct/Makefile
index 516d175..a7d111b 100644
--- a/src/gallium/auxiliary/sct/Makefile
+++ b/src/gallium/auxiliary/sct/Makefile
@@ -7,6 +7,3 @@ C_SOURCES = \
 	sct.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/tgsi/Makefile b/src/gallium/auxiliary/tgsi/Makefile
index d7df949..b4900e8 100644
--- a/src/gallium/auxiliary/tgsi/Makefile
+++ b/src/gallium/auxiliary/tgsi/Makefile
@@ -19,6 +19,3 @@ C_SOURCES = \
 	tgsi_util.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/translate/Makefile b/src/gallium/auxiliary/translate/Makefile
index ad2a5b7..3c82f8a 100644
--- a/src/gallium/auxiliary/translate/Makefile
+++ b/src/gallium/auxiliary/translate/Makefile
@@ -10,6 +10,3 @@ C_SOURCES = \
         translate_cache.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile
index 671e671..160df8d 100644
--- a/src/gallium/auxiliary/util/Makefile
+++ b/src/gallium/auxiliary/util/Makefile
@@ -27,6 +27,3 @@ C_SOURCES = \
 	u_simple_screen.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/failover/Makefile b/src/gallium/drivers/failover/Makefile
index f08b8df..dfb7f5d 100644
--- a/src/gallium/drivers/failover/Makefile
+++ b/src/gallium/drivers/failover/Makefile
@@ -9,6 +9,3 @@ C_SOURCES = \
 	fo_context.c 
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/i915simple/Makefile b/src/gallium/drivers/i915simple/Makefile
index 41a61a0..12821c5 100644
--- a/src/gallium/drivers/i915simple/Makefile
+++ b/src/gallium/drivers/i915simple/Makefile
@@ -26,6 +26,3 @@ C_SOURCES = \
 	i915_surface.c 
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/i965simple/Makefile b/src/gallium/drivers/i965simple/Makefile
index e97146e..19182af 100644
--- a/src/gallium/drivers/i965simple/Makefile
+++ b/src/gallium/drivers/i965simple/Makefile
@@ -50,5 +50,3 @@ C_SOURCES = \
 	brw_wm_surface_state.c
 
 include ../../Makefile.template
-
-symlinks:
diff --git a/src/gallium/drivers/nv04/Makefile b/src/gallium/drivers/nv04/Makefile
index 4ed62da..cf9deea 100644
--- a/src/gallium/drivers/nv04/Makefile
+++ b/src/gallium/drivers/nv04/Makefile
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv04
 
-DRIVER_SOURCES = \
+C_SOURCES = \
 	nv04_surface_2d.c \
 	nv04_clear.c \
 	nv04_context.c \
@@ -17,13 +17,4 @@ DRIVER_SOURCES = \
 	nv04_surface.c \
 	nv04_vbo.c
 
-C_SOURCES = \
-	$(COMMON_SOURCES) \
-	$(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/nv10/Makefile b/src/gallium/drivers/nv10/Makefile
index 4ba7ce5..2b5fbd4 100644
--- a/src/gallium/drivers/nv10/Makefile
+++ b/src/gallium/drivers/nv10/Makefile
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv10
 
-DRIVER_SOURCES = \
+C_SOURCES = \
 	nv10_clear.c \
 	nv10_context.c \
 	nv10_fragprog.c \
@@ -16,13 +16,4 @@ DRIVER_SOURCES = \
 	nv10_surface.c \
 	nv10_vbo.c
 
-C_SOURCES = \
-	$(COMMON_SOURCES) \
-	$(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/nv20/Makefile b/src/gallium/drivers/nv20/Makefile
index d777fd3..93e34f8 100644
--- a/src/gallium/drivers/nv20/Makefile
+++ b/src/gallium/drivers/nv20/Makefile
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv20
 
-DRIVER_SOURCES = \
+C_SOURCES = \
 	nv20_clear.c \
 	nv20_context.c \
 	nv20_fragprog.c \
@@ -17,13 +17,4 @@ DRIVER_SOURCES = \
 	nv20_vbo.c
 #	nv20_vertprog.c
 
-C_SOURCES = \
-	$(COMMON_SOURCES) \
-	$(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile
index 69f2790..4c29e2e 100644
--- a/src/gallium/drivers/nv30/Makefile
+++ b/src/gallium/drivers/nv30/Makefile
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv30
 
-DRIVER_SOURCES = \
+C_SOURCES = \
 	nv30_clear.c \
 	nv30_context.c \
 	nv30_draw.c \
@@ -25,13 +25,4 @@ DRIVER_SOURCES = \
 	nv30_vbo.c \
 	nv30_vertprog.c
 
-C_SOURCES = \
-	$(COMMON_SOURCES) \
-	$(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile
index 9c8eadf..8c738ae 100644
--- a/src/gallium/drivers/nv40/Makefile
+++ b/src/gallium/drivers/nv40/Makefile
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv40
 
-DRIVER_SOURCES = \
+C_SOURCES = \
 	nv40_clear.c \
 	nv40_context.c \
 	nv40_draw.c \
@@ -25,13 +25,4 @@ DRIVER_SOURCES = \
 	nv40_vbo.c \
 	nv40_vertprog.c
 
-C_SOURCES = \
-	$(COMMON_SOURCES) \
-	$(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/nv50/Makefile b/src/gallium/drivers/nv50/Makefile
index 48244db..612aea2 100644
--- a/src/gallium/drivers/nv50/Makefile
+++ b/src/gallium/drivers/nv50/Makefile
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = nv50
 
-DRIVER_SOURCES = \
+C_SOURCES = \
 	nv50_clear.c \
 	nv50_context.c \
 	nv50_draw.c \
@@ -18,13 +18,4 @@ DRIVER_SOURCES = \
 	nv50_transfer.c \
 	nv50_vbo.c
 
-C_SOURCES = \
-	$(COMMON_SOURCES) \
-	$(DRIVER_SOURCES)
-
-ASM_SOURCES = 
-
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 85b3f15..9b7524b 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -18,5 +18,3 @@ C_SOURCES = \
 	r300_texture.c
 
 include ../../Makefile.template
-
-symlinks:
diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile
index f186f6d..516e399 100644
--- a/src/gallium/drivers/softpipe/Makefile
+++ b/src/gallium/drivers/softpipe/Makefile
@@ -42,6 +42,3 @@ C_SOURCES = \
 	sp_surface.c 
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/drivers/trace/Makefile b/src/gallium/drivers/trace/Makefile
index 3859b8a..e1bd970 100644
--- a/src/gallium/drivers/trace/Makefile
+++ b/src/gallium/drivers/trace/Makefile
@@ -9,10 +9,6 @@ C_SOURCES = \
 	tr_screen.c \
 	tr_state.c \
 	tr_texture.c \
-	tr_winsys.c 
-
+	tr_winsys.c
 
 include ../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/state_trackers/glx/xlib/Makefile b/src/gallium/state_trackers/glx/xlib/Makefile
index 1b63db1..6d10b09 100644
--- a/src/gallium/state_trackers/glx/xlib/Makefile
+++ b/src/gallium/state_trackers/glx/xlib/Makefile
@@ -3,23 +3,15 @@ include $(TOP)/configs/current
 
 LIBNAME = xlib
 
-
-DRIVER_INCLUDES = \
+LIBRARY_INCLUDES = \
 	-I$(TOP)/include \
 	-I$(TOP)/src/mesa \
-	-I$(TOP)/src/mesa/main \
-	-I$(TOP)/src/gallium/include \
-	-I$(TOP)/src/gallium/drivers \
-	-I$(TOP)/src/gallium/auxiliary
+	-I$(TOP)/src/mesa/main
 
 C_SOURCES = \
-	glxapi.c	\
-	fakeglx.c	\
-	fakeglx_fonts.c	\
+	glxapi.c \
+	fakeglx.c \
+	fakeglx_fonts.c \
 	xm_api.c
 
-
 include ../../../Makefile.template
-
-symlinks:
-




More information about the mesa-commit mailing list