aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: b84bf10820c32d41def05b157f9fe1052f74fd80 (plain)
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
103
104
# Copyright (c) 2020 Intel and/or its affiliates.
# 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.

ifneq ($(shell uname),Darwin)
	OS_ID        := $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
	OS_VERSION_ID:= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
else
	$(warning exit)
	@exit 1;
endif

# Scripts require non-POSIX parts of bash
SHELL := /bin/bash

export BR=$(CURDIR)

DL_CACHE_DIR = $(CURDIR)/downloads
MAKE ?= make
MAKE_ARGS ?= -j
BUILD_DIR        ?= $(CURDIR)/_build
INSTALL_DIR      ?= $(CURDIR)/_install

B := $(BUILD_DIR)
I := $(INSTALL_DIR)

_VPP_VER := $(vpp)


LINUX_ITER := $(OS_ID)$(OS_VERSION_ID)
LICENSE := BSD

.PHONY: help
help:
	@echo "Make Targets:"
	@echo " dep             - install software dependencies"
	@echo " deb-vcl         - build vcl DEB package"
	@echo " build-vcl       - build vcl vpp and vcl nginx"
	@echo " deb-ldp         - build ldp DEB package"
	@echo " build-ldp       - build ldp vpp and ldp nginx"
	@echo " clean           - clean up build environment."
	@echo " clean-vcl       - clean up build vcl environment."
	@echo " clean-ldp       - clean up build ldp environment."
	@echo ""

include packages/packages.mk
include packages/package.mk
include packages/openssl-dl.mk
include packages/nginx-dl.mk
include packages/openssl.mk
include packages/vpp_vcl.mk
include packages/vpp_ldp.mk
include packages/nginx_vcl.mk
include packages/nginx_ldp.mk

.PHONY: clean
clean:
	@rm -rf $(B) $(I)

.PHONY: clean-vcl
clean-vcl:
	@rm -f $(B)/.*vcl*

.PHONY: clean-ldp
clean-ldp:
	@rm -f $(B)/.*ldp*

$(BR)/.deps.ok:
	make dep
	@touch $@

.PHONY: build-vcl
build-vcl: $(BR)/.deps.ok openssl-dl nginx-dl openssl-build vpp_vcl-build nginx_vcl-build

.PHONY: build-ldp
build-ldp: $(BR)/.deps.ok openssl-dl nginx-dl openssl-build vpp_ldp-build nginx_ldp-build


.PHONY: deb-vcl
deb-vcl: build-vcl openssl-deb vpp_vcl-deb nginx_vcl-deb

.PHONY: deb-ldp
deb-ldp: build-ldp openssl-deb vpp_ldp-deb nginx_ldp-deb

.PHONY: dep
dep:
ifeq ($(OS_ID),ubuntu)
	@sudo -E apt-get update
	@sudo -E apt-get install git gcc make \
		ruby ruby-dev libpam0g-dev \
		libmariadb-client-lgpl-dev \
		libmysqlclient-dev -y
	@sudo -E gem install fpm
	@cd vpp; echo yes|make install-dep;
endif