Merge pull request #1006 from matthiasbeyer/remove-makefile

Remove Makefile, as cargo can be used now to build all the things
This commit is contained in:
Matthias Beyer 2017-08-26 19:30:23 +02:00 committed by GitHub
commit befff96220
3 changed files with 5 additions and 127 deletions

View file

@ -28,7 +28,7 @@ before_script:
script:
- |
make all test
cargo build --all --verbose -j 1 && cargo test --all --verbose -j 1
addons:
apt:
@ -38,7 +38,6 @@ addons:
- libdw-dev
- libelf-dev
- libzzip-dev
- make
- tree
sources:
- kalakris-cmake

103
Makefile
View file

@ -1,103 +0,0 @@
toml = $@/Cargo.toml
bin = $@/target/debug/$@
doc-crate-toml=./.imag-documentation/Cargo.toml
ECHO=$(shell which echo) -e
MAKE=$(shell which make)
BASH=$(shell which bash)
CARGO=$(shell which cargo)
BINS=$(shell find -maxdepth 1 -name "imag-*" -type d | sort)
LIBS=$(shell find -maxdepth 1 -name "libimag*" -type d | sort)
BIN_TARGETS=$(patsubst imag-%,,$(BINS))
BIN_TARGET_TESTS=$(foreach x,$(BIN_TARGETS),$(x)-test)
LIB_TARGETS=$(LIBS)
LIB_TARGETS_TEST=$(foreach x,$(subst ./,,$(LIBS)),$(x)-test)
TARGETS=$(BIN_TARGETS) $(LIB_TARGETS)
RELEASE_TARGETS=$(foreach x,$(TARGETS),$(x)-release)
INSTALL_TARGETS=$(foreach x,$(BIN_TARGETS),$(x)-install)
CHECK_TARGETS=$(foreach x,$(TARGETS),$(x)-check)
all: $(TARGETS) imag-bin
@$(ECHO) "\t[ALL ]"
imag-bin:
@$(ECHO) "\t[IMAG ][BUILD ]"
@$(CARGO) build --manifest-path ./bin/Cargo.toml
imag-bin-release:
@$(ECHO) "\t[IMAG ][RELEASE]"
@$(CARGO) build --release --manifest-path ./bin/Cargo.toml
imag-bin-install:
@$(ECHO) "\t[IMAG ][INSTALL]"
@$(CARGO) install --force --path ./bin
imag-bin-check:
@$(ECHO) "\t[IMAG ][CHECK ]"
@$(CARGO) check --manifest-path ./bin/Cargo.toml
release: $(RELEASE_TARGETS) imag-bin-release
@$(ECHO) "\t[RELEASE]"
bin: $(BIN_TARGETS) imag-bin
@$(ECHO) "\t[ALLBIN ]"
bin-test: $(BIN_TARGET_TESTS) imag-bin
lib: $(LIB_TARGETS)
@$(ECHO) "\t[ALLLIB ]"
lib-test: $(LIB_TARGETS_TEST)
test: bin-test lib-test
install: $(INSTALL_TARGETS) imag-bin-install
@$(ECHO) "\t[INSTALL]"
update:
@$(ECHO) "\t[UPDATE ]"
@$(CARGO) update
clean:
@$(ECHO) "\t[CLEAN ]"
@$(CARGO) clean
check: $(CHECK_TARGETS) imag-bin-check
check-outdated:
@$(ECHO) "\t[OUTDATED]"
@$(CARGO) outdated
$(TARGETS): %: .FORCE
@$(ECHO) "\t[CARGO ]:\t$@"
@$(CARGO) build --manifest-path ./$@/Cargo.toml
$(BIN_TARGET_TESTS): %-test: % .FORCE
@$(ECHO) "\t[CARGO ][TEST]: \t$@"
@$(CARGO) test --manifest-path ./$(subst -test,,$@)/Cargo.toml
@$(ECHO) "\t[BINTEST]:\t$@"
if [ -f $(subst -test,,$@)/tests/Makefile ]; then \
$(MAKE) -C $(subst -test,,$@)/tests || exit 1;\
fi;
$(RELEASE_TARGETS): %: .FORCE
@$(ECHO) "\t[RELEASE]:\t$(subst -release,,$@)"
@$(CARGO) build --release --manifest-path ./$(subst -release,,$@)/Cargo.toml
$(LIB_TARGETS_TEST): %: .FORCE
@$(ECHO) "\t[TEST ]:\t$@"
@$(CARGO) test --manifest-path ./$(subst -test,,$@)/Cargo.toml
$(INSTALL_TARGETS): %: .FORCE imag-bin-install
@$(ECHO) "\t[INSTALL]:\t$(subst -install,,$@)"
@$(CARGO) install --force --path ./$(subst -install,,$@)
$(CHECK_TARGETS): %: .FORCE
@$(ECHO) "\t[CHECK ]:\t$(subst -check,,$@)"
@$(CARGO) check --manifest-path ./$(subst -check,,$@)/Cargo.toml
.FORCE:

View file

@ -43,28 +43,10 @@ give you a commandline application.
### Building
We use `make` to automate the build process.
Make sure to _not_ include some `-j 8` arguments, this will _not_ work as you
might think, as the rust compiler automatically parallelizes stuff and if you `make -j 8`, you end up with a pretty high load!
There are several targets for each of the sub-crates in the Makefile:
| Target | Multi | Purpose | Example |
| :--- | ----- | :--- | :--- |
| all | | Build everything, debug mode | `make all` |
| bin | | Build all binaries, debug mode | `make bin` |
| lib | | Build all libraries, debug mode | `make lib` |
| lib-test | | Test all libraries | `make lib-test` |
| imag-bin | | Build only the `imag` binary, debug mode | `make imag-bin` |
| clean | | Remove build artifacts | `make clean` |
| update | | Run `cargo update` | `make update` |
| check-outdated | | Run `cargo outdated` | `make check-outdated`|
| check | * | Run `cargo check` | `make check` |
| install | * | Build everything, release mode, install | `make install` |
| release | * | Build everything, release mode | `make release` |
The `Multi` targets are callable for each sub-crate. For example you can call
`make imag-store-check` to run `cargo check` on the `imag-store` crate.
We use `cargo` for building all crates in this repository.
Make sure to use a recent `cargo`, at least one with workspace support.
Building all crates works with `cargo build --all`, building individual crates
by `cd`ing to their directory and calling `cargo build`.
### Running