2018-12-10 17:03:52 +01:00
|
|
|
GCC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -I ../include -m32 -fno-pie -no-pie -c -o
|
2019-01-02 15:47:56 +01:00
|
|
|
ASM=gcc -nostdinc -ffreestanding -fno-builtin -m32 -c -fno-pie -no-pie -I ../include -D__ASSEMBLY__ -c -o
|
2019-01-01 13:30:06 +01:00
|
|
|
LINK=ld -m elf_i386 -n
|
2018-12-12 12:31:30 +01:00
|
|
|
CONVERT=dos2unix
|
|
|
|
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
|
|
|
|
REMOVE=rm -f
|
|
|
|
CHANGEPERM=chmod 644
|
2018-12-30 12:25:20 +01:00
|
|
|
NM=nm
|
2019-01-01 13:30:06 +01:00
|
|
|
OBJCOPY=objcopy -O binary -R .note -R .comment -S
|
2019-01-02 13:59:16 +01:00
|
|
|
OBJDEBUG=objcopy --only-keep-debug
|
2019-01-01 13:30:06 +01:00
|
|
|
ZOFFSET=sed -n -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p'
|
|
|
|
VOFFSET=sed -n -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
|
2019-01-02 13:59:16 +01:00
|
|
|
COMP=gzip -9 -f
|
2019-01-02 15:47:56 +01:00
|
|
|
BUILD=../tools/build
|
|
|
|
MKPIGGY=../tools/mkpiggy
|
2007-04-02 14:52:01 +02:00
|
|
|
|
2019-01-02 13:59:16 +01:00
|
|
|
all: system.sys
|
2018-12-27 14:24:47 +01:00
|
|
|
|
2019-01-02 15:47:56 +01:00
|
|
|
system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin
|
|
|
|
$(BUILD) realmode/setup.bin system.bin zoffset.h system.sys
|
2007-04-02 14:52:01 +02:00
|
|
|
sync
|
|
|
|
|
2019-01-02 15:47:56 +01:00
|
|
|
allpiggy.o: piggy.o decompress.o header.o
|
|
|
|
$(LINK) -T allpiggy piggy.o decompress.o header.o
|
|
|
|
|
2019-01-01 13:30:06 +01:00
|
|
|
voffset.h: system
|
|
|
|
$(NM) system|$(VOFFSET)>voffset.h
|
|
|
|
|
2019-01-02 13:59:16 +01:00
|
|
|
zoffset.h: piggy.o
|
|
|
|
$(NM) piggy.o|$(ZOFFSET)>zoffset.h
|
2019-01-01 13:30:06 +01:00
|
|
|
|
2018-12-12 12:37:19 +01:00
|
|
|
togit: clean indent
|
2018-12-12 12:31:30 +01:00
|
|
|
|
2019-01-01 19:31:26 +01:00
|
|
|
piggy.o: piggy.S
|
|
|
|
$(ASM) $@ $^
|
|
|
|
|
2019-01-01 13:30:06 +01:00
|
|
|
system: systemc.o system.o ../lib/libs.o
|
2018-12-30 12:25:20 +01:00
|
|
|
$(LINK) -T system.ld system.o ../lib/libs.o
|
2019-01-02 13:59:16 +01:00
|
|
|
$(OBJDEBUG) system system.sym
|
|
|
|
$(NM) system > system.map
|
2018-09-27 17:12:12 +02:00
|
|
|
|
2019-01-01 13:30:06 +01:00
|
|
|
system.bin: system
|
|
|
|
$(OBJCOPY) $^ $@
|
|
|
|
|
|
|
|
system.bin.gz: system.bin
|
|
|
|
cat $^|$(COMP) > $@
|
|
|
|
|
2019-01-01 19:31:26 +01:00
|
|
|
piggy.S: system.bin.gz
|
2019-01-02 15:47:56 +01:00
|
|
|
$(MKPIGGY) $^ > $@
|
2019-01-01 13:30:06 +01:00
|
|
|
|
2018-12-30 12:25:20 +01:00
|
|
|
realmode/setup.bin:
|
|
|
|
make -C realmode
|
2018-12-27 14:24:47 +01:00
|
|
|
|
2019-01-01 13:30:06 +01:00
|
|
|
systemc.o: system.c
|
2018-12-27 14:24:47 +01:00
|
|
|
$(GCC) $@ $^
|
2007-04-02 14:52:01 +02:00
|
|
|
|
2019-01-01 13:30:06 +01:00
|
|
|
system.o: system.S
|
|
|
|
$(ASM) $@ $^
|
|
|
|
|
2007-04-02 14:52:01 +02:00
|
|
|
clean:
|
2019-01-01 13:30:06 +01:00
|
|
|
make -C realmode clean
|
|
|
|
$(REMOVE) system
|
2019-01-01 19:31:26 +01:00
|
|
|
$(REMOVE) piggy.S
|
2018-12-12 12:31:30 +01:00
|
|
|
$(REMOVE) *.o
|
2019-01-02 13:59:16 +01:00
|
|
|
$(REMOVE) *.tmp
|
|
|
|
$(REMOVE) *.sym
|
|
|
|
$(REMOVE) *.map
|
2019-01-01 13:30:06 +01:00
|
|
|
$(REMOVE) *.gz
|
|
|
|
$(REMOVE) *.h
|
2018-12-12 12:31:30 +01:00
|
|
|
$(REMOVE) *.out
|
|
|
|
$(REMOVE) *.bin
|
|
|
|
$(REMOVE) *.sys
|
|
|
|
$(REMOVE) *.s
|
|
|
|
$(REMOVE) *.c~
|
|
|
|
sync
|
2007-04-02 14:52:01 +02:00
|
|
|
|
2018-12-12 12:31:30 +01:00
|
|
|
indent:
|
2018-12-30 12:25:20 +01:00
|
|
|
make -C realmode indent
|
2018-12-12 12:31:30 +01:00
|
|
|
$(CHANGEPERM) *.c
|
|
|
|
$(CONVERT) *.c
|
|
|
|
$(INDENT) *.c
|
2018-12-12 12:37:19 +01:00
|
|
|
$(REMOVE) *.c~
|
2018-12-12 12:31:30 +01:00
|
|
|
sync
|