deps: add xfy911/coco as git submodule (fork with fixes)
This commit is contained in:
parent
37c2dbc69f
commit
d6cbf5a3e3
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "coco"]
|
[submodule "coco"]
|
||||||
path = coco
|
path = coco
|
||||||
url = https://github.com/DefectingCat/coco.git
|
url = https://github.com/xfy911/coco.git
|
||||||
|
|||||||
21
Makefile
21
Makefile
@ -1,8 +1,9 @@
|
|||||||
# Cocoon - 基于 coco 协程库的静态资源 Web 服务器
|
# Cocoon - 基于 coco 协程库的静态资源 Web 服务器
|
||||||
|
|
||||||
# coco 库路径(可覆盖)
|
# coco 库路径(默认使用 submodule,可覆盖)
|
||||||
COCO_INCLUDE ?= ../coco/include
|
COCO_DIR ?= coco
|
||||||
COCO_LIB ?= ../coco/build
|
COCO_INCLUDE ?= $(COCO_DIR)/include
|
||||||
|
COCO_LIB ?= $(COCO_DIR)/build
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Wall -Wextra -O2 -std=c11 -I$(COCO_INCLUDE)
|
CFLAGS = -Wall -Wextra -O2 -std=c11 -I$(COCO_INCLUDE)
|
||||||
@ -30,6 +31,18 @@ all: $(TARGET)
|
|||||||
$(TARGET): $(OBJS)
|
$(TARGET): $(OBJS)
|
||||||
$(CC) $(OBJS) -o $@ $(LDFLAGS)
|
$(CC) $(OBJS) -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
|
# 构建 coco 依赖(如果 submodule 已初始化)
|
||||||
|
deps:
|
||||||
|
@if [ ! -d "$(COCO_DIR)/build" ]; then \
|
||||||
|
echo "[Cocoon] 构建 coco 依赖..."; \
|
||||||
|
cd $(COCO_DIR) && mkdir -p build && cd build && cmake .. && $(MAKE); \
|
||||||
|
else \
|
||||||
|
echo "[Cocoon] coco 已构建,跳过"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 完整构建(先构建依赖,再构建项目)
|
||||||
|
build-all: deps $(TARGET)
|
||||||
|
|
||||||
# 编译规则
|
# 编译规则
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
@ -50,4 +63,4 @@ clean:
|
|||||||
# 重新构建
|
# 重新构建
|
||||||
rebuild: clean all
|
rebuild: clean all
|
||||||
|
|
||||||
.PHONY: all clean install uninstall rebuild
|
.PHONY: all clean install uninstall rebuild deps build-all
|
||||||
|
|||||||
2
coco
2
coco
@ -1 +1 @@
|
|||||||
Subproject commit 8c16830f9be849f579fc12719ed108739faf563d
|
Subproject commit 7d6e23ef4b2a52f83a670a04280839a645384161
|
||||||
Loading…
x
Reference in New Issue
Block a user