O = 1 CC = ${PSMLDIR}/psml-bochs/toolchain/install/bin/i586-elf-gcc OBJCOPY = objcopy LIBDIR = ../newlibsys LDS = ${LIBDIR}/512K.lds # set optimization level CFLAGS := -O${O} # i386-gcc pass -g so we do too ;-) CFLAGS := -g # set lang standard to c99 CFLAGS += -std=c99 # turn on all warnings CFLAGS += -Wall # force 32 bit code and address generation CFLAGS += -m32 # strip extraneous info from binary explicity ensure no comment section is # generated CFLAGS += -s # ensure no startup files are included CFLAGS += -nostartfiles # avoid generating exception frame (.eh_frame) support CFLAGS += -fno-asynchronous-unwind-tables # use a freestanding environment eg no standard libs no start (may want to remove this) CFLAGS += -ffreestanding # ensure that we only statically link things CFLAGS += --static # use custom vm linker script CFLAGS += -T ${LDS} # remove identity generation from the binary CFLAGS += -Wl,--build-id=none CFLAGS += -Wl,-M LIBSYSOBJS = ${LIBDIR}/sbrk.o ${LIBDIR}/read.o ${LIBDIR}/write.o ${LIBDIR}/isatty.o ${LIBDIR}/lseek.o ${LIBDIR}/close.o ${LIBDIR}/fstat.o ${LIBDIR}/_exit.o all: protected_bios.bin ${EXPTYPE}.bin .PHONY: all protected_bios.bin: protected_bios.s as86 -2 -b $@ $< -l > protected_bios.lst ${EXPTYPE}.bin: ${EXPTYPE}.elf $(OBJCOPY) -S $< --output-target=binary $@ ${EXPTYPE}.elf: ${EXPTYPE}.o ${LIBDIR}/crt0.o $(LIBSYSOBJS) $(LDS) $(CC) ${CFLAGS} -o $@ ${LIBDIR}/crt0.o $< $(LIBSYSOBJS) > ${EXPTYPE}.map ${EXPTYPE}.o: ${EXPTYPE}.c $(CC) $(CFLAGS) ${CDEFINES} -c $< ${LIBSYSOBJS}: $(MAKE) -C ${LIBDIR} libsys.a ${LIBDIR}/crt0.o: $(MAKE) -C ${LIBDIR} crt0.o clean: -rm -rf *.o *.map *.elf *.bin *~