summaryrefslogtreecommitdiffstats
path: root/src/glsl/Makefile
diff options
context:
space:
mode:
authorChristopher James Halse Rogers <[email protected]>2011-02-03 11:19:32 +1100
committerEric Anholt <[email protected]>2011-02-11 18:31:05 -0800
commitd1e28b22673777fe1290cda899abf73aad02e4aa (patch)
tree27333db1d1d37900f19c63c5754e966ad2a0624a /src/glsl/Makefile
parentb5dc40710d0e5edffb9f673dfbf26df4d0043eef (diff)
mesa: Optionally build a dricore support library (v3)
This an adds --enable-shared-dricore option to configure. When enabled, DRI modules will link against a shared copy of the common mesa routines rather than statically linking these. This saves about 30MB on disc with a full complement of classic DRI drivers. v2: Only enable with a gcc-compatible compiler that handles rpath Handle DRI_CFLAGS without filter-out magic Build shared libraries with the full mklib voodoo Fix typos v3: Resolve conflicts with talloc removal patches Signed-off-by: Christopher James Halse Rogers <[email protected]>
Diffstat (limited to 'src/glsl/Makefile')
-rw-r--r--src/glsl/Makefile34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index 5567555a90f..cf8d4b1a707 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -1,3 +1,4 @@
+
#src/glsl/pp/Makefile
TOP = ../..
@@ -113,6 +114,9 @@ OBJECTS = \
$(C_SOURCES:.c=.o) \
$(CXX_SOURCES:.cpp=.o)
+DRICORE_OBJ_DIR = obj-visible
+OBJECTS_DRICORE = $(addprefix $(DRICORE_OBJ_DIR)/,$(OBJECTS))
+
INCLUDES = \
-I. \
-I../mesa \
@@ -128,7 +132,13 @@ ALL_SOURCES = \
##### TARGETS #####
-default: depend lib$(LIBNAME).a $(APPS)
+default: depend lib$(LIBNAME).a $(APPS) $(DRICORE_GLSL_LIBS)
+
+$(TOP)/$(LIB_DIR)/libglsl.so: $(OBJECTS_DRICORE) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template
+ $(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
+ -cplusplus -noprefix \
+ -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/[email protected] \
+ $(OBJECTS_DRICORE) builtin_function.o
lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template
$(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o
@@ -139,14 +149,24 @@ depend: $(ALL_SOURCES) Makefile
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
# Remove .o and backup files
-clean:
+clean: clean-dricore
rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak builtin_function.cpp builtin_function.o builtin_stubs.o builtin_compiler
-rm -f $(APPS)
+clean-dricore:
+ -rm -f $(DRICORE_OBJ_DIR) $(TOP)/$(LIB_DIR)/libglsl.so libglsl.so
+
+ifneq (,$(DRICORE_GLSL_LIBS))
+DRICORE_INSTALL_TARGET = install-dricore
+endif
+
# Dummy target
-install:
+install: $(DRICORE_INSTALL_TARGET)
@echo -n ""
+install-dricore: default
+ $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
+ $(INSTALL) -m 755 $(DRICORE_GLSL_LIBS) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
##### RULES #####
@@ -163,6 +183,14 @@ glcpp/glcpp: $(GLCPP_OBJECTS)
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+$(DRICORE_OBJ_DIR)/%.o : %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) -c $(INCLUDES) $(DRI_CXXFLAGS) $(DEFINES) $< -o $@
+
+$(DRICORE_OBJ_DIR)/%.o : %.c
+ @mkdir -p $(dir $@)
+ $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(DEFINES) $< -o $@
+
glsl_lexer.cpp: glsl_lexer.lpp
flex --nounistd -o$@ $<