025f7426f8597824c2a498c73c0aed3414a45aa8
[mesa.git] / src / gallium / targets / Makefile.xorg
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/$(TARGET)
30
31 ifeq ($(MESA_LLVM),1)
32 LD = $(CXX)
33 LDFLAGS += $(LLVM_LDFLAGS)
34 USE_CXX=1
35 DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
36 endif
37
38
39 ##### TARGETS #####
40
41 default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
42
43 $(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES)
44 $(MKLIB) -linker '$(CC)' -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
45
46 depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
47 rm -f depend
48 touch depend
49 $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null
50
51 $(LIBNAME_STAGING): $(LIBNAME)
52 $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium
53
54 $(TOP)/$(LIB_DIR)/gallium:
55 mkdir -p $@
56
57 clean:
58 rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME).a depend depend.bak
59
60 install:
61 $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
62 $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
63
64
65 ##### RULES #####
66
67 %.s: %.c
68 $(CC) -S $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
69
70 %.o: %.c
71 $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
72
73 %.o: %.cpp
74 $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@
75
76 %.o: %.S
77 $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
78
79 sinclude depend
80
81 .PHONY: default clean install