summaryrefslogtreecommitdiff
path: root/Source/UnixUserland/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Source/UnixUserland/Makefile')
-rw-r--r--Source/UnixUserland/Makefile50
1 files changed, 50 insertions, 0 deletions
diff --git a/Source/UnixUserland/Makefile b/Source/UnixUserland/Makefile
new file mode 100644
index 0000000..44fa29f
--- /dev/null
+++ b/Source/UnixUserland/Makefile
@@ -0,0 +1,50 @@
+.PHONY: clean, mrproper
+
+CC = gcc
+CCFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra -Werror -I../../Ports/newlib-1.15.0/newlib/libc/include
+
+LD = ld
+LDFLAGS = -r
+
+OutFile = MelonUnix.o
+Objects = _exit.o \
+ _start.o \
+ close.o \
+ environ.o \
+ execve.o \
+ fork.o \
+ fstat.o \
+ getpid.o \
+ isatty.o \
+ kill.o \
+ link.o \
+ lseek.o \
+ open.o \
+ read.o \
+ sbrk.o \
+ stat.o \
+ times.o \
+ unlink.o \
+ wait.o \
+ write.o
+
+all: $(OutFile)
+ echo "* Done with $(OutFile)."
+
+rebuild: mrproper all
+
+$(OutFile): $(Objects)
+ echo "* Linking executable : $(OutFile)..."
+ $(LD) $(LDFLAGS) -o $(OutFile) $^
+
+%.o: %.c
+ echo "* Compiling $<..."
+ $(CC) -c $< -o $@ $(CFLAGS)
+
+clean:
+ echo "* Removing object files..."
+ rm -rf $(Objects)
+
+mrproper: clean
+ echo "* Removing executable: $(OutFile)"
+ rm -rf $(OutFile)