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

Update README & checkmake #24

Merged
merged 2 commits into from
Aug 6, 2024
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
3 changes: 3 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"MD003": { "style": "setext_with_atx" }
}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
vendor/.*|
tmp/.*
)$
- repo: https://github.com/trinitronx/checkmake.git
rev: 0.2.5
- repo: https://github.com/mrtazz/checkmake.git
rev: 0.2.2
hooks:
- id: checkmake
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@ WTF?
software projects. It may be installed as a `git` `submodule` to enable your
project `Makefile`s to be more trim, elegant, and classy. 🤵‍♂️

### Prequisites

- An initialized `git` repo
- Ability to create a file in this repo: `.uncommon-build-init.mk`
- GNU `make` command
- Bash shell
- `bash` command must be available
- Not necessarily as your default shell
- POSIX shell utilities: `sed`, `grep`, `echo`, `cd`, `rm`, `mkdir`, `awk`,
`sort`, `find`, `xargs`, `basename`

How Do That?! 🤔
----------------

The simple way to accomplish this, naturally, is to add the following file to
your repo: `.uncommon-build-init.mk`
your repo: `.uncommon-build-init.mk` [$^{...You\ \textbf{\textit{doOo}
\ have\ a\ git\ repo\ already,\ yes?}$][2]

```bash
curl -Ls -o .uncommon-build-init.mk https://bit.ly/3K5HcJO
Expand Down Expand Up @@ -91,9 +103,10 @@ This target executes the following steps:
2. Fetch & Update the `git` submodule to latest
3. Commit the `.uncommon-build` and `.gitmodules` file changes.

*NOTE*: If you need to update `uncommon-build` to some version
_NOTE_: If you need to update `uncommon-build` to some version
different than `origin/main` branch, set the `UNCOMMON_BUILD_REF` variable.
This accepts any `git` ref.
For example: a branch name, tag, or commit SHA.

[1]: https://go.dev/
[2]: https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository
30 changes: 15 additions & 15 deletions install/.uncommon-build-init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
.PHONY: stylish
stylish: ## no-help
ifeq (,$(wildcard .uncommon-build))
@echo "\033[44m🔍\033[0m \033[0;36m... Looking for .uncommon-build ... \033[0m" >&2
@echo "\033[0;101m👀\033[0;31m .uncommon-build is curiously missing... 🧐 installing submodule\033[0m" >&2
@echo -e "\033[44m🔍\033[0m \033[0;36m... Looking for .uncommon-build ... \033[0m" >&2
@echo -e "\033[0;101m👀\033[0;31m .uncommon-build is curiously missing... 🧐 installing submodule\033[0m" >&2
@git submodule add https://github.com/LyraPhase/uncommon-build.git .uncommon-build >&2
@echo "\033[0;101m✍️ \033[0;\033[0;31m Committing '.uncommon-build' and '.gitmodules'\033[0m" >&2
@echo -e "\033[0;101m✍️ \033[0;\033[0;31m Committing '.uncommon-build' and '.gitmodules'\033[0m" >&2
git add .uncommon-build .gitmodules && \
git commit -m 'uncommon-build install: Installing .uncommon-build as a submodule'
else
@# Ensure `.uncommon-build` is updated and committed in .gitmodules
@echo "\033[46m✨\033[0;\033[0;96m Updating '.uncommon-build' and '.gitmodules'\033[0m" >&2
@echo -e "\033[46m✨\033[0;\033[0;96m Updating '.uncommon-build' and '.gitmodules'\033[0m" >&2
git submodule update --init .uncommon-build >&2
endif
@[ -d .uncommon-build ] && echo "\033[47m🤵‍♂️\033[0m \033[1;92m.uncommon-build is now installed!\033[0m" \
|| echo "\033[41m🤦\033[0m\033[1;91m .uncommon-build installation had issues!\033[0m" >&2
@echo "\033[44m🔍\033[0m \033[0;36m... Looking for single-colon clean target in Makefile ... \033[0m" >&2
@clean_rules="$$(grep -c "clean::" Makefile)"; \
if [ "$${clean_rules}" -eq 0 ]; \
then \
echo "\033[40m🫧\033[0;\033[0;96m 'clean:' your colon! 👉 'clean::'\033[0m" >&2; \
sed -i '' -e "s/^clean:\([^:]*.*\)/clean::\1/" Makefile; \
echo "\033[0;101m✍️ \033[0;\033[0;31m Committing 'Makefile' with double-colon clean:: \033[0m" >&2; \
git add Makefile; \
git commit -m "uncommon-build install: Convert single-colon clean: to double-colon clean:: rule"; \
@[ -d .uncommon-build ] && echo -e "\033[47m🤵‍♂️\033[0m \033[1;92m.uncommon-build is now installed!\033[0m" \
|| echo -e "\033[41m🤦\033[0m\033[1;91m .uncommon-build installation had issues!\033[0m" >&2
@echo -e "\033[44m🔍\033[0m \033[0;36m... Looking for single-colon clean target in Makefile ... \033[0m" >&2
@clean_rules="$$(grep -c "clean::" Makefile)"; \
if [ "$${clean_rules}" -eq 0 ]; \
then \
echo -e "\033[40m🫧\033[0;\033[0;96m 'clean:' your colon! 👉 'clean::'\033[0m" >&2; \
sed -i '' -e "s/^clean:\([^:]*.*\)/clean::\1/" Makefile; \
echo -e "\033[0;101m✍️ \033[0;\033[0;31m Committing 'Makefile' with double-colon clean:: \033[0m" >&2; \
git add Makefile; \
git commit -m "uncommon-build install: Convert single-colon clean: to double-colon clean:: rule"; \
fi;

ifneq ("$(wildcard .uncommon-build/main.mk)","")
Expand Down
Loading