blob: 0b72fd70081280a5f683dd4215b147c9b9986c4e [file] [log] [blame]
Joey Armstrongccab2cf2024-04-06 18:00:59 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2024 Open Networking Foundation (ONF) and the ONF Contributors
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
17# SPDX-FileCopyrightText: 2024 Open Networking Foundation Contributors
18# SPDX-License-Identifier: Apache-2.0
19# -----------------------------------------------------------------------
20
21$(if $(DEBUG),$(warning ENTER))
22
23##-------------------##
24##---] GLOBALS [---##
25##-------------------##
26
27nvm-install-sh := https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh
28
29## -----------------------------------------------------------------------
30## Intent: Install the npm pacakge manager
31## -----------------------------------------------------------------------
32nvm-install : $(nvm-sh)
33$(nvm-sh) :
34 $(HIDE)mkdir -p "$(npm-dir-root)"
35 $(HIDE)mkdir -p "$(node-modules-root)"
36
37 @echo
38 @echo "Retrieve $(nvm-install-sh)"
39 $(if $(NVM_DIR),$(null),$(error NVM_DIR= is required))#
40 curl -o- "$(nvm-install-sh)" | bash
41
42 @echo
43 @echo "Install nvm --lts"
44 $(activate-npm) && nvm install --lts
45# $(activate-npm) && nvm ls-remote
46
47 @echo
48 @echo "Install debug module"
49 $(activate-npm) && $(npm-install-cmd) debug --save
50
51## -----------------------------------------------------------------------
52## Intent: Display command version: nvm, node
53## -----------------------------------------------------------------------
54nvm-ver : nvm-install
55 $(activate-npm) && nvm --version
56 $(activate-npm) && node --version
57
58## -----------------------------------------------------------------------
59## Intent: Remove generated tool and package directories
60## -----------------------------------------------------------------------
61sterile ::
62 $(RM) -r "$(npm-dir-root)"
63 $(RM) -r "$(node-modules-root)"
64 $(RM) "$(npm-dir-root)/package.json"
65 $(RM) "$(npm-dir-root)/package-lock.json"
66
67## -----------------------------------------------------------------------
68## -----------------------------------------------------------------------
69nvm-help :
70 @printf ' %-33.33s %s\n' 'nvm-install' 'Install the nvm package manager'
71 @printf ' %-33.33s %s\n' 'nvm-ver' 'Display tool version: nvm, node'
72
73$(if $(DEBUG),$(warning LEAVE))
74
75# [EOF]