always build multicall binary

squashed:
	a2c6b27 - build: automatically generate main() files
	c942f0f - remove MULTICALL=1 build from travis
	cb7b35b - make: remove unnecessary shell command
	69bbb31 - update README
	03a3168 - all: move main() into separate file that links against util crate
	8276384 - make: always build multicall binary
	aa4edeb - make: avoid 'rustc --crate-file-name'
This commit is contained in:
Michael Gehring
2014-06-25 18:47:34 +02:00
parent 8568d41a09
commit 30bba07f9c
55 changed files with 69 additions and 251 deletions
-1
View File
@@ -5,4 +5,3 @@ install:
script:
- make
- make test
- make MULTICALL=1
+19 -31
View File
@@ -81,12 +81,12 @@ EXES := \
$(sort $(filter $(BUILD),$(filter-out $(DONT_BUILD),$(PROGS))))
CRATES := \
$(sort $(filter $(EXES), $(filter-out true false, $(EXES))))
$(sort $(EXES))
INSTALL ?= $(EXES)
INSTALLEES := \
$(filter $(INSTALL),$(filter-out $(DONT_INSTALL),$(EXES)))
$(filter $(INSTALL),$(filter-out $(DONT_INSTALL),$(EXES) uutils))
# Programs with usable tests
TEST_PROGS := \
@@ -109,17 +109,18 @@ command = sh -c '$(1)'
# Main exe build rule
define EXE_BUILD
-include build/$(1).d
build/gen/$(1).rs: build/mkmain
build/mkmain $(1) build/gen/$(1).rs
build/$(1): $(1)/$(1).rs | build deps
$(call command,$(RUSTC) $(RUSTCFLAGS) -L build/ --dep-info build/$(1).d -o build/$(1) $(1)/$(1).rs)
build/$(1): build/gen/$(1).rs build/$(1).timestamp | build deps
$(RUSTC) $(RUSTCFLAGS) -L build/ -o build/$(1) build/gen/$(1).rs
endef
define CRATE_BUILD
-include build/$(1).d
build/$(2): $(1)/$(1).rs | build deps
$(call command,$(RUSTC) $(RUSTCFLAGS) -L build/ --crate-type rlib --dep-info build/$(1).d $(1)/$(1).rs --out-dir build)
build/$(1).timestamp: $(1)/$(1).rs | build deps
$(RUSTC) $(RUSTCFLAGS) -L build/ --crate-type rlib --dep-info build/$(1).d $(1)/$(1).rs --out-dir build
@touch build/$(1).timestamp
endef
# Aliases build rule
@@ -141,16 +142,11 @@ tmp/$(1)_test: $(1)/test.rs
endef
# Main rules
ifneq ($(MULTICALL), 1)
all: $(EXES_PATHS)
else
all: build/uutils
all: $(EXES_PATHS) build/uutils
-include build/uutils.d
build/uutils: uutils/uutils.rs $(addprefix build/, $(foreach crate,$(CRATES),$(shell $(RUSTC) --crate-type rlib --crate-file-name $(crate)/$(crate).rs)))
build/uutils: uutils/uutils.rs $(addprefix build/, $(addsuffix .timestamp, $(CRATES)))
$(RUSTC) $(RUSTCFLAGS) -L build/ --dep-info $@.d uutils/uutils.rs -o $@
endif
# Dependencies
LIBCRYPTO = $(shell $(RUSTC) --crate-file-name --crate-type rlib deps/rust-crypto/src/rust-crypto/lib.rs)
@@ -158,8 +154,14 @@ LIBCRYPTO = $(shell $(RUSTC) --crate-file-name --crate-type rlib deps/rust-crypt
build/$(LIBCRYPTO): | build
$(RUSTC) $(RUSTCFLAGS) --crate-type rlib --dep-info build/rust-crypto.d deps/rust-crypto/src/rust-crypto/lib.rs --out-dir build/
build/mkmain: mkmain.rs | build
$(RUSTC) $(RUSTCFLAGS) -L build mkmain.rs -o $@
deps: build/$(LIBCRYPTO)
crates:
echo $(EXES)
test: tmp $(addprefix test_,$(TESTS))
$(RM) -rf tmp
@@ -168,28 +170,17 @@ clean:
build:
git submodule update --init
mkdir build
mkdir -p build/gen
tmp:
mkdir tmp
# Creating necessary rules for each targets
ifeq ($(MULTICALL), 1)
$(foreach crate,$(CRATES),$(eval $(call CRATE_BUILD,$(crate),$(shell $(RUSTC) --crate-type rlib --crate-file-name --out-dir build $(crate)/$(crate).rs))))
else
$(foreach crate,$(CRATES),$(eval $(call CRATE_BUILD,$(crate))))
$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe))))
$(foreach alias,$(ALIASES),$(eval $(call MAKE_ALIAS,$(alias))))
endif
$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
ifeq ($(MULTICALL), 1)
install: build/uutils
mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)
install build/uutils $(DESTDIR)$(PREFIX)$(BINDIR)/uutils
uninstall:
rm -f $(DESTDIR)$(PREFIX)$(BINDIR)/uutils
else
install: $(addprefix build/,$(INSTALLEES))
mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)
for prog in $(INSTALLEES); do \
@@ -198,10 +189,8 @@ install: $(addprefix build/,$(INSTALLEES))
uninstall:
rm -f $(addprefix $(DESTDIR)$(PREFIX)$(BINDIR)/$(PROG_PREFIX),$(PROGS))
endif
# Test under the busybox testsuite
ifeq ($(MULTICALL), 1)
build/busybox: build/uutils
rm -f build/busybox
ln -s $(SRC_DIR)/build/uutils build/busybox
@@ -222,6 +211,5 @@ else
busytest: build/busybox build/.config
(cd $(BUSYBOX_SRC)/testsuite && bindir=$(SRC_DIR)/build ./runtest $(RUNTEST_ARGS))
endif
endif
.PHONY: all deps test clean busytest install uninstall
+2 -17
View File
@@ -34,11 +34,6 @@ To build only a few of the available utilities:
make BUILD='UTILITY_1 UTILITY_2'
```
To build the multicall binary (_i.e._ BusyBox-like binary):
```
make MULTICALL=1
```
Installation Instructions
-------------------------
@@ -57,12 +52,7 @@ To install only a few of the available utilities:
make INSTALL='UTILITY_1 UTILITY_2' install
```
To install the multicall binary:
```
make MULTICALL=1 install
```
To install every program (other than the multicall binary) with a prefix:
To install every program with a prefix:
```
make PROG_PREFIX=PREFIX_GOES_HERE install
```
@@ -75,12 +65,7 @@ To uninstall all utilities:
make uninstall
```
To uninstall the multicall binary:
```
make MULTICALL=1 uninstall
```
To uninstall every program (other than the multicall binary) with a set prefix:
To uninstall every program with a set prefix:
```
make PROG_PREFIX=PREFIX_GOES_HERE uninstall
```
-4
View File
@@ -18,7 +18,6 @@ extern crate libc;
#[phase(plugin, link)] extern crate log;
use std::io::{println, File, stdin, stdout};
use std::os;
use std::str;
use getopts::{
@@ -92,9 +91,6 @@ pub fn uumain(args: Vec<String>) -> int {
0
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
fn decode(input: &mut Reader, ignore_garbage: bool) {
let mut to_decode = match input.read_to_str() {
Ok(m) => m,
-4
View File
@@ -14,7 +14,6 @@ extern crate getopts;
extern crate libc;
use std::io::{print, println};
use std::os;
use std::str::StrSlice;
#[path = "../common/util.rs"]
@@ -23,9 +22,6 @@ mod util;
static NAME: &'static str = "basename";
static VERSION: &'static str = "1.0.0";
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = strip_dir(args.get(0).as_slice());
-4
View File
@@ -14,15 +14,11 @@
extern crate getopts;
use std::os;
use std::io::{print, File};
use std::io::stdio::{stdout_raw, stdin_raw, stderr};
use std::io::{IoResult};
use std::ptr::{copy_nonoverlapping_memory};
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = args.get(0).as_slice();
let opts = [
-3
View File
@@ -36,9 +36,6 @@ extern {
static NAME: &'static str = "chroot";
static VERSION: &'static str = "1.0.0";
#[allow(dead_code)]
fn main () { std::os::set_exit_status(uumain(std::os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = args.get(0);
-4
View File
@@ -14,7 +14,6 @@ extern crate getopts;
use std::io::{BufferedReader, EndOfFile, File, IoError, IoResult, print};
use std::io::stdio::stdin;
use std::os;
#[path="../common/util.rs"]
mod util;
@@ -77,9 +76,6 @@ fn open_file(name: &str) -> IoResult<Box<Reader>> {
}
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let opts = [
getopts::optflag("h", "help", "display this help and exit"),
-4
View File
@@ -15,7 +15,6 @@ use std::cmp::Ord;
use std::io::{BufferedReader, IoResult, print};
use std::io::fs::File;
use std::io::stdio::stdin;
use std::os;
use std::path::Path;
static NAME : &'static str = "comm";
@@ -94,9 +93,6 @@ fn open_file(name: &str) -> IoResult<Box<Buffer>> {
}
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let opts = [
getopts::optflag("1", "", "suppress column 1 (lines uniq to FILE1)"),
-3
View File
@@ -31,9 +31,6 @@ pub enum Mode {
Version,
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let opts = [
optflag("h", "help", "display this help and exit"),
-4
View File
@@ -11,14 +11,10 @@
extern crate getopts;
use std::os;
use std::io::print;
static VERSION: &'static str = "1.0.0";
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = args.get(0).clone();
let opts = [
-4
View File
@@ -16,7 +16,6 @@ extern crate getopts;
extern crate libc;
extern crate time;
use std::os;
use std::io::{stderr, fs, FileStat, TypeDirectory};
use std::option::Option;
use std::path::Path;
@@ -89,9 +88,6 @@ fn du(path: &Path, mut my_stat: Stat,
stats
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = args.get(0).as_slice();
let opts = [
-4
View File
@@ -13,7 +13,6 @@
extern crate getopts;
extern crate libc;
use std::os;
use std::io::{print, println};
use std::uint;
@@ -163,9 +162,6 @@ fn print_version() {
println!("echo version: {:s}", VERSION);
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let mut options = EchoOptions {
newline: false,
Vendored
-5
View File
@@ -13,8 +13,6 @@
#![allow(non_camel_case_types)]
use std::os;
struct options {
ignore_env: bool,
null: bool,
@@ -53,9 +51,6 @@ fn print_env(null: bool) {
}
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let prog = args.get(0).as_slice();
-4
View File
@@ -14,7 +14,6 @@ extern crate getopts;
extern crate libc;
use std::u64;
use std::os;
use std::vec::{Vec};
use std::io::{stdin};
@@ -64,9 +63,6 @@ fn print_factors_str(num_str: &str) {
print_factors(num);
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = args.get(0).as_slice();
let opts = [
+3 -3
View File
@@ -1,4 +1,4 @@
#![crate_id(name="false", vers="1.0.0", author="Seldaek")]
#![crate_id = "uufalse#1.0.0"]
/*
* This file is part of the uutils coreutils package.
@@ -9,6 +9,6 @@
* file that was distributed with this source code.
*/
fn main() {
std::os::set_exit_status(1);
pub fn uumain(_: Vec<String>) -> int {
1
}
-4
View File
@@ -15,7 +15,6 @@ extern crate getopts;
use std::io::{BufferedReader, BufferedWriter, File, IoResult};
use std::io::stdio::{stdin_raw, stdout_raw};
use std::os;
use linebreak::break_lines;
use parasplit::ParagraphStream;
@@ -54,9 +53,6 @@ struct FmtOptions {
tabwidth : uint,
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())) }
pub fn uumain(args: Vec<String>) -> int {
let opts = [
-4
View File
@@ -17,7 +17,6 @@ extern crate libc;
use std::io;
use std::io::fs::File;
use std::io::BufferedReader;
use std::os;
use std::uint;
#[path = "../common/util.rs"]
@@ -26,9 +25,6 @@ mod util;
static NAME: &'static str = "fold";
static VERSION: &'static str = "1.0.0";
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let (args, obs_width) = handle_obsolete(args.as_slice());
-4
View File
@@ -12,7 +12,6 @@
extern crate getopts;
use std::os;
use getopts::{
optflag,
getopts,
@@ -26,9 +25,6 @@ use c_types::{get_pw_from_args, group};
static NAME: &'static str = "groups";
static VERSION: &'static str = "1.0.0";
#[allow(dead_code)]
fn main () { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = args.get(0).clone();
-4
View File
@@ -21,7 +21,6 @@ extern crate getopts;
use std::io::fs::File;
use std::io::stdio::stdin_raw;
use std::io::BufferedReader;
use std::os;
use regex::Regex;
use crypto::digest::Digest;
use crypto::md5::Md5;
@@ -88,9 +87,6 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&str, Box<Digest>)
}
}
#[allow(dead_code)]
fn main() { os::set_exit_status(uumain(os::args())); }
pub fn uumain(args: Vec<String>) -> int {
let program = args.get(0).clone();
let binary = Path::new(program.as_slice());

Some files were not shown because too many files have changed in this diff Show More