| 1 | #--------------------------------------------------------------------------------- |
| 2 | .SUFFIXES: |
| 3 | #--------------------------------------------------------------------------------- |
| 4 | |
| 5 | ifeq ($(strip $(DEVKITARM)),) |
| 6 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") |
| 7 | endif |
| 8 | |
| 9 | include $(DEVKITARM)/gba_rules |
| 10 | |
| 11 | #--------------------------------------------------------------------------------- |
| 12 | # TARGET is the name of the output |
| 13 | # BUILD is the directory where object files & intermediate files will be placed |
| 14 | # SOURCES is a list of directories containing source code |
| 15 | # INCLUDES is a list of directories containing extra header files |
| 16 | #--------------------------------------------------------------------------------- |
| 17 | TARGET := powder |
| 18 | |
| 19 | #--------------------------------------------------------------------------------- |
| 20 | # any extra libraries we wish to link with the project |
| 21 | #--------------------------------------------------------------------------------- |
| 22 | LIBS := -lgba |
| 23 | |
| 24 | |
| 25 | #--------------------------------------------------------------------------------- |
| 26 | # list of directories containing libraries, this must be the top level containing |
| 27 | # include and lib |
| 28 | #--------------------------------------------------------------------------------- |
| 29 | LIBDIRS := $(LIBGBA) |
| 30 | #--------------------------------------------------------------------------------- |
| 31 | # options for code generation |
| 32 | #--------------------------------------------------------------------------------- |
| 33 | ARCH := -mthumb -mthumb-interwork |
| 34 | |
| 35 | INCLUDE := -I$(LIBGBA)/include -I$(CURDIR) |
| 36 | |
| 37 | LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) |
| 38 | |
| 39 | CFLAGS := -g -Wall -O1\ |
| 40 | -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\ |
| 41 | -ffast-math -fno-short-enums \ |
| 42 | $(ARCH) |
| 43 | |
| 44 | CFLAGS += $(INCLUDE) -DNO_HAM |
| 45 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions |
| 46 | |
| 47 | ASFLAGS := -g $(ARCH) |
| 48 | LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map) |
| 49 | |
| 50 | |
| 51 | #--------------------------------------------------------------------------------- |
| 52 | # no real need to edit anything past this point unless you need to add additional |
| 53 | # rules for different file extensions |
| 54 | #--------------------------------------------------------------------------------- |
| 55 | #--------------------------------------------------------------------------------- |
| 56 | |
| 57 | OUTPUT := $(CURDIR)/$(TARGET) |
| 58 | |
| 59 | VPATH := |
| 60 | |
| 61 | DEPSDIR := $(CURDIR) |
| 62 | |
| 63 | CFILES := |
| 64 | CPPFILES := gbamain.cpp \ |
| 65 | hamfake.cpp \ |
| 66 | ../../action.cpp \ |
| 67 | ../../assert.cpp \ |
| 68 | ../../ai.cpp \ |
| 69 | ../../artifact.cpp \ |
| 70 | ../../bmp.cpp \ |
| 71 | ../../build.cpp \ |
| 72 | ../../buf.cpp \ |
| 73 | ../../control.cpp \ |
| 74 | ../../creature.cpp \ |
| 75 | ../../dpdf_table.cpp \ |
| 76 | ../../encyc_support.cpp \ |
| 77 | ../../gfxengine.cpp \ |
| 78 | ../../grammar.cpp \ |
| 79 | ../../hiscore.cpp \ |
| 80 | ../../input.cpp \ |
| 81 | ../../intrinsic.cpp \ |
| 82 | ../../item.cpp \ |
| 83 | ../../map.cpp \ |
| 84 | ../../mobref.cpp \ |
| 85 | ../../msg.cpp \ |
| 86 | ../../name.cpp \ |
| 87 | ../../piety.cpp \ |
| 88 | ../../rand.cpp \ |
| 89 | ../../signpost.cpp \ |
| 90 | ../../smokestack.cpp \ |
| 91 | ../../speed.cpp \ |
| 92 | ../../sramstream.cpp \ |
| 93 | ../../stylus.cpp \ |
| 94 | ../../victory.cpp \ |
| 95 | ../../encyclopedia.cpp \ |
| 96 | ../../glbdef.cpp \ |
| 97 | ../../credits.cpp \ |
| 98 | ../../license.cpp \ |
| 99 | ../../gfx/all_bitmaps.cpp \ |
| 100 | ../../rooms/allrooms.cpp |
| 101 | |
| 102 | SFILES := |
| 103 | BINFILES := |
| 104 | |
| 105 | #--------------------------------------------------------------------------------- |
| 106 | # use CXX for linking C++ projects, CC for standard C |
| 107 | #--------------------------------------------------------------------------------- |
| 108 | LD := $(CXX) |
| 109 | |
| 110 | OFILES := $(addsuffix .o,$(BINFILES)) \ |
| 111 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) |
| 112 | |
| 113 | DEPENDS := $(OFILES:.o=.d) |
| 114 | |
| 115 | #--------------------------------------------------------------------------------- |
| 116 | # main targets |
| 117 | #--------------------------------------------------------------------------------- |
| 118 | $(OUTPUT).gba : $(OUTPUT).elf |
| 119 | |
| 120 | $(OUTPUT).elf : $(OFILES) |
| 121 | |
| 122 | #--------------------------------------------------------------------------------- |
| 123 | %.o : %.bin |
| 124 | #--------------------------------------------------------------------------------- |
| 125 | @echo $(notdir $<) |
| 126 | @$(bin2o) |
| 127 | |
| 128 | |
| 129 | # We include this postfix rule as we want to include the version |
| 130 | # number in the ROM tag, not just the title. And we are particular |
| 131 | # about our caps. |
| 132 | postmake: |
| 133 | gbafix powder.gba -tPOWDER`cat ../../VERSION.TXT` |
| 134 | |
| 135 | -include $(DEPENDS) |
| 136 | |
| 137 | #--------------------------------------------------------------------------------- |
| 138 | #--------------------------------------------------------------------------------- |
| 139 | clean: |
| 140 | @echo clean ... |
| 141 | rm -f $(OFILES) $(DEPENDS) $(TARGET).elf $(TARGET).gba |
| 142 |