forked from embedded2016/server-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (36 loc) · 700 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
44
45
46
47
EXEC = \
test-async \
test-reactor \
test-buffer \
test-protocol-server \
httpd
OUT ?= .build
.PHONY: all
all: $(OUT) $(EXEC)
CC ?= gcc
CFLAGS = -std=gnu99 -Wall -O2 -g -I .
LDFLAGS = -lpthread
OBJS := \
async.o \
reactor.o \
buffer.o \
protocol-server.o
deps := $(OBJS:%.o=%.o.d)
OBJS := $(addprefix $(OUT)/,$(OBJS))
deps := $(addprefix $(OUT)/,$(deps))
httpd: $(OBJS) httpd.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
test-%: $(OBJS) tests/test-%.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(OUT)/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ -MMD -MF [email protected] $<
$(OUT):
@mkdir -p $@
doc:
@doxygen
clean:
$(RM) $(EXEC) $(OBJS) $(deps)
@rm -rf $(OUT)
distclean: clean
rm -rf html
-include $(deps)