Skip to content

Commit

Permalink
Updating makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Liby99 committed Feb 23, 2024
1 parent 762ac29 commit 0970574
Showing 1 changed file with 83 additions and 41 deletions.
124 changes: 83 additions & 41 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,51 +1,95 @@
distr_dir = target/distribute

all:
@echo "Try `make install-scli`, `make install-sclc`, or `make install-scallopy`"

# ================================
# === Base Scallop Executables ===

install-scli:
cargo install --path etc/scli

build-scli:
cargo build --release --bin scli

install-sclc:
cargo install --path etc/sclc

build-sclc:
cargo build --release --bin sclc

install-sclrepl:
cargo install --path etc/sclrepl

install-scallop-cli: install-scallopy-ext
make internal-install-scallop-cli

develop-scallop-cli: develop-scallopy-ext
make internal-develop-scallop-cli
build-sclrepl:
cargo build --release --bin sclrepl

install-scallopy-ext: install-scallopy
make internal-install-scallopy-ext
# ===============================
# === Python related packages ===

develop-scallopy-ext: develop-scallopy
make internal-develop-scallopy-ext
## Scallopy

install-scallopy:
maturin build --release --manifest-path etc/scallopy/Cargo.toml --out target/wheels/current
find target/wheels/current -name "*.whl" -print | xargs pip install --force-reinstall
rm -rf target/wheels/current

build-scallopy:
maturin build --release --manifest-path etc/scallopy/Cargo.toml --out target/wheels

develop-scallopy:
cd etc/scallopy; maturin develop --release

# ====================================================================
# === Internal installing scripts for scallop-cli and scallopy-ext ===
## Scallopy Extension Lib

install-scallopy-ext: install-scallopy
make -C etc/scallopy-ext install

build-scallopy-ext: develop-scallopy
make -C etc/scallopy-ext build

develop-scallopy-ext: develop-scallopy
make -C etc/scallopy-ext develop

## Scallop CLI

install-scallop-cli: install-scallopy-ext
make -C etc/scallop-cli install

build-scallop-cli:
make -C etc/scallop-cli build

develop-scallop-cli: develop-scallopy-ext
make -C etc/scallop-cli develop

## Scallopy Plugins

install-scallopy-plugins: install-scallopy-ext
make -C etc/scallopy-plugins install

internal-install-scallop-cli:
cd etc/scallop-cli; python -m build
find etc/scallop-cli/dist -name "*.whl" -print | xargs pip install --force-reinstall
build-scallopy-plugins: build-scallopy-ext
make -C etc/scallopy-plugins build

internal-develop-scallop-cli:
cd etc/scallop-cli; pip install --editable .
develop-scallopy-plugins: develop-scallopy-ext
make -C etc/scallopy-plugins develop

internal-install-scallopy-ext:
cd etc/scallopy-ext; python -m build
find etc/scallopy-ext/dist -name "*.whl" -print | xargs pip install --force-reinstall
# =================================================
# === Collect wheels and packages to distribute ===

internal-develop-scallopy-ext:
cd etc/scallopy-ext; pip install --editable .
distribute:
@echo "==> Create distribute folder..."
mkdir -p $(distr_dir)

@echo "==> Copy core scallop..."
cp target/release/scli $(distr_dir)
cp target/release/sclrepl $(distr_dir)
cp target/release/sclc $(distr_dir)

@echo "==> Copy wheels..."
cp target/wheels/*.whl $(distr_dir)
cp etc/scallopy-ext/dist/*.whl $(distr_dir)
cp etc/scallop-cli/dist/*.whl $(distr_dir)
cp -r etc/scallopy-plugins/**/dist/*.whl $(distr_dir)

# ==========================================
# === Scallop WASM for Web Demo and Node ===
Expand All @@ -56,6 +100,9 @@ wasm-demo:
run-wasm-demo:
cd etc/scallop-wasm/demo; python3 -m http.server

# ==========================================
# === Scallop vitrual environment ===

init-venv:
python3 -m venv .env
.env/bin/pip install --upgrade pip
Expand All @@ -64,20 +111,26 @@ init-venv:
clear-venv:
rm -rf .env

# =============================
# === Scallop VSCode Plugin ===

vscode-plugin:
make -C etc/vscode-scl

# ====================================
# === Project testing and cleaning ===

clean:
cargo clean
make -C etc/scallopy clean
make -C etc/scallopy-ext clean
make -C etc/scallopy-plugins clean
make -C etc/scallop-cli clean
make -C etc/scallop-wasm clean

check:
cargo check --workspace

check-torch:
cargo check --workspace --features "torch-tensor"

test:
@echo "[Info] Performing cargo test..."
@make test-cargo
Expand All @@ -86,21 +139,13 @@ test:
@echo "[Info] Performing scallopy-ext test..."
@make test-scallopy-ext

test-torch:
@echo "[Info] Performing cargo test..."
@make test-cargo
@echo "[Info] Performing scallopy test..."
@make test-scallopy-torch
@echo "[Info] Performing scallopy-ext test..."
@make test-scallopy-ext-torch

test-all: test
@echo "[Info] Performing cargo test [ignored]..."
@make test-cargo-ignored

test-all-torch: test-torch
@echo "[Info] Performing cargo test [ignored]..."
@make test-cargo-ignored
@echo "[Info] Performing scallopy test..."
@make test-scallopy
@echo "[Info] Performing scallopy-ext test..."
@make test-scallopy-ext

test-cargo:
cargo test --workspace
Expand All @@ -111,14 +156,11 @@ test-cargo-ignored:
test-scallopy: develop-scallopy
python3 etc/scallopy/tests/test.py

test-scallopy-torch: develop-scallopy-torch
python3 etc/scallopy/tests/test.py

test-scallopy-ext: develop-scallopy-ext
python3 etc/scallopy-ext/tests/test.py

test-scallopy-ext-torch: develop-scallopy-ext-torch
python3 etc/scallopy-ext/tests/test.py
# ======================
# === Documentations ===

doc:
cargo doc
Expand Down

0 comments on commit 0970574

Please sign in to comment.