Home | History | Annotate | Download | only in egl-static
      1 # src/gallium/targets/egl-static/Makefile
      2 #
      3 # This is Makefile for egl_gallium.so.  It is static in that all state trackers
      4 # and pipe drivers are linked statically when possible.
      5 #
      6 # The following variables are examined
      7 #
      8 #   EGL_PLATFORMS       - platforms to support
      9 #   EGL_CLIENT_APIS     - state trackers to support
     10 #   GALLIUM_WINSYS_DIRS - pipe drivers to support
     11 #   SHARED_GLAPI        - st/mesa can be statically linked or not
     12 #
     13 
     14 TOP = ../../../..
     15 include $(TOP)/configs/current
     16 
     17 OUTPUTS := egl_gallium
     18 
     19 egl_CPPFLAGS := \
     20 	-I$(TOP)/include \
     21 	-I$(TOP)/src/gallium/auxiliary \
     22 	-I$(TOP)/src/gallium/drivers \
     23 	-I$(TOP)/src/gallium/include \
     24 	-I$(TOP)/src/gallium/winsys
     25 egl_LIBS := \
     26 	$(TOP)/src/gallium/drivers/identity/libidentity.a \
     27 	$(TOP)/src/gallium/drivers/trace/libtrace.a \
     28 	$(TOP)/src/gallium/drivers/rbug/librbug.a \
     29 	$(GALLIUM_AUXILIARIES)
     30 egl_SYS :=
     31 
     32 egl_SOURCES := \
     33 	egl.c \
     34 	egl_pipe.c \
     35 	egl_st.c
     36 
     37 egl_OBJECTS := $(egl_SOURCES:%.c=%.o)
     38 
     39 # st/egl
     40 egl_CPPFLAGS += \
     41 	-I$(TOP)/src/gallium/state_trackers/egl \
     42 	-I$(TOP)/src/egl/main \
     43 	-D_EGL_MAIN=_eglMain
     44 egl_LIBS += $(TOP)/src/gallium/state_trackers/egl/libegl.a
     45 egl_SYS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -lEGL -lm -lpthread
     46 
     47 # EGL platforms
     48 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
     49 egl_CPPFLAGS += $(LIBDRM_CFLAGS)
     50 egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
     51 egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIBS)
     52 endif
     53 ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
     54 egl_CPPFLAGS += $(LIBDRM_CFLAGS)
     55 egl_LIBS += $(TOP)/src/gallium/winsys/sw/wayland/libws_wayland.a
     56 egl_LIBS += $(TOP)/src/egl/wayland/wayland-drm/.libs/libwayland-drm.a
     57 egl_SYS += $(LIBDRM_LIBS) $(WAYLAND_LIBS)
     58 endif
     59 ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
     60 egl_CPPFLAGS += $(LIBDRM_CFLAGS)
     61 egl_SYS += $(LIBDRM_LIBS) -lgbm
     62 endif
     63 ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
     64 egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
     65 endif
     66 ifneq ($(findstring null, $(EGL_PLATFORMS)),)
     67 egl_LIBS += $(TOP)/src/gallium/winsys/sw/null/libws_null.a
     68 endif
     69 
     70 # st/mesa
     71 ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),)
     72 egl_CPPFLAGS += -I$(TOP)/src/mesa $(API_DEFINES)
     73 # make st/mesa built-in when there is a single glapi provider
     74 ifeq ($(SHARED_GLAPI),1)
     75 egl_LIBS += $(TOP)/src/mesa/libmesagallium.a
     76 egl_SYS += -lm -lpthread $(DLOPEN_LIBS) -l$(GLAPI_LIB)
     77 else
     78 egl_CPPFLAGS += -D_EGL_EXTERNAL_GL=1
     79 OUTPUTS += st_GL
     80 endif # SHARED_GLAPI
     81 endif
     82 
     83 # st/vega
     84 ifneq ($(filter $(VG_LIB), $(EGL_CLIENT_APIS)),)
     85 egl_CPPFLAGS += -I$(TOP)/src/gallium/state_trackers/vega -DFEATURE_VG=1
     86 egl_LIBS += $(TOP)/src/gallium/state_trackers/vega/libvega.a
     87 egl_SYS += -lm -l$(VG_LIB)
     88 endif
     89 
     90 # i915
     91 ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
     92 egl_CPPFLAGS += -D_EGL_PIPE_I915=1
     93 egl_LIBS += \
     94 	$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
     95 	$(TOP)/src/gallium/drivers/i915/libi915.a
     96 egl_SYS += $(INTEL_LIBS)
     97 endif
     98 
     99 # nouveau
    100 ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
    101 egl_CPPFLAGS += -D_EGL_PIPE_NOUVEAU=1
    102 egl_LIBS += \
    103 	$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
    104 	$(TOP)/src/gallium/drivers/nv30/libnv30.a \
    105 	$(TOP)/src/gallium/drivers/nv50/libnv50.a \
    106 	$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
    107 	$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
    108 egl_SYS += $(NOUVEAU_LIBS)
    109 endif
    110 
    111 # r300
    112 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
    113 ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
    114 egl_CPPFLAGS += -D_EGL_PIPE_R300=1
    115 egl_LIBS += \
    116 	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
    117 	$(TOP)/src/gallium/drivers/r300/libr300.a
    118 egl_SYS += $(RADEON_LIBS)
    119 endif
    120 endif
    121 
    122 # r600
    123 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
    124 ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
    125 egl_CPPFLAGS += -D_EGL_PIPE_R600=1
    126 egl_LIBS += \
    127 	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
    128 	$(TOP)/src/gallium/drivers/r600/libr600.a
    129 egl_SYS += $(RADEON_LIBS)
    130 endif
    131 endif
    132 
    133 # radeonsi
    134 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
    135 ifneq ($(findstring radeonsi,$(GALLIUM_DRIVERS_DIRS)),)
    136 egl_CPPFLAGS += -D_EGL_PIPE_RADEONSI=1
    137 egl_LIBS += \
    138 	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
    139 	$(TOP)/src/gallium/drivers/radeonsi/libradeonsi.a
    140 egl_SYS += $(RADEON_LIBS)
    141 endif
    142 endif
    143 
    144 # vmwgfx
    145 ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
    146 egl_CPPFLAGS += -D_EGL_PIPE_VMWGFX=1
    147 egl_LIBS += \
    148 	$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
    149 	$(TOP)/src/gallium/drivers/svga/libsvga.a
    150 endif
    151 
    152 # softpipe
    153 ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
    154 egl_CPPFLAGS += -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE
    155 egl_LIBS += $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
    156 egl_SYS += -lm
    157 endif
    158 
    159 # llvmpipe
    160 ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
    161 egl_CPPFLAGS += -DGALLIUM_LLVMPIPE
    162 egl_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
    163 endif
    164 
    165 # sort to remove duplicates
    166 egl_CPPFLAGS := $(sort $(egl_CPPFLAGS))
    167 egl_LIBS := $(sort $(egl_LIBS))
    168 egl_SYS := $(sort $(egl_SYS))
    169 
    170 # st_GL, built only when shared glapi is not enabled
    171 st_GL_CPPFLAGS := -I $(TOP)/src/mesa -I$(TOP)/src/gallium/include
    172 st_GL_LIBS := $(TOP)/src/mesa/libmesagallium.a $(GALLIUM_AUXILIARIES)
    173 st_GL_SYS := -lm -lpthread $(DLOPEN_LIBS)
    174 
    175 # LLVM
    176 ifeq ($(MESA_LLVM),1)
    177 egl_SYS += $(LLVM_LIBS)
    178 LDFLAGS += $(LLVM_LDFLAGS)
    179 
    180 st_GL_SYS += $(LLVM_LIBS)
    181 endif
    182 
    183 OUTPUT_PATH := $(TOP)/$(LIB_DIR)/egl
    184 OUTPUTS := $(addprefix $(OUTPUT_PATH)/, $(addsuffix .so, $(OUTPUTS)))
    185 
    186 default: $(OUTPUTS)
    187 
    188 $(OUTPUT_PATH)/egl_gallium.so: $(egl_OBJECTS) $(egl_LIBS)
    189 	$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
    190 		-ldflags '-L$(TOP)/$(LIB_DIR) -Wl,--no-undefined $(LDFLAGS)' \
    191 		-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
    192 		$(egl_OBJECTS) -Wl,--start-group $(egl_LIBS) -Wl,--end-group \
    193 		$(egl_SYS)
    194 
    195 $(OUTPUT_PATH)/st_GL.so: st_GL.o $(st_GL_LIBS)
    196 	$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
    197 		-ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
    198 		-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
    199 		$< -Wl,--start-group $(st_GL_LIBS) -Wl,--end-group \
    200 		$(st_GL_SYS)
    201 
    202 $(egl_OBJECTS): %.o: %.c
    203 	$(CC) -c -o $@ $< $(egl_CPPFLAGS) $(DEFINES) $(CFLAGS)
    204 
    205 st_GL.o: st_GL.c
    206 	$(CC) -c -o $@ $< $(st_GL_CPPFLAGS) $(DEFINES) $(CFLAGS)
    207 
    208 install: $(OUTPUTS)
    209 	$(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
    210 	for out in $(OUTPUTS); do \
    211 		$(MINSTALL) -m 755 "$$out" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
    212 	done
    213 
    214 clean:
    215 	rm -f *.o
    216