Fixed linux builds

This commit is contained in:
jdah
2021-04-22 10:10:49 +02:00
parent e9c541dc01
commit 9dca2d12b8
2 changed files with 22 additions and 9 deletions

View File

@ -1,6 +1,14 @@
CC=i386-elf-gcc
ASM=i386-elf-as
LD=i386-elf-ld
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
CC=gcc -elf_i386
AS=as --32
LD=ld -m elf_i386
else
CC=i386-elf-gcc
AS=i386-elf-as
LD=i386-elf-ld
endif
GFLAGS=
CCFLAGS=-m32 -std=c11 -O2 -g -Wall -Wextra -Wpedantic -Wstrict-aliasing
@ -29,16 +37,19 @@ dirs:
mkdir -p bin
clean:
rm ./**/*.o
rm ./*.iso
rm ./**/*.elf
rm ./**/*.bin
rm -f ./**/*.o
rm -f ./*.iso
rm -f ./**/*.elf
rm -f ./**/*.bin
%.o: %.c
$(CC) -o $@ -c $< $(GFLAGS) $(CCFLAGS)
%.o: %.S
$(ASM) -o $@ -c $< $(GFLAGS) $(ASFLAGS)
$(AS) -o $@ -c $< $(GFLAGS) $(ASFLAGS)
dirs:
mkdir -p bin
bootsect: $(BOOTSECT_OBJS)
$(LD) -o ./bin/$(BOOTSECT) $^ -Ttext 0x7C00 --oformat=binary
@ -46,7 +57,7 @@ bootsect: $(BOOTSECT_OBJS)
kernel: $(KERNEL_OBJS)
$(LD) -o ./bin/$(KERNEL) $^ $(LDFLAGS) -Tsrc/link.ld
iso: bootsect kernel
iso: dirs bootsect kernel
dd if=/dev/zero of=boot.iso bs=512 count=2880
dd if=./bin/$(BOOTSECT) of=boot.iso conv=notrunc bs=512 seek=0 count=1
dd if=./bin/$(KERNEL) of=boot.iso conv=notrunc bs=512 seek=1 count=2048

View File

@ -736,6 +736,7 @@ void _main(u32 magic) {
render();
}
#ifdef ENABLE_MUSIC
if (keyboard_char('m')) {
if (!last_music_toggle) {
state.music = !state.music;
@ -746,6 +747,7 @@ void _main(u32 magic) {
} else {
last_music_toggle = false;
}
#endif
screen_swap();
state.frames++;