Complete Makefile
This commit is contained in:
+1
-3
@@ -10,8 +10,6 @@ before_script:
|
||||
- rustup component add rustfmt-preview
|
||||
- if [ -n "$TARGET" ]; then rustup target add $TARGET; fi
|
||||
script:
|
||||
- ./fmt.sh -- --write-mode=diff
|
||||
- cargo build $([ -n "$TARGET" ] && echo --target="$TARGET")
|
||||
- if [ -z "$TARGET" ]; then ./test.sh; fi
|
||||
- ./ci.sh
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
TARGET?=
|
||||
|
||||
BUILD=target/debug
|
||||
BUILD=target
|
||||
ifneq ($(TARGET),)
|
||||
BUILD=target/$(TARGET)/debug
|
||||
BUILD="target/$(TARGET)"
|
||||
CARGOFLAGS+="--target=$(TARGET)"
|
||||
CC=$(TARGET)-gcc
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),aarch64-unknown-linux-gnu)
|
||||
CC="aarch64-linux-gnu-gcc"
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),x86_64-unknown-redox)
|
||||
CC="x86_64-unknown-redox-gcc"
|
||||
endif
|
||||
|
||||
.PHONY: all clean fmt test
|
||||
|
||||
all: $(BUILD)/libc.a $(BUILD)/libcrt0.a $(BUILD)/openlibm/libopenlibm.a
|
||||
all: $(BUILD)/debug/libc.a $(BUILD)/debug/libcrt0.a $(BUILD)/openlibm/libopenlibm.a
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
@@ -21,16 +28,22 @@ fmt:
|
||||
test: all
|
||||
make -C tests run
|
||||
|
||||
$(BUILD)/libc.a:
|
||||
$(BUILD)/debug/libc.a: src/* src/*/* src/*/*/* src/*/*/*/*
|
||||
cargo build $(CARGOFLAGS)
|
||||
|
||||
$(BUILD)/libcrt0.a:
|
||||
$(BUILD)/debug/libcrt0.a: $(BUILD)/debug/libc.a
|
||||
cargo build --manifest-path src/crt0/Cargo.toml $(CARGOFLAGS)
|
||||
|
||||
$(BUILD)/release/libc.a: src/* src/*/* src/*/*/* src/*/*/*/*
|
||||
cargo build --release $(CARGOFLAGS)
|
||||
|
||||
$(BUILD)/release/libcrt0.a: $(BUILD)/release/libc.a
|
||||
cargo build --release --manifest-path src/crt0/Cargo.toml $(CARGOFLAGS)
|
||||
|
||||
$(BUILD)/openlibm: openlibm
|
||||
rm -rf $@ $@.partial
|
||||
cp -r $< $@.partial
|
||||
mv $@.partial $@
|
||||
|
||||
$(BUILD)/openlibm/libopenlibm.a: $(BUILD)/openlibm
|
||||
CC=$(CC) CFLAGS=-fno-stack-protector make -C $< libopenlibm.a
|
||||
make CC=$(CC) CFLAGS=-fno-stack-protector -C $< libopenlibm.a
|
||||
|
||||
@@ -4,7 +4,7 @@ relibc is a portable POSIX C standard library written in Rust. It is under heavy
|
||||
The motivation for this project is twofold: Reduce issues the redox crew was having with newlib, and create a safer alternative to a C standard library written in C. It is mainly designed to be used under redox, as an alternative to newlib, but it also supports linux syscalls via the [sc](https://crates.io/crates/sc) crate.
|
||||
|
||||
## Contributing
|
||||
Just search for any invocation of the `unimplemented` macro, and hop in! The ci server checks builds for linux and redox, checks formatting (via rustfmt), and runs the test suite. Run `ci.sh` locally to check that your changes will pass travis. Use `fmt.sh` to format your code and `test.sh` to run the C test suite.
|
||||
Just search for any invocation of the `unimplemented` macro, and hop in! The ci server checks builds for linux and redox, checks formatting (via rustfmt), and runs the test suite. Run `ci.sh` locally to check that your changes will pass travis. Use `fmt.sh` to format your code and `make test` to run the C test suite.
|
||||
|
||||
## Supported OSes
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
./fmt.sh -- --write-mode=diff
|
||||
make
|
||||
if [ -z "$TARGET" ]
|
||||
then
|
||||
make test
|
||||
fi
|
||||
+9
-7
@@ -87,18 +87,20 @@ verify: $(EXPECT_BINS)
|
||||
diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
|
||||
done
|
||||
|
||||
GCCHEAD=\
|
||||
CFLAGS=\
|
||||
-nostdinc \
|
||||
-nostdlib \
|
||||
-I ../include \
|
||||
-I ../target/include \
|
||||
-I ../openlibm/include \
|
||||
-I ../openlibm/src \
|
||||
-I ../target/openlibm/include \
|
||||
-I ../target/openlibm/src \
|
||||
|
||||
HEADLIBS=\
|
||||
../target/debug/libcrt0.a
|
||||
|
||||
GCCTAIL=\
|
||||
TAILLIBS=\
|
||||
../target/debug/libc.a \
|
||||
../openlibm/libopenlibm.a
|
||||
../target/openlibm/libopenlibm.a
|
||||
|
||||
%: %.c
|
||||
gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"
|
||||
%: %.c $(HEADLIBS) $(TAILLIBS)
|
||||
gcc -fno-stack-protector -Wall $(CFLAGS) $(HEADLIBS) "$<" $(TAILLIBS) -o "$@"
|
||||
|
||||
Reference in New Issue
Block a user