2025-02-03 06:08:33 +00:00
|
|
|
version: '3'
|
|
|
|
|
|
|
|
dotenv: [ '.env' ]
|
|
|
|
|
|
|
|
vars:
|
2025-02-03 16:38:33 +00:00
|
|
|
PROGRAM: vmrcli
|
|
|
|
SHELL: powershell
|
2025-02-03 06:08:33 +00:00
|
|
|
|
|
|
|
CC: gcc
|
|
|
|
|
|
|
|
SRC_DIR: src
|
|
|
|
OBJ_DIR: obj
|
|
|
|
BIN_DIR: bin
|
|
|
|
|
|
|
|
CPPFLAGS: -Iinclude -MMD -MP {{if eq .LOG_USE_COLOR "yes"}}-DLOG_USE_COLOR{{end}}
|
|
|
|
|
|
|
|
CFLAGS: -O -Wall -W -pedantic -ansi -std=c2x
|
|
|
|
LDFLAGS: -Llib
|
|
|
|
LDLIBS: -lm
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
default:
|
|
|
|
desc: "Build vmrcli for Windows"
|
|
|
|
deps: [build]
|
|
|
|
|
|
|
|
build:
|
|
|
|
desc: "Build vmrcli for Windows"
|
|
|
|
deps: [link]
|
|
|
|
|
|
|
|
link:
|
|
|
|
desc: "Link all files in obj/ for Windows"
|
|
|
|
deps: [compile]
|
|
|
|
cmds:
|
2025-02-03 16:38:33 +00:00
|
|
|
- >
|
|
|
|
{{.SHELL}} -Command
|
|
|
|
"if (!(Test-Path -Path '{{.BIN_DIR}}')) {
|
|
|
|
New-Item -ItemType Directory -Path '{{.BIN_DIR}}'
|
|
|
|
}"
|
|
|
|
- >
|
|
|
|
{{.SHELL}} -Command "{{.CC}} {{.LDFLAGS}} {{.OBJ_DIR}}/*.o {{.LDLIBS}} -o {{.BIN_DIR}}/{{.PROGRAM}}.exe"
|
2025-02-03 06:08:33 +00:00
|
|
|
sources:
|
2025-02-03 06:45:30 +00:00
|
|
|
- '{{.OBJ_DIR}}/**'
|
2025-02-03 06:08:33 +00:00
|
|
|
generates:
|
2025-02-03 16:38:33 +00:00
|
|
|
- '{{.BIN_DIR}}/{{.PROGRAM}}.exe'
|
2025-02-03 06:08:33 +00:00
|
|
|
|
|
|
|
compile:
|
|
|
|
desc: "Compile all files in src/ and include/ for Windows"
|
|
|
|
cmds:
|
2025-02-03 16:38:33 +00:00
|
|
|
- >
|
|
|
|
{{.SHELL}} -Command
|
|
|
|
"if (!(Test-Path -Path '{{.OBJ_DIR}}')) {
|
|
|
|
New-Item -ItemType Directory -Path '{{.OBJ_DIR}}'
|
|
|
|
}"
|
|
|
|
- >
|
|
|
|
{{.SHELL}} -Command
|
|
|
|
"Get-ChildItem -Path '{{.SRC_DIR}}' -Filter '*.c' |
|
|
|
|
ForEach-Object { \$_.Name -replace '\.c$', '' } |
|
|
|
|
ForEach-Object { {{.CC}} {{.CPPFLAGS}} {{.CFLAGS}} -c {{.SRC_DIR}}/\$_.c -Iinclude -o {{.OBJ_DIR}}/\$_.o }"
|
2025-02-03 06:08:33 +00:00
|
|
|
sources:
|
2025-02-03 06:45:30 +00:00
|
|
|
- '{{.SRC_DIR}}/**'
|
2025-02-03 06:08:33 +00:00
|
|
|
- include/**
|
|
|
|
generates:
|
2025-02-03 15:24:42 +00:00
|
|
|
- '{{.OBJ_DIR}}/**'
|
2025-02-03 06:08:33 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
desc: "Remove all files in obj/ and bin/"
|
|
|
|
cmds:
|
2025-02-03 16:38:33 +00:00
|
|
|
- >
|
|
|
|
{{.SHELL}} -Command "if (Test-Path -Path '{{.OBJ_DIR}}') { Remove-Item -Path '{{.OBJ_DIR}}' -Recurse -Force }"
|
|
|
|
- >
|
|
|
|
{{.SHELL}} -Command "if (Test-Path -Path '{{.BIN_DIR}}') { Remove-Item -Path '{{.BIN_DIR}}' -Recurse -Force }"
|