forked from osbuild/images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (91 loc) · 3.57 KB
/
Makefile
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
#
# Maintenance Helpers
#
# This makefile contains targets used for development, as well as helpers to
# aid automatization of maintenance. Unless a target is documented in
# `make help`, it is not supported and is only meant to be used by developers
# to aid their daily development work.
#
# All supported targets honor the `SRCDIR` variable to find the source-tree.
# For most unsupported targets, you are expected to have the source-tree as
# your working directory. To specify a different source-tree, simply override
# the variable via `SRCDIR=<path>` on the commandline. By default, the working
# directory is used for build output, but `BUILDDIR=<path>` allows overriding
# it.
#
BUILDDIR ?= .
SRCDIR ?= .
#
# Automatic Variables
#
# This section contains a bunch of automatic variables used all over the place.
# They mostly try to fetch information from the repository sources to avoid
# hard-coding them in this makefile.
#
# Most of the variables here are pre-fetched so they will only ever be
# evaluated once. This, however, means they are always executed regardless of
# which target is run.
#
# VERSION:
# This evaluates the `Version` field of the specfile. Therefore, it will
# be set to the latest version number of this repository without any
# prefix (just a plain number).
#
# COMMIT:
# This evaluates to the latest git commit sha. This will not work if
# the source is not a git checkout. Hence, this variable is not
# pre-fetched but evaluated at time of use.
#
COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD))
#
# Generic Targets
#
# The following is a set of generic targets used across the makefile. The
# following targets are defined:
#
# help
# This target prints all supported targets. It is meant as
# documentation of targets we support and might use outside of this
# repository.
# This is also the default target.
#
# $(BUILDDIR)/
# $(BUILDDIR)/%/
# This target simply creates the specified directory. It is limited to
# the build-dir as a safety measure. Note that this requires you to use
# a trailing slash after the directory to not mix it up with regular
# files. Lastly, you mostly want this as order-only dependency, since
# timestamps on directories do not affect their content.
#
.PHONY: help
help:
@echo "make [TARGETS...]"
@echo
@echo "This is the maintenance makefile of osbuild. The following"
@echo "targets are available:"
@echo
@echo " help: Print this usage information."
@echo " man: Generate all man-pages"
$(BUILDDIR)/:
mkdir -p "$@"
$(BUILDDIR)/%/:
mkdir -p "$@"
#
# Maintenance Targets
#
# The following targets are meant for development and repository maintenance.
# They are not supported nor is their use recommended in scripts.
#
.PHONY: build
build:
- mkdir -p bin
go build -o bin/osbuild-pipeline ./cmd/osbuild-pipeline/
go build -o bin/osbuild-upload-azure ./cmd/osbuild-upload-azure/
go build -o bin/osbuild-upload-aws ./cmd/osbuild-upload-aws/
go build -o bin/osbuild-upload-gcp ./cmd/osbuild-upload-gcp/
go build -o bin/osbuild-upload-oci ./cmd/osbuild-upload-oci/
go build -o bin/osbuild-upload-generic-s3 ./cmd/osbuild-upload-generic-s3/
go build -o bin/osbuild-mock-openid-provider ./cmd/osbuild-mock-openid-provider
go build -o bin/osbuild-service-maintenance ./cmd/osbuild-service-maintenance
go test -c -tags=integration -o bin/osbuild-dnf-json-tests ./cmd/osbuild-dnf-json-tests/main_test.go
go test -c -tags=integration -o bin/osbuild-image-tests ./cmd/osbuild-image-tests/