summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-17 15:03:22 -0400
committerIan Moffett <ian@osmora.org>2025-09-17 15:03:22 -0400
commit5c40e61a6035315d4341ed508171bf68f3bc1955 (patch)
tree0988fdbc5b978fe35d2955364818c2b6088abdf4 /src/cmd
parent61aaead7e2904a2756ed72a71e36eeeb21591733 (diff)
build: Add test program to src/cmd/
Add a testing program for ELF loading purposes. This is to be removed in later versions of Lunos Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/Makefile10
-rw-r--r--src/cmd/test/Makefile15
-rw-r--r--src/cmd/test/test.c6
3 files changed, 31 insertions, 0 deletions
diff --git a/src/cmd/Makefile b/src/cmd/Makefile
new file mode 100644
index 0000000..2d1c7f8
--- /dev/null
+++ b/src/cmd/Makefile
@@ -0,0 +1,10 @@
+LDSCRIPT=../../sys/arch/$(TARGET)/conf/user.ld
+
+.PHONY: all
+all:
+ cd test/; LDSCRIPT=$(LDSCRIPT) CC=$(CC) ASM=$(ASM) \
+ LD=$(ASM) SYSROOT=$(SYSROOT) make
+
+.PHONY: clean
+clean:
+ cd test/; make clean
diff --git a/src/cmd/test/Makefile b/src/cmd/test/Makefile
new file mode 100644
index 0000000..d1488b5
--- /dev/null
+++ b/src/cmd/test/Makefile
@@ -0,0 +1,15 @@
+include ../../data/build/user.mk
+
+CFILES = $(shell find . -name "*.c")
+CFILES = $(shell find . -name "*.c")
+OBJECTS = $(CFILES:%.c=%.o)
+
+$(SYSROOT)/usr/bin/test: $(OBJECTS)
+ $(LD) $(OBJECTS) -o $@ $(INTERNAL_CFLAGS)
+
+%.o: %.c
+ $(CC) $(INTERNAL_CFLAGS) -c $(CFLAGS) $< -o $@
+
+.PHONY: clean
+clean:
+ rm -f *.o *.d
diff --git a/src/cmd/test/test.c b/src/cmd/test/test.c
new file mode 100644
index 0000000..693fb65
--- /dev/null
+++ b/src/cmd/test/test.c
@@ -0,0 +1,6 @@
+__attribute__((naked))
+void
+_start(void)
+{
+ for (;;);
+}