Last active
November 26, 2019 23:42
-
-
Save da-moon/39d52cf73901d5e3b74e6ee00103f33c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/5584872/complex-conditions-check-in-makefile | |
https://stackoverflow.com/questions/4036191/sources-from-subdirectories-in-makefile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://devhints.io/makefile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# detect what shell is used | |
ifeq ($(findstring cmd.exe,$(SHELL)),cmd.exe) | |
$(info "shell Windows cmd.exe") | |
DEVNUL := NUL | |
WHICH := where | |
else | |
$(info "shell Bash") | |
DEVNUL := /dev/null | |
WHICH := which | |
endif | |
# detect platform independently if gcc is installed | |
ifeq ($(shell ${WHICH} gcc 2>${DEVNUL}),) | |
$(error "gcc is not in your system PATH") | |
else | |
$(info "gcc found") | |
endif | |
## optionally when I need to detect more tools I can use: | |
EXECUTABLES = ls dd | |
K := $(foreach myTestCommand,$(EXECUTABLES),\ | |
$(if $(shell ${WHICH} $(myTestCommand) 2>${DEVNUL} ),\ | |
$(myTestCommand) found,\ | |
$(error "No $(myTestCommand) in PATH))) | |
$(info ${K}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://ftp-master.debian.org/keys.html | |
curl -fsSL https://ftp-master.debian.org/keys/archive-key-10.asc | sudo apt-key add - && echo "deb http://ftp.ca.debian.org/debian buster main" | sudo tee /etc/apt/sources.list.d/debian-buster.list | |
sudo apt install libssl-dev | |
sudo apt install gccgo-mipsel-linux-gnu | |
sudo dpkg --add-architecture i386 && sudo apt update | |
sudo dpkg --add-architecture mipsel && sudo apt update | |
sudo dpkg --add-architecture amd64 && sudo apt update | |
sudo apt install libssl-dev:i386 libssl-dev:mipsel | |
GO111MODULE=on CC=mipsel-linux-gnu-gccgo CGO_ENABLED=1 make build GOFLAGS=-tags=openssl GOOS=linux GOARCH=mipsle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/39272954/how-to-prompt-user-for-y-n-in-my-makefile-with-pure-make-syntaxis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make does not offer a recursive wildcard function, so here's one: | |
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)) | |
# How to recursively find all files with the same name in a given folder | |
ALL_INDEX_HTMLS := $(call rwildcard,foo/,index.html) | |
# How to recursively find all files that match a pattern | |
ALL_HTMLS := $(call rwildcard,foo/,*.html) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/44339327/copy-file-in-windows-makefile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment