1# Makefile for building pipe driver shared libraries. 2# 3# Input variables: PIPE_INSTALL_DIR, PIPE_PREFIX (optional) 4# 5TOP = ../../../.. 6include $(TOP)/configs/current 7 8PIPE_PREFIX ?= pipe_ 9 10PIPE_CPPFLAGS = \ 11 -DGALLIUM_RBUG \ 12 -DGALLIUM_TRACE \ 13 -DGALLIUM_GALAHAD \ 14 -I$(TOP)/include \ 15 -I$(TOP)/src/gallium/auxiliary \ 16 -I$(TOP)/src/gallium/drivers \ 17 -I$(TOP)/src/gallium/include \ 18 -I$(TOP)/src/gallium/winsys 19 20PIPE_LIBS = \ 21 $(TOP)/src/gallium/drivers/identity/libidentity.a \ 22 $(TOP)/src/gallium/drivers/galahad/libgalahad.a \ 23 $(TOP)/src/gallium/drivers/trace/libtrace.a \ 24 $(TOP)/src/gallium/drivers/rbug/librbug.a \ 25 $(GALLIUM_AUXILIARIES) 26 27PIPE_SYS = $(LIBDRM_LIBS) -lm -lpthread $(DLOPEN_LIBS) 28 29PIPE_CFLAGS = $(LIBDRM_CFLAGS) 30 31PIPE_LDFLAGS = -Wl,--no-undefined 32 33# i915 pipe driver 34i915_LIBS = \ 35 $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \ 36 $(TOP)/src/gallium/drivers/i915/libi915.a 37i915_SYS = $(INTEL_LIBS) 38 39# nouveau pipe driver 40nouveau_LIBS = \ 41 $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \ 42 $(TOP)/src/gallium/drivers/nv30/libnv30.a \ 43 $(TOP)/src/gallium/drivers/nv50/libnv50.a \ 44 $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \ 45 $(TOP)/src/gallium/drivers/nouveau/libnouveau.a 46nouveau_SYS = $(NOUVEAU_LIBS) 47 48# r300 pipe driver 49r300_LIBS = \ 50 $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ 51 $(TOP)/src/gallium/drivers/r300/libr300.a 52r300_SYS += $(RADEON_LIBS) 53 54# r600 pipe driver 55r600_LIBS = \ 56 $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ 57 $(TOP)/src/gallium/drivers/r600/libr600.a 58r600_SYS += $(RADEON_LIBS) 59 60# radeonsi pipe driver 61radeonsi_LIBS = \ 62 $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ 63 $(TOP)/src/gallium/drivers/radeonsi/libradeonsi.a 64radeonsi_SYS += $(RADEON_LIBS) 65 66# vmwgfx pipe driver 67vmwgfx_LIBS = \ 68 $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \ 69 $(TOP)/src/gallium/drivers/svga/libsvga.a 70 71ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),) 72 swrast_LIBS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a 73 PIPE_CFLAGS += -DGALLIUM_LLVMPIPE 74else ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),) 75 swrast_LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a 76 PIPE_CFLAGS += -DGALLIUM_SOFTPIPE 77endif 78 79# LLVM 80ifeq ($(MESA_LLVM),1) 81 PIPE_SYS += $(LLVM_LIBS) 82 PIPE_LDFLAGS += $(LLVM_LDFLAGS) 83endif 84 85# determine the targets/sources 86_PIPE_TARGETS_CC = 87_PIPE_TARGETS_CXX = 88PIPE_SOURCES = 89 90ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),) 91 _PIPE_TARGETS_CC += $(PIPE_PREFIX)i915.so 92 PIPE_SOURCES += pipe_i915.c 93endif 94 95ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),) 96 _PIPE_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so 97 PIPE_SOURCES += pipe_nouveau.c 98endif 99 100ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),) 101ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),) 102 _PIPE_TARGETS_CC += $(PIPE_PREFIX)r300.so 103 PIPE_SOURCES += pipe_r300.c 104endif 105endif 106 107ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),) 108ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),) 109 _PIPE_TARGETS_CC += $(PIPE_PREFIX)r600.so 110 PIPE_SOURCES += pipe_r600.c 111endif 112endif 113 114ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),) 115ifneq ($(findstring radeonsi,$(GALLIUM_DRIVERS_DIRS)),) 116 _PIPE_TARGETS_CC += $(PIPE_PREFIX)radeonsi.so 117 PIPE_SOURCES += pipe_radeonsi.c 118endif 119endif 120 121ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),) 122 _PIPE_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so 123 PIPE_SOURCES += pipe_vmwgfx.c 124endif 125 126ifneq ($(filter llvmpipe softpipe,$(GALLIUM_DRIVERS_DIRS)),) 127 _PIPE_TARGETS_CC += $(PIPE_PREFIX)swrast.so 128 PIPE_SOURCES += pipe_swrast.c 129endif 130 131PIPE_OBJECTS := $(PIPE_SOURCES:.c=.o) 132 133ifeq ($(MESA_LLVM),1) 134 PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) $(_PIPE_TARGETS_CC) 135 PIPE_TARGETS_CC = 136else 137 PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) 138 PIPE_TARGETS_CC = $(_PIPE_TARGETS_CC) 139endif 140 141PIPE_TARGETS = $(PIPE_TARGETS_CC) $(PIPE_TARGETS_CXX) 142 143default: depend $(PIPE_TARGETS) 144 145.SECONDEXPANSION: 146 147$(PIPE_TARGETS_CC): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS) 148 $(MKLIB) -o $@ -noprefix -linker '$(CC)' \ 149 -ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \ 150 $(MKLIB_OPTIONS) $< \ 151 -Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \ 152 $(PIPE_SYS) $($*_SYS) 153 154$(PIPE_TARGETS_CXX): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS) 155 $(MKLIB) -o $@ -noprefix -linker '$(CXX)' \ 156 -ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \ 157 $(MKLIB_OPTIONS) $< \ 158 -Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \ 159 $(PIPE_SYS) $($*_SYS) 160 161$(PIPE_OBJECTS): %.o: %.c 162 $(CC) -c -o $@ $< $(PIPE_CPPFLAGS) $(PIPE_CFLAGS) $(CFLAGS) 163 164install: $(PIPE_TARGETS) 165 $(INSTALL) -d $(DESTDIR)/$(PIPE_INSTALL_DIR) 166 for tgt in $(PIPE_TARGETS); do \ 167 $(MINSTALL) "$$tgt" $(DESTDIR)/$(PIPE_INSTALL_DIR); \ 168 done 169 170clean: 171 rm -f $(PIPE_TARGETS) $(PIPE_OBJECTS) depend depend.bak 172 173depend: $(PIPE_SOURCES) 174 rm -f depend 175 touch depend 176 $(MKDEP) $(MKDEP_OPTIONS) $(PIPE_CPPFLAGS) $(PIPE_SOURCES) 2>/dev/null 177 178sinclude depend 179