Mercurial > sdl-ios-xcode
comparison test/nds-test-progs/sprite/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 |
comparison
equal
deleted
inserted
replaced
2685:2190b873ff00 | 2686:e9f27fe4f2a1 |
---|---|
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)/ds_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 := $(shell basename $(CURDIR)) | |
18 BUILD := build | |
19 SOURCES := source | |
20 DATA := data | |
21 INCLUDES := include | |
22 | |
23 #--------------------------------------------------------------------------------- | |
24 # options for code generation | |
25 #--------------------------------------------------------------------------------- | |
26 ARCH := -mthumb -mthumb-interwork | |
27 | |
28 # note: arm9tdmi isn't the correct CPU arch, but anything newer and LD | |
29 # *insists* it has a FPU or VFP, and it won't take no for an answer! | |
30 CFLAGS := -save-temps -g -Wall -O0\ | |
31 -mcpu=arm9tdmi -mtune=arm9tdmi \ | |
32 $(ARCH) | |
33 | |
34 CFLAGS += $(INCLUDE) -DARM9 -D__NDS__ | |
35 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-exceptions -fno-rtti | |
36 | |
37 ASFLAGS := -g $(ARCH) | |
38 LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map) | |
39 | |
40 #--------------------------------------------------------------------------------- | |
41 # any extra libraries we wish to link with the project | |
42 #--------------------------------------------------------------------------------- | |
43 LIBS := -lSDL -lfat -lnds9 | |
44 | |
45 | |
46 #--------------------------------------------------------------------------------- | |
47 # list of directories containing libraries, this must be the top level containing | |
48 # include and lib | |
49 #--------------------------------------------------------------------------------- | |
50 LIBDIRS := $(LIBNDS) | |
51 | |
52 #--------------------------------------------------------------------------------- | |
53 # no real need to edit anything past this point unless you need to add additional | |
54 # rules for different file extensions | |
55 #--------------------------------------------------------------------------------- | |
56 ifneq ($(BUILD),$(notdir $(CURDIR))) | |
57 #--------------------------------------------------------------------------------- | |
58 | |
59 export OUTPUT := $(CURDIR)/$(TARGET) | |
60 | |
61 export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ | |
62 $(foreach dir,$(DATA),$(CURDIR)/$(dir)) | |
63 | |
64 export DEPSDIR := $(CURDIR)/$(BUILD) | |
65 | |
66 CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) | |
67 CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) | |
68 SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) | |
69 BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) | |
70 | |
71 #--------------------------------------------------------------------------------- | |
72 # use CXX for linking C++ projects, CC for standard C | |
73 #--------------------------------------------------------------------------------- | |
74 ifeq ($(strip $(CPPFILES)),) | |
75 #--------------------------------------------------------------------------------- | |
76 export LD := $(CC) | |
77 #--------------------------------------------------------------------------------- | |
78 else | |
79 #--------------------------------------------------------------------------------- | |
80 export LD := $(CXX) | |
81 #--------------------------------------------------------------------------------- | |
82 endif | |
83 #--------------------------------------------------------------------------------- | |
84 | |
85 export OFILES := $(addsuffix .o,$(BINFILES)) \ | |
86 $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) | |
87 | |
88 export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ | |
89 $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ | |
90 $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ | |
91 -I$(CURDIR)/$(BUILD) | |
92 | |
93 export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) | |
94 | |
95 .PHONY: $(BUILD) clean | |
96 | |
97 #--------------------------------------------------------------------------------- | |
98 $(BUILD): | |
99 @[ -d $@ ] || mkdir -p $@ | |
100 @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile | |
101 | |
102 #--------------------------------------------------------------------------------- | |
103 clean: | |
104 @echo clean ... | |
105 @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba | |
106 | |
107 | |
108 #--------------------------------------------------------------------------------- | |
109 else | |
110 | |
111 DEPENDS := $(OFILES:.o=.d) | |
112 | |
113 #--------------------------------------------------------------------------------- | |
114 # main targets | |
115 #--------------------------------------------------------------------------------- | |
116 $(OUTPUT).ds.gba : $(OUTPUT).nds | |
117 $(OUTPUT).nds : $(OUTPUT).arm9 | |
118 $(OUTPUT).arm9 : $(OUTPUT).elf | |
119 $(OUTPUT).elf : $(OFILES) | |
120 | |
121 #--------------------------------------------------------------------------------- | |
122 %.pcx.o : %.pcx | |
123 #--------------------------------------------------------------------------------- | |
124 @echo $(notdir $<) | |
125 @$(bin2o) | |
126 | |
127 | |
128 -include $(DEPENDS) | |
129 | |
130 #--------------------------------------------------------------------------------------- | |
131 endif | |
132 #--------------------------------------------------------------------------------------- |