mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-28 06:04:19 +01:00
closer to compiling
This commit is contained in:
parent
5b3fda7fd4
commit
402be0e950
4
Makefile
4
Makefile
@ -1,4 +1,4 @@
|
|||||||
include ../../starlet.mk
|
include starlet.mk
|
||||||
|
|
||||||
ASFLAGS += -D_LANGUAGE_ASSEMBLY
|
ASFLAGS += -D_LANGUAGE_ASSEMBLY
|
||||||
CFLAGS += -DCAN_HAZ_IRQ -DCAN_HAZ_IPC
|
CFLAGS += -DCAN_HAZ_IRQ -DCAN_HAZ_IPC
|
||||||
@ -15,7 +15,7 @@ OBJS = start.o main.o ipc.o vsprintf.o string.o gecko.o memory.o memory_asm.o \
|
|||||||
irq.o irq_asm.o exception.o exception_asm.o seeprom.o crypto.o nand.o \
|
irq.o irq_asm.o exception.o exception_asm.o seeprom.o crypto.o nand.o \
|
||||||
boot2.o ldhack.o sdmmc.o
|
boot2.o ldhack.o sdmmc.o
|
||||||
|
|
||||||
include ../../common.mk
|
include common.mk
|
||||||
|
|
||||||
all: $(TARGET_BIN)
|
all: $(TARGET_BIN)
|
||||||
|
|
||||||
|
60
common.mk
Normal file
60
common.mk
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
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
|
||||||
|
|
12
starlet.mk
Normal file
12
starlet.mk
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
ifeq ($(strip $(WIIDEV)),)
|
||||||
|
$(error "Set WIIDEV in your environment.")
|
||||||
|
endif
|
||||||
|
|
||||||
|
PREFIX = $(WIIDEV)/bin/armeb-eabi-
|
||||||
|
|
||||||
|
CFLAGS = -mbig-endian -mcpu=arm926ej-s
|
||||||
|
CFLAGS += -fomit-frame-pointer -ffunction-sections
|
||||||
|
CFLAGS += -Wall -Wextra -Os -pipe
|
||||||
|
ASFLAGS =
|
||||||
|
LDFLAGS = -mbig-endian -n -nostartfiles -nodefaultlibs -Wl,-gc-sections
|
||||||
|
|
Loading…
Reference in New Issue
Block a user