aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 249625faf128bbf781fa0849b2a4bbef8d6dd266 (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

include config.mk

SRC=src
WLDSRC=$(SRC)/wld

PKGS = fontconfig wayland-client wayland-cursor xkbcommon pixman-1 libdrm

SOURCES = $(wildcard $(WLDSRC)/*.c)
SOURCES += $(wildcard $(SRC)/*.c)

ifeq ($(ENABLE_INTEL),1)
PKGS += libdrm_intel
SOURCES += $(wildcard $(WLDSRC)/intel/*.c)
CFLAGS += -DWITH_INTEL_DRM
endif
ifeq ($(ENABLE_NOUVEAU),1)
PKGS += libdrm_nouveau
SOURCES += $(wildcard $(WLDSRC)/nouveau/*.c)
CFLAGS += -DWITH_NOUVEAU_DRM
endif

CFLAGS += -std=c99 -Wall -g -DWITH_WAYLAND_DRM -DWITH_WAYLAND_SHM
CFLAGS += $(shell pkg-config --cflags $(PKGS)) -I include
LDFLAGS = $(shell pkg-config --libs $(PKGS)) -lm -lutil

WAYLAND_HEADERS = $(wildcard include/*.xml)

HDRS = $(WAYLAND_HEADERS:.xml=-client-protocol.h)
WAYLAND_SRC = $(HDRS:.h=.c)
SOURCES += $(WAYLAND_SRC)

OBJECTS = $(SOURCES:.c=.o)


all: wterm

include/config.h:
	cp config.def.h include/config.h

include/%-client-protocol.c: include/%.xml
	wayland-scanner code < $? > $@

include/%-client-protocol.h: include/%.xml
	wayland-scanner client-header < $?  > $@

$(OBJECTS): $(HDRS) include/config.h

wterm: $(OBJECTS)
	$(CC) -o wterm $(OBJECTS) $(LDFLAGS)

clean:
	rm -f $(OBJECTS) $(HDRS) $(WAYLAND_SRC) include/config.h

install: wterm
	tic -s wterm.info
	mkdir -p $(PREFIX)/bin/
	cp wterm $(PREFIX)/bin/