12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- AR = $(PREFIX)ar
- AS = $(PREFIX)as
- CC = $(PREFIX)gcc
- CXX = $(PREFIX)g++
- LD = $(PREFIX)ld
- OBJCOPY = $(PREFIX)objcopy
- RANLIB = $(PREFIX)ranlib
- STRIP = $(PREFIX)strip
- BIN2S = $(DEVKITPPC)/bin/bin2s
- ifeq ($(NOMAPFILE),)
- LDFLAGS += -Wl,-Map,$(TARGET).map
- endif
- ifneq ($(LDSCRIPT),)
- LDFLAGS += -Wl,-T$(LDSCRIPT)
- endif
- DEPDIR = .deps
- all: $(TARGET)
- $(TARGET): $(OBJS)
- @echo " LINK $@"
- @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
- ifneq ($(LDSCRIPT),)
- $(TARGET): $(LDSCRIPT)
- endif
- %.o: %.c
- @echo " COMPILE $<"
- @mkdir -p $(DEPDIR)
- @$(CC) $(CFLAGS) $(DEFINES) -Wp,-MMD,$(DEPDIR)/$(*F).d,-MQ,"$@",-MP -c $< -o $@
- %.o: %.s
- @echo " ASSEMBLE $<"
- @$(CC) $(CFLAGS) $(DEFINES) $(ASFLAGS) -c $< -o $@
- %.o: %.S
- @echo " ASSEMBLE $<"
- @$(CC) $(CFLAGS) $(DEFINES) $(ASFLAGS) -c $< -o $@
- clean:
- rm -rf $(DEPDIR)
- rm -f $(TARGET) $(TARGET).map $(OBJS)
- define bin2o
- @echo " BIN2S $(notdir $<)"
- @$(BIN2S) -a 32 $< | $(AS) -o $(@)
- @echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
- @echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
- @echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
- endef
- -include $(DEPDIR)/*
- .PHONY: clean
|