Home | History | Annotate | Download | only in targets
      1 # src/gallium/targets/Makefile.xorg
      2 
      3 # Template makefile for gallium xorg drivers.
      4 #
      5 # Usage:
      6 #   The minimum that the including makefile needs to define
      7 #   is TOP, LIBNAME and one of of the *_SOURCES.
      8 #
      9 # Optional defines:
     10 #   DRIVER_INCLUDES are appended to the list of includes directories.
     11 #   DRIVER_DEFINES is not used for makedepend, but for compilation.
     12 #   DRIVER_PIPES are pipe drivers and modules that the driver depends on.
     13 #   DRIVER_LINKS are flags given to the linker.
     14 
     15 ### Basic defines ###
     16 
     17 OBJECTS = $(C_SOURCES:.c=.o) \
     18 	$(CPP_SOURCES:.cpp=.o) \
     19 	$(ASM_SOURCES:.S=.o)
     20 
     21 INCLUDES = \
     22 	$(shell $(PKG_CONFIG) --cflags-only-I pixman-1 xorg-server libdrm xproto) \
     23 	-I$(TOP)/src/gallium/include \
     24 	-I$(TOP)/src/gallium/drivers \
     25 	-I$(TOP)/src/gallium/auxiliary \
     26 	-I$(TOP)/src/gallium/winsys \
     27 	$(DRIVER_INCLUDES)
     28 
     29 LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
     30 
     31 ifeq ($(MESA_LLVM),1)
     32 LDFLAGS += $(LLVM_LDFLAGS)
     33 DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
     34 LD=$(CXX)
     35 else
     36   ifeq ($(LINK_WITH_CXX),1)
     37     LD=$(CXX)
     38   else
     39     LD=$(CC)
     40   endif
     41 endif
     42 
     43 
     44 ##### TARGETS #####
     45 
     46 default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
     47 
     48 $(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES)
     49 	$(MKLIB) -linker '$(LD)' -noprefix -o $@ -ldflags '$(LDFLAGS)' $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
     50 
     51 depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
     52 	rm -f depend
     53 	touch depend
     54 	$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null
     55 
     56 $(LIBNAME_STAGING): $(LIBNAME)
     57 	$(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium
     58 
     59 $(TOP)/$(LIB_DIR)/gallium:
     60 	mkdir -p $@
     61 
     62 clean:
     63 	rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME) depend depend.bak
     64 
     65 install:
     66 	$(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
     67 	$(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
     68 
     69 
     70 ##### RULES #####
     71 
     72 %.s: %.c
     73 	$(CC) -S $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
     74 
     75 %.o: %.c
     76 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
     77 
     78 %.o: %.cpp
     79 	$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
     80 
     81 %.o: %.S
     82 	$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES)  $< -o $@
     83 
     84 sinclude depend
     85 
     86 .PHONY: default clean install
     87