Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Chadderz121/brainslug-wii
Browse files Browse the repository at this point in the history
Conflicts:
	Makefile
	modules/Makefile
  • Loading branch information
Chadderz121 committed Jan 12, 2015
2 parents 56ca32d + 98f5da0 commit c70bf31
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 160 deletions.
67 changes: 45 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,43 @@ endif
# Compiler settings

# The toolchain to use.
PREFIX = powerpc-eabi-
PREFIX ?= powerpc-eabi-
# Tools to use
AS = $(PREFIX)as
LD = $(PREFIX)g++
CC = $(PREFIX)g++
OBJDUMP = $(PREFIX)objdump
OBJCOPY = $(PREFIX)objcopy
ELF2DOL = elf2dol

AS := $(PREFIX)as
LD := $(PREFIX)g++
CC := $(PREFIX)g++
OBJDUMP := $(PREFIX)objdump
OBJCOPY := $(PREFIX)objcopy
ELF2DOL ?= elf2dol

# -O2: optimise lots
# -Wl$C--gc-sections: remove unneeded symbols
# -mrvl: enable wii/gamecube compilation
# -mcpu=750: enable processor specific compilation
# -meabi: enable eabi specific compilation
# -Wl$C--section-start$C.init=0x80a00000:
# start the executable after 0x80a00000 so we don't have to move in order to
# load a dol file from a disk.
# -Wl$C-Map$C: generate a map file
LDFLAGS += -O2 -Wl$C--gc-sections \
-mrvl -mcpu=750 -meabi \
-Wl$C--section-start$C.init=0x80a00000 \
$(patsubst %,-Wl$C-Map$C%,$(strip $(MAP)))
# -O2: optimise lots
# -Wall: generate lots of warnings
# -x c: compile as C code
# -std=gnu99: use the C99 standard with GNU extensions
# -DGEKKO: define the symbol GEKKO (used in some libogc headers)
# -DHW_RVL: define the symbol HW_RVL (used in some libogc headers)
# -D__wii__: define the symbol __wii__ (used in some libogc headers)
# -mrvl: enable wii/gamecube compilation
# -mcpu=750: enable processor specific compilation
# -meabi: enable eabi specific compilation
# -mhard-float: enable hardware floating point instructions
# -msdata=eabi: use r2 and r13 as small data areas
# -memb: enable embedded application specific compilation
# -ffunction-sections: split up functions so linker can garbage collect
# -fdata-sections: split up data so linker can garbage collect
CFLAGS += -O2 -Wall -x c -std=gnu99 \
-DGEKKO -DHW_RVL -D__wii__ \
-mrvl -mcpu=750 -meabi -mhard-float \
Expand Down Expand Up @@ -120,12 +144,13 @@ all : $(TARGET) $(BIN)/boot.elf
PHONY += release
release: $(TARGET) meta.xml icon.png
$(LOG)
-$Qmkdir $(RELEASE)
-$Qmkdir $(RELEASE)/apps
-$Qmkdir $(RELEASE)/apps/netslug
$(addprefix $Qrm -rf ,$(wildcard $(RELEASE)))
$Qmkdir $(RELEASE)
$Qmkdir $(RELEASE)/apps
$Qmkdir $(RELEASE)/apps/netslug
$Qcp -r $(TARGET) $(RELEASE)/apps/netslug
$Qcp -r symbols $(RELEASE)/apps/netslug
-$Qmkdir $(RELEASE)/apps/netslug/modules
$Qmkdir $(RELEASE)/apps/netslug/modules
$Qcp -r USAGE $(RELEASE)/readme.txt
$Qcp config.ini $(RELEASE)/apps/netslug/config.ini
$Q$(MAKE) -C modules release RELEASE_DIR=../$(RELEASE)/apps/netslug/modules
Expand Down Expand Up @@ -154,38 +179,38 @@ endif
# Special build rules

# Rule to make the image file.
$(TARGET) : $(BUILD)/output.elf $(BIN)
$(TARGET) : $(BUILD)/output.elf | $(BIN)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(ELF2DOL) $(BUILD)/output.elf $(TARGET)

$(BIN)/boot.elf : $(BUILD)/output.elf $(BIN)
$(BIN)/boot.elf : $(BUILD)/output.elf | $(BIN)
$(LOG)
$Qcp $< $@
$Q$(PREFIX)strip $@
$Q$(PREFIX)strip -g $@

# Rule to make the elf file.
$(BUILD)/output.elf : $(OBJECTS) $(LINKER) $(BUILD)
$(BUILD)/output.elf : $(OBJECTS) $(LINKER) | $(BIN) $(BUILD)
$(LOG)
$Q$(LD) $(OBJECTS) $(LDFLAGS) -o $@

# Rule to make intermediate directory
$(BUILD) :
-$Qmkdir $@
$Qmkdir $@

# Rule to make output directory
$(BIN) :
-$Qmkdir $@
$Qmkdir $@

###############################################################################
# Standard build rules

$(BUILD)/%.c.o: %.c
$(BUILD)/%.c.o: %.c | $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(CC) -c $(CFLAGS) $< -o $@
$(BUILD)/%.c.d: %.c
$(BUILD)/%.c.d: %.c | $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(RM) $(wildcard $@)
Expand All @@ -212,9 +237,7 @@ list : $(LIST)
# Rule to clean files.
PHONY += clean
clean :
-$Qrm -rf $(BUILD)
-$Qrm -rf $(BIN)
-$Qrm -rf $(RELEASE)
$Qrm -rf $(wildcard $(BUILD) $(BIN) $(RELEASE))

###############################################################################
# Phony targets
Expand Down
8 changes: 4 additions & 4 deletions modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ all: $(addsuffix _module,$(MODULES))

###############################################################################
# Release rule


PHONY += release
release: $(addsuffix _module_release,$(MODULES))
release: $(addsuffix _module_release,$(MODULES))

%_module_release: %_module
$(LOG)
$Qcp $*/bin/$*.mod $(RELEASE_DIR)/$*.mod
$(LOG)
$Qcp $*/bin/$*.mod $(RELEASE_DIR)/$*.mod

###############################################################################
# Clean rule
Expand Down
28 changes: 13 additions & 15 deletions modules/console-gx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ INC_DIRS += $(LIB_INC_DIRS)
# Compiler settings

# The toolchain to use.
PREFIX = powerpc-eabi-
PREFIX ?= powerpc-eabi-
# Tools to use
AS = $(PREFIX)as
LD = $(PREFIX)ld
CC = $(PREFIX)g++
OBJDUMP = $(PREFIX)objdump
AS := $(PREFIX)as
LD := $(PREFIX)ld
CC := $(PREFIX)g++
OBJDUMP := $(PREFIX)objdump

# --relocatable: make sure ld doesn't remove relocations bslug will need
# -s: strip local symbols to speed linking
Expand All @@ -78,14 +78,15 @@ LD1FLAGS += --relocatable -s \
# -meabi: enable eabi specific compilation
# -mhard-float: enable hardware floating point instructions
# -fshort-wchar: use 16 bit whcar_t type in keeping with Wii executables
# -fno-common: stop common variables which the loader can't understand
# -msdata-none: do not use r2 or r13 as small data areas
# -memb: enable embedded application specific compilation
# -ffunction-sections: split up functions so linker can garbage collect
# -fdata-sections: split up data so linker can garbage collect
CFLAGS += -O2 -Wall -x c -std=gnu99 \
-nostdinc -ffreestanding \
-DGEKKO -DHW_RVL -D__wii__ \
-mrvl -mcpu=750 -meabi -mhard-float -fshort-wchar \
-mrvl -mcpu=750 -meabi -mhard-float -fshort-wchar -fno-common \
-msdata=none -memb -ffunction-sections -fdata-sections

ifdef DEBUG
Expand Down Expand Up @@ -119,29 +120,27 @@ OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC)))
# Special build rules

# Rule to make the module file.
$(TARGET) : $(BUILD)/output.elf $(BIN)
$(TARGET) : $(BUILD)/output.elf | $(BIN)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@

# Rule to make the module file.
$(BUILD)/output.elf : $(OBJECTS) $(BUILD)
$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@

# Rule to make intermediate directory
$(BUILD) :
-$Qmkdir $@
$Qmkdir $@

# Rule to make output directory
$(BIN) :
-$Qmkdir $@
$Qmkdir $@

###############################################################################
# Standard build rules

$(BUILD)/%.c.o: %.c
$(BUILD)/%.c.o: %.c | $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(CC) -c $(CFLAGS) $< -o $@
Expand All @@ -165,8 +164,7 @@ list : $(LIST)
# Rule to clean files.
PHONY += clean
clean :
-$Qrm -rf $(BUILD)
-$Qrm -rf $(BIN)
$Qrm -rf $(wildcard $(BUILD) $(BIN))

###############################################################################
# Phony targets
Expand Down
28 changes: 13 additions & 15 deletions modules/console-sd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ INC_DIRS += $(LIB_INC_DIRS)
# Compiler settings

# The toolchain to use.
PREFIX = powerpc-eabi-
PREFIX ?= powerpc-eabi-
# Tools to use
AS = $(PREFIX)as
LD = $(PREFIX)ld
CC = $(PREFIX)g++
OBJDUMP = $(PREFIX)objdump
AS := $(PREFIX)as
LD := $(PREFIX)ld
CC := $(PREFIX)g++
OBJDUMP := $(PREFIX)objdump

# --relocatable: make sure ld doesn't remove relocations bslug will need
# -s: strip local symbols to speed linking
Expand All @@ -78,14 +78,15 @@ LD1FLAGS += --relocatable -s \
# -meabi: enable eabi specific compilation
# -mhard-float: enable hardware floating point instructions
# -fshort-wchar: use 16 bit whcar_t type in keeping with Wii executables
# -fno-common: stop common variables which the loader can't understand
# -msdata-none: do not use r2 or r13 as small data areas
# -memb: enable embedded application specific compilation
# -ffunction-sections: split up functions so linker can garbage collect
# -fdata-sections: split up data so linker can garbage collect
CFLAGS += -O2 -Wall -x c -std=gnu99 \
-nostdinc -ffreestanding \
-DGEKKO -DHW_RVL -D__wii__ \
-mrvl -mcpu=750 -meabi -mhard-float -fshort-wchar \
-mrvl -mcpu=750 -meabi -mhard-float -fshort-wchar -fno-common \
-msdata=none -memb -ffunction-sections -fdata-sections

ifdef DEBUG
Expand Down Expand Up @@ -119,29 +120,27 @@ OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC)))
# Special build rules

# Rule to make the module file.
$(TARGET) : $(BUILD)/output.elf $(BIN)
$(TARGET) : $(BUILD)/output.elf | $(BIN)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@

# Rule to make the module file.
$(BUILD)/output.elf : $(OBJECTS) $(BUILD)
$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@

# Rule to make intermediate directory
$(BUILD) :
-$Qmkdir $@
$Qmkdir $@

# Rule to make output directory
$(BIN) :
-$Qmkdir $@
$Qmkdir $@

###############################################################################
# Standard build rules

$(BUILD)/%.c.o: %.c
$(BUILD)/%.c.o: %.c | $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(CC) -c $(CFLAGS) $< -o $@
Expand All @@ -165,8 +164,7 @@ list : $(LIST)
# Rule to clean files.
PHONY += clean
clean :
-$Qrm -rf $(BUILD)
-$Qrm -rf $(BIN)
$Qrm -rf $(wildcard $(BUILD) $(BIN))

###############################################################################
# Phony targets
Expand Down
28 changes: 13 additions & 15 deletions modules/gecko/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ INC_DIRS += $(LIB_INC_DIRS)
# Compiler settings

# The toolchain to use.
PREFIX = powerpc-eabi-
PREFIX ?= powerpc-eabi-
# Tools to use
AS = $(PREFIX)as
LD = $(PREFIX)ld
CC = $(PREFIX)g++
OBJDUMP = $(PREFIX)objdump
AS := $(PREFIX)as
LD := $(PREFIX)ld
CC := $(PREFIX)g++
OBJDUMP := $(PREFIX)objdump

# --relocatable: make sure ld doesn't remove relocations bslug will need
# -s: strip local symbols to speed linking
Expand All @@ -78,14 +78,15 @@ LD1FLAGS += --relocatable -s \
# -meabi: enable eabi specific compilation
# -mhard-float: enable hardware floating point instructions
# -fshort-wchar: use 16 bit whcar_t type in keeping with Wii executables
# -fno-common: stop common variables which the loader can't understand
# -msdata-none: do not use r2 or r13 as small data areas
# -memb: enable embedded application specific compilation
# -ffunction-sections: split up functions so linker can garbage collect
# -fdata-sections: split up data so linker can garbage collect
CFLAGS += -O2 -Wall -x c -std=gnu99 \
-nostdinc -ffreestanding \
-DGEKKO -DHW_RVL -D__wii__ \
-mrvl -mcpu=750 -meabi -mhard-float -fshort-wchar \
-mrvl -mcpu=750 -meabi -mhard-float -fshort-wchar -fno-common \
-msdata=none -memb -ffunction-sections -fdata-sections

ifdef DEBUG
Expand Down Expand Up @@ -119,29 +120,27 @@ OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC)))
# Special build rules

# Rule to make the module file.
$(TARGET) : $(BUILD)/output.elf $(BIN)
$(TARGET) : $(BUILD)/output.elf | $(BIN)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@

# Rule to make the module file.
$(BUILD)/output.elf : $(OBJECTS) $(BUILD)
$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@

# Rule to make intermediate directory
$(BUILD) :
-$Qmkdir $@
$Qmkdir $@

# Rule to make output directory
$(BIN) :
-$Qmkdir $@
$Qmkdir $@

###############################################################################
# Standard build rules

$(BUILD)/%.c.o: %.c
$(BUILD)/%.c.o: %.c | $(BUILD)
$(LOG)
-$Qmkdir -p $(dir $@)
$Q$(CC) -c $(CFLAGS) $< -o $@
Expand All @@ -165,8 +164,7 @@ list : $(LIST)
# Rule to clean files.
PHONY += clean
clean :
-$Qrm -rf $(BUILD)
-$Qrm -rf $(BIN)
$Qrm -rf $(wildcard $(BUILD) $(BIN))

###############################################################################
# Phony targets
Expand Down
Loading

0 comments on commit c70bf31

Please sign in to comment.