Skip to content

Commit

Permalink
move utility scripts into common/
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholatian committed Feb 19, 2021
1 parent 98ea9f3 commit e091044
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 1 deletion.
17 changes: 17 additions & 0 deletions common/util/cleanall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
# -*- coding: utf-8 -*-

echo -e 'Cleaning all sub-repositories.\n' >/dev/stderr;

REPOS='arr clarg err futils himem log mt19937 str table';

for repo in ${REPOS}; do
cd ${repo};
echo -n "Cleaning sub-repo ‘${repo}’... " >/dev/stderr;
make clean 2>&1 >/dev/null;
echo 'done.' >/dev/stderr;
cd ..;
done

echo -e 'All done. Exiting...' >/dev/stderr;
exit 0;
18 changes: 18 additions & 0 deletions common/util/fmtall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
# -*- coding: utf-8 -*-

echo -e 'Auto-formatting all sub-repositories.\n' >/dev/stderr;

REPOS='arr chkmath clarg decl endian err futils himem log mt19937 str table
text';

for repo in ${REPOS}; do
cd ${repo};
echo -n "Formatting sub-repo ‘${repo}’... " >/dev/stderr;
make format 2>&1 >/dev/null;
echo 'done.' >/dev/stderr;
cd ..;
done

echo -e 'All done. Exiting...' >/dev/stderr;
exit 0;
2 changes: 1 addition & 1 deletion polity/util/getcosmo.sh → common/util/getcosmo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ else
fi

echo -n 'Extracting the binaries... ' >/dev/stderr;
unzip -qu common/build/cosmo.zip -x cosmopolitan.h -d common/build/cosmo;
unzip -qu common/build/cosmo.zip -d common/build/cosmo;
_x=$?;

if [ "$_x" = '0' ]; then
Expand Down
46 changes: 46 additions & 0 deletions common/util/makeall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh
# -*- coding: utf-8 -*-

echo 'Building all sub-repositories.' >/dev/stderr;
if [ "$1" = 'release' ]; then
target=release;
echo 'Building optimised release target.' >/dev/stderr;
elif [ "$1" = 'check' ]; then
target=check;
echo 'Building sanity check target.' >/dev/stderr;
elif [ "$1" = 'cov' ]; then
target=cov;
echo 'Building code coverage target.' >/dev/stderr;
elif [ "$1" = 'asan' ]; then
target=asan;
echo 'Building A-san target.' >/dev/stderr;
elif [ "$1" = 'ubsan' ]; then
target=ubsan;
echo 'Building UB-san target.' >/dev/stderr;
elif [ "$1" = '' ] || [ "$1" = 'debug' ]; then
target=debug;
echo 'Building debug target.' >/dev/stderr;
else
echo "Unknown target ‘$1’. Exiting..." >/dev/stderr;
exit 127;
fi

REPOS='arr clarg err futils himem log mt19937 str table';

if [ "$(uname -s)" = 'Darwin' ]; then
jobs=$(($(sysctl -n hw.ncpu)))
else
jobs=$(($(nproc) * 2));
fi

for repo in ${REPOS}; do
cd ${repo};
echo "Building sub-repo ‘${repo}’..." >/dev/stderr;
make ${target} -j${jobs};
cd ..;
done

echo -e 'All done. Exiting...' >/dev/stderr;

unset target jobs;
exit 0;
File renamed without changes.

0 comments on commit e091044

Please sign in to comment.