
Found a bug in Intel's cross-compiler. => Switch to the standard gcc and use the flags "-march=i586 -mtune=i586" => Code runs on all Pentium (I) systems
66 lines
1.6 KiB
Makefile
66 lines
1.6 KiB
Makefile
MAKE = make
|
|
CC = gcc
|
|
CROSS_COMPILE=gcc
|
|
CROSS_OBJCOPY=objcopy
|
|
CFLAGS = -m32 -O2 -Wall
|
|
LDFLGAS =
|
|
DEFINES =
|
|
NASM = nasm
|
|
NASMFLAGS = -fbin
|
|
EXECFILES = $(shell find ../newlib/examples -perm -u+r+x -type f)
|
|
CORENUM ?= 1
|
|
|
|
# other implicit rules
|
|
%.o : %.c
|
|
$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
default: all
|
|
|
|
all: make_initrd initrd.img
|
|
|
|
initrd.img: $(EXECFILES) make_initrd
|
|
./make_initrd /bin $(foreach FILE, $(EXECFILES), $(FILE) $(shell basename $(FILE)))
|
|
|
|
make_initrd: make_initrd.o
|
|
$(CC) $(CFLAGS) -o make_initrd $< $(LDFLAGS)
|
|
|
|
smp_setup.bin: smp_setup.asm
|
|
$(NASM) $(NASMFLAGS) -o $@ $<
|
|
|
|
smp_setup.hex: smp_setup.bin
|
|
hexdump -v -e '"0x" 1/1 "%02X" ", "' $< > $@
|
|
|
|
scc_setup.bin: scc_setup.asm
|
|
$(NASM) $(NASMFLAGS) -o $@ $<
|
|
|
|
reset_vector.o: reset_vector.S
|
|
gcc -m32 -c -o reset_vector.o reset_vector.S
|
|
|
|
reset_vector.bin: reset_vector.o
|
|
ld --oformat binary -Ttext 0 -melf_i386 -o $@ $<
|
|
|
|
scc_bootinfo.asm: bootinfo.sh initrd.img
|
|
./bootinfo.sh 0x01000000 initrd.img $(CORENUM) 533 `seq 0 $$(($(CORENUM) - 1))` > scc_bootinfo.asm
|
|
|
|
scc_bootinfo.bin: scc_bootinfo.asm
|
|
$(NASM) $(NASMFLAGS) -o $@ $<
|
|
|
|
bin2obj: bin2obj.c
|
|
$(CC) $(CFLAGS) -o $@ $<
|
|
|
|
SCC: scc_bootinfo.bin scc_setup.bin reset_vector.bin initrd.img bin2obj
|
|
cp ../metalsvm.elf .
|
|
$(CROSS_OBJCOPY) -j .mboot -j .text -j .data -j .rodata -j .bss -O binary metalsvm.elf metalsvm.bin
|
|
chmod a-x *.bin
|
|
. ./prepare.sh
|
|
./bin2obj -m load.map -o metalsvm.obj
|
|
sccMerge -noimage -m 8 -n 12 -force ./metalsvm.mt
|
|
|
|
clean:
|
|
$(RM) -rf *.o *~ bin2obj make_initrd initrd.img *.bin *.obj *.hex *.elf obj
|
|
|
|
depend:
|
|
$(CC) -MM $(CFLAGS) *.c > Makefile.dep
|
|
|
|
-include Makefile.dep
|
|
# DO NOT DELETE
|