blob: 5617b0d8166bf5e6d39a9376ff609e52747f67ef [file] [log] [blame]
Andreas Geisslerf247bf62022-08-01 17:05:42 +02001# Copyright © 2020 Samsung Electronics
2# Copyright (c) 2021 AT&T. All rights reserved.
Jack Lucas7723ffe2020-02-13 17:19:01 -05003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Andreas Geisslerf247bf62022-08-01 17:05:42 +020015
16ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
17OUTPUT_DIR := $(ROOT_DIR)/../dist
18PACKAGE_DIR := $(OUTPUT_DIR)/packages
19SECRET_DIR := $(OUTPUT_DIR)/secrets
20
21HELM_REPO := local
22
23EXCLUDES :=
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020024HELM_BIN := helm
Andreas Geisslerf247bf62022-08-01 17:05:42 +020025ifneq ($(SKIP_LINT),TRUE)
26 HELM_LINT_CMD := $(HELM_BIN) lint
27else
28 HELM_LINT_CMD := echo "Skipping linting of"
29endif
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020030
Andreas Geisslerf247bf62022-08-01 17:05:42 +020031HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
Jack Lucas7723ffe2020-02-13 17:19:01 -050032
Andreas Geisslerf247bf62022-08-01 17:05:42 +020033.PHONY: $(EXCLUDES) $(HELM_CHARTS)
Jack Lucas7723ffe2020-02-13 17:19:01 -050034
Andreas Geisslerf247bf62022-08-01 17:05:42 +020035all: $(HELM_CHARTS)
Jack Lucas7723ffe2020-02-13 17:19:01 -050036
Andreas Geisslerf247bf62022-08-01 17:05:42 +020037$(HELM_CHARTS):
38 @echo "\n[$@]"
39 @make package-$@
Jack Lucas7723ffe2020-02-13 17:19:01 -050040
Andreas Geisslerf247bf62022-08-01 17:05:42 +020041make-%:
42 @if [ -f $*/Makefile ]; then make -C $*; fi
Jack Lucas7723ffe2020-02-13 17:19:01 -050043
Andreas Geisslerf247bf62022-08-01 17:05:42 +020044dep-%: make-%
45 @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) dep up $*; fi
Jack Lucas7723ffe2020-02-13 17:19:01 -050046
Andreas Geisslerf247bf62022-08-01 17:05:42 +020047lint-%: dep-%
48 @if [ -f $*/Chart.yaml ]; then $(HELM_LINT_CMD) $*; fi
Jack Lucas7723ffe2020-02-13 17:19:01 -050049
Andreas Geisslerf247bf62022-08-01 17:05:42 +020050package-%: lint-%
51 @mkdir -p $(PACKAGE_DIR)
52 @if [ -f $*/Chart.yaml ]; then PACKAGE_NAME=$$($(HELM_BIN) package -d $(PACKAGE_DIR) $* | cut -d":" -f2) && $(HELM_BIN) cm-push -f $$PACKAGE_NAME local; fi
53 @sleep 3
54 #@$(HELM_BIN) repo index $(PACKAGE_DIR)
Jack Lucas8c3463e2020-06-12 18:36:55 -040055
Jack Lucas7723ffe2020-02-13 17:19:01 -050056clean:
Andreas Geisslerf247bf62022-08-01 17:05:42 +020057 @rm -f */Chart.lock
58 @rm -f *tgz */charts/*tgz
59 @rm -rf $(PACKAGE_DIR)
60%:
61 @: