summaryrefslogtreecommitdiff
path: root/src/common.make
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.make')
-rw-r--r--src/common.make39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/common.make b/src/common.make
new file mode 100644
index 0000000..6aa6e4b
--- /dev/null
+++ b/src/common.make
@@ -0,0 +1,39 @@
+# ============== ENVIRONMENT VARIABLES
+
+CC = i586-elf-gcc
+CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra
+
+LD = i586-elf-ld
+.PHONY: clean, mrproper
+
+LDFLAGS =
+
+ASM = nasm
+AFLAGS = -f elf
+
+# ============== GENERAL BUILD PROCEDURES
+
+all: $(Out)
+
+$(Out): $(Obj)
+ echo ""; echo "- Linking $@..."
+ $(LD) $(LDFLAGS) $^ -o $@
+
+# ============== GENERAL CLEAINING PROCEDURES
+
+clean:
+ rm $(Obj) || exit 0
+ rm *.o */*.o || exit 0
+
+mrproper: clean
+ rm $(Out) || exit 0
+
+# ============== SOURCE FILE BUILD PROCEDURES
+
+%.o: %.asm
+ echo ""; echo "- $<"
+ $(ASM) $(AFLAGS) -o $@ $<
+
+%.o: %.c
+ echo ""; echo "- $<"
+ $(CC) -c $< -o $@ $(CFLAGS)