2019-05-15 07:08:56 +03:00
|
|
|
CC = gcc
|
|
|
|
LD = ld
|
|
|
|
|
|
|
|
CFLAGS = -O2 -pipe -Wall -Wextra
|
|
|
|
|
|
|
|
INTERNAL_CFLAGS = \
|
2019-05-30 17:35:49 +03:00
|
|
|
-m32 \
|
2019-05-15 07:08:56 +03:00
|
|
|
-ffreestanding \
|
|
|
|
-nostdlib \
|
|
|
|
-masm=intel \
|
|
|
|
-fno-pic \
|
|
|
|
-mno-sse \
|
|
|
|
-mno-sse2 \
|
|
|
|
-ffreestanding \
|
|
|
|
-fno-stack-protector \
|
|
|
|
-I.
|
|
|
|
|
|
|
|
LDFLAGS =
|
|
|
|
|
|
|
|
INTERNAL_LDFLAGS = \
|
|
|
|
-m elf_i386 \
|
|
|
|
-nostdlib \
|
|
|
|
-Tlinker.ld
|
|
|
|
|
|
|
|
.PHONY: all clean
|
|
|
|
|
|
|
|
C_FILES := $(shell find ./ -type f -name '*.c')
|
|
|
|
OBJ := $(C_FILES:.c=.o)
|
|
|
|
|
|
|
|
all: qloader2.bin
|
|
|
|
|
2019-05-30 16:59:25 +03:00
|
|
|
qloader2.bin: bootsect/bootsect.bin $(OBJ)
|
|
|
|
$(LD) $(LDFLAGS) $(INTERNAL_LDFLAGS) $(OBJ) -o stage2.bin
|
|
|
|
cat bootsect/bootsect.bin stage2.bin > $@
|
|
|
|
|
|
|
|
bootsect/bootsect.bin: bootsect/bootsect.asm
|
|
|
|
cd bootsect && nasm bootsect.asm -fbin -o bootsect.bin
|
2019-05-15 07:08:56 +03:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
clean:
|
2019-05-30 16:59:25 +03:00
|
|
|
rm -f $(OBJ) bootsect/bootsect.bin
|