summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/Makefile.xorg
blob: 4237f944e0d707b502648ddb8da10cc6a3ad7fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# src/gallium/targets/Makefile.xorg

# Template makefile for gallium xorg drivers.
#
# Usage:
#   The minimum that the including makefile needs to define
#   is TOP, LIBNAME and one of of the *_SOURCES.
#
# Optional defines:
#   DRIVER_INCLUDES are appended to the list of includes directories.
#   DRIVER_DEFINES is not used for makedepend, but for compilation.
#   DRIVER_LINKS are flags given to the linker

### Basic defines ###

OBJECTS = $(C_SOURCES:.c=.o) \
	$(CPP_SOURCES:.cpp=.o) \
	$(ASM_SOURCES:.S=.o)

INCLUDES = \
	$(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
	-I$(TOP)/src/gallium/include \
	-I$(TOP)/src/gallium/drivers \
	-I$(TOP)/src/gallium/auxiliary \
	-I$(TOP)/src/gallium/winsys \
	$(DRIVER_INCLUDES)

LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)


##### TARGETS #####

default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)

$(LIBNAME): $(OBJECTS) Makefile $(LIBS)
	$(MKLIB) -noprefix -o $@ $(OBJECTS) $(DRIVER_LINKS)

depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
	rm -f depend
	touch depend
	$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null

$(LIBNAME_STAGING): $(LIBNAME)
	$(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium

$(TOP)/$(LIB_DIR)/gallium:
	mkdir -p $@

clean:
	rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME).a depend depend.bak

install:
	$(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
	$(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)


##### RULES #####

%.s: %.c
	$(CC) -S $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@

%.o: %.c
	$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@

%.o: %.cpp
	$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@

%.o: %.S
	$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES)  $< -o $@

sinclude depend

.PHONY: default clean install