# Annotation #================================================== # Script is capable of building different applications. # Application target is an appropriate *.elf file name, # (e.g. "opcodes.elf") which must be listed in # ${ALL_ELF} variable and must have at least one rule # with depending object files. # # See "Rules of different projects". # # WARNING !!! # As the link process is not ideally implemented, when # you are building an app then "boot.o" and "no_os.o" # are usually dependencies. And "boot.o" MUST be listed # as the first dependency! AS = mips-elf-as CC = mips-elf-gcc LD = mips-elf-ld OD = mips-elf-objdump LDFLAGS = -eentry -Ttext=0 -N -s CFLAGS = -I ${PLASMA_INCLUDE} PLASMA_INCLUDE = ../plasma/tools ALL_ELF = opcodes.elf test.elf .PHONY: help clean help: # Rules of different projects #================================================== opcodes.elf: opcodes.o test.elf: boot.o test.o no_os.o # General rules: #================================================== ${ALL_ELF}: ${LD} ${LDFLAGS} -Map ${@:.elf=.map} -o $@ $^ ${OD} -d -t -S $@ > ${@:.elf=.lst} %.o: %.c ${CC} ${CFLAGS} -c -o $@ $< %.o: %.asm ${AS} -o $@ $< %.o: %.a ${AS} -o $@ $< # Special .PHONY targets #================================================== clean: rm -r *.o *.elf *.lst *.map help: @echo Select one of the targets: @echo ${ALL_ELF} # Additional rules for "boot.o" and "no_os.o" #================================================== %.o: ${PLASMA_INCLUDE}/%.asm ${AS} -o $@ $< %.o: ${PLASMA_INCLUDE}/%.c ${CC} ${CFLAGS} -c -o $@ $<