diff options
Diffstat (limited to 'apps/codecs/dumb/Makefile')
-rw-r--r-- | apps/codecs/dumb/Makefile | 311 |
1 files changed, 311 insertions, 0 deletions
diff --git a/apps/codecs/dumb/Makefile b/apps/codecs/dumb/Makefile new file mode 100644 index 0000000000..3ced51338d --- /dev/null +++ b/apps/codecs/dumb/Makefile | |||
@@ -0,0 +1,311 @@ | |||
1 | # Main Makefile for DUMB. | ||
2 | |||
3 | # In theory, this Makefile can be used without modifications on DOS, Windows, | ||
4 | # Linux, BeOS and Mac OS X. Caveats are as follows: | ||
5 | |||
6 | # - For DOS and Windows users, COMSPEC (or ComSpec) must be set to point to | ||
7 | # command.com or cmd.exe. If they point to a Unix-style shell, this | ||
8 | # Makefile will die horribly. | ||
9 | |||
10 | # - Users of other platforms must NOT set COMSPEC or ComSpec. They must be | ||
11 | # undefined. | ||
12 | |||
13 | # Commands are as follows: | ||
14 | |||
15 | # make - Build the library (does make config for you first time). | ||
16 | # make install - Install the library and examples into the system. | ||
17 | # make uninstall - Remove the above. | ||
18 | # make config - Do or redo the configuration. | ||
19 | # make clean - Delete all object files; examples and libraries remain. | ||
20 | # make veryclean - Delete examples and libraries too. | ||
21 | |||
22 | # TODO: consider whether to delete config.txt and/or dumbask(.exe) | ||
23 | |||
24 | |||
25 | .PHONY: all install uninstall clean veryclean config config-if-necessary | ||
26 | |||
27 | PHONY_TARGETS := core allegro core-examples allegro-examples core-headers allegro-headers | ||
28 | |||
29 | .PHONY: $(PHONY_TARGETS) | ||
30 | .PHONY: $(PHONY_TARGETS:%=install-%) | ||
31 | .PHONY: $(PHONY_TARGETS:%=uninstall-%) | ||
32 | |||
33 | |||
34 | COMMA := , | ||
35 | |||
36 | #CC := gcc | ||
37 | #AR := ar | ||
38 | |||
39 | |||
40 | # Configuration. | ||
41 | # The configuration is done by an MS-DOS batch file if COMSPEC is set. | ||
42 | # Otherwise it is done by a Unix shell script. A file called 'config.txt', | ||
43 | # containing variables that control the build process, is created, and | ||
44 | # included by this Makefile. | ||
45 | |||
46 | |||
47 | ifeq "$(COMSPEC)" "" | ||
48 | ifdef ComSpec | ||
49 | COMSPEC := $(ComSpec) | ||
50 | endif | ||
51 | endif | ||
52 | |||
53 | |||
54 | -include make/config.txt | ||
55 | |||
56 | |||
57 | ifeq "$(OSTYPE)" "beos" | ||
58 | |||
59 | INCLUDE_INSTALL_PATH := /boot/develop/headers | ||
60 | LIB_INSTALL_PATH := /boot/develop/lib/x86 | ||
61 | BIN_INSTALL_PATH := /boot/home/config/bin | ||
62 | # DEFAULT_PREFIX is not set, so config.sh will not prompt for PREFIX. | ||
63 | LINK_MATH := | ||
64 | |||
65 | else | ||
66 | |||
67 | ifdef PREFIX | ||
68 | DEFAULT_PREFIX := $(PREFIX) | ||
69 | else | ||
70 | DEFAULT_PREFIX := /usr/local | ||
71 | endif | ||
72 | export DEFAULT_PREFIX | ||
73 | INCLUDE_INSTALL_PATH := $(PREFIX)/include | ||
74 | LIB_INSTALL_PATH := $(PREFIX)/lib | ||
75 | BIN_INSTALL_PATH := $(PREFIX)/bin | ||
76 | |||
77 | endif | ||
78 | |||
79 | |||
80 | all: config-if-necessary | ||
81 | @$(MAKE) --no-print-directory $(ALL_TARGETS) | ||
82 | $(call ECHO,DUMB has been built. Run $(APOST)make install$(APOST) to install it.) | ||
83 | |||
84 | install: config-if-necessary | ||
85 | @$(MAKE) --no-print-directory $(ALL_TARGETS:%=install-%) | ||
86 | $(call ECHO,DUMB has been installed.) | ||
87 | $(call ECHO,See readme.txt for details on the example programs.) | ||
88 | $(call ECHO,When you$(APOST)re ready to start using DUMB$(COMMA) see docs/howto.txt.) | ||
89 | $(call ECHO,Enjoy!) | ||
90 | |||
91 | uninstall: config-if-necessary | ||
92 | @$(MAKE) --no-print-directory $(ALL_TARGETS:%=uninstall-%) | ||
93 | $(call ECHO,DUMB has been uninstalled.) | ||
94 | |||
95 | |||
96 | ifdef COMSPEC | ||
97 | # Assume DOS or Windows. | ||
98 | SHELL := $(COMSPEC) | ||
99 | CONFIG_COMMAND := make\config.bat | ||
100 | DUMBASK_EXE := make/dumbask.exe | ||
101 | else | ||
102 | # Assume a Unix-compatible system. | ||
103 | CONFIG_COMMAND := make/config.sh | ||
104 | DUMBASK_EXE := make/dumbask | ||
105 | endif | ||
106 | |||
107 | # This will always configure. | ||
108 | config: $(DUMBASK_EXE) | ||
109 | $(CONFIG_COMMAND) | ||
110 | |||
111 | # This will only configure if the configuration file is absent. We don't use | ||
112 | # config.txt as the target name, because Make then runs the config initially, | ||
113 | # and again when it sees the 'config' target, so an initial 'make config' | ||
114 | # causes the configuration to be done twice. | ||
115 | ifeq "$(wildcard make/config.txt)" "" | ||
116 | config-if-necessary: config | ||
117 | else | ||
118 | config-if-necessary: | ||
119 | endif | ||
120 | |||
121 | $(DUMBASK_EXE): make/dumbask.c | ||
122 | $(CC) $< -o $@ | ||
123 | |||
124 | |||
125 | ifdef PLATFORM | ||
126 | |||
127 | |||
128 | # Build. | ||
129 | |||
130 | |||
131 | CORE_MODULES := \ | ||
132 | core/atexit.c \ | ||
133 | core/duhlen.c \ | ||
134 | core/dumbfile.c \ | ||
135 | core/loadduh.c \ | ||
136 | core/makeduh.c \ | ||
137 | core/rawsig.c \ | ||
138 | core/readduh.c \ | ||
139 | core/register.c \ | ||
140 | core/rendduh.c \ | ||
141 | core/rendsig.c \ | ||
142 | core/unload.c \ | ||
143 | helpers/clickrem.c \ | ||
144 | helpers/memfile.c \ | ||
145 | helpers/resample.c \ | ||
146 | helpers/sampbuf.c \ | ||
147 | helpers/silence.c \ | ||
148 | it/itload.c \ | ||
149 | it/itread.c \ | ||
150 | it/itrender.c \ | ||
151 | it/itunload.c \ | ||
152 | it/loads3m.c \ | ||
153 | it/reads3m.c \ | ||
154 | it/loadxm.c \ | ||
155 | it/readxm.c \ | ||
156 | it/loadmod.c \ | ||
157 | it/readmod.c \ | ||
158 | it/xmeffect.c \ | ||
159 | it/itorder.c \ | ||
160 | it/itmisc.c | ||
161 | # helpers/stdfile.c | ||
162 | |||
163 | ALLEGRO_MODULES := \ | ||
164 | allegro/alplay.c \ | ||
165 | allegro/datduh.c \ | ||
166 | allegro/datit.c \ | ||
167 | allegro/datxm.c \ | ||
168 | allegro/dats3m.c \ | ||
169 | allegro/datmod.c \ | ||
170 | allegro/datunld.c \ | ||
171 | allegro/packfile.c | ||
172 | |||
173 | CORE_EXAMPLES := examples/dumbout.c | ||
174 | ALLEGRO_EXAMPLES := examples/dumbplay.c | ||
175 | |||
176 | CORE_HEADERS := include/dumb.h | ||
177 | ALLEGRO_HEADERS := include/aldumb.h | ||
178 | |||
179 | |||
180 | LIBDIR := lib/$(PLATFORM) | ||
181 | OBJDIR_BASE := obj/$(PLATFORM) | ||
182 | |||
183 | |||
184 | WFLAGS := -Wall -W -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -DDUMB_DECLARE_DEPRECATED | ||
185 | WFLAGS_ALLEGRO := -Wno-missing-declarations | ||
186 | OFLAGS := -O2 -ffast-math -fomit-frame-pointer | ||
187 | DBGFLAGS := -DDEBUGMODE=1 -g3 | ||
188 | |||
189 | CFLAGS_RELEASE := -Iinclude $(WFLAGS) $(OFLAGS) | ||
190 | CFLAGS_DEBUG := -Iinclude $(WFLAGS) $(DBGFLAGS) | ||
191 | |||
192 | LDFLAGS := -s | ||
193 | |||
194 | |||
195 | CORE_EXAMPLES_OBJ := $(addprefix examples/, $(notdir $(patsubst %.c, %.o, $(CORE_EXAMPLES)))) | ||
196 | ALLEGRO_EXAMPLES_OBJ := $(addprefix examples/, $(notdir $(patsubst %.c, %.o, $(ALLEGRO_EXAMPLES)))) | ||
197 | |||
198 | CORE_EXAMPLES_EXE := $(addprefix examples/, $(notdir $(patsubst %.c, %$(EXE_SUFFIX), $(CORE_EXAMPLES)))) | ||
199 | ALLEGRO_EXAMPLES_EXE := $(addprefix examples/, $(notdir $(patsubst %.c, %$(EXE_SUFFIX), $(ALLEGRO_EXAMPLES)))) | ||
200 | |||
201 | |||
202 | CORE_LIB_FILE_RELEASE := $(LIBDIR)/libdumb.a | ||
203 | ALLEGRO_LIB_FILE_RELEASE := $(LIBDIR)/libaldmb.a | ||
204 | |||
205 | CORE_LIB_FILE_DEBUG := $(LIBDIR)/libdumbd.a | ||
206 | ALLEGRO_LIB_FILE_DEBUG := $(LIBDIR)/libaldmd.a | ||
207 | |||
208 | |||
209 | core: $(CORE_LIB_FILE_RELEASE) $(CORE_LIB_FILE_DEBUG) | ||
210 | allegro: $(ALLEGRO_LIB_FILE_RELEASE) $(ALLEGRO_LIB_FILE_DEBUG) | ||
211 | |||
212 | core-examples: $(CORE_EXAMPLES_EXE) | ||
213 | allegro-examples: $(ALLEGRO_EXAMPLES_EXE) | ||
214 | |||
215 | core-headers: | ||
216 | |||
217 | allegro-headers: | ||
218 | |||
219 | install-core: core | ||
220 | $(call COPY,$(CORE_LIB_FILE_RELEASE),$(LIB_INSTALL_PATH)) | ||
221 | $(call COPY,$(CORE_LIB_FILE_DEBUG),$(LIB_INSTALL_PATH)) | ||
222 | |||
223 | install-allegro: allegro | ||
224 | $(call COPY,$(ALLEGRO_LIB_FILE_RELEASE),$(LIB_INSTALL_PATH)) | ||
225 | $(call COPY,$(ALLEGRO_LIB_FILE_DEBUG),$(LIB_INSTALL_PATH)) | ||
226 | |||
227 | ifeq "$(COMSPEC)" "" | ||
228 | install-core-examples: core-examples | ||
229 | $(call COPY,$(CORE_EXAMPLES_EXE),$(BIN_INSTALL_PATH)) | ||
230 | |||
231 | install-allegro-examples: allegro-examples | ||
232 | $(call COPY,$(ALLEGRO_EXAMPLES_EXE),$(BIN_INSTALL_PATH)) | ||
233 | else | ||
234 | # Don't install the examples on a Windows system. | ||
235 | install-core-examples: | ||
236 | install-allegro-examples: | ||
237 | endif | ||
238 | |||
239 | install-core-headers: | ||
240 | $(call COPY,$(CORE_HEADERS),$(INCLUDE_INSTALL_PATH)) | ||
241 | |||
242 | install-allegro-headers: | ||
243 | $(call COPY,$(ALLEGRO_HEADERS),$(INCLUDE_INSTALL_PATH)) | ||
244 | |||
245 | |||
246 | uninstall-core: | ||
247 | $(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(CORE_LIB_FILE_RELEASE))) | ||
248 | $(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(CORE_LIB_FILE_DEBUG))) | ||
249 | |||
250 | uninstall-allegro: | ||
251 | $(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(ALLEGRO_LIB_FILE_RELEASE))) | ||
252 | $(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(ALLEGRO_LIB_FILE_DEBUG))) | ||
253 | |||
254 | ifeq "$COMSPEC" "" | ||
255 | uninstall-core-examples: | ||
256 | $(call DELETE,$(patsubst %,$(BIN_INSTALL_PATH)/%,$(notdir $(CORE_EXAMPLES_EXE)))) | ||
257 | |||
258 | uninstall-allegro-examples: | ||
259 | $(call DELETE,$(patsubst %,$(BIN_INSTALL_PATH)/%,$(notdir $(ALLEGRO_EXAMPLES_EXE)))) | ||
260 | else | ||
261 | # The examples wouldn't have been installed on a Windows system. | ||
262 | uninstall-core-examples: | ||
263 | uninstall-allegro-examples: | ||
264 | endif | ||
265 | |||
266 | uninstall-core-headers: | ||
267 | $(call DELETE,$(patsubst %,$(INCLUDE_INSTALL_PATH)/%,$(notdir $(CORE_HEADERS)))) | ||
268 | |||
269 | uninstall-allegro-headers: | ||
270 | $(call DELETE,$(patsubst %,$(INCLUDE_INSTALL_PATH)/%,$(notdir $(ALLEGRO_HEADERS)))) | ||
271 | |||
272 | |||
273 | OBJDIR := $(OBJDIR_BASE)/release | ||
274 | CFLAGS := $(CFLAGS_RELEASE) | ||
275 | CORE_LIB_FILE := $(LIBDIR)/libdumb.a | ||
276 | ALLEGRO_LIB_FILE := $(LIBDIR)/libaldmb.a | ||
277 | include make/Makefile.inc | ||
278 | |||
279 | OBJDIR := $(OBJDIR_BASE)/debug | ||
280 | CFLAGS := $(CFLAGS_DEBUG) | ||
281 | CORE_LIB_FILE := $(LIBDIR)/libdumbd.a | ||
282 | ALLEGRO_LIB_FILE := $(LIBDIR)/libaldmd.a | ||
283 | include make/Makefile.inc | ||
284 | |||
285 | |||
286 | $(CORE_EXAMPLES_EXE): examples/%$(EXE_SUFFIX): examples/%.o $(CORE_LIB_FILE_RELEASE) | ||
287 | $(CC) $^ -o $@ $(LDFLAGS) $(LINK_MATH) | ||
288 | |||
289 | $(ALLEGRO_EXAMPLES_EXE): examples/%$(EXE_SUFFIX): examples/%.o $(ALLEGRO_LIB_FILE_RELEASE) $(CORE_LIB_FILE_RELEASE) | ||
290 | $(CC) $^ -o $@ $(LDFLAGS) $(LINK_ALLEGRO) | ||
291 | |||
292 | $(CORE_EXAMPLES_OBJ): examples/%.o: examples/%.c include/dumb.h | ||
293 | $(CC) -c $< -o $@ $(CFLAGS_RELEASE) | ||
294 | |||
295 | $(ALLEGRO_EXAMPLES_OBJ): examples/%.o: examples/%.c include/dumb.h include/aldumb.h | ||
296 | $(CC) -c $< -o $@ $(CFLAGS_RELEASE) -Wno-missing-declarations | ||
297 | |||
298 | |||
299 | clean: | ||
300 | $(call DELETE,$(call FIX,$(OBJDIR_BASE)/release/*.o)) | ||
301 | $(call DELETE,$(call FIX,$(OBJDIR_BASE)/debug/*.o)) | ||
302 | $(call DELETE,$(call FIX,examples/*.o)) | ||
303 | |||
304 | veryclean: clean | ||
305 | $(call DELETE,$(call FIX,$(CORE_LIB_FILE))) | ||
306 | $(call DELETE,$(call FIX,$(ALLEGRO_LIB_FILE))) | ||
307 | $(call DELETE,$(call FIX,$(CORE_EXAMPLES_EXE))) | ||
308 | $(call DELETE,$(call FIX,$(ALLEGRO_EXAMPLES_EXE))) | ||
309 | |||
310 | |||
311 | endif # ifdef PLATFORM | ||