From 126762cc9b3322d724102ebd94ff8d4e2311c150 Mon Sep 17 00:00:00 2001 From: verdant Date: Mon, 1 Jun 2026 20:44:58 +0800 Subject: Initial commit --- Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5c48466 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +CC = gcc +AS = as +LD = ld + +CFLAGS = -c -nostdlib -fno-builtin +ASFLAGS = -c + +LDFLAGS = -entry main -z noexecstack + +TARGET = helloworld +OBJS = syscall.o helloworld.o + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(LD) $(OBJS) $(LDFLAGS) -o $@ + +helloworld.o: helloworld.c + $(CC) $(CFLAGS) $< -o $@ + +syscall.o: syscall.s + $(AS) $(ASFLAGS) $< -o $@ + +clean: + rm -f $(OBJS) $(TARGET) + +run: $(TARGET) + ./$(TARGET) + +size: $(TARGET) + stat -c "%s bytes" $(TARGET) + +.PHONY: all clean run size -- cgit v1.2.3