summaryrefslogtreecommitdiffstats
path: root/apps/init/Makefile
diff options
context:
space:
mode:
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 $@