Files
sealos/scripts/make-rules/common.mk
T
Mercurio b89d95d148 ci: Update ci.yml to use simpler make build to build testing binaries (#1278)
* ci: Update ci.yml to use simpler make build to build testing binaries

Signed-off-by: Mercurio <signormercurio@gmail.com>

* fix GOARCH bug in Makefile

Signed-off-by: Mercurio <signormercurio@gmail.com>

* attempt to remove some of the dependencies

Signed-off-by: Mercurio <signormercurio@gmail.com>

* sync makefile and goreleaser build flags

Signed-off-by: Mercurio <signormercurio@gmail.com>
2022-07-09 01:24:29 +08:00

60 lines
1.7 KiB
Makefile

# Copyright © 2022 sealos.
#
# Licensed 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.
SHELL := /bin/bash
DIRS=$(shell ls)
DEBUG ?= 0
GIT_TAG := $(shell git describe --exact-match --tags --abbrev=0 2> /dev/null || echo untagged)
GIT_COMMIT ?= $(shell git rev-parse --short HEAD || echo "0.0.0")
BUILD_DATE=$(shell date +%FT%T%z)
# include the common makefile
COMMON_SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
ifeq ($(origin ROOT_DIR),undefined)
ROOT_DIR := $(abspath $(shell cd $(COMMON_SELF_DIR)/../.. && pwd -P))
endif
ifeq ($(origin OUTPUT_DIR),undefined)
OUTPUT_DIR := $(ROOT_DIR)/dist
$(shell mkdir -p $(OUTPUT_DIR))
endif
ifeq ($(origin BIN_DIR),undefined)
BIN_DIR := $(ROOT_DIR)/bin
$(shell mkdir -p $(BIN_DIR))
endif
ifeq ($(origin TOOLS_DIR),undefined)
TOOLS_DIR := $(ROOT_DIR)/tools
$(shell mkdir -p $(TOOLS_DIR))
endif
# only support linux
GOOS=linux
# set a specific GOARCH
ifeq ($(origin GOARCH), undefined)
GOARCH := $(shell go env GOARCH)
endif
# set a specific PLATFORM
ifeq ($(origin PLATFORM), undefined)
PLATFORM := $(GOOS)_$(GOARCH)
endif
# Linux command settings
CODE_DIRS := $(ROOT_DIR)/pkg $(ROOT_DIR)/cmd $(ROOT_DIR)/test $(ROOT_DIR)/staging
FIND := find $(CODE_DIRS)
# verbose settings
ifndef V
MAKEFLAGS += --no-print-directory
endif