Home | History | Annotate | Download | only in gen
      1 # This file isn't used during a normal compilation since we don't want to
      2 # require Python in order to compile Mesa.
      3 # Instead, when the Mesa developers update/change the API interface it's
      4 # up to him/her to re-run this makefile and check in the newly generated files.
      5 
      6 
      7 TOP = ../../../..
      8 
      9 # These are the "official" xserver indent flags from utils/modular/x-indent.sh
     10 XORG_INDENT_FLAGS = -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 -lc80 -psl -nbbo \
     11     -nbc -psl -nbfda -nut -nss -T pointer -T ScreenPtr -T ScrnInfoPtr -T pointer \
     12     -T DeviceIntPtr -T DevicePtr -T ClientPtr -T CallbackListPtr \
     13     -T CallbackProcPtr -T OsTimerPtr -T CARD32 -T CARD16 -T CARD8 \
     14     -T INT32 -T INT16 -T INT8 -T Atom -T Time -T WindowPtr -T DrawablePtr \
     15     -T PixmapPtr -T ColormapPtr -T CursorPtr -T Font -T XID -T Mask \
     16     -T BlockHandlerProcPtr -T WakeupHandlerProcPtr -T RegionPtr \
     17     -T InternalEvent -T GrabPtr -T Timestamp -T Bool -T TimeStamp \
     18     -T xEvent -T DeviceEvent -T RawDeviceEvent -T GrabMask -T Window \
     19     -T Drawable -T FontPtr -T CallbackPtr -T XIPropertyValuePtr \
     20     -T GrabParameters -T deviceKeyButtonPointer -T TouchOwnershipEvent \
     21     -T xGenericEvent -T DeviceChangedEvent -T GCPtr -T BITS32 \
     22     -T xRectangle -T BoxPtr -T RegionRec -T ValuatorMask -T KeyCode \
     23     -T KeySymsPtr -T XkbDescPtr -T InputOption -T XI2Mask -T DevUnion \
     24     -T DevPrivateKey -T DevScreenPrivateKey -T PropertyPtr -T RESTYPE \
     25     -T XkbAction -T XkbChangesPtr -T XkbControlsPtr -T PrivatePtr -T pmWait \
     26     -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT
     27 
     28 
     29 MESA_DIR = $(TOP)/src/mesa
     30 MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi
     31 MESA_MAPI_DIR = $(TOP)/src/mapi/mapi
     32 MESA_GLX_DIR = $(TOP)/src/glx
     33 
     34 MESA_GLAPI_OUTPUTS = \
     35 	$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h \
     36 	$(MESA_GLAPI_DIR)/glprocs.h \
     37 	$(MESA_GLAPI_DIR)/glapitemp.h \
     38 	$(MESA_GLAPI_DIR)/glapitable.h \
     39 	$(MESA_GLAPI_DIR)/glapi_gentable.c
     40 
     41 MESA_GLAPI_ASM_OUTPUTS =
     42 if HAVE_X86_ASM
     43 MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86.S
     44 endif
     45 
     46 if HAVE_X86_64_ASM
     47 MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86-64.S
     48 endif
     49 
     50 if HAVE_SPARC_ASM
     51 MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_sparc.S
     52 endif
     53 
     54 MESA_OUTPUTS = \
     55 	$(MESA_GLAPI_OUTPUTS) \
     56 	$(MESA_GLAPI_ASM_OUTPUTS) \
     57 	$(MESA_DIR)/main/enums.c \
     58 	$(MESA_DIR)/main/dispatch.h \
     59 	$(MESA_DIR)/main/remap_helper.h \
     60 	$(MESA_GLX_DIR)/indirect.c \
     61 	$(MESA_GLX_DIR)/indirect.h \
     62 	$(MESA_GLX_DIR)/indirect_init.c \
     63 	$(MESA_GLX_DIR)/indirect_size.h \
     64 	$(MESA_GLX_DIR)/indirect_size.c
     65 
     66 ######################################################################
     67 
     68 XORG_GLX_DIR = $(XORG_BASE)/glx
     69 XORG_GLAPI_DIR = $(XORG_BASE)/glx
     70 
     71 XORG_GLAPI_OUTPUTS = \
     72 	$(XORG_GLAPI_DIR)/glprocs.h \
     73 	$(XORG_GLAPI_DIR)/glapitable.h \
     74 	$(XORG_GLAPI_DIR)/dispatch.h \
     75 	$(XORG_GLAPI_DIR)/glapi_gentable.c
     76 
     77 XORG_OUTPUTS = \
     78 	$(XORG_GLAPI_OUTPUTS) \
     79 	$(XORG_GLX_DIR)/indirect_dispatch.c \
     80 	$(XORG_GLX_DIR)/indirect_dispatch_swap.c \
     81 	$(XORG_GLX_DIR)/indirect_dispatch.h \
     82 	$(XORG_GLX_DIR)/indirect_reqsize.c \
     83 	$(XORG_GLX_DIR)/indirect_reqsize.h \
     84 	$(XORG_GLX_DIR)/indirect_size.h \
     85 	$(XORG_GLX_DIR)/indirect_size_get.c \
     86 	$(XORG_GLX_DIR)/indirect_size_get.h \
     87 	$(XORG_GLX_DIR)/indirect_table.c
     88 
     89 ######################################################################
     90 
     91 API_XML = \
     92 	gl_API.xml \
     93 	ARB_base_instance.xml \
     94 	ARB_color_buffer_float.xml \
     95 	ARB_copy_buffer.xml \
     96 	ARB_debug_output.xml \
     97 	ARB_depth_buffer_float.xml \
     98 	ARB_depth_clamp.xml \
     99 	ARB_draw_buffers_blend.xml \
    100 	ARB_draw_elements_base_vertex.xml \
    101 	ARB_draw_instanced.xml \
    102 	ARB_ES2_compatibility.xml \
    103 	ARB_framebuffer_object.xml \
    104 	ARB_geometry_shader4.xml \
    105 	ARB_instanced_arrays.xml \
    106 	ARB_map_buffer_range.xml \
    107 	ARB_robustness.xml \
    108 	ARB_sampler_objects.xml \
    109 	ARB_seamless_cube_map.xml \
    110 	ARB_sync.xml \
    111 	ARB_texture_buffer_object.xml \
    112 	ARB_texture_compression_rgtc.xml \
    113 	ARB_texture_float.xml \
    114 	ARB_texture_rg.xml \
    115 	ARB_texture_storage.xml \
    116 	ARB_vertex_array_object.xml \
    117 	AMD_draw_buffers_blend.xml \
    118 	ARB_vertex_type_2_10_10_10_rev.xml \
    119 	APPLE_object_purgeable.xml \
    120 	APPLE_vertex_array_object.xml \
    121 	ARB_uniform_buffer_object.xml \
    122 	EXT_draw_buffers2.xml \
    123 	EXT_framebuffer_object.xml \
    124 	EXT_gpu_shader4.xml \
    125 	EXT_packed_depth_stencil.xml \
    126 	EXT_provoking_vertex.xml \
    127 	EXT_separate_shader_objects.xml \
    128 	EXT_texture_array.xml \
    129 	EXT_texture_integer.xml \
    130 	EXT_transform_feedback.xml \
    131 	NV_conditional_render.xml \
    132 	NV_primitive_restart.xml \
    133 	NV_texture_barrier.xml \
    134 	OES_EGL_image.xml \
    135 	GL3x.xml
    136 
    137 
    138 COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py
    139 
    140 COMMON_ES = \
    141 	$(COMMON) \
    142 	gl_and_es_API.xml \
    143 	es_EXT.xml \
    144 	ARB_ES2_compatibility.xml \
    145 	ARB_get_program_binary.xml \
    146 	OES_fixed_point.xml \
    147 	OES_single_precision.xml
    148 
    149 COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
    150 
    151 PYTHON_GEN = $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS)
    152 
    153 ######################################################################
    154 
    155 all-local: $(MESA_OUTPUTS)
    156 
    157 xorg: check-xorg-source $(XORG_OUTPUTS)
    158 
    159 check-xorg-source:
    160 	@if ! test -d $(XORG_GLX_DIR); then \
    161 		echo "ERROR: Must specify path to xserver/ checkout. Set XORG_BASE env var."; \
    162 		if test x$(XORG_BASE) != x; then \
    163 			echo "'$(XORG_GLX_DIR)' does not exist."; \
    164 		fi; \
    165 		exit 1; \
    166 	fi
    167 
    168 clean-local:
    169 	-rm -f *~ *.pyo
    170 	-rm -f $(MESA_OUTPUTS)
    171 
    172 ######################################################################
    173 
    174 $(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c
    175 	$(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
    176 
    177 $(XORG_GLAPI_DIR)/dispatch.h: $(MESA_DIR)/main/dispatch.h
    178 	$(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
    179 
    180 $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
    181 	$(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
    182 
    183 ######################################################################
    184 
    185 $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES)
    186 	$(PYTHON_GEN) $< \
    187 		--printer glapi --mode lib $(srcdir)/gl_and_es_API.xml > $@
    188 
    189 $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
    190 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    191 
    192 $(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON)
    193 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    194 
    195 $(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON)
    196 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    197 
    198 $(MESA_GLAPI_DIR)/glapi_gentable.c: gl_gentable.py $(COMMON)
    199 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    200 
    201 ######################################################################
    202 
    203 $(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON)
    204 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    205 
    206 $(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON)
    207 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    208 
    209 $(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON)
    210 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    211 
    212 ######################################################################
    213 
    214 $(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON_ES)
    215 	$(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@
    216 
    217 $(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON)
    218 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m remap_table > $@
    219 
    220 $(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON)
    221 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
    222 
    223 ######################################################################
    224 
    225 $(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX)
    226 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m proto \
    227 	  | $(INDENT) $(INDENT_FLAGS) > $@
    228 
    229 $(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX)
    230 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m init_h > $@
    231 
    232 $(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX)
    233 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m init_c > $@
    234 
    235 $(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX)
    236 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_h --only-set \
    237 	    -h _INDIRECT_SIZE_H_ \
    238 	  | $(INDENT) $(INDENT_FLAGS) > $@
    239 
    240 $(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
    241 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_c --only-set \
    242 	  | $(INDENT) $(INDENT_FLAGS) > $@
    243 
    244 ######################################################################
    245 
    246 $(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX)
    247 	$(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m dispatch_c \
    248 	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
    249 
    250 $(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX)
    251 	$(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m dispatch_c -s \
    252 	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
    253 
    254 $(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX)
    255 	$(PYTHON_GEN) $(PYTHON_FLAGS) $< -m dispatch_h -f $(srcdir)/gl_and_glX_API.xml -s \
    256 	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
    257 
    258 $(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX)
    259 	$(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m size_h \
    260            --only-get -h '_INDIRECT_SIZE_GET_H_' \
    261 	  | $(INDENT) $(XORG_INDENT_FLAGS) > $@
    262 
    263 $(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX)
    264 	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_c \
    265 	  | $(INDENT) $(INDENT_FLAGS) > $@
    266 
    267 $(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX)
    268 	$(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m reqsize_h \
    269            --only-get -h '_INDIRECT_SIZE_GET_H_' \
    270 	  | $(INDENT) $(XORG_INDENT_FLAGS) > $@
    271 
    272 $(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX)
    273 	$(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m reqsize_c \
    274           | $(INDENT) $(XORG_INDENT_FLAGS) > $@
    275 
    276 $(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX)
    277 	$(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_and_glX_API.xml \
    278 	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
    279