Improve build system

- Reduce full build latency from ~20s to ~18s
- Bring back silent mode if `make V=0` is passed
- Demodernize utimes() polyfill so it works RHEL5
- Delete some old shell scripts that are no longer needed
- Truncate long lines when outputting builds to Emacs buffers
This commit is contained in:
Justine Tunney 2021-02-19 22:20:38 -08:00
parent c797f139bb
commit b740cca642
39 changed files with 440 additions and 916 deletions

View file

@ -17,7 +17,9 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/sysv/consts/o.h"
#include "libc/time/time.h"
/**
* Creates new file or changes modified time on existing one.
@ -28,7 +30,12 @@
* @see creat()
*/
int touch(const char *file, uint32_t mode) {
int fd;
if ((fd = open(file, O_CREAT | O_WRONLY, mode)) == -1) return -1;
return close(fd);
int rc, fd, olderr;
olderr = errno;
if ((rc = utimes(file, NULL)) == -1 && errno == ENOENT) {
errno = olderr;
if ((fd = open(file, O_CREAT | O_WRONLY, mode)) == -1) return -1;
return close(fd);
}
return rc;
}