Makefile revision 1b33c96954667ba382fa595baf7b31290bfdd517
253N/A#---------------------------------------------------------------------------------
253N/A.SUFFIXES:
253N/A#---------------------------------------------------------------------------------
253N/A
253N/Aifeq ($(strip $(DEVKITARM)),)
253N/A$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
253N/Aendif
253N/A
253N/Ainclude $(DEVKITARM)/ds_rules
253N/A
253N/A#---------------------------------------------------------------------------------
253N/A# TARGET is the name of the output
253N/A# BUILD is the directory where object files & intermediate files will be placed
253N/A# SOURCES is a list of directories containing source code
253N/A# DATA is a list of directories containing data files
253N/A# INCLUDES is a list of directories containing header files
253N/A#---------------------------------------------------------------------------------
253N/ATARGET := $(shell basename $(CURDIR))
253N/ABUILD := build
253N/ASOURCES := ../../
5680N/ADATA := data
253N/AINCLUDES := include
5680N/A
5680N/A#---------------------------------------------------------------------------------
5680N/A# options for code generation
5680N/A#---------------------------------------------------------------------------------
253N/AARCH := -mthumb -mthumb-interwork
253N/A
5680N/ACFLAGS := -Wall -O2\
253N/A -march=armv5te -mtune=arm946e-s \
253N/A -fomit-frame-pointer -ffast-math \
1233N/A $(ARCH)
253N/A
844N/ACFLAGS += $(INCLUDE) -DARM9
1233N/ACXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
1233N/A
1258N/AASFLAGS := $(ARCH) -march=armv5te -mtune=arm946e-s
253N/ALDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
3966N/A
3966N/A#---------------------------------------------------------------------------------
5680N/A# list of directories containing libraries, this must be the top level containing
5680N/A# include and lib
253N/A#---------------------------------------------------------------------------------
253N/ALIBDIRS := $(LIBNDS)
253N/A
253N/A#---------------------------------------------------------------------------------
253N/A# no real need to edit anything past this point unless you need to add additional
253N/A# rules for different file extensions
253N/A#---------------------------------------------------------------------------------
5680N/Aifneq ($(BUILD),$(notdir $(CURDIR)))
253N/A#---------------------------------------------------------------------------------
253N/A
5680N/Aexport OUTPUT := $(CURDIR)/lib/libz.a
253N/A
253N/Aexport VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
253N/A $(foreach dir,$(DATA),$(CURDIR)/$(dir))
253N/A
253N/Aexport DEPSDIR := $(CURDIR)/$(BUILD)
5680N/A
253N/ACFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
5680N/ACPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
5680N/ASFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
253N/ABINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
5680N/A
5680N/A#---------------------------------------------------------------------------------
5680N/A# use CXX for linking C++ projects, CC for standard C
253N/A#---------------------------------------------------------------------------------
5680N/Aifeq ($(strip $(CPPFILES)),)
253N/A#---------------------------------------------------------------------------------
253N/A export LD := $(CC)
5680N/A#---------------------------------------------------------------------------------
5680N/Aelse
253N/A#---------------------------------------------------------------------------------
253N/A export LD := $(CXX)
253N/A#---------------------------------------------------------------------------------
253N/Aendif
253N/A#---------------------------------------------------------------------------------
253N/A
253N/Aexport OFILES := $(addsuffix .o,$(BINFILES)) \
253N/A $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
253N/A
253N/Aexport INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
253N/A $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
253N/A -I$(CURDIR)/$(BUILD)
253N/A
253N/A.PHONY: $(BUILD) clean all
253N/A
253N/A#---------------------------------------------------------------------------------
253N/Aall: $(BUILD)
253N/A @[ -d $@ ] || mkdir -p include
253N/A @cp ../../*.h include
253N/A
253N/Alib:
253N/A @[ -d $@ ] || mkdir -p $@
253N/A
253N/A$(BUILD): lib
253N/A @[ -d $@ ] || mkdir -p $@
253N/A @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
253N/A
2298N/A#---------------------------------------------------------------------------------
2298N/Aclean:
5680N/A @echo clean ...
5680N/A @rm -fr $(BUILD) lib
5680N/A
253N/A#---------------------------------------------------------------------------------
5680N/Aelse
5680N/A
5680N/ADEPENDS := $(OFILES:.o=.d)
5680N/A
5680N/A#---------------------------------------------------------------------------------
253N/A# main targets
5680N/A#---------------------------------------------------------------------------------
5680N/A$(OUTPUT) : $(OFILES)
253N/A
5680N/A#---------------------------------------------------------------------------------
5680N/A%.bin.o : %.bin
4337N/A#---------------------------------------------------------------------------------
3817N/A @echo $(notdir $<)
3817N/A @$(bin2o)
3817N/A
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------