Reorganise source tree
This commit is contained in:
parent
6a6171d5e1
commit
cb9edd2a7b
27
Makefile
27
Makefile
|
@ -6,28 +6,39 @@ CC = cc
|
||||||
OBJCOPY = objcopy
|
OBJCOPY = objcopy
|
||||||
CFLAGS = -O2 -pipe -Wall -Wextra
|
CFLAGS = -O2 -pipe -Wall -Wextra
|
||||||
|
|
||||||
.PHONY: all toolchain limine install clean echfs-test ext2-test test.img
|
.PHONY: all toolchain stage2 stage2-clean decompressor decompressor-clean limine install clean echfs-test ext2-test fat32-test test.img
|
||||||
|
|
||||||
all: limine-install
|
all: limine-install
|
||||||
|
|
||||||
toolchain:
|
toolchain:
|
||||||
cd toolchain && ./make_toolchain.sh -j`nproc`
|
cd toolchain && ./make_toolchain.sh -j`nproc`
|
||||||
|
|
||||||
limine:
|
stage2:
|
||||||
$(MAKE) -C src all
|
$(MAKE) -C stage2 all
|
||||||
cp src/limine.bin ./
|
|
||||||
|
|
||||||
install: all
|
stage2-clean:
|
||||||
install -s limine-install $(DESTDIR)$(PREFIX)/bin/
|
$(MAKE) -C stage2 clean
|
||||||
|
|
||||||
clean:
|
decompressor:
|
||||||
|
$(MAKE) -C decompressor all
|
||||||
|
|
||||||
|
decompressor-clean:
|
||||||
|
$(MAKE) -C decompressor clean
|
||||||
|
|
||||||
|
limine: stage2 decompressor
|
||||||
|
gzip -n -9 < stage2/stage2.bin > stage2/stage2.bin.gz
|
||||||
|
cd bootsect && nasm bootsect.asm -fbin -o ../limine.bin
|
||||||
|
|
||||||
|
clean: stage2-clean decompressor-clean
|
||||||
rm -f limine-install
|
rm -f limine-install
|
||||||
$(MAKE) -C src clean
|
|
||||||
|
|
||||||
limine-install: limine.bin limine-install.c
|
limine-install: limine.bin limine-install.c
|
||||||
$(OBJCOPY) -I binary -O default limine.bin limine.o
|
$(OBJCOPY) -I binary -O default limine.bin limine.o
|
||||||
$(CC) $(CFLAGS) limine.o limine-install.c -o limine-install
|
$(CC) $(CFLAGS) limine.o limine-install.c -o limine-install
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install -s limine-install $(DESTDIR)$(PREFIX)/bin/
|
||||||
|
|
||||||
test.img:
|
test.img:
|
||||||
rm -f test.img
|
rm -f test.img
|
||||||
dd if=/dev/zero bs=1M count=0 seek=64 of=test.img
|
dd if=/dev/zero bs=1M count=0 seek=64 of=test.img
|
||||||
|
|
|
@ -156,7 +156,7 @@ incbin '../decompressor/decompressor.bin'
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
stage2:
|
stage2:
|
||||||
incbin '../stage2.bin.gz'
|
incbin '../stage2/stage2.bin.gz'
|
||||||
.size: equ $ - stage2
|
.size: equ $ - stage2
|
||||||
|
|
||||||
times 32768-($-$$) db 0
|
times 32768-($-$$) db 0
|
|
@ -1,6 +1,6 @@
|
||||||
CC = ../../toolchain/bin/i386-elf-gcc
|
CC = ../toolchain/bin/i386-elf-gcc
|
||||||
LD = ../../toolchain/bin/i386-elf-gcc
|
LD = ../toolchain/bin/i386-elf-gcc
|
||||||
OBJCOPY = ../../toolchain/bin/i386-elf-objcopy
|
OBJCOPY = ../toolchain/bin/i386-elf-objcopy
|
||||||
|
|
||||||
CFLAGS = -flto -Os -pipe -Wall -Wextra
|
CFLAGS = -flto -Os -pipe -Wall -Wextra
|
||||||
|
|
||||||
|
@ -9,8 +9,10 @@ INTERNAL_CFLAGS = \
|
||||||
-ffreestanding \
|
-ffreestanding \
|
||||||
-fno-stack-protector \
|
-fno-stack-protector \
|
||||||
-fno-pic \
|
-fno-pic \
|
||||||
|
-fomit-frame-pointer \
|
||||||
-mno-80387 \
|
-mno-80387 \
|
||||||
-mno-mmx \
|
-mno-mmx \
|
||||||
|
-mno-3dnow \
|
||||||
-mno-sse \
|
-mno-sse \
|
||||||
-mno-sse2 \
|
-mno-sse2 \
|
||||||
-I. \
|
-I. \
|
|
@ -9,8 +9,10 @@ INTERNAL_CFLAGS = \
|
||||||
-ffreestanding \
|
-ffreestanding \
|
||||||
-fno-stack-protector \
|
-fno-stack-protector \
|
||||||
-fno-pic \
|
-fno-pic \
|
||||||
|
-fomit-frame-pointer \
|
||||||
-mno-80387 \
|
-mno-80387 \
|
||||||
-mno-mmx \
|
-mno-mmx \
|
||||||
|
-mno-3dnow \
|
||||||
-mno-sse \
|
-mno-sse \
|
||||||
-mno-sse2 \
|
-mno-sse2 \
|
||||||
-I. \
|
-I. \
|
||||||
|
@ -28,8 +30,8 @@ INTERNAL_LDFLAGS = \
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
C_FILES := $(shell find ./ -type f -name '*.c' | grep -v bootsect | grep -v decompressor | sort)
|
C_FILES := $(shell find ./ -type f -name '*.c' | sort)
|
||||||
ASM_FILES := $(shell find ./ -type f -name '*.asm' | grep -v bootsect | grep -v decompressor | sort)
|
ASM_FILES := $(shell find ./ -type f -name '*.asm' | sort)
|
||||||
OBJ := $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o)
|
OBJ := $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o)
|
||||||
|
|
||||||
all: limine.bin
|
all: limine.bin
|
||||||
|
@ -37,9 +39,6 @@ all: limine.bin
|
||||||
limine.bin: $(OBJ)
|
limine.bin: $(OBJ)
|
||||||
$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.elf
|
$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.elf
|
||||||
$(OBJCOPY) -O binary stage2.elf stage2.bin
|
$(OBJCOPY) -O binary stage2.elf stage2.bin
|
||||||
gzip -n -9 < stage2.bin > stage2.bin.gz
|
|
||||||
$(MAKE) -C decompressor
|
|
||||||
cd bootsect && nasm bootsect.asm -fbin -o ../limine.bin
|
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
||||||
|
@ -48,5 +47,4 @@ limine.bin: $(OBJ)
|
||||||
nasm $< -f elf32 -o $@
|
nasm $< -f elf32 -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C decompressor clean
|
rm -f stage2.bin stage2.elf $(OBJ)
|
||||||
rm -f stage2.bin.gz stage2.bin stage2.elf limine.bin $(OBJ)
|
|
Loading…
Reference in New Issue