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