apple: Integrate our libGL into the existing build system better
[mesa.git] / src / glx / apple / Makefile
1 TOP = ../../..
2
3 include $(TOP)/configs/current
4
5 #CC=gcc
6 #GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT $(RC_CFLAGS) $(CFLAGS)
7 #GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module
8
9 TCLSH=tclsh8.5
10 MKDIR=mkdir
11 INSTALL=install
12 LN=ln
13 RM=rm
14
15 #INCLUDE=-I. -Iinclude -I.. -DGLX_ALIAS_UNSUPPORTED -I$(INSTALL_DIR)/include -I$(X11_DIR)/include
16
17 #COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c
18
19 #The directory with the final binaries.
20 BUILD_DIR=builds
21
22 all: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
23
24 SOURCES = \
25 apple_cgl.c \
26 apple_glx.c \
27 apple_glx_context.c \
28 apple_glx_drawable.c \
29 apple_glx_pbuffer.c \
30 apple_glx_pixmap.c \
31 apple_glx_surface.c \
32 apple_visual.c \
33 apple_xgl_api.c \
34 apple_xgl_api_read.c \
35 apple_xgl_api_stereo.c \
36 apple_xgl_api_viewport.c \
37 appledri.c \
38 ../clientattrib.c \
39 ../compsize.c \
40 ../glcontextmodes.c \
41 glx_empty.c \
42 glx_error.c \
43 ../glx_pbuffer.c \
44 ../glx_query.c \
45 ../glxcmds.c \
46 ../glxcurrent.c \
47 ../glxext.c \
48 ../glxextensions.c \
49 glxreply.c \
50 ../pixel.c \
51 ../xfont.c
52
53 include $(TOP)/src/mesa/sources.mak
54
55 LDFLAGS += -lXplugin -framework ApplicationServices -framework CoreFoundation
56
57 MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES))
58 MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES))
59 MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS))
60
61 OBJECTS = $(SOURCES:.c=.o) # $(MESA_GLAPI_OBJECTS)
62
63 INCLUDES = -I. -Iinclude -I..\
64 -I$(TOP)/include \
65 -I$(TOP)/include/GL/internal \
66 -I$(TOP)/src/mesa \
67 -I$(TOP)/src/mesa/glapi \
68 $(LIBDRM_CFLAGS) \
69 $(DRI2PROTO_CFLAGS) \
70 $(X11_INCLUDES)
71
72 ##### RULES #####
73
74 $(OBJECTS) : include/GL/gl.h apple_xgl_api.h
75
76 apple_xgl_api.c : apple_xgl_api.h
77
78 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
79 $(TCLSH) gen_code.tcl
80
81 include/GL/gl.h: include/GL/gl.h.template gen_gl_h.sh
82 ./gen_gl_h.sh include/GL/gl.h.template $@
83
84 .c.o:
85 $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
86
87 .S.o:
88 $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
89
90 ##### TARGETS #####
91
92 default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
93
94 # Make libGL
95 $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
96 $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
97 -major 1 -minor 2 $(MKLIB_OPTIONS) \
98 -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
99 $(GL_LIB_DEPS) $(OBJECTS)
100
101 depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile
102 rm -f depend
103 touch depend
104 $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
105 $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES)
106
107 # Emacs tags
108 tags:
109 etags `find . -name \*.[ch]` `find $(TOP)/include`
110
111 install_headers: include/GL/gl.h
112 $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
113 $(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL
114
115 install_libraries: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
116 $(MAKE) -C $(TOP)/src/mesa install-libgl
117
118 install: install_headers install_libraries
119
120 #%.c : ../%.c
121 # ln -s $<
122
123 # Remove .o and backup files
124 clean:
125 -rm -f *.o *.a *~
126 -rm -f *.c~ *.h~
127 -rm -f apple_xgl_api.h apple_xgl_api.c
128 -rm -f *.dylib
129 -rm -f include/GL/gl.h
130 -rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB)
131 -rm -f *.o *~
132 -rm -f depend depend.bak
133
134 -include depend