-
Notifications
You must be signed in to change notification settings - Fork 67
/
Makefile
39 lines (35 loc) · 1.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
SHELL := /bin/bash
GOPATH?=$(shell go env GOPATH)
curr_dir := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
rest_args := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
$(eval $(rest_args):;@:)
help:
#
# Usage:
# make template : create a mapper based on a template.
# make mapper {mapper-name} <action> <parameter>: execute mapper building process.
# make device {device-name} <action> <parameter>: execute device simulator build process. (only used by modbus)
# make e2e {mapper-name} : execute mapper e2e building process. (only support modbus and opcua)
# make all : execute building process to all mappers.
#
# Actions:
# - mod, m : download code dependencies.
# - lint, l : verify code via go fmt and `golangci-lint`.
# - build, b : compile code.
# - package, p : package docker image.
# - test, t : run unit tests.
# - clean, c : clean output binary.
#
# Parameters:
# ARM : true or undefined
# ARM64 : true or undefined
#
# Example:
# - make mapper modbus ARM64=true : execute `build` "modbus" mapper for ARM64.
# - make mapper modbus test : execute `test` "modbus" mapper.
@echo
make_rules := $(shell ls $(curr_dir)/hack/make-rules | sed 's/.sh//g')
$(make_rules):
@$(curr_dir)/hack/make-rules/$@.sh $(rest_args)
.DEFAULT_GOAL := all
.PHONY: $(make_rules) build