File: Makefile.rdy

package info (click to toggle)
libdumb 1%3A0.9.3-5.4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 956 kB
  • sloc: ansic: 9,398; makefile: 314; sh: 23
file content (364 lines) | stat: -rw-r--r-- 10,099 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# Main Makefile for DUMB.

# In theory, this Makefile can be used without modifications on DOS, Windows,
# Linux, BeOS and Mac OS X. Caveats are as follows:

# - For DOS and Windows users, COMSPEC (or ComSpec) must be set to point to
#   command.com or cmd.exe. If they point to a Unix-style shell, this
#   Makefile will die horribly.

# - Users of other platforms must NOT set COMSPEC or ComSpec. They must be
#   undefined.

# Commands are as follows:

#   make           - Build the library (does make config for you first time).
#   make install   - Install the library and examples into the system.
#   make uninstall - Remove the above.
#   make config    - Do or redo the configuration.
#   make clean     - Delete all object files; examples and libraries remain.
#   make veryclean - Delete examples and libraries too.
#   make distclean - Delete examples, libraries and configuration.
#                    (Note that this is unable to delete the dumbask
#                    executable if the configuration is absent.)

MAKEFILE = Makefile.rdy

.PHONY: all install uninstall clean veryclean distclean config config-if-necessary make-outdirs

PHONY_TARGETS := core allegro core-examples allegro-examples core-headers allegro-headers

.PHONY: $(PHONY_TARGETS)
.PHONY: $(PHONY_TARGETS:%=install-%)
.PHONY: $(PHONY_TARGETS:%=uninstall-%)


COMMA := ,

ifdef USE_ICC
CC := icc
else
ifdef USE_SGICC
CC := cc
else
CC := gcc
endif
endif
AR := ar


# Configuration.
# The configuration is done by an MS-DOS batch file if COMSPEC is set.
# Otherwise it is done by a Unix shell script. A file called 'config.txt',
# containing variables that control the build process, is created, and
# included by this Makefile.


ifeq "$(COMSPEC)" ""
ifdef ComSpec
COMSPEC := $(ComSpec)
endif
endif


-include make/config.txt


ifeq "$(OSTYPE)" "beos"

INCLUDE_INSTALL_PATH := /boot/develop/headers
LIB_INSTALL_PATH := /boot/develop/lib/x86
BIN_INSTALL_PATH := /boot/home/config/bin
# DEFAULT_PREFIX is not set, so config.sh will not prompt for PREFIX.
LINK_MATH :=

else

ifdef PREFIX
DEFAULT_PREFIX := $(PREFIX)
else
DEFAULT_PREFIX := /usr/local
endif
export DEFAULT_PREFIX
INCLUDE_INSTALL_PATH := $(PREFIX)/include
LIB_INSTALL_PATH := $(PREFIX)/lib
BIN_INSTALL_PATH := $(PREFIX)/bin

endif


all: config-if-necessary make-outdirs
	@$(MAKE) -f $(MAKEFILE) --no-print-directory $(ALL_TARGETS)
	$(call ECHO,DUMB has been built. Run $(APOST)make install$(APOST) to install it.)

install: config-if-necessary
	@$(MAKE) -f $(MAKEFILE) --no-print-directory $(ALL_TARGETS:%=install-%)
	$(call ECHO,DUMB has been installed.)
	$(call ECHO,See readme.txt for details on the example programs.)
	$(call ECHO,When you$(APOST)re ready to start using DUMB$(COMMA) see docs/howto.txt.)
	$(call ECHO,Enjoy!)

uninstall: config-if-necessary
	@$(MAKE) -f $(MAKEFILE) --no-print-directory $(ALL_TARGETS:%=uninstall-%)
	$(call ECHO,DUMB has been uninstalled.)


ifdef COMSPEC
# Assume DOS or Windows.
SHELL := $(COMSPEC)
CONFIG_COMMAND := make\config.bat
DUMBASK_EXE := make/dumbask.exe
else
# Assume a Unix-compatible system.
CONFIG_COMMAND := make/config.sh
DUMBASK_EXE := make/dumbask
endif

# This will always configure.
config: $(DUMBASK_EXE)
	$(CONFIG_COMMAND)

# This will only configure if the configuration file is absent. We don't use
# config.txt as the target name, because Make then runs the config initially,
# and again when it sees the 'config' target, so an initial 'make config'
# causes the configuration to be done twice.
ifeq "$(wildcard make/config.txt)" ""
config-if-necessary: config
else
config-if-necessary:
endif

$(DUMBASK_EXE): make/dumbask.c
	$(CC) $< -o $@


ifdef PLATFORM


# Build.


CORE_MODULES :=            \
    core/atexit.c          \
    core/duhlen.c          \
    core/duhtag.c          \
    core/dumbfile.c        \
    core/loadduh.c         \
    core/makeduh.c         \
    core/rawsig.c          \
    core/readduh.c         \
    core/register.c        \
    core/rendduh.c         \
    core/rendsig.c         \
    core/unload.c          \
    helpers/clickrem.c     \
    helpers/memfile.c      \
    helpers/resample.c     \
    helpers/sampbuf.c      \
    helpers/silence.c      \
    helpers/stdfile.c      \
    it/itload.c            \
    it/itread.c            \
    it/itload2.c           \
    it/itread2.c           \
    it/itrender.c          \
    it/itunload.c          \
    it/loads3m.c           \
    it/reads3m.c           \
    it/loadxm.c            \
    it/readxm.c            \
    it/loadmod.c           \
    it/readmod.c           \
    it/loads3m2.c          \
    it/reads3m2.c          \
    it/loadxm2.c           \
    it/readxm2.c           \
    it/loadmod2.c          \
    it/readmod2.c          \
    it/xmeffect.c          \
    it/itorder.c           \
    it/itmisc.c

ALLEGRO_MODULES :=         \
    allegro/alplay.c       \
    allegro/datduh.c       \
    allegro/datit.c        \
    allegro/datxm.c        \
    allegro/dats3m.c       \
    allegro/datmod.c       \
    allegro/datitq.c       \
    allegro/datxmq.c       \
    allegro/dats3mq.c      \
    allegro/datmodq.c      \
    allegro/datunld.c      \
    allegro/packfile.c

CORE_EXAMPLES := examples/dumbout.c examples/dumb2wav.c
ALLEGRO_EXAMPLES := examples/dumbplay.c

CORE_HEADERS := include/dumb.h
ALLEGRO_HEADERS := include/aldumb.h


LIBDIR := lib/$(PLATFORM)
OBJDIR_BASE := obj/$(PLATFORM)

make-outdirs:
	-$(call MKDIR,lib)
	-$(call MKDIR,lib/$(PLATFORM))
	-$(call MKDIR,obj)
	-$(call MKDIR,obj/$(PLATFORM))
	-$(call MKDIR,obj/$(PLATFORM)/debug)
	-$(call MKDIR,obj/$(PLATFORM)/release)


ifdef USE_ICC
WFLAGS := -Wall -DDUMB_DECLARE_DEPRECATED
WFLAGS_ALLEGRO :=
OFLAGS := -O2
DBGFLAGS := -DDEBUGMODE=1
else
ifdef USE_SGICC
WFLAGS := -fullwarn -DDUMB_DECLARE_DEPRECATED
WFLAGS_ALLEGRO :=
OFLAGS := -n32 -O2 -use_readonly_const
DBGFLAGS := -n32 -g3 -DDEBUGMODE=1
else
WFLAGS := -Wall -W -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -DDUMB_DECLARE_DEPRECATED
WFLAGS_ALLEGRO := -Wno-missing-declarations
OFLAGS := -O2 -ffast-math -fomit-frame-pointer
DBGFLAGS := -DDEBUGMODE=1 -g3
endif
endif

CFLAGS_RELEASE := -Iinclude $(WFLAGS) $(OFLAGS)
CFLAGS_DEBUG := -Iinclude $(WFLAGS) $(DBGFLAGS)

LDFLAGS := -s


CORE_EXAMPLES_OBJ := $(addprefix examples/, $(notdir $(patsubst %.c, %.o, $(CORE_EXAMPLES))))
ALLEGRO_EXAMPLES_OBJ := $(addprefix examples/, $(notdir $(patsubst %.c, %.o, $(ALLEGRO_EXAMPLES))))

CORE_EXAMPLES_EXE := $(addprefix examples/, $(notdir $(patsubst %.c, %$(EXE_SUFFIX), $(CORE_EXAMPLES))))
ALLEGRO_EXAMPLES_EXE := $(addprefix examples/, $(notdir $(patsubst %.c, %$(EXE_SUFFIX), $(ALLEGRO_EXAMPLES))))


CORE_LIB_FILE_RELEASE := $(LIBDIR)/libdumb.a
ALLEGRO_LIB_FILE_RELEASE := $(LIBDIR)/libaldmb.a

CORE_LIB_FILE_DEBUG := $(LIBDIR)/libdumbd.a
ALLEGRO_LIB_FILE_DEBUG := $(LIBDIR)/libaldmd.a


core: $(CORE_LIB_FILE_RELEASE) $(CORE_LIB_FILE_DEBUG)
allegro: $(ALLEGRO_LIB_FILE_RELEASE) $(ALLEGRO_LIB_FILE_DEBUG)

core-examples: $(CORE_EXAMPLES_EXE)
allegro-examples: $(ALLEGRO_EXAMPLES_EXE)

core-headers:

allegro-headers:

install-core: core
	$(call COPY,$(CORE_LIB_FILE_RELEASE),$(LIB_INSTALL_PATH))
	$(call COPY,$(CORE_LIB_FILE_DEBUG),$(LIB_INSTALL_PATH))

install-allegro: allegro
	$(call COPY,$(ALLEGRO_LIB_FILE_RELEASE),$(LIB_INSTALL_PATH))
	$(call COPY,$(ALLEGRO_LIB_FILE_DEBUG),$(LIB_INSTALL_PATH))

ifeq "$(COMSPEC)" ""
install-core-examples: core-examples
	$(call COPY,$(CORE_EXAMPLES_EXE),$(BIN_INSTALL_PATH))

install-allegro-examples: allegro-examples
	$(call COPY,$(ALLEGRO_EXAMPLES_EXE),$(BIN_INSTALL_PATH))
else
# Don't install the examples on a Windows system.
install-core-examples:
install-allegro-examples:
endif

install-core-headers:
	$(call COPY,$(CORE_HEADERS),$(INCLUDE_INSTALL_PATH))

install-allegro-headers:
	$(call COPY,$(ALLEGRO_HEADERS),$(INCLUDE_INSTALL_PATH))


uninstall-core:
	$(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(CORE_LIB_FILE_RELEASE)))
	$(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(CORE_LIB_FILE_DEBUG)))

uninstall-allegro:
	$(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(ALLEGRO_LIB_FILE_RELEASE)))
	$(call DELETE,$(LIB_INSTALL_PATH)/$(notdir $(ALLEGRO_LIB_FILE_DEBUG)))

ifeq "$(COMSPEC)" ""
uninstall-core-examples:
	$(call DELETE,$(patsubst %,$(BIN_INSTALL_PATH)/%,$(notdir $(CORE_EXAMPLES_EXE))))

uninstall-allegro-examples:
	$(call DELETE,$(patsubst %,$(BIN_INSTALL_PATH)/%,$(notdir $(ALLEGRO_EXAMPLES_EXE))))
else
# The examples wouldn't have been installed on a Windows system.
uninstall-core-examples:
uninstall-allegro-examples:
endif

uninstall-core-headers:
	$(call DELETE,$(patsubst %,$(INCLUDE_INSTALL_PATH)/%,$(notdir $(CORE_HEADERS))))

uninstall-allegro-headers:
	$(call DELETE,$(patsubst %,$(INCLUDE_INSTALL_PATH)/%,$(notdir $(ALLEGRO_HEADERS))))


OBJDIR := $(OBJDIR_BASE)/release
CFLAGS := $(CFLAGS_RELEASE)
CORE_LIB_FILE := $(LIBDIR)/libdumb.a
ALLEGRO_LIB_FILE := $(LIBDIR)/libaldmb.a
include make/Makefile.inc

OBJDIR := $(OBJDIR_BASE)/debug
CFLAGS := $(CFLAGS_DEBUG)
CORE_LIB_FILE := $(LIBDIR)/libdumbd.a
ALLEGRO_LIB_FILE := $(LIBDIR)/libaldmd.a
include make/Makefile.inc


$(CORE_EXAMPLES_EXE): examples/%$(EXE_SUFFIX): examples/%.o $(CORE_LIB_FILE_RELEASE)
	$(CC) $^ -o $@ $(LDFLAGS) $(LINK_MATH)

$(ALLEGRO_EXAMPLES_EXE): examples/%$(EXE_SUFFIX): examples/%.o $(ALLEGRO_LIB_FILE_RELEASE) $(CORE_LIB_FILE_RELEASE)
	$(CC) $^ -o $@ $(LDFLAGS) $(LINK_ALLEGRO)

$(CORE_EXAMPLES_OBJ): examples/%.o: examples/%.c include/dumb.h
	$(CC) $(CFLAGS_RELEASE) -c $< -o $@

$(ALLEGRO_EXAMPLES_OBJ): examples/%.o: examples/%.c include/dumb.h include/aldumb.h
	$(CC) $(CFLAGS_RELEASE) -Wno-missing-declarations -c $< -o $@


clean:
	$(call DELETE,$(OBJDIR_BASE)/release/*.o)
	$(call DELETE,$(OBJDIR_BASE)/debug/*.o)
	$(call DELETE,examples/*.o)

veryclean: clean
	$(call DELETE,$(CORE_LIB_FILE))
	$(call DELETE,$(ALLEGRO_LIB_FILE))
	$(call DELETE,$(CORE_EXAMPLES_EXE))
	$(call DELETE,$(ALLEGRO_EXAMPLES_EXE))

distclean: veryclean
	$(call DELETE,make/config.txt)
	$(call DELETE,$(DUMBASK_EXE))


else

make-outdirs:  # don't make output before configuration

endif # ifdef PLATFORM