Build mesa glsl with make.
authormichal <michal@transistor.(none)>
Thu, 10 Dec 2009 00:03:15 +0000 (01:03 +0100)
committermichal <michal@transistor.(none)>
Thu, 10 Dec 2009 00:03:15 +0000 (01:03 +0100)
Still don't know how to add glsl to mesa dependencies.

Makefile
configs/default
src/glsl/Makefile [new file with mode: 0644]
src/glsl/Makefile.template [new file with mode: 0644]
src/glsl/apps/Makefile [new file with mode: 0644]
src/glsl/cl/Makefile [new file with mode: 0644]
src/glsl/pp/Makefile [new file with mode: 0644]
src/mesa/Makefile
src/mesa/shader/slang/library/Makefile

index ea00e811b7781c9a5729e05109146c1aa61dfa8e..0f759d86dfec3d29113e6ee5cfd7855e24c61f7c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -225,6 +225,10 @@ MAIN_FILES = \
        $(DIRECTORY)/include/GL/vms_x_fix.h                             \
        $(DIRECTORY)/include/GL/wglext.h                                \
        $(DIRECTORY)/include/GL/wmesa.h                                 \
+       $(DIRECTORY)/src/glsl/Makefile                                  \
+       $(DIRECTORY)/src/glsl/*/Makefile                                \
+       $(DIRECTORY)/src/glsl/*/SConscript                              \
+       $(DIRECTORY)/src/glsl/*/*.[ch]                                  \
        $(DIRECTORY)/src/Makefile                                       \
        $(DIRECTORY)/src/mesa/Makefile*                                 \
        $(DIRECTORY)/src/mesa/sources.mak                               \
index cb3ca1046f4ab155b583f341452511089a980c57..f3659312040399f69062937545b07a8ff2998547 100644 (file)
@@ -83,7 +83,7 @@ MOTIF_CFLAGS = -I/usr/include/Motif1.2
 
 # Directories to build
 LIB_DIR = lib
-SRC_DIRS = mesa gallium egl gallium/winsys glu glut/glx glew glw
+SRC_DIRS = glsl mesa gallium egl gallium/winsys glu glut/glx glew glw
 GLU_DIRS = sgi
 DRIVER_DIRS = x11 osmesa
 # Which subdirs under $(TOP)/progs/ to enter:
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
new file mode 100644 (file)
index 0000000..ca7f2d2
--- /dev/null
@@ -0,0 +1,15 @@
+# src/glsl/Makefile
+
+TOP = ../..
+
+include $(TOP)/configs/current
+
+SUBDIRS = pp cl apps
+
+default install clean:
+       @for dir in $(SUBDIRS) ; do \
+               if [ -d $$dir ] ; then \
+                       (cd $$dir && $(MAKE) $@) || exit 1; \
+               fi \
+       done
+
diff --git a/src/glsl/Makefile.template b/src/glsl/Makefile.template
new file mode 100644 (file)
index 0000000..974987a
--- /dev/null
@@ -0,0 +1,50 @@
+# src/glsl/Makefile.template
+
+# Template makefile for glsl libraries.
+#
+# Usage:
+#   The minimum that the including makefile needs to define
+#   is TOP, LIBNAME and one of of the *_SOURCES.
+#
+# Optional defines:
+#   LIBRARY_INCLUDES are appended to the list of includes directories.
+#   LIBRARY_DEFINES is not used for makedepend, but for compilation.
+
+
+### Basic defines ###
+
+OBJECTS = $(C_SOURCES:.c=.o)
+
+INCLUDES = \
+       -I. \
+       $(LIBRARY_INCLUDES)
+
+
+##### TARGETS #####
+
+default: depend lib$(LIBNAME).a
+
+lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template
+       $(MKLIB) -o $(LIBNAME) -static $(OBJECTS)
+
+depend: $(C_SOURCES)
+       rm -f depend
+       touch depend
+       $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) 2> /dev/null
+
+# 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 $@
+
+-include depend
+
diff --git a/src/glsl/apps/Makefile b/src/glsl/apps/Makefile
new file mode 100644 (file)
index 0000000..c80fcb9
--- /dev/null
@@ -0,0 +1,42 @@
+# src/glsl/apps/Makefile
+
+TOP = ../../..
+
+include $(TOP)/configs/current
+
+LIBS = \
+       $(TOP)/src/glsl/pp/libglslpp.a \
+       $(TOP)/src/glsl/cl/libglslcl.a
+
+SOURCES = \
+       compile.c \
+       process.c \
+       purify.c \
+       tokenise.c \
+       version.c
+
+APPS = $(SOURCES:%.c=%)
+
+INCLUDES = -I.
+
+
+##### RULES #####
+
+.SUFFIXES:
+.SUFFIXES: .c
+
+.c:
+       $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
+
+.c.o:
+       $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+
+##### TARGETS #####
+
+default: $(APPS)
+
+clean:
+       -rm -f $(APPS)
+       -rm -f *.o
+
diff --git a/src/glsl/cl/Makefile b/src/glsl/cl/Makefile
new file mode 100644 (file)
index 0000000..04a52df
--- /dev/null
@@ -0,0 +1,13 @@
+#src/glsl/cl/Makefile
+
+TOP = ../../..
+
+include $(TOP)/configs/current
+
+LIBNAME = glslcl
+
+C_SOURCES = \
+       sl_cl_parse.c
+
+include ../Makefile.template
+
diff --git a/src/glsl/pp/Makefile b/src/glsl/pp/Makefile
new file mode 100644 (file)
index 0000000..819079f
--- /dev/null
@@ -0,0 +1,26 @@
+#src/glsl/pp/Makefile
+
+TOP = ../../..
+
+include $(TOP)/configs/current
+
+LIBNAME = glslpp
+
+C_SOURCES = \
+       sl_pp_context.c \
+       sl_pp_define.c \
+       sl_pp_dict.c \
+       sl_pp_error.c \
+       sl_pp_expression.c \
+       sl_pp_extension.c \
+       sl_pp_if.c \
+       sl_pp_line.c \
+       sl_pp_macro.c \
+       sl_pp_pragma.c \
+       sl_pp_process.c \
+       sl_pp_purify.c \
+       sl_pp_token.c \
+       sl_pp_version.c
+
+include ../Makefile.template
+
index 8300b3014416f4a51b24dcdcab6e95f93851ec25..67cac2d24802f12b460f4b61e4578e9ae2948daa 100644 (file)
@@ -19,10 +19,10 @@ include sources.mak
 
 
 
-# Default: build dependencies, then asm_subdirs, then convenience
-# libs (.a) and finally the device drivers:
-default: depend asm_subdirs libmesa.a libmesagallium.a libglapi.a \
-       driver_subdirs
+# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
+# then convenience libs (.a) and finally the device drivers:
+default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
+       libglapi.a driver_subdirs
 
 
 
@@ -63,6 +63,12 @@ asm_subdirs:
        fi
 
 
+######################################################################
+# GLSL built-in library
+glsl_builtin:
+       (cd shader/slang/library && $(MAKE)) || exit 1 ;
+
+
 ######################################################################
 # Dependency generation
 
@@ -156,6 +162,7 @@ clean:
        -rm -f depend depend.bak libmesa.a libglapi.a
        -rm -f drivers/*/*.o
        -rm -f *.pc
+       -rm -f shader/slang/library/*_gc.h
        -@cd drivers/dri && $(MAKE) clean
        -@cd drivers/x11 && $(MAKE) clean
        -@cd drivers/osmesa && $(MAKE) clean
index 5033d887c5b8b4ee68b8aadea255527232e026cb..c6964512bfec548cf1f14e5d82a42429e0a3d231 100644 (file)
@@ -4,9 +4,7 @@ TOP = ../../../../..
 
 include $(TOP)/configs/current
 
-INCDIR = $(TOP)/include
-
-LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+GLSL_CL = $(TOP)/src/glsl/apps/compile
 
 #
 # targets
@@ -14,32 +12,13 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
 
 .PHONY: default clean
 
-default: syntax builtin
+default: builtin
 
 clean:
-       -rm -f syn_to_c gc_to_bin *_syn.h *_gc.h
-
-syntax: slang_shader_syn.h
+       -rm -f *_gc.h
 
 builtin: builtin_110 builtin_120
 
-#
-# executables
-#
-
-syn_to_c: syn_to_c.c
-       $(CC) syn_to_c.c -o syn_to_c
-
-gc_to_bin: gc_to_bin.c slang_shader_syn.h
-       $(CC) gc_to_bin.c -o gc_to_bin
-
-#
-# syntax scripts
-#
-
-slang_shader_syn.h: syn_to_c slang_shader.syn
-       ./syn_to_c slang_shader.syn > slang_shader_syn.h
-
 #
 # builtin library sources
 #
@@ -49,24 +28,24 @@ builtin_110: slang_common_builtin_gc.h slang_core_gc.h slang_fragment_builtin_gc
 builtin_120: slang_120_core_gc.h slang_builtin_120_common_gc.h slang_builtin_120_fragment_gc.h
 
 
-slang_120_core_gc.h: gc_to_bin slang_120_core.gc
-       ./gc_to_bin 1 slang_120_core.gc slang_120_core_gc.h
+slang_120_core_gc.h: slang_120_core.gc
+       $(GLSL_CL) fragment slang_120_core.gc slang_120_core_gc.h
 
-slang_builtin_120_common_gc.h: gc_to_bin slang_builtin_120_common.gc
-       ./gc_to_bin 1 slang_builtin_120_common.gc slang_builtin_120_common_gc.h
+slang_builtin_120_common_gc.h: slang_builtin_120_common.gc
+       $(GLSL_CL) fragment slang_builtin_120_common.gc slang_builtin_120_common_gc.h
 
-slang_builtin_120_fragment_gc.h: gc_to_bin slang_builtin_120_fragment.gc
-       ./gc_to_bin 1 slang_builtin_120_fragment.gc slang_builtin_120_fragment_gc.h
+slang_builtin_120_fragment_gc.h: slang_builtin_120_fragment.gc
+       $(GLSL_CL) fragment slang_builtin_120_fragment.gc slang_builtin_120_fragment_gc.h
 
-slang_common_builtin_gc.h: gc_to_bin slang_common_builtin.gc
-       ./gc_to_bin 1 slang_common_builtin.gc slang_common_builtin_gc.h
+slang_common_builtin_gc.h: slang_common_builtin.gc
+       $(GLSL_CL) fragment slang_common_builtin.gc slang_common_builtin_gc.h
 
-slang_core_gc.h: gc_to_bin slang_core.gc
-       ./gc_to_bin 1 slang_core.gc slang_core_gc.h
+slang_core_gc.h: slang_core.gc
+       $(GLSL_CL) fragment slang_core.gc slang_core_gc.h
 
-slang_fragment_builtin_gc.h: gc_to_bin slang_fragment_builtin.gc
-       ./gc_to_bin 1 slang_fragment_builtin.gc slang_fragment_builtin_gc.h
+slang_fragment_builtin_gc.h: slang_fragment_builtin.gc
+       $(GLSL_CL) fragment slang_fragment_builtin.gc slang_fragment_builtin_gc.h
 
-slang_vertex_builtin_gc.h: gc_to_bin slang_vertex_builtin.gc
-       ./gc_to_bin 2 slang_vertex_builtin.gc slang_vertex_builtin_gc.h
+slang_vertex_builtin_gc.h: slang_vertex_builtin.gc
+       $(GLSL_CL) vertex slang_vertex_builtin.gc slang_vertex_builtin_gc.h