31 lines
555 B
Makefile
31 lines
555 B
Makefile
target:
|
|
mkdir -p target
|
|
|
|
target/nbody.c: target
|
|
$(CC) -O3 -fomit-frame-pointer -march=native -funroll-loops \
|
|
nbody.c -o target/nbody.c -lm
|
|
|
|
target/nbody-rs:
|
|
rustc -C opt-level=3 -C target-cpu=native -C codegen-units=1 \
|
|
src/main.rs -o target/nbody-rs
|
|
|
|
build: target/nbody.c target/nbody-rs
|
|
|
|
time-build:
|
|
time make build
|
|
|
|
clean:
|
|
cargo clean
|
|
|
|
run-c: target/nbody.c
|
|
./target/nbody.c 50000000
|
|
|
|
run-rust: target/nbody-rs
|
|
./target/nbody-rs 50000000
|
|
|
|
run:
|
|
make run-c
|
|
@echo "----------------------"
|
|
make run-rust
|
|
|
|
.PHONY: run-c run |