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