3ee911dc |
1 | CROSS = m68k-elf-\r |
2 | CC = $(CROSS)gcc\r |
3 | AS = $(CROSS)as\r |
4 | LD = $(CROSS)ld\r |
5 | OBJCOPY = $(CROSS)objcopy\r |
6 | \r |
7 | ASFLAGS += -m68000 --register-prefix-optional --bitwise-or -pic\r |
8 | ASFLAGS_CC += -Wa,-m68000 -Wa,--register-prefix-optional -Wa,--bitwise-or -Wa,-pic\r |
9 | CFLAGS += -Wall -g -O2 -m68000 -fomit-frame-pointer\r |
10 | LDLIBS += $(shell $(CC) -print-file-name=libgcc.a)\r |
11 | \r |
12 | TARGET = sramtest\r |
13 | OBJS = sega_gcc.o main.o asmtools.o data.o\r |
14 | \r |
15 | all: $(TARGET).bin\r |
16 | \r |
17 | $(TARGET).elf: $(OBJS)\r |
18 | $(LD) -o $@ -Tsega.ld -Map $(TARGET).map $^ $(LDLIBS)\r |
19 | \r |
20 | $(TARGET)_e.bin: $(TARGET).bin\r |
21 | dd if=/dev/zero of=$@ bs=1M count=1\r |
22 | dd if=$^ of=$@ bs=1M seek=1\r |
23 | dd if=$^ of=$@ conv=notrunc\r |
24 | \r |
25 | clean:\r |
26 | $(RM) $(TARGET).bin $(OBJS) $(TARGET).elf $(TARGET).map\r |
27 | \r |
28 | \r |
29 | %.bin: %.elf\r |
30 | $(OBJCOPY) -I elf32-m68k -O binary $^ $@\r |
31 | \r |
32 | %.o: %.S\r |
33 | $(CC) -c -o $@ $^ $(ASFLAGS_CC)\r |