summaryrefslogtreecommitdiff
path: root/lib/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Makefile')
-rw-r--r--lib/Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile
new file mode 100644
index 0000000..13c92f2
--- /dev/null
+++ b/lib/Makefile
@@ -0,0 +1,29 @@
+TARGET = lib.a
+
+SRCS = $(wildcard *.c)
+ASMS = $(wildcard *.s)
+OBJS = $(SRCS:.c=.o) $(ASMS:.s=.o)
+
+CFLAGS = -m32 -I../include -ffreestanding -nostdinc -nostdlib -fno-stack-protector -fno-pie -gstabs+ -g
+ASMFLAGS = -f elf32
+
+AR = ar
+CC = gcc $(CFLAGS)
+ASM = nasm $(ASMFLAGS)
+
+all: build
+
+build: $(TARGET)
+
+.s.o:
+ $(ASM) -o $*.o $^
+
+.c.o:
+ $(CC) -c -o $*.o $^
+
+$(TARGET): $(OBJS)
+ $(AR) rc $(TARGET) $(OBJS)
+
+clean:
+ rm -f $(OBJS)
+ rm -f $(TARGET)