summaryrefslogtreecommitdiff
path: root/arm9/Makefile
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2006-11-14 00:57:41 +0000
committerIan C <ianc@noddybox.co.uk>2006-11-14 00:57:41 +0000
commit90082bd6e19121cae87be17fdd9c01916bd24cbe (patch)
treecba821f7351a29501df8bb6e85b35de2e96864f7 /arm9/Makefile
parentf94a304eaa22130ad4b121d8113c04422b1e32e2 (diff)
Project modified so that seperate ARM7 and ARM9 bits can be compiled. Intended for wifi access.
Diffstat (limited to 'arm9/Makefile')
-rw-r--r--arm9/Makefile85
1 files changed, 42 insertions, 43 deletions
diff --git a/arm9/Makefile b/arm9/Makefile
index 00d7675..0eb1905 100644
--- a/arm9/Makefile
+++ b/arm9/Makefile
@@ -1,31 +1,27 @@
-# This is a generic DS makefile, as taken from the libnds example programs.
-#
-
-#-------------------------------------------------------------------------------
+#---------------------------------------------------------------------------------
.SUFFIXES:
-#-------------------------------------------------------------------------------
-
+#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
include $(DEVKITARM)/ds_rules
-#-------------------------------------------------------------------------------
-# TARGET is the name of the output
+#---------------------------------------------------------------------------------
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
-#-------------------------------------------------------------------------------
-TARGET := $(shell basename $(CURDIR))
+# DATA is a list of directories containing binary files
+# all directories are relative to this makefile
+#---------------------------------------------------------------------------------
BUILD := build
-SOURCES := source gbagfx
-DATA := data
-INCLUDES := include gbagfx
+SOURCES := source
+INCLUDES := include
+DATA := data
-#-------------------------------------------------------------------------------
+#---------------------------------------------------------------------------------
# options for code generation
-#-------------------------------------------------------------------------------
+#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork
# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
@@ -37,37 +33,36 @@ CFLAGS := -g -Wall -O2\
$(ADDITIONAL_CFLAGS)
CFLAGS += $(INCLUDE) -DARM9
-CXXFLAGS := $(CFLAGS)
+CXXFLAGS := $(CFLAGS)
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)
-#-------------------------------------------------------------------------------
+#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
-#-------------------------------------------------------------------------------
-LIBS := -lfat -lnds9
-
+#---------------------------------------------------------------------------------
+LIBS := -lfat -lnds9 -ldswifi9
-#-------------------------------------------------------------------------------
+#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
-#-------------------------------------------------------------------------------
+#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)
-#-------------------------------------------------------------------------------
-# no real need to edit anything past this point unless you need to add
-# additional rules for different file extensions
-#-------------------------------------------------------------------------------
+#---------------------------------------------------------------------------------
+# no real need to edit anything past this point unless you need to add additional
+# rules for different file extensions
+#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
-#-------------------------------------------------------------------------------
-
-export OUTPUT := $(CURDIR)/$(TARGET)
+#---------------------------------------------------------------------------------
+export ARM9BIN := $(TOPDIR)/$(TARGET).arm9
+export ARM9ELF := $(CURDIR)/$(TARGET).arm9.elf
+export DEPSDIR := $(CURDIR)/$(BUILD)
+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
-
-export DEPSDIR := $(CURDIR)/$(BUILD)
-
+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
@@ -91,9 +86,8 @@ export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
- $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
- $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
- -I$(CURDIR)/$(BUILD)
+ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
+ -I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
@@ -107,7 +101,7 @@ $(BUILD):
#---------------------------------------------------------------------------------
clean:
@echo clean ...
- @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba
+ @rm -fr $(BUILD) *.elf *.nds* *.bin
#---------------------------------------------------------------------------------
@@ -118,18 +112,23 @@ DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
-$(OUTPUT).ds.gba : $(OUTPUT).nds
-$(OUTPUT).nds : $(OUTPUT).arm9
-$(OUTPUT).arm9 : $(OUTPUT).elf
-$(OUTPUT).elf : $(OFILES)
-
+$(ARM9BIN) : $(ARM9ELF)
+ @$(OBJCOPY) -O binary $< $@
+ @echo built ... $(notdir $@)
+
+$(ARM9ELF) : $(OFILES)
+ @echo linking $(notdir $@)
+ @$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
+
+#---------------------------------------------------------------------------------
+# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-
-
+
+
-include $(DEPENDS)
#---------------------------------------------------------------------------------------