summaryrefslogtreecommitdiffstats
path: root/src/glx/apple/Makefile
blob: 279f7aded9dd68e5c6fa0e802856f150dee597af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
TOP = ../../..

include $(TOP)/configs/current

#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 -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: $(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_additional.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) : 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

.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 $(DESTDIR)$(INSTALL_DIR)/include/GL

install_libraries: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
	$(MAKE) -C $(TOP)/src/mesa install-libgl

install: install_libraries

# Remove .o and backup files
clean:
	-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