Skip to content

Commit

Permalink
treewide: Add Makefile's with a standardised set of targets
Browse files Browse the repository at this point in the history
This is to simplify dev/ci and allows anyone not familiar with Go/Python/Whatever to hack on components without also learning about relevant build tooling.
  • Loading branch information
adisbladis committed Apr 30, 2021
1 parent 7c2de50 commit b6b177b
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 8 deletions.
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
all: build test lint format

build:
for pkg in packages/*; do \

This comment has been minimized.

Copy link
@Mic92

Mic92 May 4, 2021

Member

if there were targets rather than a bash loop, they could be executed in parallel if you care about that.

bash -c "cd $$pkg && nix-shell --run 'make build'"; \
done

test:
for pkg in packages/*; do \
bash -c "cd $$pkg && nix-shell --run 'make test'"; \
done

lint:
for pkg in packages/*; do \
bash -c "cd $$pkg && nix-shell --run 'make lint'"; \
done

format:
nixpkgs-fmt --check .
for pkg in packages/*; do \
bash -c "cd $$pkg && nix-shell --run 'make format'"; \
done
11 changes: 11 additions & 0 deletions packages/nix-nar-unpack/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
cargo build

test:
true # noop, no tests

lint:
true # noop, no linter

format:
true # noop, no formatter
1 change: 1 addition & 0 deletions packages/pynix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
11 changes: 11 additions & 0 deletions packages/pynix/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
true # noop, no build step for python

test:
python -m tests

lint:
true # noop, no linter

format:
black --quiet --check .
12 changes: 12 additions & 0 deletions packages/trustix-nix-reprod/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
build:
bash -c "cd trustix_nix_reprod/js && nix-shell --run 'npm run build'"
true # noop, no build step for python

test:
@true

lint:
true # noop, no linter

format:
black --quiet --check .
11 changes: 11 additions & 0 deletions packages/trustix-nix/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
go build

test:
@true

lint:
true # noop, we're not using a linter for Go

format:
gofmt -d .
15 changes: 10 additions & 5 deletions packages/trustix-proto/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
all: go py

go:
build:
$(MAKE) -C schema
$(MAKE) -C protocol
$(MAKE) -C proto
$(MAKE) -C api

py:
bash -c 'cd ../trustix-python && nix-shell --run make'

test:
true # noop, no tests for codegen

lint:
@true # noop, no linter for codegen

format:
gofmt -d .
13 changes: 11 additions & 2 deletions packages/trustix-python/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
all:
$(MAKE) -C dev
build:
true # noop, no build step for python

test:
true # no tests, codegen

lint:
true # noop, no linter

format:
black --quiet --check .
11 changes: 10 additions & 1 deletion packages/trustix/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
all:
build:
go build

test:
$(MAKE) -C tests

lint:
true # noop, we're not using a linter for Go

format:
gofmt -d .

0 comments on commit b6b177b

Please sign in to comment.