Skip to content

Commit 7b86d0b

Browse files
committed
Merge mantle/Makefile into Makefile
Add targets for the mantle binaries and kolet. Put mantle binaries into the top-level `bin/` directory. Simplify `schema-check` docs and logic since we're no longer double-vendoring the schema. Add `vendor` target.
1 parent 74d7bfb commit 7b86d0b

File tree

3 files changed

+18
-53
lines changed

3 files changed

+18
-53
lines changed

Makefile

+15-10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ PYIGNORE ?= E128,E241,E402,E501,E722,W503,W504
1212
.PHONY: all check shellcheck flake8 pycheck unittest clean mantle mantle-check install
1313

1414
MANTLE_BINARIES := ore kola plume
15+
KOLET_ARCHES := aarch64 ppc64le s390x x86_64
1516

1617
all: bin/coreos-assembler mantle
1718

@@ -66,16 +67,16 @@ clean:
6667
rm -f ${src_checked} ${tests_checked} ${cwd_checked}
6768
find . -name "*.py[co]" -type f | xargs rm -f
6869
find . -name "__pycache__" -type d | xargs rm -rf
70+
rm -rfv bin
6971

70-
mantle:
71-
cd mantle && $(MAKE)
72+
mantle: $(MANTLE_BINARIES) kolet
7273

7374
.PHONY: $(MANTLE_BINARIES) kolet
7475
$(MANTLE_BINARIES) kolet:
75-
cd mantle && $(MAKE) $@
76+
mantle/build cmd/$(basename $@)
7677

7778
mantle-check:
78-
cd mantle && $(MAKE) test
79+
cd mantle && ./test
7980

8081
.PHONY: schema
8182
schema:
@@ -84,17 +85,12 @@ schema:
8485
# To update the coreos-assembler schema:
8586
# Edit src/v1.json
8687
# $ make schema
87-
# $ (cd mantle && go mod vendor)
8888
.PHONY: schema-check
8989
schema-check: DIGEST = $(shell sha256sum src/v1.json | awk '{print $$1}')
9090
schema-check:
9191
# Is the generated Go code synced with the schema?
9292
grep -q "$(DIGEST)" pkg/builds/cosa_v1.go
9393
grep -q "$(DIGEST)" pkg/builds/schema_doc.go
94-
# Are the vendored copies of the generated code synced with the
95-
# canonical ones?
96-
diff -u mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/cosa_v1.go pkg/builds/cosa_v1.go
97-
diff -u mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/schema_doc.go pkg/builds/schema_doc.go
9894

9995
install:
10096
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler
@@ -111,4 +107,13 @@ install:
111107
ln -sf ../lib/coreos-assembler/cp-reflink $(DESTDIR)$(PREFIX)/bin/
112108
ln -sf coreos-assembler $(DESTDIR)$(PREFIX)/bin/cosa
113109
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler/tests/kola
114-
cd mantle && $(MAKE) install DESTDIR=$(DESTDIR)
110+
cd bin && install -D -t $(DESTDIR)$(PREFIX)/bin $(MANTLE_BINARIES)
111+
for arch in $(KOLET_ARCHES); do \
112+
install -D -m 0755 -t $(DESTDIR)$(PREFIX)/lib/kola/$${arch} bin/$${arch}/kolet; \
113+
done
114+
115+
.PHONY: vendor
116+
vendor:
117+
@go mod vendor
118+
@go mod tidy
119+

mantle/Makefile

-40
This file was deleted.

mantle/build

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ host_build() {
2929
go build \
3030
-ldflags "${ldflags}" \
3131
-mod vendor \
32-
-o "bin/$cmd" \
32+
-o "../bin/$cmd" \
3333
${race} \
3434
"$@" "${REPO_PATH}/cmd/$cmd"
3535
}
@@ -38,13 +38,13 @@ cross_static_build() {
3838
local cmd=$1; shift
3939
local a
4040
for a in ${KOLET_ARCHES}; do \
41-
mkdir -p "bin/$a"
41+
mkdir -p "../bin/$a"
4242
echo "Building $a/$cmd (static)"
4343
CGO_ENABLED=0 GOARCH=${BASEARCH_TO_GOARCH[$a]} \
4444
go build \
4545
-ldflags "${ldflags} -extldflags=-static" \
4646
-mod vendor \
47-
-o "bin/$a/$cmd" \
47+
-o "../bin/$a/$cmd" \
4848
-tags osusergo,netgo \
4949
"${REPO_PATH}/cmd/$cmd"
5050
done

0 commit comments

Comments
 (0)