1 # -*-makefile-*- 2 3 4 ifeq ($(MESA_LLVM),1) 5 LDFLAGS += $(LLVM_LDFLAGS) 6 DRIVER_EXTRAS = $(LLVM_LIBS) 7 endif 8 9 MESA_MODULES = \ 10 $(TOP)/src/mesa/libmesagallium.a \ 11 $(GALLIUM_AUXILIARIES) 12 13 COMMON_GALLIUM_SOURCES = \ 14 $(TOP)/src/mesa/drivers/dri/common/utils.c \ 15 $(TOP)/src/mesa/drivers/dri/common/dri_util.c \ 16 $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c 17 18 COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ 19 $(TOP)/src/mesa/drivers/common/driverfuncs.c 20 21 COMMON_BM_SOURCES = \ 22 $(TOP)/src/mesa/drivers/dri/common/dri_bufmgr.c \ 23 $(TOP)/src/mesa/drivers/dri/common/dri_drmpool.c 24 25 INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) 26 27 OBJECTS = \ 28 $(C_SOURCES:.c=.o) \ 29 $(ASM_SOURCES:.S=.o) 30 31 32 ### Include directories 33 SHARED_INCLUDES = \ 34 -I. \ 35 -I$(TOP)/src/mesa/drivers/dri/common \ 36 -Iserver \ 37 -I$(TOP)/include \ 38 -I$(TOP)/include/GL/internal \ 39 -I$(TOP)/src/mapi \ 40 -I$(TOP)/src/gallium/include \ 41 -I$(TOP)/src/gallium/auxiliary \ 42 -I$(TOP)/src/gallium/drivers \ 43 -I$(TOP)/src/gallium/winsys \ 44 -I$(TOP)/src/mesa \ 45 -I$(TOP)/src/mesa/main \ 46 -I$(TOP)/src/mesa/math \ 47 -I$(TOP)/src/mesa/transform \ 48 -I$(TOP)/src/mesa/shader \ 49 -I$(TOP)/src/mesa/swrast \ 50 -I$(TOP)/src/mesa/swrast_setup \ 51 -I$(TOP)/src/egl/main \ 52 -I$(TOP)/src/egl/drivers/dri \ 53 $(LIBDRM_CFLAGS) 54 55 LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME) 56 57 58 ##### RULES ##### 59 60 .c.o: 61 $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ 62 63 .S.o: 64 $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ 65 66 67 ##### TARGETS ##### 68 69 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING) 70 71 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \ 72 $(TOP)/src/mesa/drivers/dri/common/dri_test.o 73 $(MKLIB) -o $@.tmp -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ 74 $(OBJECTS) $(PIPE_DRIVERS) \ 75 -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \ 76 $(GALLIUM_DRI_LIB_DEPS) $(DRIVER_EXTRAS) 77 $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(GALLIUM_DRI_LIB_DEPS) $(LDFLAGS); 78 @rm -f $@.test 79 mv -f $@.tmp $@ 80 81 $(TOP)/$(LIB_DIR)/gallium: 82 mkdir -p $@ 83 84 $(LIBNAME_STAGING): $(LIBNAME) 85 $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium 86 87 depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) 88 rm -f depend 89 touch depend 90 $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ 91 $(ASM_SOURCES) 2> /dev/null 92 93 94 # Emacs tags 95 tags: 96 etags `find . -name \*.[ch]` `find ../include` 97 98 99 # Remove .o and backup files 100 clean: 101 -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS) 102 -rm -f depend depend.bak 103 104 105 install: $(LIBNAME) 106 $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) 107 $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) 108 109 110 include depend 111