diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-10-20 11:44:30 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-10-20 11:44:30 +0200 |
| commit | 9b9005101e6170a226acb265428aac429be6edbf (patch) | |
| tree | f89c76f4a5c2a00a72abe9b92468ac9f15083b94 /Makefile | |
| download | facedet-9b9005101e6170a226acb265428aac429be6edbf.tar.gz facedet-9b9005101e6170a226acb265428aac429be6edbf.zip | |
Init
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b9a4b88 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +CC = cc +AR = ar +CFLAGS = -O3 -std=c11 -Wall -Wextra -Wpedantic +LDLIBS = -lm + +BUILD = build +CORE = yunet.c nn.c gemm.c +MODEL_HEADER = model_data.h +MODEL_CPPFLAGS = -DYUNET_MODEL_HEADER='"$(abspath $(MODEL_HEADER))"' + +REFINER_HEADER = +ifneq ($(strip $(REFINER_HEADER)),) +MODEL_CPPFLAGS += -DYUNET_REFINER_HEADER='"$(abspath $(REFINER_HEADER))"' +endif + +HEADERS = yunet.h nn.h gemm.h $(MODEL_HEADER) $(REFINER_HEADER) +OBJECTS = $(BUILD)/yunet.o $(BUILD)/nn.o $(BUILD)/gemm.o + +.PHONY: all model clean +all: $(BUILD)/yunet $(BUILD)/libyunet.a $(BUILD)/libyunet.so $(BUILD)/libimage.so + +$(BUILD): + mkdir -p $(BUILD) + +$(BUILD)/%.o: %.c $(HEADERS) | $(BUILD) + $(CC) $(CPPFLAGS) $(MODEL_CPPFLAGS) $(CFLAGS) -c $< -o $@ + +$(BUILD)/libyunet.a: $(OBJECTS) + $(AR) rcs $@ $^ + +$(BUILD)/main.o $(BUILD)/image.o: image.h +$(BUILD)/image.o: third_party/stb/stb_image.h +$(BUILD)/main.o $(BUILD)/overlay.o: overlay.h +$(BUILD)/overlay.o $(BUILD)/draw.o: draw.h + +$(BUILD)/yunet: $(BUILD)/main.o $(BUILD)/image.o $(BUILD)/overlay.o $(BUILD)/draw.o $(BUILD)/libyunet.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) + +$(BUILD)/libyunet.so: $(CORE) $(HEADERS) | $(BUILD) + $(CC) $(CPPFLAGS) $(MODEL_CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared -fPIC -o $@ $(CORE) $(LDLIBS) + +$(BUILD)/libimage.so: image.c image.h third_party/stb/stb_image.h | $(BUILD) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared -fPIC -o $@ image.c $(LDLIBS) + +clean: + rm -rf $(BUILD) + rm -f model_data.h + +model: model_data.h + +model_data.h: convert.py models/face_detection_yunet_2026may.onnx + uv run --with onnx==1.23.0 --with numpy==2.5.3 python convert.py |
