-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (37 loc) · 1.23 KB
/
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
44
45
46
47
48
#
# SPDX-License-Identifier: ISC
#
# Copyright (c) 2022 Codethink
#
all: cdt
BUILDDIR := build
CC ?= gcc
MKDIR ?= mkdir -p
PKG_CONFIG ?= pkg-config
CPPFLAGS += -MMD -MP
CFLAGS += -Isrc
CFLAGS += -g -O0 -std=c11 -D_GNU_SOURCE
CFLAGS += -Wall -Wextra -pedantic -Wconversion -Wwrite-strings -Wcast-align \
-Wpointer-arith -Winit-self -Wshadow -Wstrict-prototypes \
-Wmissing-prototypes -Wredundant-decls -Wundef -Wvla \
-Wdeclaration-after-statement
PKG_DEPS := libwebsockets libcyaml sdl2 SDL2_image
CFLAGS += $(shell $(PKG_CONFIG) --cflags $(PKG_DEPS))
LDFLAGS += $(shell $(PKG_CONFIG) --libs $(PKG_DEPS))
SRC := $(addprefix src/,cdt.c display.c)
SRC += $(addprefix src/cmd/,cmd.c)
SRC += $(addprefix src/msg/,msg.c queue.c)
SRC += $(addprefix src/util/,base64.c buffer.c cli.c cyaml.c decode.c file.c log.c)
SRC += $(shell find src/cmd/handler -type f -name *.c)
SRC += $(shell find src/msg/handler -type f -name *.c)
OBJ := $(patsubst %.c,%.o, $(addprefix $(BUILDDIR)/,$(SRC)))
DEP := $(patsubst %.c,%.d, $(addprefix $(BUILDDIR)/,$(SRC)))
$(OBJ): $(BUILDDIR)/%.o : %.c
$(Q)$(MKDIR) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
cdt: $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
rm -rf $(BUILDDIR)
-include $(DEP)
.PHONY: all clean install