https://github.com/roguh/makeanywhere
Run make from any subdirectory.
https://github.com/roguh/makeanywhere
Last synced: about 2 months ago
JSON representation
Run make from any subdirectory.
- Host: GitHub
- URL: https://github.com/roguh/makeanywhere
- Owner: roguh
- Created: 2021-11-10T15:57:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-17T04:32:16.000Z (about 3 years ago)
- Last Synced: 2025-01-26T04:42:00.595Z (over 1 year ago)
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# makeanywhere: Run make from any subdirectory of a directory with a Makefile.
## Usage
```
$ makeanywhere --help
USAGE: makeanywhere [-h|--help|make arguments]
Run make from any subdirectory of a directory with a Makefile.
```
To run a make command from any directory that has a parent directory with a Makefile:
```
makeanywhere
```
### Examples
```
$ ls
Makefile src
$ cd src
$ makeanywhere test
```
If `vim` is setup to change directories to that of the current file,
you can use this script to run `make` while within any directory of your
`make` based project.
```
$ vim src/main.c
!makeanywhere test
!makeanywhere format-fix FILES=%:p
```
## Installation
1. Download [raw.githubusercontent.com/roguh/gp/main/gp](https://raw.githubusercontent.com/roguh/gp/main/gp).
2. Make executable and move to your preferred binary location.
```
chmod +x gp
sudo cp gp /usr/bin/gp
```
## Shell Integration
### Bash and ZSH
Use `alias ma=makeanywhere` for a convenient alias.
### ZSH
To support `make` autocompletions, try using the zsh-completions plugin
and using `compdef makeanywhere make`.
See [manual](https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#copying-completions-from-another-command)
### Fish Shell
Copy `makeanywhere.fish` to `~/.config/fish/functions/`.
## Vim Integration
Simply make sure this script is in your `$PATH`.
Usage: `!makeanywhere `
Look at `./example.vimrc` for how to setup aliases in Vim.
The contents of `~/.bash_vim` are in `~/example.bash_vim`.
## For developers
### Cloning and Installation
```
git clone https://github.com/roguh/gp.git
cd gp
```
Then one of:
```
make install
make install-to-user
make install-symlink-to-user
```
## Integration Testing
If the test script fails, the tests have failed.
Also read the output to determine if `makeanywhere` is behaving correctly.
Note the `test-integration-all-shells.sh` script runs the `test-integration.sh` script using the test shell itself.
### Linux: Running tests for many shells at once
```
make test-on-linux
```
### MacOS: Running tests for many shells at once
```
make test-on-macos
```
### Running tests for stricter POSIX shells
```
make test-on-strict-posix-shells
```
### Running tests one shell at a time
```
./tests/test-integration.sh dash
```
## Test results
### Linux
Tested using GNU coreutils 9.0 in these shells:
- dash 0.5
- bash 5.1
- bash 5.1 in bash 3.1 compatibility mode BASH_COMPAT=31
- zsh 5.8
- yash 2.52
- ksh version 2020.0.0
### MacOS
Not tested on MacOS, yet. It should work fine.
## Linting and Compatibility Check
Use shellcheck to check shellscripts.
```
make check
```