forked from asgardeo/thunder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (79 loc) · 2.96 KB
/
Makefile
File metadata and controls
102 lines (79 loc) · 2.96 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# ----------------------------------------------------------------------------
# Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com).
#
# WSO2 LLC. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# Constants
VERSION_FILE=version.txt
VERSION=$(shell cat $(VERSION_FILE))
BINARY_NAME=thunder
# Tools
PROJECT_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))/backend
PROJECT_BIN_DIR := $(PROJECT_DIR)/bin
TOOL_BIN ?= $(PROJECT_BIN_DIR)/tools
GOLANGCI_LINT ?= $(TOOL_BIN)/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.64.8
$(TOOL_BIN):
mkdir -p $(TOOL_BIN)
# Default target
all: prepare clean test_unit build test_integration
prepare:
chmod +x build.sh
clean_all:
./build.sh clean_all $(OS) $(ARCH)
clean:
./build.sh clean $(OS) $(ARCH)
build: build_backend build_samples
build_backend:
./build.sh build_backend $(OS) $(ARCH)
package_samples:
./build.sh package_samples $(OS) $(ARCH)
build_samples:
./build.sh build_samples
test:
./build.sh test $(OS) $(ARCH)
test_unit:
./build.sh test_unit $(OS) $(ARCH)
test_integration:
./build.sh test_integration $(OS) $(ARCH)
run:
./build.sh run $(OS) $(ARCH)
lint: golangci-lint
cd backend && $(GOLANGCI_LINT) run ./...
help:
@echo "Makefile targets:"
@echo " all - Clean, build, and test the project."
@echo " clean - Remove build artifacts."
@echo " clean_all - Remove all build artifacts including distribution files."
@echo " build - Build the Go project and frontend, then package."
@echo " build_backend - Build the backend Go application."
@echo " package_samples - Package sample applications."
@echo " build_samples - Build sample applications."
@echo " test_unit - Run unit tests."
@echo " test_integration - Run integration tests."
@echo " test - Run all tests (unit and integration)."
@echo " run - Build and run the application locally."
@echo " lint - Run golangci-lint on the project."
@echo " help - Show this help message."
.PHONY: all prepare clean clean_all build build_samples package_samples run lint help
.PHONY: test_unit test_integration test
.PHONY: go_install_tool golangci-lint
define go_install_tool
cd /tmp && \
GOBIN=$(TOOL_BIN) go install $(2)@$(3)
endef
golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT): $(TOOL_BIN)
$(call go_install_tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))