forked from oaitbenh-21/0-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (37 loc) · 964 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (37 loc) · 964 Bytes
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
# Directories
ENV_FILE := .env
TARGET_DIR := target/release
INTERNALS_DIR :=commands/src/bin
INSTALL_DIR := bin
.PHONY: all clean build copy env
all: clean build copy env
clean:
@echo "Cleaning $(TARGET_DIR)..."
@cargo clean
@rm -rf $(INSTALL_DIR)/* $(INSTALL_DIR)/*
@mkdir -p $(INSTALL_DIR)
build:
@echo "Building workspace..."
@cargo build --release --workspace
copy:
@echo "Copying binaries to $(INSTALL_DIR)..."
@for crate in $(wildcard $(INTERNALS_DIR)/*); do \
if [ -d $$crate ]; then \
name=$$(basename $$crate); \
bin_path=$(TARGET_DIR)/$$name; \
if [ -f $$bin_path ] && [ -x $$bin_path ]; then \
echo "Installing $$name -> $(INSTALL_DIR)"; \
cp $$bin_path $(INSTALL_DIR)/; \
fi \
fi \
done
env:
@echo "Updating $(ENV_FILE)..."
@rm -f $(ENV_FILE)
@touch $(ENV_FILE)
@echo "DIR=$(shell pwd)/bin/" >> $(ENV_FILE);
@echo "✅ .env updated:"
@cat $(ENV_FILE)
run:
@echo "Running shell..."
@$(TARGET_DIR)/shell