annotate test/nds-test-progs/general/Makefile @ 2686:e9f27fe4f2a1 gsoc2008_nds

Existing testsprite programs made into NDS projects
author Darren Alton <dalton@stevens.edu>
date Wed, 13 Aug 2008 00:49:03 +0000
parents
children
rev   line source
2686
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
1 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
2 .SUFFIXES:
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
3 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
4
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
5 ifeq ($(strip $(DEVKITARM)),)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
6 $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
7 endif
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
8
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
9 include $(DEVKITARM)/ds_rules
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
10
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
11 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
12 # TARGET is the name of the output
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
13 # BUILD is the directory where object files & intermediate files will be placed
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
14 # SOURCES is a list of directories containing source code
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
15 # INCLUDES is a list of directories containing extra header files
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
16 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
17 TARGET := $(shell basename $(CURDIR))
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
18 BUILD := build
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
19 SOURCES := source
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
20 DATA := data
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
21 INCLUDES := include
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
22
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
23 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
24 # options for code generation
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
25 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
26 ARCH := -mthumb -mthumb-interwork
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
27
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
28 # note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
29 # *insists* it has a FPU or VFP, and it won't take no for an answer!
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
30 CFLAGS := -save-temps -g -Wall -O0\
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
31 -mcpu=arm9tdmi -mtune=arm9tdmi \
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
32 $(ARCH)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
33
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
34 CFLAGS += $(INCLUDE) -DARM9 -D__NDS__
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
35 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-exceptions -fno-rtti
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
36
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
37 ASFLAGS := -g $(ARCH)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
38 LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
39
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
40 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
41 # any extra libraries we wish to link with the project
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
42 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
43 LIBS := -lSDL -lfat -lnds9
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
44
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
45
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
46 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
47 # list of directories containing libraries, this must be the top level containing
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
48 # include and lib
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
49 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
50 LIBDIRS := $(LIBNDS)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
51
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
52 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
53 # no real need to edit anything past this point unless you need to add additional
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
54 # rules for different file extensions
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
55 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
56 ifneq ($(BUILD),$(notdir $(CURDIR)))
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
57 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
58
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
59 export OUTPUT := $(CURDIR)/$(TARGET)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
60
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
61 export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
62 $(foreach dir,$(DATA),$(CURDIR)/$(dir))
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
63
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
64 export DEPSDIR := $(CURDIR)/$(BUILD)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
65
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
66 CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
67 CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
68 SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
69 BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
70
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
71 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
72 # use CXX for linking C++ projects, CC for standard C
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
73 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
74 ifeq ($(strip $(CPPFILES)),)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
75 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
76 export LD := $(CC)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
77 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
78 else
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
79 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
80 export LD := $(CXX)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
81 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
82 endif
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
83 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
84
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
85 export OFILES := $(addsuffix .o,$(BINFILES)) \
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
86 $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
87
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
88 export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
89 $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
90 $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
91 -I$(CURDIR)/$(BUILD)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
92
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
93 export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
94
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
95 .PHONY: $(BUILD) clean
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
96
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
97 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
98 $(BUILD):
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
99 @[ -d $@ ] || mkdir -p $@
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
100 @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
101
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
102 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
103 clean:
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
104 @echo clean ...
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
105 @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
106
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
107
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
108 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
109 else
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
110
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
111 DEPENDS := $(OFILES:.o=.d)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
112
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
113 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
114 # main targets
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
115 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
116 $(OUTPUT).ds.gba : $(OUTPUT).nds
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
117 $(OUTPUT).nds : $(OUTPUT).arm9
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
118 $(OUTPUT).arm9 : $(OUTPUT).elf
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
119 $(OUTPUT).elf : $(OFILES)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
120
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
121 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
122 %.pcx.o : %.pcx
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
123 #---------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
124 @echo $(notdir $<)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
125 @$(bin2o)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
126
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
127
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
128 -include $(DEPENDS)
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
129
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
130 #---------------------------------------------------------------------------------------
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
131 endif
e9f27fe4f2a1 Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
132 #---------------------------------------------------------------------------------------