rulimine/src/Makefile

43 lines
721 B
Makefile
Raw Normal View History

CC = ../toolchain/bin/i386-elf-gcc
LD = ../toolchain/bin/i386-elf-gcc
CFLAGS = -Os -pipe -Wall -Wextra
INTERNAL_CFLAGS = \
2020-08-25 00:35:06 +03:00
-std=gnu99 \
-ffreestanding \
-fno-pic \
2020-08-25 00:35:06 +03:00
-mno-80387 \
-mno-mmx \
-mno-sse \
-mno-sse2 \
-fno-stack-protector \
2020-04-29 17:53:05 +03:00
-I. \
-Wno-address-of-packed-member
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)
OBJ := $(C_FILES:.c=.o)
all: qloader2.bin
qloader2.bin: $(OBJ)
$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.bin
cd bootsect && nasm bootsect.asm -fbin -o ../qloader2.bin
%.o: %.c
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
clean:
rm -f $(OBJ)