Skip to content
Snippets Groups Projects
Commit 47ee733a authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Complete Makefile

parent ae137dbc
No related branches found
No related tags found
No related merge requests found
......@@ -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
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
......
ci.sh 0 → 100755
#!/bin/bash
set -ex
./fmt.sh -- --write-mode=diff
make
if [ -z "$TARGET" ]
then
make test
fi
#!/bin/bash
set -ex
make
make -C tests clean
make -C tests run
......@@ -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 "$@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment