udrone/Makefile
2022-09-22 23:18:43 +03:00

75 lines
2.0 KiB
Makefile

APP_NAME = UDrone
APP_PATH = $(pwd)
SHELL ?= /bin/bash
ARGS = $(filter-out $@,$(MAKECMDGOALS))
BUILD_ID ?= $(shell /bin/date "+%Y%m%d-%H%M%S")
.SILENT: ; # no need for @
.ONESHELL: ; # recipes execute in same shell
.NOTPARALLEL: ; # wait for this target to finish
.EXPORT_ALL_VARIABLES: ; # send all vars to shell
Makefile: ; # skip prerequisite discovery
.DEFAULT_GOAL = help
ifneq ("$(wildcard ./VERSION)","")
VERSION ?= $(shell cat ./VERSION | head -n 1)
else
VERSION ?= 1.0.0
endif
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHTGRAY='\033[0;37m'
DARKGRAY='\033[1;30m'
LIGHTRED='\033[1;31m'
LIGHTGREEN='\033[1;32m'
YELLOW='\033[1;33m'
LIGHTBLUE='\033[1;34m'
LIGHTPURPLE='\033[1;35m'
LIGHTCYAN='\033[1;36m'
WHITE='\033[1;37m'
%.env:
cp $@.dist $@
.PHONY: .title
.title:
$(info $(APP_NAME) v$(VERSION))
.PHONY: fbuild
fbuild: ## Build frontend
npm install
cd node_modules/mqtt
npm install
webpack ./mqtt.js --output-library mqtt
cd ../..
npm run build-dev
# Public targets
.PHONY: test
test: ## Start test webserver
python3 server.py
.PHONY: help
help: .title ## Show this help and exit (default target)
echo ''
printf " %s: \033[94m%s\033[0m \033[90m[%s] [%s]\033[0m\n" "Usage" "make" "target" "ENV_VARIABLE=ENV_VALUE ..."
echo ''
echo ' Available targets:'
echo ' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
grep -hE '^[a-zA-Z. 0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## " }; {printf "\033[36m%+15s\033[0m: %s\n", $$1, $$2}'
echo ' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
echo ''
%:
@: