From 13870159fbdc8a953db253e25829c43def70fefb Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Tue, 3 May 2005 03:49:29 +0000 Subject: [PATCH] added base rules for makefiles --- dka-rules/base_rules | 55 ++++++++++++++++++++++++++++++++++++++++ dka-rules/ds_rules | 4 +++ dka-rules/gba_rules | 19 ++++++++++++++ dka-rules/gp32_rules | 18 +++++++++++++ dkp-rules/base_rules | 55 ++++++++++++++++++++++++++++++++++++++++ dkp-rules/gamecube_rules | 10 ++++++++ 6 files changed, 161 insertions(+) create mode 100644 dka-rules/base_rules create mode 100644 dka-rules/ds_rules create mode 100644 dka-rules/gba_rules create mode 100644 dka-rules/gp32_rules create mode 100644 dkp-rules/base_rules create mode 100644 dkp-rules/gamecube_rules diff --git a/dka-rules/base_rules b/dka-rules/base_rules new file mode 100644 index 0000000..0a38afc --- /dev/null +++ b/dka-rules/base_rules @@ -0,0 +1,55 @@ +#--------------------------------------------------------------------------------- +# the prefix on the compiler executables +#--------------------------------------------------------------------------------- +PREFIX := arm-elf- + +export CC := $(PREFIX)gcc +export CXX := $(PREFIX)g++ +export AR := $(PREFIX)ar +export OBJCOPY := $(PREFIX)objcopy + + +#--------------------------------------------------------------------------------- +%.a: +#--------------------------------------------------------------------------------- + @echo $(notdir $@) + @$(AR) -rc $@ $^ + +#--------------------------------------------------------------------------------- +%.o: %.cpp + @echo $(notdir $<) + @$(CXX) -MMD -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +%.o: %.c + @echo $(notdir $<) + @$(CC) -MMD -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +%.o: %.s + @echo $(notdir $<) + @$(CC) -MMD -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +%.o: %.S + @echo $(notdir $<) + @$(CC) -MMD -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +# canned command sequence for binary data +#--------------------------------------------------------------------------------- +define bin2o + cp $(<) $(*).tmp + alignbin $(*).tmp + $(OBJCOPY) -I binary -O elf32-littlearm -B arm \ + --rename-section .data=.rodata,readonly,data,contents,alloc \ + --redefine-sym _binary_`(echo $(*) | tr . _)`_tmp_start=`(echo $(*) | tr . _)`\ + --redefine-sym _binary_`(echo $(*) | tr . _)`_tmp_end=`(echo $(*) | tr . _)`_end\ + --redefine-sym _binary_`(echo $(*) | tr . _)`_tmp_size=`(echo $(*) | tr . _)`_size\ + $(*).tmp $(@) + echo "extern const u32" `(echo $(*) | tr . _)`"_end[];" >> $(*).h + echo "extern const u8" `(echo $(*) | tr . _)`"[];" >> $(*).h + echo "extern const u32" `(echo $(*) | tr . _)`_size[]";" >> $(*).h + rm $(*).tmp +endef + diff --git a/dka-rules/ds_rules b/dka-rules/ds_rules new file mode 100644 index 0000000..96e8f00 --- /dev/null +++ b/dka-rules/ds_rules @@ -0,0 +1,4 @@ +-include $(DEVKITARM)/base_rules + +LIBNDS := $(DEVKITPRO)/libnds + diff --git a/dka-rules/gba_rules b/dka-rules/gba_rules new file mode 100644 index 0000000..0cc74c1 --- /dev/null +++ b/dka-rules/gba_rules @@ -0,0 +1,19 @@ +-include $(DEVKITARM)/base_rules + +LIBGBA := $(DEVKITPRO)/libgba + +#--------------------------------------------------------------------------------- +%.gba: %.elf + @$(OBJCOPY) -O binary $< $@ + @echo built ... $(notdir $@) + @gbafix $@ + +#--------------------------------------------------------------------------------- +%_mb.elf: + @echo linking multiboot + @$(LD) -specs=gba_mb.specs $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ + +#--------------------------------------------------------------------------------- +%.elf: + @echo linking cartridge + @$(LD) $(LDFLAGS) -specs=gba.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $@ diff --git a/dka-rules/gp32_rules b/dka-rules/gp32_rules new file mode 100644 index 0000000..d4e3918 --- /dev/null +++ b/dka-rules/gp32_rules @@ -0,0 +1,18 @@ +-include $(DEVKITARM)/base_rules + +LIBMIRKO := $(DEVKITPRO)/libmirko + +#--------------------------------------------------------------------------------- +%.fxe: %.bin + @b2fxec -a "$(AUTHOR)" -t "$(TITLE)" $< $@ + @echo built ... $(notdir $@) + +#--------------------------------------------------------------------------------- +%.bin: %.elf + @$(OBJCOPY) -O binary $< $@ + @echo built ... $(notdir $@) + +#--------------------------------------------------------------------------------- +%.elf: + @echo linking binary + @$(LD) $(LDFLAGS) -specs=gp32.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $@ diff --git a/dkp-rules/base_rules b/dkp-rules/base_rules new file mode 100644 index 0000000..ec0653e --- /dev/null +++ b/dkp-rules/base_rules @@ -0,0 +1,55 @@ +#--------------------------------------------------------------------------------- +# the prefix on the compiler executables +#--------------------------------------------------------------------------------- +PREFIX := powerpc-gekko- + +export CC := $(PREFIX)gcc +export CXX := $(PREFIX)g++ +export AR := $(PREFIX)ar +export OBJCOPY := $(PREFIX)objcopy + + +#--------------------------------------------------------------------------------- +%.a: +#--------------------------------------------------------------------------------- + @echo $(notdir $@) + @$(AR) -rc $@ $^ + +#--------------------------------------------------------------------------------- +%.o: %.cpp + @echo $(notdir $<) + @$(CXX) -MMD -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +%.o: %.c + @echo $(notdir $<) + @$(CC) -MMD -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +%.o: %.s + @echo $(notdir $<) + @$(CC) -MMD -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +%.o: %.S + @echo $(notdir $<) + @$(CC) -MMD -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +# canned command sequence for binary data +#--------------------------------------------------------------------------------- +define bin2o + cp $(<) $(*).tmp + alignbin $(*).tmp + $(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \ + --rename-section .data=.rodata,readonly,data,contents,alloc \ + --redefine-sym _binary_`(echo $(*) | tr . _)`_tmp_start=`(echo $(*) | tr . _)`\ + --redefine-sym _binary_`(echo $(*) | tr . _)`_tmp_end=`(echo $(*) | tr . _)`_end\ + --redefine-sym _binary_`(echo $(*) | tr . _)`_tmp_size=`(echo $(*) | tr . _)`_size\ + $(*).tmp $(@) + echo "extern const u32" `(echo $(*) | tr . _)`"_end[];" >> $(*).h + echo "extern const u8" `(echo $(*) | tr . _)`"[];" >> $(*).h + echo "extern const u32" `(echo $(*) | tr . _)`_size[]";" >> $(*).h + rm $(*).tmp +endef + diff --git a/dkp-rules/gamecube_rules b/dkp-rules/gamecube_rules new file mode 100644 index 0000000..0bf2199 --- /dev/null +++ b/dkp-rules/gamecube_rules @@ -0,0 +1,10 @@ +-include $(DEVKITPPC)/base_rules + +%.dol: %.elf + @echo output ... $(notdir $@) + @$(OBJCOPY) -O binary $< $@ + +#--------------------------------------------------------------------------------- +%.elf: + @echo linking ... $(notdir $@) + @$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@