mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-29 05:50:27 +00:00
Work around Landlock output inode in compile.com
This change fixes Landlock Make so that only the output target file is unveiled, rather than unveiling the directory that contains it. This gives us a much stronger sandbox. It also helped identify problematic build code in our repo that should have been using o/tmp instead. Landlock isn't able to let us unveil files that don't exist. Even if they do, then once a file is deleted, the sandboxing for it goes away. This caused problems for Landlock Make because tools like GNU LD will repeatedly delete and recreate the output file. This change uses the compile.com wrapper to ensure on changes happen to the output inode. New binary available on https://justine.lol/make/ Fixes #528
This commit is contained in:
parent
c464f45692
commit
133c693650
33 changed files with 207 additions and 1346 deletions
|
@ -31,6 +31,7 @@
|
|||
#include "libc/log/check.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/io.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sock/sock.h"
|
||||
|
@ -322,13 +323,9 @@ int main(int argc, char *argv[]) {
|
|||
goto fail;
|
||||
}
|
||||
outsize += (remain = sizes.p[i]);
|
||||
while ((rc = copy_file_range(fd, 0, outfd, 0, remain, 0)) < remain) {
|
||||
if (rc <= 0) {
|
||||
reason = "copy_file_range failed";
|
||||
goto fail;
|
||||
} else {
|
||||
remain -= rc;
|
||||
}
|
||||
if (_copyfd(fd, outfd, remain) == -1) {
|
||||
reason = "copy_file_range failed";
|
||||
goto fail;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
|
|
@ -85,17 +85,6 @@ o/$(MODE)/tool/build/%.com.dbg: \
|
|||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
.PRECIOUS: o/$(MODE)/tool/build/blinkenlights.com
|
||||
o/$(MODE)/tool/build/blinkenlights.com: \
|
||||
o/$(MODE)/tool/build/blinkenlights.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/build/.blinkenlights/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/build/.blinkenlights/.symtab
|
||||
|
||||
o/$(MODE)/tool/build/emulator.o: \
|
||||
OVERRIDE_COPTS += \
|
||||
-fno-sanitize=pointer-overflow
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/bits/safemacros.internal.h"
|
||||
#include "libc/calls/calls.h"
|
||||
|
@ -38,6 +37,7 @@
|
|||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/mem/io.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/kcpuids.h"
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
|
@ -171,6 +171,7 @@ char *target;
|
|||
char *output;
|
||||
char *outpath;
|
||||
char *command;
|
||||
char *movepath;
|
||||
char *shortened;
|
||||
char *colorflag;
|
||||
char ccpath[PATH_MAX];
|
||||
|
@ -188,6 +189,7 @@ struct timespec signalled;
|
|||
sigset_t mask;
|
||||
sigset_t savemask;
|
||||
char buf[PAGESIZE];
|
||||
char tmpout[PATH_MAX];
|
||||
|
||||
const char *const kSafeEnv[] = {
|
||||
"ADDR2LINE", // needed by GetAddr2linePath
|
||||
|
@ -707,6 +709,24 @@ void ReportResources(void) {
|
|||
appendw(&output, '\n');
|
||||
}
|
||||
|
||||
bool MovePreservingDestinationInode(const char *from, const char *to) {
|
||||
bool res;
|
||||
struct stat st;
|
||||
int fdin, fdout;
|
||||
if ((fdin = open(from, O_RDONLY)) == -1) {
|
||||
return false;
|
||||
}
|
||||
fstat(fdin, &st);
|
||||
if ((fdout = creat(to, st.st_mode)) == -1) {
|
||||
close(fdin);
|
||||
return false;
|
||||
}
|
||||
res = _copyfd(fdin, fdout, -1) != -1;
|
||||
close(fdin);
|
||||
close(fdout);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool IsNativeExecutable(const char *path) {
|
||||
bool res;
|
||||
char buf[4];
|
||||
|
@ -737,6 +757,7 @@ int main(int argc, char *argv[]) {
|
|||
char *s, *p, *q, **envp;
|
||||
|
||||
mode = firstnonnull(getenv("MODE"), MODE);
|
||||
ksnprintf(tmpout, sizeof(tmpout), "%scompile.%d", kTmpPath, getpid());
|
||||
|
||||
/*
|
||||
* parse prefix arguments
|
||||
|
@ -835,18 +856,26 @@ int main(int argc, char *argv[]) {
|
|||
* ingest arguments
|
||||
*/
|
||||
for (i = optind; i < argc; ++i) {
|
||||
if (!movepath && !outpath && target && !strcmp(target, argv[i])) {
|
||||
outpath = argv[i];
|
||||
AddArg(tmpout);
|
||||
movepath = target;
|
||||
MovePreservingDestinationInode(target, tmpout);
|
||||
continue;
|
||||
}
|
||||
if (argv[i][0] != '-') {
|
||||
AddArg(argv[i]);
|
||||
continue;
|
||||
}
|
||||
if (startswith(argv[i], "-o")) {
|
||||
if (!strcmp(argv[i], "-o")) {
|
||||
AddArg(argv[i]);
|
||||
AddArg((outpath = argv[++i]));
|
||||
outpath = argv[++i];
|
||||
} else {
|
||||
AddArg(argv[i]);
|
||||
outpath = argv[i] + 2;
|
||||
}
|
||||
AddArg("-o");
|
||||
AddArg(tmpout);
|
||||
movepath = outpath;
|
||||
continue;
|
||||
}
|
||||
if (!iscc) {
|
||||
|
@ -1091,6 +1120,19 @@ int main(int argc, char *argv[]) {
|
|||
makedirs(xdirname(target), 0755);
|
||||
touch(target, 0644);
|
||||
}
|
||||
if (movepath) {
|
||||
if (!MovePreservingDestinationInode(tmpout, movepath)) {
|
||||
unlink(tmpout);
|
||||
exitcode = 90;
|
||||
appends(&output, "\nfailed to move output file\n");
|
||||
appends(&output, tmpout);
|
||||
appends(&output, "\n");
|
||||
appends(&output, movepath);
|
||||
appends(&output, "\n");
|
||||
} else {
|
||||
unlink(tmpout);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
appendw(&output, '\n');
|
||||
PrintRed();
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/mem/io.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/ex.h"
|
||||
#include "libc/sysv/consts/exit.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/ok.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/x/x.h"
|
||||
|
@ -162,6 +164,24 @@ char *Join(const char *a, const char *b) {
|
|||
return dstfile;
|
||||
}
|
||||
|
||||
bool MovePreservingDestinationInode(const char *from, const char *to) {
|
||||
bool res;
|
||||
struct stat st;
|
||||
int fdin, fdout;
|
||||
if ((fdin = open(from, O_RDONLY)) == -1) {
|
||||
return false;
|
||||
}
|
||||
fstat(fdin, &st);
|
||||
if ((fdout = creat(to, st.st_mode)) == -1) {
|
||||
close(fdin);
|
||||
return false;
|
||||
}
|
||||
res = _copyfd(fdin, fdout, -1) != -1;
|
||||
close(fdin);
|
||||
close(fdout);
|
||||
return res;
|
||||
}
|
||||
|
||||
void Cp(char *src, char *dst) {
|
||||
ssize_t rc;
|
||||
const char *s;
|
||||
|
@ -207,7 +227,7 @@ void Cp(char *src, char *dst) {
|
|||
linkbuf[rc] = 0;
|
||||
if (symlink(linkbuf, dst) == -1) goto OnFail;
|
||||
} else {
|
||||
if (copyfile(src, dst, flags) == -1) goto OnFail;
|
||||
if (!MovePreservingDestinationInode(src, dst)) goto OnFail;
|
||||
}
|
||||
return;
|
||||
OnFail:
|
||||
|
|
|
@ -62,9 +62,9 @@ static bool IsOverlappingIov(struct iovec *a, struct iovec *b) {
|
|||
*/
|
||||
void PersistObject(const char *path, size_t align,
|
||||
const struct ObjectParam *obj) {
|
||||
const char *pad;
|
||||
struct iovec *iov;
|
||||
int i, n, fd, iovlen;
|
||||
const char *tmp, *pad;
|
||||
long len, size, bytes, filesize;
|
||||
unsigned char *hdr, *p1, *p2, **pp;
|
||||
intptr_t arrayptroffset, arraydataoffset;
|
||||
|
@ -79,7 +79,6 @@ void PersistObject(const char *path, size_t align,
|
|||
pad = gc(xcalloc(align, 1));
|
||||
hdr = gc(xmalloc(obj->size));
|
||||
iov = gc(xcalloc(iovlen, sizeof(*iov)));
|
||||
tmp = gc(xasprintf("%s.%d.%s", path, getpid(), "tmp"));
|
||||
bytes = obj->size;
|
||||
iov[0].iov_base = memcpy(hdr, obj->p, obj->size);
|
||||
iov[0].iov_len = bytes;
|
||||
|
@ -115,8 +114,7 @@ void PersistObject(const char *path, size_t align,
|
|||
iov[(i + 0) * 2].iov_base, iov[(i + 0) * 2].iov_len, (i + 1) * 2,
|
||||
iov[(i + 1) * 2].iov_base, iov[(i + 1) * 2].iov_len, path);
|
||||
}
|
||||
CHECK_NE(-1, (fd = open(tmp, O_CREAT | O_WRONLY | O_EXCL, 0644)), "%s", tmp);
|
||||
CHECK_NE(-1, (fd = creat(path, 0644)), "%s", path);
|
||||
CHECK_EQ(filesize, writev(fd, iov, iovlen));
|
||||
CHECK_NE(-1, close(fd));
|
||||
CHECK_NE(-1, rename(tmp, path), "%s", path);
|
||||
}
|
||||
|
|
|
@ -425,7 +425,6 @@ void Explore(void) {
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i, fd;
|
||||
char path[PATH_MAX];
|
||||
ShowCrashReports();
|
||||
if (argc == 2 && !strcmp(argv[1], "-n")) exit(0);
|
||||
GetOpts(argc, argv);
|
||||
|
@ -435,14 +434,12 @@ int main(int argc, char *argv[]) {
|
|||
LoadRelationships(argc, argv);
|
||||
Crunch();
|
||||
Explore();
|
||||
ksnprintf(path, sizeof(path), "%s.%d", out, getpid());
|
||||
CHECK_NE(-1, (fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)),
|
||||
"open(%#s)", path);
|
||||
CHECK_NE(-1, (fd = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0644)),
|
||||
"open(%#s)", out);
|
||||
for (i = 0; i < threads; ++i) {
|
||||
CHECK_NE(-1, xwrite(fd, bouts[i], appendz(bouts[i]).i));
|
||||
}
|
||||
CHECK_NE(-1, close(fd));
|
||||
CHECK_NE(-1, rename(path, out));
|
||||
for (i = 0; i < threads; ++i) {
|
||||
free(bouts[i]);
|
||||
}
|
||||
|
|
|
@ -141,9 +141,6 @@ struct Package *LoadPackage(const char *path) {
|
|||
pkg->strings.p = (char *)((intptr_t)pkg->strings.p + (intptr_t)pkg);
|
||||
pkg->objects.p = (struct Object *)((intptr_t)pkg->objects.p + (intptr_t)pkg);
|
||||
pkg->symbols.p = (struct Symbol *)((intptr_t)pkg->symbols.p + (intptr_t)pkg);
|
||||
CHECK(strcmp(path, &pkg->strings.p[pkg->path]) == 0,
|
||||
"corrupt package: %`'s pkg=%012lx strings=%012lx", path, pkg,
|
||||
pkg->strings.p);
|
||||
pkg->addr = pkg;
|
||||
pkg->size = st.st_size;
|
||||
CHECK_NE(-1, mprotect(pkg, st.st_size, PROT_READ));
|
||||
|
|
164
tool/net/net.mk
164
tool/net/net.mk
|
@ -104,65 +104,20 @@ o/$(MODE)/tool/net/redbean.com.dbg: \
|
|||
o/$(MODE)/tool/net/lsqlite3.o \
|
||||
o/$(MODE)/tool/net/largon2.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
ifneq ($(MODE),tiny)
|
||||
ifneq ($(MODE),tinylinux)
|
||||
o/$(MODE)/tool/net/redbean.com: \
|
||||
o/$(MODE)/tool/net/redbean.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com \
|
||||
tool/net/net.mk \
|
||||
tool/net/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
o/$(MODE)/tool/build/symtab.com
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/$(MODE)/tool/net/.redbean
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/net/.redbean/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/net/.redbean/.symtab \
|
||||
tool/net/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
endif
|
||||
endif
|
||||
|
||||
o/tiny/tool/net/redbean.com: \
|
||||
o/tiny/tool/net/redbean.com.dbg \
|
||||
o/tiny/third_party/zip/zip.com \
|
||||
tool/net/net.mk \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/tiny/tool/net/.redbean
|
||||
@$(COMPILE) -AZIP -T$@ o/tiny/third_party/zip/zip.com -9qj $@ \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
|
||||
o/tinylinux/tool/net/redbean.com: \
|
||||
o/tinylinux/tool/net/redbean.com.dbg \
|
||||
o/tinylinux/third_party/zip/zip.com \
|
||||
tool/net/net.mk \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/tinylinux/tool/net/.redbean
|
||||
@$(COMPILE) -AZIP -T$@ o/tinylinux/third_party/zip/zip.com -9qj $@ \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/.init.lua \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com -o $(SYMTAB) $<
|
||||
@$(COMPILE) -AZIP -T$@ $@ -A $(SYMTAB)
|
||||
|
||||
# REDBEAN-DEMO.COM
|
||||
#
|
||||
|
@ -170,6 +125,7 @@ o/tinylinux/tool/net/redbean.com: \
|
|||
# bundles a bunch of example code and there's a live of it available
|
||||
# online at http://redbean.justine.lol/
|
||||
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql.lua.zip.o \
|
||||
|
@ -196,6 +152,7 @@ o/$(MODE)/tool/net/demo/redbean-form.lua.zip.o \
|
|||
o/$(MODE)/tool/net/demo/redbean-xhr.lua.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/demo/404.html.zip.o: \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-B
|
||||
|
@ -263,49 +220,30 @@ o/$(MODE)/tool/net/redbean-demo.com.dbg: \
|
|||
o/$(MODE)/tool/net/demo/.lua/mymodule.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/net/redbean-demo.com: \
|
||||
o/$(MODE)/tool/net/redbean-demo.com.dbg \
|
||||
o/$(MODE)/tool/build/symtab.com \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
tool/net/help.txt
|
||||
o/$(MODE)/tool/build/symtab.com
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/$(MODE)/tool/net/.redbean-demo
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/net/.redbean-demo/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/net/.redbean-demo/.symtab \
|
||||
tool/net/help.txt
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com -o $(SYMTAB) $<
|
||||
@$(COMPILE) -AZIP -T$@ $@ -A $(SYMTAB)
|
||||
|
||||
# REDBEAN-STATIC.COM
|
||||
#
|
||||
# Passing the -DSTATIC causes Lua and SQLite to be removed. This reduces
|
||||
# the binary size from roughly 1500 kb to 500 kb. It still supports SSL.
|
||||
|
||||
o/$(MODE)/tool/net/redbean-static.com: \
|
||||
o/$(MODE)/tool/net/redbean-static.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com \
|
||||
tool/net/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/$(MODE)/tool/net/.redbean-static
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/net/.redbean-static/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/net/.redbean-static/.symtab \
|
||||
tool/net/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
|
||||
o/$(MODE)/tool/net/redbean-static.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
o/$(MODE)/tool/net/redbean-static.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
@ -316,23 +254,6 @@ o/$(MODE)/tool/net/redbean-static.com.dbg: \
|
|||
# That doesn't mean redbean becomes insecure. It just reduces complexity
|
||||
# in situations where you'd rather have SSL be handled in an edge proxy.
|
||||
|
||||
o/$(MODE)/tool/net/redbean-unsecure.com: \
|
||||
o/$(MODE)/tool/net/redbean-unsecure.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com \
|
||||
tool/net/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/$(MODE)/tool/net/.redbean-unsecure
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/net/.redbean-unsecure/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/net/.redbean-unsecure/.symtab \
|
||||
tool/net/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
|
||||
o/$(MODE)/tool/net/redbean-unsecure.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
o/$(MODE)/tool/net/redbean-unsecure.o \
|
||||
|
@ -345,6 +266,9 @@ o/$(MODE)/tool/net/redbean-unsecure.com.dbg: \
|
|||
o/$(MODE)/tool/net/lsqlite3.o \
|
||||
o/$(MODE)/tool/net/largon2.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
@ -355,57 +279,13 @@ o/$(MODE)/tool/net/redbean-unsecure.com.dbg: \
|
|||
# produce 200kb binary that's very similar to redbean as it existed on
|
||||
# Hacker News the day it went viral.
|
||||
|
||||
ifneq ($(MODE),tiny)
|
||||
ifneq ($(MODE),tinylinux)
|
||||
o/$(MODE)/tool/net/redbean-original.com: \
|
||||
o/$(MODE)/tool/net/redbean-original.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com \
|
||||
tool/net/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/$(MODE)/tool/net/.redbean-original
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/net/.redbean-original/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/net/.redbean-original/.symtab \
|
||||
tool/net/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
endif
|
||||
endif
|
||||
|
||||
o/tiny/tool/net/redbean-original.com: \
|
||||
o/tiny/tool/net/redbean-original.com.dbg \
|
||||
o/tiny/third_party/zip/zip.com \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/tiny/tool/net/.redbean-original
|
||||
@$(COMPILE) -AZIP -T$@ o/tiny/third_party/zip/zip.com -9qj $@ \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
|
||||
o/tinylinux/tool/net/redbean-original.com: \
|
||||
o/tinylinux/tool/net/redbean-original.com.dbg \
|
||||
o/tinylinux/third_party/zip/zip.com \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/tinylinux/tool/net/.redbean-original
|
||||
@$(COMPILE) -AZIP -T$@ o/tinylinux/third_party/zip/zip.com -9qj $@ \
|
||||
tool/net/tiny/help.txt \
|
||||
tool/net/favicon.ico \
|
||||
tool/net/redbean.png
|
||||
|
||||
o/$(MODE)/tool/net/redbean-original.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
o/$(MODE)/tool/net/redbean-original.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
|
|
@ -46,19 +46,6 @@ o/$(MODE)/tool/plinko/%.com.dbg: \
|
|||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
.PRECIOUS: o/$(MODE)/tool/plinko/plinko.com
|
||||
o/$(MODE)/tool/plinko/plinko.com: \
|
||||
o/$(MODE)/tool/plinko/plinko.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com \
|
||||
tool/plinko/plinko.mk
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -AMKDIR -T$@ $(MKDIR) o/$(MODE)/tool/plinko/.redbean
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/plinko/.plinko/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/plinko/.plinko/.symtab
|
||||
|
||||
$(TOOL_PLINKO_OBJS): \
|
||||
$(BUILD_FILES) \
|
||||
tool/plinko/plinko.mk
|
||||
|
|
|
@ -82,26 +82,6 @@ o/$(MODE)/tool/viz/printimage.com.dbg: \
|
|||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/viz/printimage.com: \
|
||||
o/$(MODE)/tool/viz/printimage.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/viz/.printimage/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/viz/.printimage/.symtab
|
||||
|
||||
o/$(MODE)/tool/viz/printvideo.com: \
|
||||
o/$(MODE)/tool/viz/printvideo.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com
|
||||
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
||||
@$(COMPILE) -ASYMTAB o/$(MODE)/tool/build/symtab.com \
|
||||
-o o/$(MODE)/tool/viz/.printvideo/.symtab $<
|
||||
@$(COMPILE) -AZIP -T$@ o/$(MODE)/third_party/zip/zip.com -9qj $@ \
|
||||
o/$(MODE)/tool/viz/.printvideo/.symtab
|
||||
|
||||
o/$(MODE)/tool/viz/derasterize.o: \
|
||||
OVERRIDE_CFLAGS += \
|
||||
-DSTACK_FRAME_UNLIMITED \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue