blob: a6f7b1a2883d045bc1f79b9c857a1cf8c72054ee (
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
|
CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -fwrapv -fPIC -pthread
ifneq ($(DEBUG),)
CFLAGS += -g
else
CFLAGS += -O2
endif
LDFLAGS = -ldl -pthread
BIN = cserver
PLUGINDIR = plugins
PLUGINS = $(patsubst $(PLUGINDIR)/%,%,$(shell find $(PLUGINDIR) -mindepth 1 -maxdepth 1 -type d))
.PHONY: all clean remake
all: $(BIN)
for pl in $(PLUGINS); do make -C $(PLUGINDIR) $@ PLUGINNAME=$$pl; done
clean:
rm -rf $(BIN) *.o *.dSYM
for pl in $(PLUGINS); do make -C $(PLUGINDIR) $@ PLUGINNAME=$$pl; done
remake: clean
make all
$(BIN): $(patsubst %.c,%.o,$(wildcard *.c))
$(CC) -o $@ $^ $(LDFLAGS)
%.o: %.c $(wildcard $(dir %.o)*.h)
$(CC) $(CFLAGS) -c -o $@ $<
|