blob: 41621f9fa7c3c4687d0e39010889f64f44ee027c (
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
|
CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -g -O2 -fwrapv -D_DEFAULT_SOURCE
LDFLAGS = -ldl
CFLAGS += $(shell pkg-config --cflags sqlite3 libsodium)
LDFLAGS += $(shell pkg-config --libs sqlite3 libsodium)
TARGETS = tomsg_server
PLUGINDIR = plugins
PLUGINS = $(filter-out _%,$(patsubst $(PLUGINDIR)/%,%,$(shell find $(PLUGINDIR)/ -maxdepth 1 -type d)))
.PHONY: all clean
# Clear all implicit suffix rules
.SUFFIXES:
# Don't delete intermediate files
.SECONDARY:
all: $(TARGETS)
for pl in $(PLUGINS); do make --no-print-directory -C $(PLUGINDIR) $@ PLUGINNAME=$$pl; done
clean:
rm -f $(TARGETS) *.o *.sql.h
for pl in $(PLUGINS); do make --no-print-directory -C $(PLUGINDIR) $@ PLUGINNAME=$$pl; done
$(TARGETS): $(patsubst %.c,%.o,$(wildcard *.c))
$(CC) -o $@ $^ $(LDFLAGS)
%.o: %.c $(wildcard *.h) $(patsubst %.sql,%.sql.h,$(wildcard *.sql))
$(CC) $(CFLAGS) -c -o $@ $<
%.sql.h: %.sql
xxd -i $^ $@
|