mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2026-01-16 10:11:01 +00:00
Squashed commit of the following:
commit 7b7981d315dd7748287bedc8f6417bbc2f9cb1ee
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Sat May 24 00:33:49 2014 -0400
Last minute touchups
commit dae70f52e2b485695e8c7e2ce8d2997f571afcab
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Fri May 23 23:43:24 2014 -0400
Minor indentation fixes
commit 782a02fe2768cf9e457bb6db9e8a63615c3a4bd1
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Fri May 23 23:40:57 2014 -0400
Fixes for latest rust
commit 51b0e59f75352bf65c89d2ab8cf0948da8404753
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Sun Apr 27 15:15:29 2014 -0400
Fixups
commit 9efd1f4c07f4610e3067a5b2bd047eb117344cdf
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Sun Apr 27 14:20:11 2014 -0400
Basic date and timestamp support
commit a354bc9c07a6ed2cd2748f1734a1ce0f6683e58c
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Sun Apr 27 01:37:37 2014 -0400
Primary functionality in place
commit 8bbaa0caa34fbca129db0c86f32d376d6eafbe18
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Sat Apr 26 22:23:16 2014 -0400
Support creating files
commit 5bf47c3c790b556b596d25a05cd74ca4c06b6d67
Author: Nick Platt <platt.nicholas@gmail.com>
Date: Mon Apr 21 00:24:49 2014 -0400
Add touch with basic usage text
120 lines
1.9 KiB
Makefile
120 lines
1.9 KiB
Makefile
include common.mk
|
|
|
|
# Possible programs
|
|
PROGS := \
|
|
base64 \
|
|
basename \
|
|
cat \
|
|
cksum \
|
|
comm \
|
|
cp \
|
|
dirname \
|
|
echo \
|
|
env \
|
|
du \
|
|
false \
|
|
fold \
|
|
md5sum \
|
|
mkdir \
|
|
paste \
|
|
printenv \
|
|
pwd \
|
|
rm \
|
|
rmdir \
|
|
sleep \
|
|
seq \
|
|
tac \
|
|
tee \
|
|
touch \
|
|
tr \
|
|
true \
|
|
truncate \
|
|
unlink \
|
|
wc \
|
|
yes \
|
|
hostname \
|
|
head \
|
|
|
|
UNIX_PROGS := \
|
|
hostid \
|
|
kill \
|
|
logname \
|
|
users \
|
|
whoami \
|
|
tty \
|
|
groups \
|
|
id \
|
|
uptime \
|
|
uname
|
|
|
|
ifneq ($(OS),Windows_NT)
|
|
PROGS := $(PROGS) $(UNIX_PROGS)
|
|
endif
|
|
|
|
BUILD ?= $(PROGS)
|
|
|
|
# Output names
|
|
EXES := \
|
|
$(sort $(filter $(BUILD),$(filter-out $(DONT_BUILD),$(PROGS))))
|
|
|
|
# Programs with usable tests
|
|
TEST_PROGS := \
|
|
cat \
|
|
mkdir \
|
|
seq \
|
|
tr \
|
|
truncate \
|
|
|
|
TEST ?= $(TEST_PROGS)
|
|
|
|
TESTS := \
|
|
$(filter $(TEST),$(filter-out $(DONT_TEST),$(filter $(BUILD),$(filter-out $(DONT_BUILD),$(TEST_PROGS)))))
|
|
|
|
# Utils stuff
|
|
EXES_PATHS := $(addprefix build/,$(EXES))
|
|
command = sh -c '$(1)'
|
|
|
|
# Main exe build rule
|
|
define EXE_BUILD
|
|
ifeq ($(wildcard $(1)/Makefile),)
|
|
build/$(1): $(1)/$(1).rs
|
|
$(call command,$(RUSTC) $(RUSTCFLAGS) -o build/$(1) $(1)/$(1).rs)
|
|
clean_$(1):
|
|
else
|
|
build/$(1): $(1)/$(1).rs
|
|
cd $(1) && make
|
|
clean_$(1):
|
|
cd $(1) && make clean
|
|
endif
|
|
endef
|
|
|
|
# Test exe built rules
|
|
define TEST_BUILD
|
|
test_$(1): tmp/$(1)_test build build/$(1)
|
|
$(call command,tmp/$(1)_test)
|
|
|
|
tmp/$(1)_test: $(1)/test.rs
|
|
$(call command,$(RUSTC) $(RUSTCFLAGS) --test -o tmp/$(1)_test $(1)/test.rs)
|
|
endef
|
|
|
|
# Main rules
|
|
all: build $(EXES_PATHS)
|
|
|
|
test: tmp $(addprefix test_,$(TESTS))
|
|
$(RM) -rf tmp
|
|
|
|
clean: $(addprefix clean_,$(EXES))
|
|
$(RM) -rf build tmp
|
|
|
|
build:
|
|
git submodule update --init
|
|
mkdir build
|
|
|
|
tmp:
|
|
mkdir tmp
|
|
|
|
# Creating necessary rules for each targets
|
|
$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe))))
|
|
$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
|
|
|
|
.PHONY: all test clean
|