diff options
-rwxr-xr-x | configure | 19 | ||||
-rw-r--r-- | src/cmd/drawmouse.c (renamed from src/cmd/drawmouse/drawmouse.c) | 0 | ||||
-rw-r--r-- | src/cmd/dvd.c (renamed from src/cmd/dvd/dvd.c) | 0 | ||||
-rw-r--r-- | src/cmd/find.c (renamed from src/cmd/find/find.c) | 0 | ||||
-rw-r--r-- | src/cmd/httpd.c (renamed from src/cmd/httpd/httpd.c) | 0 | ||||
-rw-r--r-- | src/cmd/iochk.c (renamed from src/cmd/iochk/iochk.c) | 0 | ||||
-rw-r--r-- | src/cmd/iostress.c (renamed from src/cmd/iostress/iostress.c) | 0 | ||||
-rw-r--r-- | src/cmd/logfs.c (renamed from src/cmd/logfs/logfs.c) | 0 | ||||
-rw-r--r-- | src/cmd/netdog.c (renamed from src/cmd/netdog/nd.c) | 0 | ||||
-rw-r--r-- | src/cmd/ps.c (renamed from src/cmd/ps/ps.c) | 0 | ||||
-rw-r--r-- | src/cmd/socksfs.c (renamed from src/cmd/socksfs/socksfs.c) | 0 | ||||
-rw-r--r-- | src/cmd/testelf/main.c | 26 | ||||
-rw-r--r-- | src/cmd/tmpfs.c (renamed from src/cmd/tmpfs/tmpfs.c) | 0 | ||||
-rw-r--r-- | src/cmd/true.c (renamed from src/cmd/true/true.c) | 0 |
14 files changed, 13 insertions, 32 deletions
@@ -1,12 +1,17 @@ #!/usr/bin/env python3 from glob import glob +import os file = open('Makefile', 'w', encoding='utf-8') def raw(s): print(s, file=file) def srcobj(path): - srcs = glob(path + '/**/*.[csS]', recursive=True) + srcs = None + if os.path.isfile(path): + srcs = [path] + else: + srcs = glob(path + '/**/*.[csS]', recursive=True) objs = ['out/obj/' + src.removeprefix('src/') + '.o' for src in srcs] return ' ' + ' '.join(objs) + ' ' @@ -95,13 +100,15 @@ t('out/fs/boot/grub/grub.cfg', 'src/kernel/arch/amd64/grub.cfg', ['cp $< $@']) t('out/fs.e2', '', ['mkfs.ext2 $@ 1024 >/dev/null']) -userbins = glob('*', root_dir='src/cmd/') -raw("USERBINS = " + " ".join(userbins)) - -for cmd in userbins: - t(f'out/initrd/bin/amd64/{cmd}', '$(LIB) ' + srcobj(f'src/cmd/{cmd}'), [ +userbins = [] +for src in glob('*', root_dir='src/cmd/'): + cmd = src.removesuffix('.c') + t(f'out/initrd/bin/amd64/{cmd}', '$(LIB) ' + srcobj(f'src/cmd/{src}'), [ '$(CC) $^ -o $@' ]) + userbins.append(cmd) + +raw("USERBINS = " + " ".join(userbins)) # don't build the example implementation from libext2 t('out/obj/cmd/ext2fs/ext2/example.c.o', '', ['touch $@']) diff --git a/src/cmd/drawmouse/drawmouse.c b/src/cmd/drawmouse.c index f20d9bd..f20d9bd 100644 --- a/src/cmd/drawmouse/drawmouse.c +++ b/src/cmd/drawmouse.c diff --git a/src/cmd/dvd/dvd.c b/src/cmd/dvd.c index 0b5caaf..0b5caaf 100644 --- a/src/cmd/dvd/dvd.c +++ b/src/cmd/dvd.c diff --git a/src/cmd/find/find.c b/src/cmd/find.c index d473b82..d473b82 100644 --- a/src/cmd/find/find.c +++ b/src/cmd/find.c diff --git a/src/cmd/httpd/httpd.c b/src/cmd/httpd.c index 8826dcb..8826dcb 100644 --- a/src/cmd/httpd/httpd.c +++ b/src/cmd/httpd.c diff --git a/src/cmd/iochk/iochk.c b/src/cmd/iochk.c index 4483610..4483610 100644 --- a/src/cmd/iochk/iochk.c +++ b/src/cmd/iochk.c diff --git a/src/cmd/iostress/iostress.c b/src/cmd/iostress.c index ac555de..ac555de 100644 --- a/src/cmd/iostress/iostress.c +++ b/src/cmd/iostress.c diff --git a/src/cmd/logfs/logfs.c b/src/cmd/logfs.c index a50d530..a50d530 100644 --- a/src/cmd/logfs/logfs.c +++ b/src/cmd/logfs.c diff --git a/src/cmd/netdog/nd.c b/src/cmd/netdog.c index 221dc9c..221dc9c 100644 --- a/src/cmd/netdog/nd.c +++ b/src/cmd/netdog.c diff --git a/src/cmd/ps/ps.c b/src/cmd/ps.c index c855251..c855251 100644 --- a/src/cmd/ps/ps.c +++ b/src/cmd/ps.c diff --git a/src/cmd/socksfs/socksfs.c b/src/cmd/socksfs.c index 9469d0c..9469d0c 100644 --- a/src/cmd/socksfs/socksfs.c +++ b/src/cmd/socksfs.c diff --git a/src/cmd/testelf/main.c b/src/cmd/testelf/main.c deleted file mode 100644 index 0cbe56c..0000000 --- a/src/cmd/testelf/main.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <err.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -const char *str = "Hello!", *str2 = "World."; - -int main(int argc, char **argv) { - printf("elftest's &main == %p\n", &main); - printf("%s %s\n", str, str2); - printf("argc == %u\n", argc); - for (int i = 0; i < argc; i++) - printf("argv[%u] == %p == \"%s\"\n", i, argv[i], argv[i]); - if (argv[1] && strcmp(argv[1], "stackexec") == 0) { - /* exec something with arguments on the stack */ - const char s_d[] = "I am a pretty long string on the stack. Oh my. " \ - "I hope I won't get corrupted.\0"; - char s[sizeof(s_d)]; - memcpy(s, s_d, sizeof(s_d)); - const char *argv2[] = {"/bin/testelf", s, s, "hello", s, s, s, "lol", NULL}; - printf("argv2 == %p, s == %p\n== exec ==\n", argv2, s); - execv((void*)argv2[0], (void*)argv2); - err(1, "execv"); - } - return 0; -} diff --git a/src/cmd/tmpfs/tmpfs.c b/src/cmd/tmpfs.c index 6d58790..6d58790 100644 --- a/src/cmd/tmpfs/tmpfs.c +++ b/src/cmd/tmpfs.c diff --git a/src/cmd/true/true.c b/src/cmd/true.c index 061ed7e..061ed7e 100644 --- a/src/cmd/true/true.c +++ b/src/cmd/true.c |