summaryrefslogtreecommitdiff
path: root/src/library/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/Makefile')
-rw-r--r--src/library/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/library/Makefile b/src/library/Makefile
new file mode 100644
index 0000000..c562dec
--- /dev/null
+++ b/src/library/Makefile
@@ -0,0 +1,34 @@
+.PHONY: clean, mrproper
+
+CC = gcc
+CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra
+
+LD = ld
+LDFLAGS = -r
+
+Library = grapes.o
+Objects = grapes/syscall.o \
+ start.o
+
+all: $(Library)
+ echo "* Done with library $(Library)"
+
+rebuild: mrproper all
+
+$(Library): $(Objects)
+ echo "* Linking library $(Library)..."
+ $(LD) $(LDFLAGS) $^ -o $@
+
+%.uo: %.c
+ echo "* Compiling $<..."
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ echo "* Removing object files..."
+ rm *.o || exit 0
+ rm -rf $(Objects) || exit 0
+
+mrproper: clean
+ echo "* Removing library..."
+ rm *.o || exit 0
+ rm -rf $(Library) || exit 0