PATH := /opt/devkitpro/devkitARM/bin:$(PATH) SHELL := /bin/bash # --- Project details ------------------------------------------------- PROJ := main TARGET := $(PROJ) OBJS := $(PROJ).o # Lorsqu'un fichier .s est present dans le projet, decommenter la ligne ci-dessous # et placer le nom de la cible a compiler a partir du fichier .s avant le .o. #OBJSAS := .o # --- Build defines --------------------------------------------------- PREFIX := arm-none-eabi- CC := $(PREFIX)gcc LD := $(PREFIX)gcc AS := $(PREFIX)as OBJCOPY := $(PREFIX)objcopy ARCH := -mthumb-interwork SPECS := -specs=gba.specs CFLAGS := $(ARCH) -O2 -Wall -fno-strict-aliasing LDFLAGS := $(ARCH) $(SPECS) .PHONY : build clean # --- Build ----------------------------------------------------------- # Build process starts here! build: $(TARGET).gba # Strip and fix header (step 3,4) $(TARGET).gba : $(TARGET).elf $(OBJCOPY) -v -O binary $< $@ -@gbafix $@ # Link (step 2) $(TARGET).elf : $(OBJS) $(OBJSAS) $(LD) $^ $(LDFLAGS) -o $@ # Compile (step 1) $(OBJS) : %.o : %.c $(CC) -c $< $(CFLAGS) -o $@ # Decommenter les lignes ci-dessous si le projet contient # des sources en assembleur (fichiers .s). # Compile (step 1) #$(OBJSAS) : %.o : %.s # $(AS) $< -o $@ source: export PATH # --- Clean ----------------------------------------------------------- clean : @rm -fv *.gba @rm -fv *.elf @rm -fv *.o #EOF