Skip to content

Instantly share code, notes, and snippets.

@da-moon
Last active November 26, 2019 23:42
Show Gist options
  • Save da-moon/39d52cf73901d5e3b74e6ee00103f33c to your computer and use it in GitHub Desktop.
Save da-moon/39d52cf73901d5e3b74e6ee00103f33c to your computer and use it in GitHub Desktop.
https://stackoverflow.com/questions/5584872/complex-conditions-check-in-makefile
https://stackoverflow.com/questions/4036191/sources-from-subdirectories-in-makefile
https://devhints.io/makefile
# 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})
# 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
https://stackoverflow.com/questions/39272954/how-to-prompt-user-for-y-n-in-my-makefile-with-pure-make-syntaxis
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