Home | History | Annotate | Download | only in pipe-loader
      1 # Makefile for building pipe driver shared libraries.
      2 #
      3 # Input variables: PIPE_INSTALL_DIR, PIPE_PREFIX (optional)
      4 #
      5 TOP = ../../../..
      6 include $(TOP)/configs/current
      7 
      8 PIPE_PREFIX ?= pipe_
      9 
     10 PIPE_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 
     20 PIPE_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 
     27 PIPE_SYS = $(LIBDRM_LIBS) -lm -lpthread $(DLOPEN_LIBS)
     28 
     29 PIPE_CFLAGS = $(LIBDRM_CFLAGS)
     30 
     31 PIPE_LDFLAGS = -Wl,--no-undefined
     32 
     33 # i915 pipe driver
     34 i915_LIBS = \
     35 	$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
     36 	$(TOP)/src/gallium/drivers/i915/libi915.a
     37 i915_SYS = $(INTEL_LIBS)
     38 
     39 # nouveau pipe driver
     40 nouveau_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
     46 nouveau_SYS = $(NOUVEAU_LIBS)
     47 
     48 # r300 pipe driver
     49 r300_LIBS = \
     50 	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
     51 	$(TOP)/src/gallium/drivers/r300/libr300.a
     52 r300_SYS += $(RADEON_LIBS)
     53 
     54 # r600 pipe driver
     55 r600_LIBS = \
     56 	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
     57 	$(TOP)/src/gallium/drivers/r600/libr600.a
     58 r600_SYS += $(RADEON_LIBS)
     59 
     60 # radeonsi pipe driver
     61 radeonsi_LIBS = \
     62 	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
     63 	$(TOP)/src/gallium/drivers/radeonsi/libradeonsi.a
     64 radeonsi_SYS += $(RADEON_LIBS)
     65 
     66 # vmwgfx pipe driver
     67 vmwgfx_LIBS = \
     68 	$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
     69 	$(TOP)/src/gallium/drivers/svga/libsvga.a
     70 
     71 ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
     72    swrast_LIBS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
     73    PIPE_CFLAGS += -DGALLIUM_LLVMPIPE
     74 else ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
     75    swrast_LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
     76    PIPE_CFLAGS += -DGALLIUM_SOFTPIPE
     77 endif
     78 
     79 # LLVM
     80 ifeq ($(MESA_LLVM),1)
     81    PIPE_SYS += $(LLVM_LIBS)
     82    PIPE_LDFLAGS += $(LLVM_LDFLAGS)
     83 endif
     84 
     85 # determine the targets/sources
     86 _PIPE_TARGETS_CC =
     87 _PIPE_TARGETS_CXX =
     88 PIPE_SOURCES =
     89 
     90 ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
     91    _PIPE_TARGETS_CC += $(PIPE_PREFIX)i915.so
     92    PIPE_SOURCES += pipe_i915.c
     93 endif
     94 
     95 ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
     96    _PIPE_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
     97    PIPE_SOURCES += pipe_nouveau.c
     98 endif
     99 
    100 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
    101 ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
    102    _PIPE_TARGETS_CC += $(PIPE_PREFIX)r300.so
    103    PIPE_SOURCES += pipe_r300.c
    104 endif
    105 endif
    106 
    107 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
    108 ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
    109    _PIPE_TARGETS_CC += $(PIPE_PREFIX)r600.so
    110    PIPE_SOURCES += pipe_r600.c
    111 endif
    112 endif
    113 
    114 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
    115 ifneq ($(findstring radeonsi,$(GALLIUM_DRIVERS_DIRS)),)
    116    _PIPE_TARGETS_CC += $(PIPE_PREFIX)radeonsi.so
    117    PIPE_SOURCES += pipe_radeonsi.c
    118 endif
    119 endif
    120 
    121 ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
    122    _PIPE_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
    123    PIPE_SOURCES += pipe_vmwgfx.c
    124 endif
    125 
    126 ifneq ($(filter llvmpipe softpipe,$(GALLIUM_DRIVERS_DIRS)),)
    127    _PIPE_TARGETS_CC += $(PIPE_PREFIX)swrast.so
    128    PIPE_SOURCES += pipe_swrast.c
    129 endif
    130 
    131 PIPE_OBJECTS := $(PIPE_SOURCES:.c=.o)
    132 
    133 ifeq ($(MESA_LLVM),1)
    134    PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) $(_PIPE_TARGETS_CC)
    135    PIPE_TARGETS_CC =
    136 else
    137    PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX)
    138    PIPE_TARGETS_CC = $(_PIPE_TARGETS_CC)
    139 endif
    140 
    141 PIPE_TARGETS = $(PIPE_TARGETS_CC) $(PIPE_TARGETS_CXX)
    142 
    143 default: 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 
    164 install: $(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 
    170 clean:
    171 	rm -f $(PIPE_TARGETS) $(PIPE_OBJECTS) depend depend.bak
    172 
    173 depend: $(PIPE_SOURCES)
    174 	rm -f depend
    175 	touch depend
    176 	$(MKDEP) $(MKDEP_OPTIONS) $(PIPE_CPPFLAGS) $(PIPE_SOURCES) 2>/dev/null
    177 
    178 sinclude depend
    179