# @configure_input@

# make "all" a default target
all:

# install scripts
INSTALL = @INSTALL@

# binaries we need to build things
CC := @CC@
CXX := @CXX@
GO := @GOBINARY@
GOFMT := @GOFMTBINARY@
GIT := @GIT@
BASH := @BASH_SHELL@
BASH_SHELL := @BASH_SHELL@
ABS_GO := @ABS_GO@

# [STAGE1] build settings

# selinux tags for rkt and functional tests
RKT_TAGS := -tags "selinux @TPM_TAGS@ @SDJOURNAL_TAGS@"
# stage1 build mode

RKT_VERSION := @RKT_VERSION@
RKT_ACI_ARCH := @RKT_ACI_ARCH@
RKT_STAGE1_VERSION_OVERRIDE := @RKT_STAGE1_FLAVORS_VERSION_OVERRIDE@

RKT_STAGE1_DEFAULT_NAME := @RKT_STAGE1_DEFAULT_NAME@
RKT_STAGE1_DEFAULT_VERSION := @RKT_STAGE1_DEFAULT_VERSION@

RKT_STAGE1_ALL_FLAVORS := @RKT_STAGE1_ALL_FLAVORS@
RKT_STAGE1_FLAVORS := @RKT_STAGE1_FLAVORS@
RKT_STAGE1_DEFAULT_FLAVOR := @RKT_STAGE1_DEFAULT_FLAVOR@

RKT_STAGE1_KVM_HV := @RKT_STAGE1_KVM_HV@
RKT_STAGE1_KVM_ALL_HV := @RKT_STAGE1_KVM_ALL_HV@

RKT_STAGE1_DEFAULT_LOCATION := @RKT_STAGE1_DEFAULT_LOCATION@
RKT_STAGE1_DEFAULT_IMAGES_DIR := @RKT_STAGE1_DEFAULT_IMAGES_DIR@
RKT_STAGE1_DEFAULT_IMAGE_FILENAME_IN_RKT_DIRECTORY := @RKT_STAGE1_DEFAULT_IMAGE_FILENAME_IN_RKT_DIRECTORY@

RKT_STAGE1_SYSTEMD_SRC := @RKT_STAGE1_SYSTEMD_SRC@
RKT_STAGE1_SYSTEMD_VER := @RKT_STAGE1_SYSTEMD_VER@
RKT_STAGE1_SYSTEMD_REV := @RKT_STAGE1_SYSTEMD_REV@

RKT_LOCAL_COREOS_PXE_IMAGE_PATH := @RKT_LOCAL_COREOS_PXE_IMAGE_PATH@
RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER := @RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER@

RKT_STAGE1_COREOS_BOARD := @RKT_STAGE1_COREOS_BOARD@
RKT_STAGE1_INTERPRETER := @RKT_STAGE1_INTERPRETER@

# defines for enter
RKT_DEFINES_FOR_ENTER := @RKT_DEFINES_FOR_ENTER@

RKT_RUN_FUNCTIONAL_TESTS := @RKT_RUN_FUNCTIONAL_TESTS@

INCREMENTAL_BUILD := @INCREMENTAL_BUILD@

GOARCH := @GOARCH@
GOARM := @GOARM@
GOARCH_FOR_BUILD := @GOARCH_FOR_BUILD@

RKT_STAGE1_DEFAULT_NAME_LDFLAGS := @RKT_STAGE1_DEFAULT_NAME_LDFLAGS@
RKT_STAGE1_DEFAULT_VERSION_LDFLAGS := @RKT_STAGE1_DEFAULT_VERSION_LDFLAGS@
RKT_STAGE1_DEFAULT_LOCATION_LDFLAGS := @RKT_STAGE1_DEFAULT_LOCATION_LDFLAGS@
RKT_STAGE1_DEFAULT_IMAGE_FILENAME_LDFLAGS := @RKT_STAGE1_DEFAULT_IMAGE_FILENAME_LDFLAGS@
RKT_STAGE1_DEFAULT_IMAGES_DIRECTORY_LDFLAGS := @RKT_STAGE1_DEFAULT_IMAGES_DIRECTORY_LDFLAGS@
RKT_STAGE1_INTERPRETER_LDFLAGS := @RKT_STAGE1_INTERPRETER_LDFLAGS@
RKT_VERSION_LDFLAGS := @RKT_VERSION_LDFLAGS@
RKT_FEATURES_LDFLAGS := @RKT_FEATURES_LDFLAGS@

# build-related directories and binaries
BUILDDIR ?= $(MK_TOPLEVEL_ABS_SRCDIR)/build-@PACKAGE_TARNAME@-@PACKAGE_VERSION@

# makelib/inc.mk must be included first!
include makelib/inc.mk
include makelib/verbosity.mk
include makelib/file-ops-prolog.mk
include makelib/variables.mk
include makelib/misc.mk

SHELL := $(BASH_SHELL)
TOPLEVEL_STAMPS :=
TOPLEVEL_CHECK_STAMPS :=
TOPLEVEL_UNIT_CHECK_STAMPS :=
TOPLEVEL_FUNCTIONAL_CHECK_STAMPS :=
TOPLEVEL_SUBDIRS := rkt tests stage1 stage1_fly
RKT_MONITOR_STAMPS :=

$(call inc-one,tools/tools.mk)
$(call inc-one,Documentation/devel/devel.mk)
$(call inc-many,$(foreach sd,$(TOPLEVEL_SUBDIRS),$(sd)/$(sd).mk))

all: $(TOPLEVEL_STAMPS)

$(TOPLEVEL_CHECK_STAMPS): $(TOPLEVEL_STAMPS)

.INTERMEDIATE: $(TOPLEVEL_CHECK_STAMPS)
.INTERMEDIATE: $(TOPLEVEL_UNIT_CHECK_STAMPS)
.INTERMEDIATE: $(TOPLEVEL_FUNCTIONAL_CHECK_STAMPS)

check: $(TOPLEVEL_CHECK_STAMPS)
unit-check: $(TOPLEVEL_UNIT_CHECK_STAMPS)
functional-check: $(TOPLEVEL_FUNCTIONAL_CHECK_STAMPS)
rkt-monitor: $(RKT_MONITOR_STAMPS)

include makelib/file-ops-epilog.mk

.PHONY: all check unit-check functional-check
