diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4247b8..4652116 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,68 +1,37 @@ -name: Build binaries +name: C/C++ CI on: [push, pull_request] jobs: build: + name: ubuntu-18.04 runs-on: ubuntu-18.04 - timeout-minutes: 20 + container: devkitpro/devkitppc:latest + steps: - - uses: actions/checkout@v2 - - - name: Cache - id: cache-1 - uses: actions/cache@v2 - with: - path: cache - key: ${{ runner.os }}-cache-1 - - - name: Download devkitPPC r37, libogc 2.1.0, bin2s, elf2dol, ppc-mxml 2.11 and libfat-ogc 1.1.5 - if: steps.cache-1.outputs.cache-hit != 'true' - # general-tools is needed for bin2s and gamecube-tools is needed for elf2dol - run: | - mkdir cache && cd cache - wget "https://wii.leseratte10.de/devkitPro/file.php/devkitPPC-r37-4-linux.pkg.tar.xz" - wget "https://wii.leseratte10.de/devkitPro/file.php/libogc-2.1.0-1-any.pkg.tar.xz" - wget "https://wii.leseratte10.de/devkitPro/file.php/general-tools-1.2.0-1-linux.pkg.tar.xz" - wget "https://wii.leseratte10.de/devkitPro/file.php/gamecube-tools-1.0.2-1-linux.pkg.tar.xz" - wget "https://wii.leseratte10.de/devkitPro/file.php/ppc-mxml-2.11-2-any.pkg.tar.xz" - wget "https://wii.leseratte10.de/devkitPro/file.php/libfat-ogc-1.1.5-2-any.pkg.tar.xz" - cd .. - - - name: Extract all the archives - run: | - tar -xf cache/devkitPPC-r37-4-linux.pkg.tar.xz opt/devkitpro/devkitPPC --strip-components=1 - tar -xf cache/libogc-2.1.0-1-any.pkg.tar.xz opt/devkitpro/libogc --strip-components=1 - tar -xf cache/libfat-ogc-1.1.5-2-any.pkg.tar.xz opt/devkitpro/libogc --strip-components=1 - tar -xf cache/general-tools-1.2.0-1-linux.pkg.tar.xz opt/devkitpro/tools/bin/bin2s --strip-components=4 - sudo cp bin2s /usr/local/bin/bin2s - tar -xf cache/gamecube-tools-1.0.2-1-linux.pkg.tar.xz opt/devkitpro/tools/bin/elf2dol --strip-components=4 - sudo cp elf2dol /usr/local/bin/elf2dol - tar -xf cache/ppc-mxml-2.11-2-any.pkg.tar.xz opt/devkitpro/portlibs --strip-components=1 - - - name: Compile - run: | - PATH=$(pwd)/devkitpro/devkitPPC/bin:$PATH DEVKITPPC=$(pwd)/devkitpro/devkitPPC DEVKITPRO=$(pwd)/devkitpro make install - cd modules - PATH=$(pwd)/../devkitpro/devkitPPC/bin:$PATH DEVKITPPC=$(pwd)/../devkitpro/devkitPPC DEVKITPRO=$(pwd)/../devkitpro make - cd .. - PATH=$(pwd)/devkitpro/devkitPPC/bin:$PATH DEVKITPPC=$(pwd)/devkitpro/devkitPPC DEVKITPRO=$(pwd)/devkitpro make - PATH=$(pwd)/devkitpro/devkitPPC/bin:$PATH DEVKITPPC=$(pwd)/devkitpro/devkitPPC DEVKITPRO=$(pwd)/devkitpro make release - cp modules/*/bin/*.mod . - - - name: Upload compiled Brainslug binaries - uses: actions/upload-artifact@v2 - with: - name: brainslug - path: | - release/apps - release/bslug - release/readme.txt - - - name: Upload compiled modules - uses: actions/upload-artifact@v2 - with: - name: modules - path: | - *.mod - + - uses: actions/checkout@v1 + + + - name: Build + run: | + export BSLUGDIR=$(pwd)blsug + make && make install + make -C modules + make release + cp modules/*/bin/*.mod . + + - name: Upload compiled Brainslug binaries + uses: actions/upload-artifact@v2 + with: + name: brainslug + path: | + release/apps + release/bslug + release/readme.txt + + - name: Upload compiled modules + uses: actions/upload-artifact@v2 + with: + name: modules + path: | + *.mod diff --git a/BUILDING b/BUILDING index 789b111..45c1718 100644 --- a/BUILDING +++ b/BUILDING @@ -1,7 +1,6 @@ -To build the BrainSlug channel you must first have a copy of devkitPro: - http://sourceforge.net/projects/devkitpro/ -You must also have libmxml for devkitPro, which can be found here: - http://wiibrew.org/wiki/Mini-XML +To build the BrainSlug channel you must first have a copy of devkitPPC: + https://devkitpro.org +You must also have libmxml for devkitPPC, which can be installed via pacman: You also need to have libfat installed. In the root directory of the BrainSlug repository, run the commands: diff --git a/INSTALLING b/INSTALLING index 573d70f..424edfd 100644 --- a/INSTALLING +++ b/INSTALLING @@ -1,14 +1,13 @@ To install BrainSlug for development of modules you must first have a copy of -devkitPro, specifically with devkitPPC included: - http://sourceforge.net/projects/devkitpro/ +devkitPPC installed. You can obtain this from devkitPro (https://devkitpro.org) In the root directory of the BrainSlug repository, run the following commands: make clean && make -C modules clean make install - -It may be necessary to run the last command with administrative privileges. -This installs the necessary headers into a bslug subdirectory within devkitPro. +This installs the necessary headers into a bslug subdirectory. Please do not +install this to /opt/devkitpro which is reserved for devkitPro tools and libraries. + Now BrainSlug modules can be compiled. See modules/README for more information about BrainSlug module development. diff --git a/Makefile b/Makefile index ae6e892..53f136d 100644 --- a/Makefile +++ b/Makefile @@ -14,48 +14,15 @@ C := , ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") endif -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPRO") -endif -ifeq ($(OS),Windows_NT) - $(info Compiling from $(OS)) - - PORTLIBS := $(DEVKITPRO)/portlibs/ppc - PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH) - ifeq ($(DEVKITPRO),$(subst :, ,$(DEVKITPRO))) - DEVKITPRO := $(patsubst /$(firstword $(subst /, ,$(DEVKITPRO)))/%,$(firstword $(subst /, ,$(DEVKITPRO))):/%,$(DEVKITPRO)) - $(info DEVKITPRO corrected to $(DEVKITPRO)) - else - $(info DEVKITPRO is $(DEVKITPRO)) - endif - PORTLIBS := $(DEVKITPRO)/portlibs/ppc - ifeq ($(DEVKITPPC),$(subst :, ,$(DEVKITPPC))) - DEVKITPPC := $(patsubst /$(firstword $(subst /, ,$(DEVKITPPC)))/%,$(firstword $(subst /, ,$(DEVKITPPC))):/%,$(DEVKITPPC)) - $(info DEVKITPPC corrected to $(DEVKITPPC)) - else - $(info DEVKITPPC is $(DEVKITPPC)) - endif -else - $(info Compiling from Unix) +BSLUGDIR ?= $(CURDIR)/bslug - PORTLIBS := $(DEVKITPRO)/portlibs/ppc - $(info DEVKITPRO is $(DEVKITPRO)) - $(info DEVKITPPC is $(DEVKITPPC)) -endif +include $(DEVKITPPC)/base_tools + +PORTLIBS := $(DEVKITPRO)/portlibs/ppc -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -AS := $(PREFIX)as -LD := $(PREFIX)g++ -CC := $(PREFIX)g++ -OBJDUMP := $(PREFIX)objdump -OBJCOPY := $(PREFIX)objcopy ELF2DOL ?= elf2dol +LD := $(CC) # -O2: optimise lots # -Wl$C--gc-sections: remove unneeded symbols @@ -124,12 +91,9 @@ SRC := # Phony targets PHONY := # Include directories -INC_DIRS := . +INC_DIRS := . $(DEVKITPRO)/libogc/include $(PORTLIBS)/include # Library directories -LIB_DIRS := $(DEVKITPPC) $(DEVKITPPC)/powerpc-eabi \ - $(DEVKITPRO)/libogc $(DEVKITPRO)/libogc/lib/wii \ - $(wildcard $(DEVKITPPC)/lib/gcc/powerpc-eabi/*) \ - $(PORTLIBS) $(PORTLIBS)/wii +LIB_DIRS := $(DEVKITPRO)/libogc/lib/wii $(PORTLIBS)/lib ############################################################################### # Rule to make everything. @@ -140,11 +104,9 @@ all : $(TARGET) $(BIN)/boot.elf ############################################################################### # Install rule -BSLUGDIR := $(DEVKITPRO)/bslug - # Rule to install bslug. PHONY += install -install : bslug_include modules symbols bslug.ld bslug_elf.ld +install : bslug_include modules symbols bslug.ld bslug_elf.ld bslug.mk $(LOG) $(addprefix $Qrm -rf ,$(wildcard $(BSLUGDIR))) $Qmkdir $(BSLUGDIR) @@ -153,6 +115,7 @@ install : bslug_include modules symbols bslug.ld bslug_elf.ld $Qcp -r symbols $(BSLUGDIR) $Qcp -r bslug.ld $(BSLUGDIR) $Qcp -r bslug_elf.ld $(BSLUGDIR) + $Qcp -r bslug.mk $(BSLUGDIR) # Rule to install bslug. PHONY += uninstall @@ -186,14 +149,14 @@ include src/makefile.mk LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src + -iquote src OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) ifeq ($(words $(filter clean%,$(MAKECMDGOALS))),0) ifeq ($(words $(filter install%,$(MAKECMDGOALS))),0) ifeq ($(words $(filter uninstall%,$(MAKECMDGOALS))),0) - include $(patsubst %.c,$(BUILD)/%.c.d,$(filter %.c,$(SRC))) + -include $(patsubst %.c,$(BUILD)/%.c.d,$(filter %.c,$(SRC))) endif endif endif diff --git a/bslug.mk b/bslug.mk new file mode 100644 index 0000000..5ab66c1 --- /dev/null +++ b/bslug.mk @@ -0,0 +1,134 @@ +############################################################################### +# Compiler settings + +############################################################################### +# devkitPPC settings +ifeq ($(strip $(DEVKITPPC)),) + $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/base_tools + +LD := $(PREFIX)ld + +FREESTANDING_INC := $(shell LANG=C $(DEVKITPPC)/bin/powerpc-eabi-gcc -print-search-dirs | sed -n -e 's/install: \(.*\)/\1/p') + +INC_DIRS += $(FREESTANDING_INC)include $(FREESTANDING_INC)include-fixed $(BSLUGDIR)/include + +# --relocatable: make sure ld doesn't remove relocations bslug will need +# -s: strip local symbols to speed linking +# --gc-sections: remove unneeded symbols +# -T: use the linker script specified (to force certain bslug sections together) +# -Map: generate a map file +LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ + -T $(BSLUGDIR)/bslug.ld \ + $(patsubst %,-Map %,$(strip $(MAP))) +LD1FLAGS += --relocatable -s \ + -T $(BSLUGDIR)/bslug_elf.ld + + +LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ + $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) + +CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ + $(patsubst %,-I %/include,$(LIB_DIRS)) + +# -O2: optimise lots +# -Wall: generate lots of warnings +# -x c: compile as C code +# -std=gnu99: use the C99 standard with GNU extensions +# -nostdinc: don't include standard headers (we don't have all the symbols) +# -ffreestanding: we don't have libc; don't expect we do +# -DGEKKO: define the symbol GEKKO (used in some libogc headers) +# -DHW_RVL: define the symbol HW_RVL (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 +# -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 \ + -mrvl -mcpu=750 -meabi -mhard-float -fno-common \ + -msdata=none -memb -ffunction-sections -fdata-sections + +ifdef DEBUG +else + CFLAGS += -DNDEBUG +endif + +############################################################################### +# Variable init + +# Phony targets +PHONY := + +############################################################################### +# Rule to make everything. +PHONY += all + +all : $(TARGET) + +############################################################################### +# Derived rules + +OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) + +############################################################################### +# Special build rules + +# Rule to make the module file. +$(TARGET) : $(BUILD)/output.elf | $(BIN) + $(LOG) + $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ + +# Rule to make the module file. +$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) + $(LOG) + $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ + +# Rule to make intermediate directory +$(BUILD) : + $Qmkdir $@ + +# Rule to make output directory +$(BIN) : + $Qmkdir $@ + +############################################################################### +# Standard build rules + +$(BUILD)/%.c.o: %.c | $(BUILD) + $(LOG) + -$Qmkdir -p $(dir $@) + $Q$(CC) -c $(CFLAGS) $< -o $@ + +############################################################################### +# Assembly listing rules + +# Rule to make assembly listing. +PHONY += list +list : $(LIST) + +# Rule to make the listing file. +%.list : $(TARGET) + $(LOG) + -$Qmkdir -p $(dir $@) + $Q$(OBJDUMP) -d $< > $@ + +############################################################################### +# Clean rule + +# Rule to clean files. +PHONY += clean +clean : + $Qrm -rf $(wildcard $(BUILD) $(BIN)) + +############################################################################### +# Phony targets + +.PHONY : $(PHONY) diff --git a/modules/console-gx/Makefile b/modules/console-gx/Makefile index e8c57ec..7265e24 100644 --- a/modules/console-gx/Makefile +++ b/modules/console-gx/Makefile @@ -4,27 +4,24 @@ # # A makefile script for generation of a brainslug module ############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. ############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +# Source files -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk +# The source files to compile. +SRC := main.c +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := ############################################################################### # Parameters @@ -37,137 +34,12 @@ LOG ?= @echo $@ # The intermediate directory for compiled object files. BUILD ?= build # The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) +LIST ?= $(TARGET).list # The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections +MAP ?= $(TARGET).map -ifdef DEBUG -else - CFLAGS += -DNDEBUG +ifeq ($(strip $(BSLUGDIR)),) + $(error "Please set BSLUGDIR in your environment. export BSLUGDIR=bslug") endif -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +include $(BSLUGDIR)/bslug.mk \ No newline at end of file diff --git a/modules/console-gx/makefile.mk b/modules/console-gx/makefile.mk deleted file mode 100644 index 0b8bed9..0000000 --- a/modules/console-gx/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := main.c -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS := diff --git a/modules/console-sd/Makefile b/modules/console-sd/Makefile index e8c57ec..7265e24 100644 --- a/modules/console-sd/Makefile +++ b/modules/console-sd/Makefile @@ -4,27 +4,24 @@ # # A makefile script for generation of a brainslug module ############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. ############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +# Source files -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk +# The source files to compile. +SRC := main.c +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := ############################################################################### # Parameters @@ -37,137 +34,12 @@ LOG ?= @echo $@ # The intermediate directory for compiled object files. BUILD ?= build # The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) +LIST ?= $(TARGET).list # The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections +MAP ?= $(TARGET).map -ifdef DEBUG -else - CFLAGS += -DNDEBUG +ifeq ($(strip $(BSLUGDIR)),) + $(error "Please set BSLUGDIR in your environment. export BSLUGDIR=bslug") endif -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +include $(BSLUGDIR)/bslug.mk \ No newline at end of file diff --git a/modules/console-sd/makefile.mk b/modules/console-sd/makefile.mk deleted file mode 100644 index 0b8bed9..0000000 --- a/modules/console-sd/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := main.c -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS := diff --git a/modules/gecko/Makefile b/modules/gecko/Makefile index e8c57ec..f3060f3 100644 --- a/modules/gecko/Makefile +++ b/modules/gecko/Makefile @@ -4,27 +4,24 @@ # # A makefile script for generation of a brainslug module ############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. ############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +# Source files -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk +# The source files to compile. +SRC := gecko.c +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := ############################################################################### # Parameters @@ -37,137 +34,12 @@ LOG ?= @echo $@ # The intermediate directory for compiled object files. BUILD ?= build # The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) +LIST ?= $(TARGET).list # The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections +MAP ?= $(TARGET).map -ifdef DEBUG -else - CFLAGS += -DNDEBUG +ifeq ($(strip $(BSLUGDIR)),) + $(error "Please set BSLUGDIR in your environment. export BSLUGDIR=bslug") endif -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +include $(BSLUGDIR)/bslug.mk diff --git a/modules/gecko/makefile.mk b/modules/gecko/makefile.mk deleted file mode 100644 index f4bc93f..0000000 --- a/modules/gecko/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := gecko.c -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS := diff --git a/modules/https/Makefile b/modules/https/Makefile index 5aab63b..20394d8 100644 --- a/modules/https/Makefile +++ b/modules/https/Makefile @@ -1,173 +1,172 @@ -############################################################################### -# Makefile -# by Alex Chadwick -# -# A makefile script for generation of a brainslug module -############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. - -############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) - -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk - -############################################################################### -# Parameters - -# A comma to make writing commands easier -C := , -# Used to suppress command echo. -Q ?= @ -LOG ?= @echo $@ -# The intermediate directory for compiled object files. -BUILD ?= build -# The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) -# The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections - -ifdef DEBUG -else - CFLAGS += -DNDEBUG -endif - -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +############################################################################### +# Makefile +# by Alex Chadwick +# +# A makefile script for generation of a brainslug module +############################################################################### + +############################################################################### +# devkitpro settings +ifeq ($(strip $(DEVKITPPC)),) + $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/base_tools + +############################################################################### +# Source files + +# The source files to compile. +SRC := main.c +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := + +############################################################################### +# Parameters + +# A comma to make writing commands easier +C := , +# Used to suppress command echo. +Q ?= @ +LOG ?= @echo $@ +# The intermediate directory for compiled object files. +BUILD ?= build +# The name of the assembler listing file to generate. +LIST ?= $(TARGET).list +# The name of the map file to generate. +MAP ?= $(TARGET).map + +INC_DIRS += $(LIB_INC_DIRS) + +############################################################################### +# Compiler settings +LD := $(PREFIX)ld + +# --relocatable: make sure ld doesn't remove relocations bslug will need +# -s: strip local symbols to speed linking +# --gc-sections: remove unneeded symbols +# -T: use the linker script specified (to force certain bslug sections together) +# -Map: generate a map file +LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ + -T $(BSLUGDIR)/bslug.ld \ + $(patsubst %,-Map %,$(strip $(MAP))) +LD1FLAGS += --relocatable -s \ + -T $(BSLUGDIR)/bslug_elf.ld + + +LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ + $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) +CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ + $(patsubst %,-I %/include,$(LIB_DIRS)) \ + -I $(BSLUGDIR)/include + + +# -O2: optimise lots +# -Wall: generate lots of warnings +# -x c: compile as C code +# -std=gnu99: use the C99 standard with GNU extensions +# -nostdinc: don't include standard headers (we don't have all the symbols) +# -ffreestanding: we don't have libc; don't expect we do +# -DGEKKO: define the symbol GEKKO (used in some libogc headers) +# -DHW_RVL: define the symbol HW_RVL (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 +# -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 \ + -ffreestanding \ + -DGEKKO -DHW_RVL \ + -mrvl -mcpu=750 -meabi -mhard-float -fno-common \ + -msdata=none -memb -ffunction-sections -fdata-sections + +ifdef DEBUG +else + CFLAGS += -DNDEBUG +endif + +############################################################################### +# Variable init + +# Phony targets +PHONY := + +############################################################################### +# Rule to make everything. +PHONY += all + +all : $(TARGET) + +############################################################################### +# Derived rules + +OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) + +############################################################################### +# Special build rules + +# Rule to make the module file. +$(TARGET) : $(BUILD)/output.elf | $(BIN) + $(LOG) + $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ + +# Rule to make the module file. +$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) + $(LOG) + $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ + +# Rule to make intermediate directory +$(BUILD) : + $Qmkdir $@ + +# Rule to make output directory +$(BIN) : + $Qmkdir $@ + +############################################################################### +# Standard build rules + +$(BUILD)/%.c.o: %.c | $(BUILD) + $(LOG) + -$Qmkdir -p $(dir $@) + $Q$(CC) -c $(CFLAGS) $< -o $@ + +############################################################################### +# Assembly listing rules + +# Rule to make assembly listing. +PHONY += list +list : $(LIST) + +# Rule to make the listing file. +%.list : $(TARGET) + $(LOG) + -$Qmkdir -p $(dir $@) + $Q$(OBJDUMP) -d $< > $@ + +############################################################################### +# Clean rule + +# Rule to clean files. +PHONY += clean +clean : + $Qrm -rf $(wildcard $(BUILD) $(BIN)) + +############################################################################### +# Phony targets + +.PHONY : $(PHONY) diff --git a/modules/https/makefile.mk b/modules/https/makefile.mk deleted file mode 100644 index b7fa45f..0000000 --- a/modules/https/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := main.c -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS := diff --git a/modules/libfat-sd/Makefile b/modules/libfat-sd/Makefile index e8c57ec..7265e24 100644 --- a/modules/libfat-sd/Makefile +++ b/modules/libfat-sd/Makefile @@ -4,27 +4,24 @@ # # A makefile script for generation of a brainslug module ############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. ############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +# Source files -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk +# The source files to compile. +SRC := main.c +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := ############################################################################### # Parameters @@ -37,137 +34,12 @@ LOG ?= @echo $@ # The intermediate directory for compiled object files. BUILD ?= build # The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) +LIST ?= $(TARGET).list # The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections +MAP ?= $(TARGET).map -ifdef DEBUG -else - CFLAGS += -DNDEBUG +ifeq ($(strip $(BSLUGDIR)),) + $(error "Please set BSLUGDIR in your environment. export BSLUGDIR=bslug") endif -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +include $(BSLUGDIR)/bslug.mk \ No newline at end of file diff --git a/modules/libfat-sd/makefile.mk b/modules/libfat-sd/makefile.mk deleted file mode 100644 index 0b8bed9..0000000 --- a/modules/libfat-sd/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := main.c -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS := diff --git a/modules/libfat/Makefile b/modules/libfat/Makefile index e8c57ec..cf47d9c 100644 --- a/modules/libfat/Makefile +++ b/modules/libfat/Makefile @@ -4,27 +4,24 @@ # # A makefile script for generation of a brainslug module ############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. ############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +# Source files -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk +# The source files to compile. +SRC := $(wildcard *.c) +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := ############################################################################### # Parameters @@ -37,137 +34,12 @@ LOG ?= @echo $@ # The intermediate directory for compiled object files. BUILD ?= build # The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) +LIST ?= $(TARGET).list # The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections +MAP ?= $(TARGET).map -ifdef DEBUG -else - CFLAGS += -DNDEBUG +ifeq ($(strip $(BSLUGDIR)),) + $(error "Please set BSLUGDIR in your environment. export BSLUGDIR=bslug") endif -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +include $(BSLUGDIR)/bslug.mk \ No newline at end of file diff --git a/modules/libfat/makefile.mk b/modules/libfat/makefile.mk deleted file mode 100644 index 856b827..0000000 --- a/modules/libfat/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := $(wildcard *.c) -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS := diff --git a/modules/libsd/Makefile b/modules/libsd/Makefile index e8c57ec..7265e24 100644 --- a/modules/libsd/Makefile +++ b/modules/libsd/Makefile @@ -4,27 +4,24 @@ # # A makefile script for generation of a brainslug module ############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. ############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +# Source files -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk +# The source files to compile. +SRC := main.c +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := ############################################################################### # Parameters @@ -37,137 +34,12 @@ LOG ?= @echo $@ # The intermediate directory for compiled object files. BUILD ?= build # The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) +LIST ?= $(TARGET).list # The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections +MAP ?= $(TARGET).map -ifdef DEBUG -else - CFLAGS += -DNDEBUG +ifeq ($(strip $(BSLUGDIR)),) + $(error "Please set BSLUGDIR in your environment. export BSLUGDIR=bslug") endif -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +include $(BSLUGDIR)/bslug.mk \ No newline at end of file diff --git a/modules/libsd/makefile.mk b/modules/libsd/makefile.mk deleted file mode 100644 index ca5bed4..0000000 --- a/modules/libsd/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := main.c wiisd.c -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS := diff --git a/modules/template/Makefile b/modules/template/Makefile index e8c57ec..7265e24 100644 --- a/modules/template/Makefile +++ b/modules/template/Makefile @@ -4,27 +4,24 @@ # # A makefile script for generation of a brainslug module ############################################################################### -# Hopefully you shouldn't need to change anything in this file. -# Alter makefile.mk to change common settings. ############################################################################### -# devkitpro settings -ifeq ($(strip $(DEVKITPRO)),) - $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro") -endif -ifeq ($(strip $(DEVKITPPC)),) - $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -BSLUGDIR := $(DEVKITPRO)/bslug -GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +# Source files -PATH := $(DEVKITPPC)/bin:$(PATH) -LIB_INC_DIRS := $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER)/include-fixed \ - $(BSLUGDIR)/include - -include makefile.mk +# The source files to compile. +SRC := main.c +# Include directories +INC_DIRS := +# Library directories +LIB_DIRS := +# The names of libraries to use. +LIBS := +# The output directory for compiled results. +BIN := bin +# The name of the output file to generate. +TARGET := $(BIN)/$(notdir $(CURDIR)).mod +# C compiler flags +CFLAGS := ############################################################################### # Parameters @@ -37,137 +34,12 @@ LOG ?= @echo $@ # The intermediate directory for compiled object files. BUILD ?= build # The name of the assembler listing file to generate. -LIST ?= $(TARGET:.mod=.list) +LIST ?= $(TARGET).list # The name of the map file to generate. -MAP ?= $(TARGET:.mod=.map) - -INC_DIRS += $(LIB_INC_DIRS) - -############################################################################### -# Compiler settings - -# The toolchain to use. -PREFIX ?= powerpc-eabi- -# Tools to use -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 -# --gc-sections: remove unneeded symbols -# -T: use the linker script specified (to force certain bslug sections together) -# -Map: generate a map file -LDFLAGS += --relocatable -s --gc-sections -u bslug_load -u bslug_meta \ - -T $(BSLUGDIR)/bslug.ld \ - $(patsubst %,-Map %,$(strip $(MAP))) -LD1FLAGS += --relocatable -s \ - -T $(BSLUGDIR)/bslug_elf.ld - -# -O2: optimise lots -# -Wall: generate lots of warnings -# -x c: compile as C code -# -std=gnu99: use the C99 standard with GNU extensions -# -nostdinc: don't include standard headers (we don't have all the symbols) -# -ffreestanding: we don't have libc; don't expect we do -# -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 -# -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 -fno-common \ - -msdata=none -memb -ffunction-sections -fdata-sections +MAP ?= $(TARGET).map -ifdef DEBUG -else - CFLAGS += -DNDEBUG +ifeq ($(strip $(BSLUGDIR)),) + $(error "Please set BSLUGDIR in your environment. export BSLUGDIR=bslug") endif -############################################################################### -# Variable init - -# Phony targets -PHONY := - -############################################################################### -# Rule to make everything. -PHONY += all - -all : $(TARGET) - -############################################################################### -# Derived rules - -LDFLAGS += $(patsubst %,-l %,$(LIBS)) $(patsubst %,-l %,$(LIBS)) \ - $(patsubst %,-L %,$(LIB_DIRS)) $(patsubst %,-L %/lib,$(LIB_DIRS)) -CFLAGS += $(patsubst %,-I %,$(INC_DIRS)) \ - $(patsubst %,-I %/include,$(LIB_DIRS)) -iquote src - -OBJECTS := $(patsubst %.c,$(BUILD)/%.c.o,$(filter %.c,$(SRC))) - -############################################################################### -# Special build rules - -# Rule to make the module file. -$(TARGET) : $(BUILD)/output.elf | $(BIN) - $(LOG) - $Q$(LD) $(BUILD)/output.elf $(LDFLAGS) -o $@ - -# Rule to make the module file. -$(BUILD)/output.elf : $(OBJECTS) | $(BIN) $(BUILD) - $(LOG) - $Q$(LD) $(OBJECTS) $(LD1FLAGS) -o $@ - -# Rule to make intermediate directory -$(BUILD) : - $Qmkdir $@ - -# Rule to make output directory -$(BIN) : - $Qmkdir $@ - -############################################################################### -# Standard build rules - -$(BUILD)/%.c.o: %.c | $(BUILD) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(CC) -c $(CFLAGS) $< -o $@ - -############################################################################### -# Assembly listing rules - -# Rule to make assembly listing. -PHONY += list -list : $(LIST) - -# Rule to make the listing file. -%.list : $(TARGET) - $(LOG) - -$Qmkdir -p $(dir $@) - $Q$(OBJDUMP) -d $< > $@ - -############################################################################### -# Clean rule - -# Rule to clean files. -PHONY += clean -clean : - $Qrm -rf $(wildcard $(BUILD) $(BIN)) - -############################################################################### -# Phony targets - -.PHONY : $(PHONY) +include $(BSLUGDIR)/bslug.mk \ No newline at end of file diff --git a/modules/template/makefile.mk b/modules/template/makefile.mk deleted file mode 100644 index 0b8bed9..0000000 --- a/modules/template/makefile.mk +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Source files - -# The source files to compile. -SRC := main.c -# Include directories -INC_DIRS := -# Library directories -LIB_DIRS := -# The names of libraries to use. -LIBS := -# The output directory for compiled results. -BIN := bin -# The name of the output file to generate. -TARGET := $(BIN)/$(notdir $(CURDIR)).mod -# C compiler flags -CFLAGS :=