Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile stub for contrail's packages
This is a makefile that automates building of all the packages in contrail-packages repo and will be used as single source of truth for both CI and dev-env. It will also allow building of packages after merge from contrail-packaging. Change-Id: I03a70723833621266435483474fbcffcd22f3bda Partial-Bug: 1752195
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
MKFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
SB_TOP := $(MKFILE_DIR:/tools/packages/=) | ||
|
||
SPEC_DIR := $(MKFILE_DIR)rpm | ||
SPEC_FILES := $(wildcard $(SPEC_DIR)/*/*.spec) | ||
PACKAGES := $(patsubst %.spec,rpm-%,$(notdir $(SPEC_FILES))) | ||
DEPENDENCIES := $(patsubst %.spec,dep-%,$(notdir $(SPEC_FILES))) | ||
|
||
DEBUGINFO := TRUE | ||
SCONSOPT := production | ||
SRCVER := $(shell cat $(SB_TOP)/controller/src/base/version.info) | ||
KVERS := $(shell rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-devel) | ||
BUILDTAG := $(shell date +%m%d%Y%H%M) | ||
|
||
RPMBUILD_FLAGS := -bb --define "_sbtop $(SB_TOP)" | ||
RPMBUILD_FLAGS += --define "_opt $(SCONSOPT)" | ||
RPMBUILD_FLAGS += --define "_kVers $(KVERS)" | ||
RPMBUILD_FLAGS += --define "_srcVer $(SRCVER)" | ||
RPMBUILD_FLAGS += --define "_buildTag $(BUILDTAG)" | ||
|
||
SCONSFLAGS := -j$(shell nproc) | ||
|
||
export BUILD_ONLY := TRUE | ||
export SCONSFLAGS := $(SCONSFLAGS) | ||
|
||
all: dep rpm | ||
@echo $(PACKAGES) | ||
@echo $(DEPENDENCIES) | ||
|
||
.PHONY: all rpm dep | ||
|
||
dep: $(DEPENDENCIES) | ||
rpm: $(PACKAGES) | ||
|
||
dep-%: | ||
$(eval SPECFILE = $(filter %/$(patsubst dep-%,%.spec,$@), $(SPEC_FILES))) | ||
$(info Installing dependencies for $(SPECFILE)...) | ||
@yum-builddep -y $(SPECFILE) >/dev/null | ||
$(info DONE) | ||
|
||
rpm-%: | ||
$(eval SPECFILE = $(filter %/$(patsubst rpm-%,%.spec,$@), $(SPEC_FILES))) | ||
@rpmbuild $(RPMBUILD_FLAGS) $(SPECFILE) | ||
|
||
list: | ||
@echo $(patsubst rpm-%,%,$(PACKAGES)) | ||
|
||
info: | ||
@echo SPEC_FILES=$(SPEC_FILES) | ||
@echo SRCVER=$(SRCVER) | ||
@echo KVERS=$(KVERS) | ||
@echo SCONSOPT=$(SCONSOPT) | ||
@echo BUILDTAG=$(BUILDTAG) |