rulimine/Makefile

44 lines
745 B
Makefile
Raw Normal View History

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
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:
rm -f $(OBJ) bootsect/bootsect.bin