-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (53 loc) · 2.3 KB
/
Copy pathMakefile
File metadata and controls
70 lines (53 loc) · 2.3 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
58
59
60
61
62
63
64
65
66
67
68
69
70
BUILD_DIR := build
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=Release
# Optional: make build CLI=OFF
ifdef CLI
CMAKE_FLAGS += -DPARAKEET_BUILD_CLI=$(CLI)
endif
# Optional: make build SERVER=ON
ifdef SERVER
CMAKE_FLAGS += -DPARAKEET_BUILD_SERVER_EXAMPLE=$(SERVER)
endif
# Use Ninja if available, otherwise Unix Makefiles
ifneq ($(shell which ninja 2>/dev/null),)
GENERATOR := Ninja
BUILD_CMD := ninja -C $(BUILD_DIR)
else
GENERATOR := "Unix Makefiles"
NPROC := $(shell sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo 4)
BUILD_CMD := $(MAKE) -C $(BUILD_DIR) -j$(NPROC)
endif
.PHONY: all configure build run test bench bench-single debug install format format-check clean samples
all: build
configure:
cmake -B $(BUILD_DIR) -G $(GENERATOR) $(CMAKE_FLAGS)
build: configure
$(BUILD_CMD)
debug: CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=Debug
debug: configure
$(BUILD_CMD)
run: build
./$(BUILD_DIR)/parakeet
test: build
./$(BUILD_DIR)/parakeet_tests
bench: build
./$(BUILD_DIR)/parakeet_bench $(ARGS)
bench-single: build
./$(BUILD_DIR)/parakeet_bench $(ARGS)
install: build
cmake --install $(BUILD_DIR)
format:
find src include examples -name '*.cpp' -o -name '*.hpp' -o -name '*.c' | xargs clang-format -i
format-check:
find src include examples -name '*.cpp' -o -name '*.hpp' -o -name '*.c' | xargs clang-format --dry-run --Werror
clean:
rm -rf $(BUILD_DIR)
samples:
@echo "Downloading samples..."
@mkdir -p samples
@wget --quiet --show-progress -O samples/gb0.ogg "https://upload.wikimedia.org/wikipedia/commons/2/22/George_W._Bush%27s_weekly_radio_address_%28November_1%2C_2008%29.oga"
@wget --quiet --show-progress -O samples/gb1.ogg "https://upload.wikimedia.org/wikipedia/commons/1/1f/George_W_Bush_Columbia_FINAL.ogg"
@wget --quiet --show-progress -O samples/hp0.ogg "https://upload.wikimedia.org/wikipedia/en/d/d4/En.henryfphillips.ogg"
@wget --quiet --show-progress -O samples/mm1.wav "https://cdn.openai.com/whisper/draft-20220913a/micro-machines.wav"
@wget --quiet --show-progress -O samples/a13.mp3 "https://upload.wikimedia.org/wikipedia/commons/transcoded/6/6f/Apollo13-wehaveaproblem.ogg/Apollo13-wehaveaproblem.ogg.mp3"
@wget --quiet --show-progress -O samples/diffusion2023-07-03.flac "https://archive.org/download/diffusion2023-07-03/diffusion2023-07-03.flac"