2020-01-22 01:45:13 +03:00
|
|
|
CC = ../toolchain/bin/i386-elf-gcc
|
2020-08-29 19:51:23 +03:00
|
|
|
LD = ../toolchain/bin/i386-elf-gcc
|
2020-01-22 01:45:13 +03:00
|
|
|
|
2020-04-24 16:24:37 +03:00
|
|
|
CFLAGS = -Os -pipe -Wall -Wextra
|
2020-01-22 01:45:13 +03:00
|
|
|
|
|
|
|
INTERNAL_CFLAGS = \
|
2020-08-25 00:35:06 +03:00
|
|
|
-std=gnu99 \
|
2020-01-22 01:45:13 +03:00
|
|
|
-ffreestanding \
|
|
|
|
-fno-pic \
|
2020-08-25 00:35:06 +03:00
|
|
|
-mno-80387 \
|
|
|
|
-mno-mmx \
|
2020-01-22 01:45:13 +03:00
|
|
|
-mno-sse \
|
|
|
|
-mno-sse2 \
|
|
|
|
-fno-stack-protector \
|
2020-04-29 17:53:05 +03:00
|
|
|
-I. \
|
|
|
|
-Wno-address-of-packed-member
|
2020-01-22 01:45:13 +03:00
|
|
|
|
|
|
|
LDFLAGS = -O2
|
|
|
|
|
|
|
|
INTERNAL_LDFLAGS = \
|
|
|
|
-nostdlib \
|
|
|
|
-no-pie \
|
|
|
|
-lgcc \
|
|
|
|
-static-libgcc \
|
|
|
|
-Tlinker.ld
|
|
|
|
|
|
|
|
.PHONY: all clean
|
|
|
|
|
2020-04-14 07:36:43 +03:00
|
|
|
C_FILES := $(shell find ./ -type f -name '*.c' | sort)
|
2020-01-22 01:45:13 +03:00
|
|
|
OBJ := $(C_FILES:.c=.o)
|
|
|
|
|
|
|
|
all: qloader2.bin
|
|
|
|
|
2020-04-15 11:14:58 +03:00
|
|
|
qloader2.bin: $(OBJ)
|
2020-08-29 19:51:23 +03:00
|
|
|
$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.bin
|
2020-04-15 11:14:58 +03:00
|
|
|
cd bootsect && nasm bootsect.asm -fbin -o ../qloader2.bin
|
2020-01-22 01:45:13 +03:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
clean:
|
2020-04-15 11:14:58 +03:00
|
|
|
rm -f $(OBJ)
|