rulimine/stage2/Makefile
VAN BOSSUYT Nicolas 9f0a2c6013 Move stivale in separate headers.
Making them easier to use when including "limine" has a submodule.
Also renamed stivale2_hdr_tag_framebuffer to stivale2_header_tag_framebuffer.
This make it more consistant with other declaration in stivale2.
2020-09-18 12:51:26 +02:00

54 lines
991 B
Makefile

CC = ../toolchain/bin/i386-elf-gcc
LD = ../toolchain/bin/i386-elf-gcc
OBJCOPY = ../toolchain/bin/i386-elf-objcopy
CFLAGS = -flto -Os -pipe -Wall -Wextra
INTERNAL_CFLAGS = \
-std=gnu11 \
-fplan9-extensions \
-ffreestanding \
-fno-stack-protector \
-fno-pic \
-fomit-frame-pointer \
-masm=intel \
-mno-80387 \
-mno-mmx \
-mno-3dnow \
-mno-sse \
-mno-sse2 \
-I. \
-I.. \
-Wno-address-of-packed-member
LDFLAGS = -flto -Os
INTERNAL_LDFLAGS = \
-lgcc \
-static-libgcc \
-nostdlib \
-no-pie \
-static \
-Tlinker.ld
.PHONY: all clean
C_FILES := $(shell find ./ -type f -name '*.c' | sort)
ASM_FILES := $(shell find ./ -type f -name '*.asm' | sort)
OBJ := $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o)
all: limine.bin
limine.bin: $(OBJ)
$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.elf
$(OBJCOPY) -O binary stage2.elf stage2.bin
%.o: %.c
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
%.o: %.asm
nasm $< -f elf32 -o $@
clean:
rm -f stage2.bin stage2.elf $(OBJ)