-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (41 loc) · 2.15 KB
/
Makefile
File metadata and controls
57 lines (41 loc) · 2.15 KB
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
48
49
50
51
52
53
54
55
56
57
# Border Queue Optimizer — Makefile
# Requires: C11 compiler, make
CC ?= cc
CFLAGS := -std=c11 -Wall -Wextra -Wpedantic -O2
LDFLAGS := -lm
BUILD := build
SRCS := src/heap.c src/stats.c src/queue_model.c src/simulator.c \
src/optimizer.c src/predictor.c src/arrival.c
OBJS := $(patsubst src/%.c,$(BUILD)/%.o,$(SRCS))
TEST_SRCS := tests/test_main.c tests/test_queue_model.c tests/test_heap.c \
tests/test_simulator.c tests/test_optimizer.c
TEST_OBJS := $(patsubst tests/%.c,$(BUILD)/%.o,$(TEST_SRCS))
BIN := $(BUILD)/border-queue-optimizer
TEST_BIN := $(BUILD)/bqo_tests
.PHONY: all clean test simulate optimize predict
all: $(BIN)
# ── Core objects ─────────────────────────────────────────────────────
$(BUILD)/%.o: src/%.c | $(BUILD)
$(CC) $(CFLAGS) -Iinclude -Isrc -c $< -o $@
# ── Test objects ─────────────────────────────────────────────────────
$(BUILD)/%.o: tests/%.c | $(BUILD)
$(CC) $(CFLAGS) -Iinclude -Isrc -c $< -o $@
# ── Main binary ─────────────────────────────────────────────────────
$(BIN): $(BUILD)/main.o $(OBJS)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
# ── Test binary ─────────────────────────────────────────────────────
$(TEST_BIN): $(TEST_OBJS) $(OBJS)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(BUILD):
mkdir -p $(BUILD)
# ── Convenience targets ─────────────────────────────────────────────
test: $(TEST_BIN)
./$(TEST_BIN)
simulate: $(BIN)
./$(BIN) simulate --lanes 4 --duration 28800 --rate 120 --service-rate 40
optimize: $(BIN)
./$(BIN) optimize --rate 120 --service-rate 40 --max-lanes 16
predict: $(BIN)
./$(BIN) predict --hour 8 --minute 30
clean:
rm -rf $(BUILD)