-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
87 lines (73 loc) · 2.79 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Set the shell explicitly for UNIX-like systems
SHELL := /bin/bash
# Detect the operating system
ifeq ($(OS),Windows_NT)
DETECTED_OS := Windows
RMDIR_CMD := del /S
SLASH := \\
else
DETECTED_OS := $(shell uname)
RMDIR_CMD := rm -rf
SLASH := /
endif
PLATFORM_INTERFACE_DIR := ./miniaudio_dart_platform_interface/
FFI_DIR := .$(SLASH)miniaudio_dart_ffi$(SLASH)
WEB_DIR := .$(SLASH)miniaudio_dart_web$(SLASH)
MINISOUND_DIR := .$(SLASH)miniaudio_dart$(SLASH)
EXAMPLE_DIR := .$(SLASH)miniaudio_dart$(SLASH)example$(SLASH)
SRC_DIR := .$(SLASH)miniaudio_dart_ffi$(SLASH)src$(SLASH)
BUILD_DIR := .$(SLASH)miniaudio_dart_ffi$(SLASH)src$(SLASH)build$(SLASH)
VERSION ?= 1.0.0
default: run
init_submodules:
@echo " Initializing submodules..."
@git submodule update --init --recursive
pubspec_local:
@echo " Switching our pubspecs for local dev with version ${VERSION}."
@python update_pubspecs.py ${VERSION}
pubspec_release:
@echo " Switching our pubspecs for release with version ${VERSION}."
@python update_pubspecs.py ${VERSION} --release
clean:
@echo " Cleaning Example."
@cd $(EXAMPLE_DIR) && flutter clean
run: init_submodules
ifeq ($(DETECTED_OS), Windows)
@echo " Running example on Windows..."
@cd $(EXAMPLE_DIR) && cmd /c flutter run -d Windows
else ifeq ($(DETECTED_OS), Linux)
@echo " Running example on $(DETECTED_OS)..."
@cd $(EXAMPLE_DIR) && flutter run -d Linux
else ifeq ($(DETECTED_OS), Darwin)
@echo " Running example on $(DETECTED_OS)..."
@cd $(EXAMPLE_DIR) && flutter run -d MacOS
else
@echo "Unsupported OS: $(DETECTED_OS)"
endif
run_device: init_submodules
@echo " Running example on device..."
@cd $(EXAMPLE_DIR) && flutter run
run_web: build_weblib
@echo " Running web example..."
@cd $(EXAMPLE_DIR) && flutter run -d chrome --web-browser-flag --enable-features=SharedArrayBuffer
ffigen: init_submodules
@echo "Generating dart ffi bindings..."
@cd $(FFI_DIR) && dart run ffigen
build_weblib: init_submodules
@echo "Building ffi lib to web via emscripten..."
@cd $(BUILD_DIR) && emcmake cmake .. && cmake --build .
clean_weblib:
@echo "Cleaning web lib..."
@$(RMDIR_CMD) "$(BUILD_DIR)/*"
help:
@echo "Available targets:"
@echo " pubspec_local: Switches pubspecs for local dev."
@echo " pubspec_release: Switches pubspecs for release."
@echo " clean: Cleans the example project."
@echo " run: Runs the example project on current OS."
@echo " run_device: Runs the example project on chosen device."
@echo " run_web: Runs the web example project."
@echo " ffigen: Generates dart ffi bindings."
@echo " build_weblib: Builds the ffi lib to web via emscripten."
@echo " clean_weblib: Cleans the web lib."
@echo " help: Shows this help message."