From: Jeremy Huddleston Date: Fri, 2 Apr 2010 07:57:38 +0000 (-0700) Subject: apple: Integrate our libGL into the existing build system better X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=de96d063b1eba9137d96074c9434aafe858d3271;p=mesa.git apple: Integrate our libGL into the existing build system better Signed-off-by: Jeremy Huddleston --- diff --git a/configs/darwin b/configs/darwin index d28d5906ba1..e5196848776 100644 --- a/configs/darwin +++ b/configs/darwin @@ -13,7 +13,10 @@ CC = gcc CXX = g++ PIC_FLAGS = -fPIC DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \ - -DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING + -DGLX_ALIAS_UNSUPPORTED \ + -DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL + +# -DGLX_INDIRECT_RENDERING \ # -D_GNU_SOURCE - for src/mesa/main ... # -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx @@ -49,7 +52,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm # omit glw lib for now: -SRC_DIRS = glsl glx mesa gallium glu glut/glx glew +SRC_DIRS = glsl glx/apple mesa gallium glu glut/glx glew GLU_DIRS = sgi DRIVER_DIRS = osmesa #DRIVER_DIRS = dri diff --git a/src/glx/Makefile b/src/glx/Makefile index 6711fdc61bb..c6ebc49828b 100644 --- a/src/glx/Makefile +++ b/src/glx/Makefile @@ -90,7 +90,7 @@ install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) # Remove .o and backup files clean: - -rm -f $(TOP)/$(LIB_DIR)/libGL.so* + -rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) -rm -f *.o *~ -rm -f depend depend.bak diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile index a3ee888288b..8fa5b01f286 100644 --- a/src/glx/apple/Makefile +++ b/src/glx/apple/Makefile @@ -1,97 +1,134 @@ -INSTALL_DIR = /usr/X11 -X11_DIR = $(INSTALL_DIR) +TOP = ../../.. -CC=gcc -GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT -DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL -DGLX_ALIAS_UNSUPPORTED $(RC_CFLAGS) $(CFLAGS) -GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module +include $(TOP)/configs/current -TCLSH=tclsh8.5 +#CC=gcc +#GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT $(RC_CFLAGS) $(CFLAGS) +#GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module +TCLSH=tclsh8.5 MKDIR=mkdir INSTALL=install LN=ln RM=rm -INCLUDE=-I. -Iinclude -Iinclude/internal -I.. -I../../../include -I../../../src/mesa -I../../../src/mesa/glapi -I$(INSTALL_DIR)/include -I$(X11_DIR)/include -COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c +#INCLUDE=-I. -Iinclude -I.. -DGLX_ALIAS_UNSUPPORTED -I$(INSTALL_DIR)/include -I$(X11_DIR)/include + +#COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c #The directory with the final binaries. BUILD_DIR=builds -all: $(BUILD_DIR)/libGL.1.2.dylib - -OBJECTS=clientattrib.o glxext.o glxcmds.o glx_pbuffer.o glx_query.o glxcurrent.o glxextensions.o \ - appledri.o apple_glx_context.o apple_glx.o pixel.o \ - compsize.o apple_visual.o apple_cgl.o glxreply.o glcontextmodes.o \ - apple_xgl_api.o apple_glx_drawable.o xfont.o apple_glx_pbuffer.o \ - apple_glx_pixmap.o apple_xgl_api_read.o glx_empty.o glx_error.o \ - apple_xgl_api_viewport.o apple_glx_surface.o apple_xgl_api_stereo.o - -$(BUILD_DIR)/libGL.1.2.dylib: $(OBJECTS) - -if ! test -d $(BUILD_DIR); then $(MKDIR) $(BUILD_DIR); fi - $(CC) $(GL_CFLAGS) -o $@ -dynamiclib -install_name $(INSTALL_DIR)/lib/libGL.1.dylib -compatibility_version 1.2 -current_version 1.2 -lXplugin -framework ApplicationServices -framework CoreFoundation $(GL_LDFLAGS) -lXext -lX11 -Wl,-exported_symbols_list,exports.list $(OBJECTS) - -.c.o: - $(COMPILE) $< - -apple_glx_drawable.o: apple_glx_drawable.h apple_glx_drawable.c include/GL/gl.h -apple_xgl_api.o: apple_xgl_api.h apple_xgl_api.c apple_xgl_api_stereo.c include/GL/gl.h -apple_xgl_api_read.o: apple_xgl_api_read.h apple_xgl_api_read.c apple_xgl_api.h include/GL/gl.h -apple_xgl_api_viewport.o: apple_xgl_api_viewport.h apple_xgl_api_viewport.c apple_xgl_api.h include/GL/gl.h -apple_xgl_api_stereo.o: apple_xgl_api_stereo.h apple_xgl_api_stereo.c apple_xgl_api.h include/GL/gl.h -glcontextmodes.o: glcontextmodes.c include/GL/gl.h -glxext.o: glxext.c include/GL/gl.h -glxreply.o: glxreply.c include/GL/gl.h -glxcmds.o: glxcmds.c apple_glx_context.h include/GL/gl.h -glx_pbuffer.o: glx_pbuffer.c include/GL/gl.h -glx_error.o: glx_error.c include/GL/gl.h -glx_query.o: glx_query.c include/GL/gl.h -glxcurrent.o: glxcurrent.c include/GL/gl.h -glxextensions.o: glxextensions.c include/GL/gl.h -glxhash.o: glxhash.h glxhash.c include/GL/gl.h -appledri.o: appledri.h appledristr.h appledri.c include/GL/gl.h -apple_glx_context.o: apple_glx_context.c apple_glx_context.h apple_glx_context.h include/GL/gl.h -apple_glx.o: apple_glx.h apple_glx.c apple_xgl_api.h include/GL/gl.h -apple_visual.o: apple_visual.h apple_visual.c include/GL/gl.h -apple_cgl.o: apple_cgl.h apple_cgl.c include/GL/gl.h -apple_glx_pbuffer.o: apple_glx_drawable.h apple_glx_pbuffer.c include/GL/gl.h -apple_glx_pixmap.o: apple_glx_drawable.h apple_glx_pixmap.c appledri.h include/GL/gl.h -apple_glx_surface.o: apple_glx_drawable.h apple_glx_surface.c appledri.h include/GL/gl.h -xfont.o: xfont.c include/GL/gl.h -compsize.o: compsize.c include/GL/gl.h -renderpix.o: renderpix.c include/GL/gl.h -singlepix.o: singlepix.c include/GL/gl.h -pixel.o: pixel.c include/GL/gl.h -glx_empty.o: glx_empty.c include/GL/gl.h - -apple_xgl_api.c: apple_xgl_api.h -apple_xgl_api.h: gen_api_header.tcl gen_api_library.tcl gen_code.tcl gen_defs.tcl gen_exports.tcl gen_funcs.tcl gen_types.tcl +all: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) + +SOURCES = \ + apple_cgl.c \ + apple_glx.c \ + apple_glx_context.c \ + apple_glx_drawable.c \ + apple_glx_pbuffer.c \ + apple_glx_pixmap.c \ + apple_glx_surface.c \ + apple_visual.c \ + apple_xgl_api.c \ + apple_xgl_api_read.c \ + apple_xgl_api_stereo.c \ + apple_xgl_api_viewport.c \ + appledri.c \ + ../clientattrib.c \ + ../compsize.c \ + ../glcontextmodes.c \ + glx_empty.c \ + glx_error.c \ + ../glx_pbuffer.c \ + ../glx_query.c \ + ../glxcmds.c \ + ../glxcurrent.c \ + ../glxext.c \ + ../glxextensions.c \ + glxreply.c \ + ../pixel.c \ + ../xfont.c + +include $(TOP)/src/mesa/sources.mak + +LDFLAGS += -lXplugin -framework ApplicationServices -framework CoreFoundation + +MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES)) +MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES)) +MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS)) + +OBJECTS = $(SOURCES:.c=.o) # $(MESA_GLAPI_OBJECTS) + +INCLUDES = -I. -Iinclude -I..\ + -I$(TOP)/include \ + -I$(TOP)/include/GL/internal \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/glapi \ + $(LIBDRM_CFLAGS) \ + $(DRI2PROTO_CFLAGS) \ + $(X11_INCLUDES) + +##### RULES ##### + +$(OBJECTS) : include/GL/gl.h apple_xgl_api.h + +apple_xgl_api.c : apple_xgl_api.h + +apple_xgl_api.h : gen_api_header.tcl gen_api_library.tcl gen_code.tcl gen_defs.tcl gen_exports.tcl gen_funcs.tcl gen_types.tcl $(TCLSH) gen_code.tcl include/GL/gl.h: include/GL/gl.h.template gen_gl_h.sh ./gen_gl_h.sh include/GL/gl.h.template $@ +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@ + +##### TARGETS ##### + +default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) + +# Make libGL +$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile + $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major 1 -minor 2 $(MKLIB_OPTIONS) \ + -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \ + $(GL_LIB_DEPS) $(OBJECTS) + +depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \ + $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find $(TOP)/include` + install_headers: include/GL/gl.h $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL - $(INSTALL) -m 644 include/GL/gl.h include/GL/glext.h include/GL/glx.h include/GL/glxext.h $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL -install_libraries: $(BUILD_DIR)/libGL.1.2.dylib - $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/lib - $(INSTALL) -m 755 $(BUILD_DIR)/libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib - $(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib - $(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib - $(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib - $(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib +install_libraries: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) + $(MAKE) -C $(TOP)/src/mesa install-libgl install: install_headers install_libraries +#%.c : ../%.c +# ln -s $< + +# Remove .o and backup files clean: - rm -rf $(BUILD_DIR) - rm -f *.o *.a - rm -f *.c~ *.h~ - rm -f apple_xgl_api.h apple_xgl_api.c - rm -f *.dylib - rm -f include/GL/gl.h - -%.c : ../%.c - ln -s $< + -rm -f *.o *.a *~ + -rm -f *.c~ *.h~ + -rm -f apple_xgl_api.h apple_xgl_api.c + -rm -f *.dylib + -rm -f include/GL/gl.h + -rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) + -rm -f *.o *~ + -rm -f depend depend.bak + +-include depend