forked from w23/drmtoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (36 loc) · 904 Bytes
/
Makefile
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
.SUFFIXES:
.DEFAULT:
BUILDDIR ?= build
CC ?= cc
CFLAGS += -Wall -Wextra -Werror
CFLAGS += -std=gnu99 -I/usr/include/libdrm
LIBS += -ldrm -lGL
ifeq ($(DEBUG), 1)
CONFIG = dbg
CFLAGS += -O0 -ggdb3
else
CONFIG = rel
CFLAGS += -O3
endif
DEPFLAGS = -MMD -MP
COMPILE.c = $(CC) -std=gnu99 $(CFLAGS) $(DEPFLAGS) -MT $@ -MF [email protected]
OBJDIR ?= $(BUILDDIR)/$(CONFIG)
$(OBJDIR)/%.c.o: %.c
@mkdir -p $(dir $@)
$(COMPILE.c) -c $< -o $@
ENUM_SOURCES = enum.c
ENUM_OBJS = $(ENUM_SOURCES:%=$(OBJDIR)/%.o)
ENUM_DEPS = $(ENUM_OBJS:%=%.d)
-include $(ENUM_DEPS)
enum: $(OBJDIR)/enum
$(OBJDIR)/enum: $(ENUM_OBJS)
@mkdir -p $(dir $@)
$(CC) $^ $(LIBS) -o $@
KMSGRAB_SOURCES = kmsgrab.c
KMSGRAB_OBJS = $(KMSGRAB_SOURCES:%=$(OBJDIR)/%.o)
KMSGRAB_DEPS = $(KMSGRAB_OBJS:%=%.d)
-include $(KMSGRAB_DEPS)
kmsgrab: $(OBJDIR)/kmsgrab
$(OBJDIR)/kmsgrab: $(KMSGRAB_OBJS)
@mkdir -p $(dir $@)
$(CC) $^ $(LIBS) -lEGL -lX11 -o $@