Skip to content
Merged
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
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
.PHONY: install
install:
swift build -q -c release
install .build/release/hexcode /usr/local/bin/hexcode
@INSTALLATION_PATH=$(if $(filter install, $(MAKECMDGOALS)), $(word 2, $(MAKECMDGOALS)), $(which hexcode)) ; \
if [ -z "$${INSTALLATION_PATH}" ]; then \
INSTALLATION_PATH=/usr/local/bin/hexcode ; \
fi && \
swift build -q -c release && \
install .build/release/hexcode "$${INSTALLATION_PATH}" && \
echo "Installed at $${INSTALLATION_PATH}"

.PHONY: uninstall
uninstall:
@rm $$(which hexcode)

.PHONY: clean
clean:
@rm -rf .build
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ Or you can just run it as an executable Swift package [without installation](#ru
### Using make:
From the root of the repository, run the following command:
```
sudo make install
make install
```
If you want to install it into a directory other than default `/usr/local/bin`, replace it in the `Makefile` with your target directory.
Just make sure it's added to the PATH.
With no installation path provided, it will try to install `hexcode` to where it's already installed. If this is the first-time installation, the default path is `/usr/local/bin`.

There's also an option to provide a custom installation path:
```
make install </custom/installation/path>
```
Just make sure it's added to the PATH or sourced if you want the command to be visible from anywhere without typing the full path to it. Depending on the installation path and current user, `make install` command might need `sudo` access.
### Running without installation:
From the `hexcode` directory (or passing it as `--package-path`), the command can be run as executable package without previous installation, for example:
```
Expand Down