r300/compiler: Compile the compiler seperately into an archive
authorNicolai Hähnle <nhaehnle@gmail.com>
Thu, 16 Jul 2009 21:56:15 +0000 (23:56 +0200)
committerNicolai Hähnle <nhaehnle@gmail.com>
Mon, 27 Jul 2009 18:32:04 +0000 (20:32 +0200)
This is all part of untangling the compiler from the classic driver, so that
it may be used in Gallium without depending on Mesa stuff if possible

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
src/mesa/drivers/dri/r300/Makefile
src/mesa/drivers/dri/r300/compiler/Makefile [new file with mode: 0644]

index 8a85293756ffe2020a51e7241df17b1616dfc6bb..95c6765bc4f6e54704a9bb77f336af2fd37fb834 100644 (file)
@@ -38,19 +38,6 @@ RADEON_COMMON_SOURCES = \
        radeon_span.c \
        radeon_fbo.c
 
-RADEON_COMPILER_SOURCES = \
-               compiler/radeon_nqssadce.c \
-               compiler/radeon_program.c \
-               compiler/radeon_program_alu.c \
-               compiler/radeon_program_pair.c \
-               compiler/r3xx_fragprog.c \
-               compiler/r300_fragprog.c \
-               compiler/r300_fragprog_swizzle.c \
-               compiler/r300_fragprog_emit.c \
-               compiler/r500_fragprog.c \
-               compiler/r500_fragprog_emit.c \
-               compiler/memory_pool.c
-
 DRIVER_SOURCES = \
                 radeon_screen.c \
                 r300_context.c \
@@ -67,7 +54,6 @@ DRIVER_SOURCES = \
                 r300_emit.c \
                 r300_swtcl.c \
                 $(RADEON_COMMON_SOURCES) \
-                $(RADEON_COMPILER_SOURCES) \
                 $(EGL_SOURCES) \
                 $(CS_SOURCES)
 
@@ -80,8 +66,16 @@ DRIVER_DEFINES = -DCOMPILE_R300 -DR200_MERGED=0 \
 
 DRI_LIB_DEPS += $(RADEON_LDFLAGS)
 
+PIPE_DRIVERS =  compiler/libr300compiler.a
+
 ##### TARGETS #####
 
 include ../Makefile.template
 
 symlinks:
+
+# Mark the archive phony so that we always check for recompilation
+.PHONY : compiler/libr300compiler.a
+
+compiler/libr300compiler.a:
+       cd compiler && $(MAKE)
diff --git a/src/mesa/drivers/dri/r300/compiler/Makefile b/src/mesa/drivers/dri/r300/compiler/Makefile
new file mode 100644 (file)
index 0000000..4da173c
--- /dev/null
@@ -0,0 +1,71 @@
+# src/mesa/drivers/dri/r300/compiler/Makefile
+
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = r300compiler
+
+C_SOURCES = \
+               radeon_nqssadce.c \
+               radeon_program.c \
+               radeon_program_alu.c \
+               radeon_program_pair.c \
+               r3xx_fragprog.c \
+               r300_fragprog.c \
+               r300_fragprog_swizzle.c \
+               r300_fragprog_emit.c \
+               r500_fragprog.c \
+               r500_fragprog_emit.c \
+               \
+               memory_pool.c
+
+
+### Basic defines ###
+
+OBJECTS = $(C_SOURCES:.c=.o) \
+       $(CPP_SOURCES:.cpp=.o) \
+       $(ASM_SOURCES:.S=.o)
+
+INCLUDES = \
+       -I. \
+       -I$(TOP)/include \
+       -I$(TOP)/src/mesa \
+
+
+##### TARGETS #####
+
+default: depend lib$(LIBNAME).a
+
+lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/configs/current
+       $(MKLIB) -o $(LIBNAME) -static $(OBJECTS)
+
+depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
+       rm -f depend
+       touch depend
+       $(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 $(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 $@
+
+
+sinclude depend