summaryrefslogtreecommitdiffstats
path: root/apps/init/Makefile
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2025-08-10 15:46:33 -0400
committerJon Santmyer <jon@jonsantmyer.com>2025-08-10 15:46:33 -0400
commit65ba015d6c1f248d36ad01a653bc49637804b15b (patch)
treea77c3fb3ca7ecac8f65eb9638d152f1e90307d0a /apps/init/Makefile
downloadjove-os-65ba015d6c1f248d36ad01a653bc49637804b15b.tar.gz
jove-os-65ba015d6c1f248d36ad01a653bc49637804b15b.tar.bz2
jove-os-65ba015d6c1f248d36ad01a653bc49637804b15b.zip
working usermode objdir iteration
Diffstat (limited to 'apps/init/Makefile')
-rw-r--r--apps/init/Makefile21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/init/Makefile b/apps/init/Makefile
new file mode 100644
index 0000000..642ca38
--- /dev/null
+++ b/apps/init/Makefile
@@ -0,0 +1,21 @@
+include $(CONFIG)
+
+CFILES := $(wildcard *.c)
+OFILES := $(patsubst %.c,%.o,$(CFILES))
+OFILES += $(STATICLIBS)
+
+CFLAGS := -ffreestanding -nostdlib -g
+LDFLAGS := -T $(TARGET_MACHINE).ld
+OCFLAGS := -O binary \
+ --set-section-flags .bss=alloc,load,contents
+
+all: $(OFILES)
+ $(LD) $(LDFLAGS) ${OFILES} -o init.elf
+ objcopy $(OCFLAGS) init.elf $(OUT)/init
+
+clean:
+ -rm ${OFILES}
+ -rm init.elf
+
+%.o:%.c
+ $(CC) $(CFLAGS) -c $< -o $@