[skip ci] makefile
This commit is contained in:
parent
c78091f619
commit
94b8f6474f
1 changed files with 4 additions and 30 deletions
34
Makefile
34
Makefile
|
@ -1,40 +1,14 @@
|
|||
SHELL := bash
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
.env:
|
||||
cp .env.example $@
|
||||
include .env
|
||||
|
||||
ccache_dir ?= $(HOME)/.ccache
|
||||
gem_dir := .
|
||||
gem_cache_dir := $(gem_dir)/cache
|
||||
gem_binary_dir := $(gem_dir)/gems/$(ALPINE_VERSION)
|
||||
|
||||
help: always ## Ayuda
|
||||
@grep "^[^\t]\+:.*##" Makefile | sed -re "s/(.*):.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/"
|
||||
|
||||
%: ## Compila la gema (make puma v=5.3.0)
|
||||
%: ## Agrega la gema a la cola de compilación (make puma v=5.3.0)
|
||||
@test -n "$v" || echo "Falta la versión en el argumento v=" ; :
|
||||
@test -n "$v" || exit 1
|
||||
$(MAKE) $(gem_binary_dir)/$@-$(v)-x86_64-linux-musl.gem
|
||||
|
||||
# Compila la gema si no existe
|
||||
$(gem_binary_dir)/%-x86_64-linux-musl.gem:
|
||||
@echo "Compilando $*"
|
||||
@test -n "$(HTTP_BASIC_USER)" || echo "Agrega las credenciales en el archivo .env" ; :
|
||||
@test -n "$(HTTP_BASIC_USER)" || exit 1
|
||||
@test -n "$(HTTP_BASIC_PASSWORD)" || echo "Agrega las credenciales en el archivo .env" ; :
|
||||
@test -n "$(HTTP_BASIC_PASSWORD)" || exit 1
|
||||
@echo "$(PATH)" | grep -q ccache || "Instala ccache para acelerar la compilación"
|
||||
@docker run \
|
||||
-v $(shell realpath "$(gem_dir)"):/srv/gems \
|
||||
-v $(shell realpath "$(ccache_dir)"):/home/builder/.ccache \
|
||||
-e HTTP_BASIC_USER="$(HTTP_BASIC_USER)" \
|
||||
-e HTTP_BASIC_PASSWORD="$(HTTP_BASIC_PASSWORD)" \
|
||||
-e GEM=$(shell echo $(notdir $*) | sed -re "s/-[^-]+$$//") \
|
||||
-e VERSION=$(shell echo $(notdir $*) | sed -re "s/.*-([^-]+)$$/\1/") \
|
||||
-e JOBS=$(shell grep processor /proc/cpuinfo | wc -l) \
|
||||
--rm -it \
|
||||
sutty/gem-compiler:latest || echo "No se pudo compilar $*"
|
||||
install -dm 755 build/$@
|
||||
touch build/$@/$(v)
|
||||
git add build/$@/$(v)
|
||||
|
||||
.PHONY: always
|
||||
|
|
Loading…
Reference in a new issue