From: michal Date: Thu, 10 Dec 2009 00:03:15 +0000 (+0100) Subject: Build mesa glsl with make. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=068596c9a7e8d330ffdff8ad8700bd6093b5bdea;p=mesa.git Build mesa glsl with make. Still don't know how to add glsl to mesa dependencies. --- diff --git a/Makefile b/Makefile index ea00e811b77..0f759d86dfe 100644 --- 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 \ diff --git a/configs/default b/configs/default index cb3ca1046f4..f3659312040 100644 --- a/configs/default +++ b/configs/default @@ -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 index 00000000000..ca7f2d2ac7d --- /dev/null +++ b/src/glsl/Makefile @@ -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 index 00000000000..974987a0a04 --- /dev/null +++ b/src/glsl/Makefile.template @@ -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 index 00000000000..c80fcb9d974 --- /dev/null +++ b/src/glsl/apps/Makefile @@ -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 index 00000000000..04a52df8c33 --- /dev/null +++ b/src/glsl/cl/Makefile @@ -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 index 00000000000..819079f6258 --- /dev/null +++ b/src/glsl/pp/Makefile @@ -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 + diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 8300b301441..67cac2d2480 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -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 diff --git a/src/mesa/shader/slang/library/Makefile b/src/mesa/shader/slang/library/Makefile index 5033d887c5b..c6964512bfe 100644 --- a/src/mesa/shader/slang/library/Makefile +++ b/src/mesa/shader/slang/library/Makefile @@ -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