reorganize source
[com32] / Makefile
index a3411a3..4005ee9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,19 @@
-csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c)
-ssrc = $(wildcard src/*.asm) $(wildcard src/libc/*.asm)
+csrc = $(wildcard src/*.c) $(wildcard src/kern/*.c) $(wildcard src/libc/*.c)
+ssrc = $(wildcard src/*.asm) $(wildcard src/kern/*.asm) $(wildcard src/libc/*.asm)
 obj = $(csrc:.c=.o) $(ssrc:.asm=.o)
 dep = $(csrc:.c=.d)
 bin = test.com
 
 warn = -pedantic -Wall
-inc = -Isrc -Isrc/libc
+opt = -O2
+inc = -Isrc -Isrc/kern -Isrc/libc
 
-CFLAGS = -m32 -march=i386 $(warn) $(opt) $(dbg) -fno-pic -ffreestanding -nostdinc $(inc) $(def)
+AS = nasm
+
+ASFLAGS = -Isrc/ -Isrc/kern/
+CFLAGS = -m32 -march=i386 $(warn) $(opt) $(dbg) -fno-pic -ffreestanding \
+                -fno-stack-protector -mpreferred-stack-boundary=2 -nostdinc -ffast-math \
+                -fno-asynchronous-unwind-tables $(inc) $(def) -MMD
 LDFLAGS = -m elf_i386 -nostdlib -T com32.ld -Map test.map
 
 $(bin): $(obj)
@@ -16,10 +22,10 @@ $(bin): $(obj)
 -include $(dep)
 
 %.o: %.asm
-       nasm -o $@ -f elf $<
+       $(AS) -o $@ -f elf $(ASFLAGS) $<
 
 %.s: %.c
-       $(CC) $(CFLAGS) -S $< -o $@
+       $(CC) $(CFLAGS) -masm=intel -S $< -o $@
 
 .PHONY: clean
 clean: