Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Makefile and instructions for installation from source #106

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
regex = "1.10"
ron = "0.8.1"

# TODO: opt-out of uneeded Rhai features
[dependencies.rhai]
version = "1.18.0"
Expand Down
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
shell := /bin/bash

INSTALL_DIR=/usr/local/bin

# Check if synless is already installed in the current path
ifneq ("$(wildcard $(shell which synless))","")
EXISTING_BIN_PATH = $(shell which synless)
endif

# If these files change, we know we need to rebuild the executable
SOURCES = $(wildcard src/**) Cargo.toml

# Build synless executable
./target/debug/synless: $(SOURCES)
cargo build

# Install the executable to the specified INSTALL_DIR
.PHONY: install
install: ./target/debug/synless
ifdef EXISTING_BIN_PATH
$(error ERROR: Conflicting binary already installed in the current path at $(EXISTING_BIN_PATH))
endif
sudo cp $(shell pwd)/target/debug/synless $(INSTALL_DIR)

# Uninstall the executable from EXISTING_BIN_PATH
.PHONY: uninstall
uninstall: $(EXISTING_BIN_PATH)
ifndef EXISTING_BIN_PATH
$(error ERROR: synless binary not installed in the current path)
endif
sudo rm -i $(EXISTING_BIN_PATH)

# Remove generated files
.PHONY: clean
clean:
rm -r target
36 changes: 36 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,39 @@ To learn more:
[The Synless Design Documentation](doc/design.md) (for developers)

[An Incomplete Survey of Tree Editors](doc/survey.md)

## Install from source (Linux)

### Prerequisites

1. [Install Rust](https://www.rust-lang.org/tools/install)
2. Clone this repository
3. `cd` into the repository (i.e. `cd synless`)

### Build and install the executable

This will build and install the executable to a default installation directory:

make install

You may specify the installation directory with `INSTALL_DIR`:

make install INSTALL_DIR=/path/to/bin

#### Run the executable

To verify your installation, run the executable from any working directory:

synless

### Remove generated files

This will remove the `target` directory:

make clean

### Uninstall

This will remove the executable named `synless` that is in the current path:

make uninstall