/
Makefile
706 lines (581 loc) · 25.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#-----------------------------------------------------------------------------#
# TOBY -- An abstract interpreter engine and system for learning.
# Copyright (C) 1999 Ryan C. Gordon.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Makefile for building Toby on Unix-like systems. Follow the instructions
# for editing this file, then run "make" on the command line.
#
25
# Written by Ryan C. Gordon (icculus@icculus.org)
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Set to your liking.
#-----------------------------------------------------------------------------#
CC = gcc
LINKER = gcc
#-----------------------------------------------------------------------------#
# If this makefile fails to detect Cygwin correctly, or you want to force
# the build process's behaviour, set it to "true" or "false" (w/o quotes).
#-----------------------------------------------------------------------------#
#cygwin := true
#cygwin := false
cygwin := autodetect
#-----------------------------------------------------------------------------#
# Set this to true if you want to create a debug build.
#-----------------------------------------------------------------------------#
46
47
#debug := false
debug := true
48
49
50
51
52
53
54
55
56
#-----------------------------------------------------------------------------#
# Set this to true to link with Electric Fence. If you don't
# know what that is, you better not set it.
# ElectricFence can be found at ftp://ftp.perens.com/pub/ElectricFence/
#-----------------------------------------------------------------------------#
use_efence := false
#use_efence := true
57
58
59
60
#-----------------------------------------------------------------------------#
# Set this to what your platform has.
# Current option(s): "pthreads", "sdl", "null".
#-----------------------------------------------------------------------------#
61
62
platform_threads := pthreads
#platform_threads := sdl
63
64
65
66
#platform_threads := null
#-----------------------------------------------------------------------------#
# Set this to what your platform has.
67
# Current option(s): "sdl", "gtk", "null".
68
69
#-----------------------------------------------------------------------------#
platform_video := gtk
70
71
72
73
74
75
76
77
78
79
#platform_video := sdl
#platform_video := null
#-----------------------------------------------------------------------------#
# Set this to what your platform has.
# Current option(s): "sdl", "unix", "null".
#-----------------------------------------------------------------------------#
platform_clock := unix
#platform_clock := sdl
#platform_clock := null
80
81
82
#-----------------------------------------------------------------------------#
# Choose a default natural language.
83
# Please report incorrect translations to Ryan: icculus@icculus.org.
84
85
86
87
88
# Ryan would also love to hear from you if you are willing to translate this
# software to other natural languages; it's easy to do, if you are bilingual
# in the first place.
#
# Current option(s): "english", "french"
89
#-----------------------------------------------------------------------------#
90
#platform_i18n := french
91
92
platform_i18n := english
93
94
95
96
97
98
#-----------------------------------------------------------------------------#
# Set this to what your platform has.
# Current option(s): "unix", "null".
#-----------------------------------------------------------------------------#
#platform_loader := null
platform_loader := unix
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#-----------------------------------------------------------------------------#
# Set this accordingly. If you choose the XML lexer, you need to be
# building for a platform that has a working dynamic loader (you can use
# the NullLoader to compile, but it renders the parsers useless), and has
# an actual filesystem. The XML loader gives you more flexibility at the
# cost of more initial overhead and some code bloat. More importantly, the
# XML lexer can dynamically generate C++ code that duplicates its
# functionality. This code can be generated on any platform that supports the
# XML lexer, and then be compiled in for a more lean (but more ridgid)
# equivalent lexer that should work on all platforms that can't use
# the XML lexer for whatever reason. This generated code comprises the
# "static" lexer. The static lexer can be used on any platform, if the code
# has already been generated (we keep a revision of that code around, so you
# can have a choice without having to build one then the other). The Null
# lexer is just for stubbing out a rather important subsystem while porting
# to a extremely foreign platform.
#
# If you are really confused, the general rule is:
# Choose "xml", unless you're building for an unusual platform (PalmOS, a
# port to a new platform), in which case choose "static".
#
# Current option(s): "xml", "static", "null"
#-----------------------------------------------------------------------------#
123
platform_lexer := static
124
#platform_lexer := null
125
#platform_lexer := xml
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
#-----------------------------------------------------------------------------#
# Choose all that apply. These are parsers for languages that you will be
# linking statically into the program. Each one you link in adds more bulk
# to the binary, but it's one less thing that can go wrong later. If you
# want to use a language, it MUST be listed either here or in the
# "dynamic_parsers" section, below. Systems without a dynamic loader
# (PalmOS, etc) must list all languages they want to use in this section.
# Each language should be lowercase, and separated by a space character.
#
# If you are really confused, the defaults are probably okay.
#
# Current option(s): "Toby"
#-----------------------------------------------------------------------------#
#static_parsers :=
static_parsers := Toby
#-----------------------------------------------------------------------------#
# Choose all that apply. These are parsers for languages that you will be
# linking dynamically against the program. The usual arguments for shared
# libraries apply here; modularity, plugins, potential errors, yaddayadda...
# If you want to use a language, it MUST be listed either here or in the
# "static_parsers" section, above. Systems without a dynamic loader
# (PalmOS, etc) must list any languages they want to use IN THE STATIC
# PARSERS SECTION. Each language should be lowercase, and separated by
# a space character.
#
# If you are really confused, the defaults are probably okay.
#
# Current option(s): "toby"
#-----------------------------------------------------------------------------#
#dynamic_parsers := toby
dynamic_parsers :=
160
161
#-----------------------------------------------------------------------------#
# To use a different platform's ASM or portable C, change this.
162
# Currently, this MUST be -DUSE_PORTABLE_C
163
164
165
166
#-----------------------------------------------------------------------------#
#USE_ASM := -DUSE_I386_ASM
USE_ASM := -DUSE_PORTABLE_C
167
168
169
170
171
172
173
#-----------------------------------------------------------------------------#
# Set this accordingly.
#-----------------------------------------------------------------------------#
#strcasecmp := stricmp
strcasecmp := strcasecmp
174
175
#-----------------------------------------------------------------------------#
# You only need to set SDL_INC_DIR and SDL_LIB_DIR if you are using CygWin
176
# as a compiler and SDL for some subsystem or another.
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
#
# SDL_INC_DIR is where SDL.h and associated headers can be found, and
# SDL_LIB_DIR is where SDL.lib and SDL.dll are located. These may be set as
# environment variables, if you'd prefer to not hack the Makefile.
#
# Same thing applies for GTK+, if you are using that. Good luck.
#
# examples:
# SDL_INC_DIR := C:/2/SDL-1.1.8/include
# SDL_LIB_DIR := C:/2/SDL-1.1.8/lib
#-----------------------------------------------------------------------------#
ifeq ($(strip $(SDL_INC_DIR)),)
SDL_INC_DIR := please_set_me_cygwin_users
endif
ifeq ($(strip $(SDL_LIB_DIR)),)
SDL_LIB_DIR := please_set_me_cygwin_users
endif
ifeq ($(strip $(GTK_INC_DIR)),)
GTK_INC_DIR := please_set_me_cygwin_users
endif
ifeq ($(strip $(GTK_LIB_DIR)),)
GTK_LIB_DIR := please_set_me_cygwin_users
endif
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Everything below this line is probably okay.
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
219
220
221
222
223
224
#-----------------------------------------------------------------------------#
# Basic initialization.
#-----------------------------------------------------------------------------#
need_xml := false
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#-----------------------------------------------------------------------------#
# CygWin autodetect.
#-----------------------------------------------------------------------------#
ifeq ($(strip $(cygwin)),autodetect)
ifneq ($(strip $(shell gcc -v 2>&1 |grep "cygwin")),)
cygwin := true
else
cygwin := false
endif
endif
#-----------------------------------------------------------------------------#
# Set up video flags...
#-----------------------------------------------------------------------------#
using_sdl_at_all := false
ifeq ($(strip $(platform_video)),sdl)
using_sdl_at_all := true
endif
ifeq ($(strip $(platform_threads)),sdl)
using_sdl_at_all := true
endif
248
249
250
ifeq ($(strip $(platform_clock)),sdl)
using_sdl_at_all := true
endif
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
ifeq ($(strip $(using_sdl_at_all)),true)
ifeq ($(strip $(cygwin)),true)
ifeq ($(strip $(SDL_INC_DIR)),please_set_me_cygwin_users)
$(error Cygwin users need to set the SDL_INC_DIR envr var.)
else
CFLAGS += -I$(SDL_INC_DIR)
endif
ifeq ($(strip $(SDL_LIB_DIR)),please_set_me_cygwin_users)
$(error Cygwin users need to set the SDL_LIB_DIR envr var.)
else
LDFLAGS += -L$(SDL_LIB_DIR) -lSDL
endif
else
CFLAGS += $(shell sdl-config --cflags)
LDFLAGS += $(shell sdl-config --libs)
endif
endif
ifeq ($(strip $(platform_video)),gtk)
ifeq ($(strip $(cygwin)),true)
ifeq ($(strip $(GTK_INC_DIR)),please_set_me_cygwin_users)
$(error Cygwin users need to set the GTK_INC_DIR envr var.)
else
CFLAGS += -I$(GTK_INC_DIR)
endif
ifeq ($(strip $(GTK_LIB_DIR)),please_set_me_cygwin_users)
$(error Cygwin users need to set the GTK_LIB_DIR envr var.)
else
LDFLAGS += -L$(GTK_LIB_DIR) -lgtk -lgdk -lglib
endif
else
CFLAGS += $(shell gtk-config --cflags)
LDFLAGS += $(shell gtk-config --libs)
endif
endif
#-----------------------------------------------------------------------------#
# Platform-specific binary stuff.
#-----------------------------------------------------------------------------#
294
CFLAGS += -Dstrcasecmp=$(strcasecmp) $(EXTRAINCLUDES)
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
ifeq ($(strip $(cygwin)),true)
ASM = nasmw
EXE_EXT = .exe
ASMOBJFMT = win32
ASMDEFS = -dC_IDENTIFIERS_UNDERSCORED
CFLAGS += -DC_IDENTIFIERS_UNDERSCORED
else
ASM = nasm
EXE_EXT =
ASMOBJFMT = elf
endif
#-----------------------------------------------------------------------------#
# General compiler, assembler, and linker flags.
#-----------------------------------------------------------------------------#
BINDIR := bin
SRCDIR := src
CFLAGS += $(USE_ASM) -I$(SRCDIR) -D_REENTRANT -fsigned-char -DPLATFORM_UNIX
317
CFLAGS += -Wall -Werror -fexceptions -frtti -D_REENTRANT
318
319
320
LDFLAGS += -lm
321
322
323
324
ifeq ($(strip $(use_efence)),true)
EFENCELIB := /usr/lib/libefence.a
endif
325
ifeq ($(strip $(debug)),true)
326
327
328
CFLAGS += -DDEBUG -g -fno-omit-frame-pointer
LDFLAGS += -g -fno-omit-frame-pointer
else
329
330
CFLAGS += -DNDEBUG -s -O2 -fomit-frame-pointer
LDFLAGS += -s -O2 -fomit-frame-pointer
331
332
333
334
335
336
337
338
339
340
endif
ifneq ($(strip $(USE_ASM)),-DUSE_PORTABLE_C)
CFLAGS += -O2 -fasm
endif
ASMFLAGS := -f $(ASMOBJFMT) $(ASMDEFS)
#-----------------------------------------------------------------------------#
341
# Language modules.
342
343
344
345
#-----------------------------------------------------------------------------#
CFLAGS += "-ATOBYI18N_DEFAULT($(strip $(platform_i18n)))"
346
#-----------------------------------------------------------------------------#
347
# Thread modules.
348
#-----------------------------------------------------------------------------#
349
350
351
352
353
valid_threads_target := false
ifeq ($(strip $(platform_threads)),pthreads)
THREADSRCS := platform/threads/pthreads/PthreadsThread.cpp \
platform/threads/pthreads/PthreadsMutex.cpp
THREADSDIR := pthreads
354
LDFLAGS += -lpthread
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
valid_threads_target := true
endif
ifeq ($(strip $(platform_threads)),sdl)
THREADSRCS := platform/threads/sdlthreads/SDLThread.cpp \
platform/threads/sdlthreads/SDLMutex.cpp
THREADSDIR := sdlthreads
valid_threads_target := true
endif
ifeq ($(strip $(platform_threads)),null)
THREADSRCS := platform/threads/nullthreads/NullThread.cpp \
platform/threads/nullthreads/NullMutex.cpp
THREADSDIR := nullthreads
valid_threads_target := true
endif
ifneq ($(strip $(valid_threads_target)),true)
$(error platform_threads flag in Makefile is not valid.)
endif
377
#-----------------------------------------------------------------------------#
378
# Clock modules.
379
#-----------------------------------------------------------------------------#
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
valid_clock_target := false
ifeq ($(strip $(platform_clock)),sdl)
CLOCKSRCS := platform/clocks/sdlclock/SDLClock.cpp
CLOCKDIR := sdlclock
valid_clock_target := true
endif
ifeq ($(strip $(platform_clock)),unix)
CLOCKSRCS := platform/clocks/unixclock/UnixClock.cpp
CLOCKDIR := unixclock
valid_clock_target := true
endif
ifeq ($(strip $(platform_clock)),null)
CLOCKSRCS := platform/clocks/nullclock/NullClock.cpp
CLOCKDIR := nullclock
valid_clock_target := true
endif
ifneq ($(strip $(valid_clock_target)),true)
$(error platform_clock flag in Makefile is not valid.)
endif
404
#-----------------------------------------------------------------------------#
405
# Loader modules.
406
407
408
409
410
#-----------------------------------------------------------------------------#
valid_loader_target := false
ifeq ($(strip $(platform_loader)),unix)
LOADERSRCS := platform/loaders/unixloader/UnixLoader.cpp
LOADERDIR := unixloader
411
LDFLAGS += -ldl
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
valid_loader_target := true
endif
ifeq ($(strip $(platform_loader)),null)
LOADERSRCS := platform/loaders/nullloader/NullLoader.cpp
LOADERDIR := nullloader
valid_loader_target := true
endif
ifneq ($(strip $(valid_loader_target)),true)
$(error platform_loader flag in Makefile is not valid.)
endif
#-----------------------------------------------------------------------------#
427
# Video modules.
428
#-----------------------------------------------------------------------------#
429
430
431
432
433
434
435
436
437
438
439
440
441
442
valid_video_target := false
ifeq ($(strip $(platform_video)),sdl)
VIDEOSRCS := platform/renderers/fbrenderer/FrameBufferTurtleSpaceRenderer.cpp \
platform/renderers/sdlrenderer/SDLTurtleSpaceRenderer.cpp
VIDEODIR := sdlrenderer
valid_video_target := true
endif
ifeq ($(strip $(platform_video)),gtk)
VIDEOSRCS := platform/renderers/gtkrenderer/GTKTurtleSpaceRenderer.cpp
VIDEODIR := gtkrenderer
valid_video_target := true
endif
443
444
445
446
447
448
ifeq ($(strip $(platform_video)),null)
VIDEOSRCS := platform/renderers/nullrenderer/NullTurtleSpaceRenderer.cpp
VIDEODIR := nullrenderer
valid_video_target := true
endif
449
450
451
452
ifneq ($(strip $(valid_video_target)),true)
$(error platform_video flag in Makefile is not valid.)
endif
453
454
455
456
457
458
459
460
#-----------------------------------------------------------------------------#
# Lexer modules.
#-----------------------------------------------------------------------------#
valid_lexer_target := false
ifeq ($(strip $(platform_lexer)),xml)
need_xml := true
LEXERSRCS := platform/lexers/xmllexer/XMLLexer.cpp \
461
462
platform/lexers/xmllexer/LanguageRulesXML.cpp \
platform/lexers/xmllexer/TokenizerRulesXML.cpp \
463
platform/lexers/xmllexer/ElementRulesXML.cpp \
464
465
466
467
468
469
470
471
platform/lexers/xmllexer/RepeatRulesXML.cpp \
platform/lexers/xmllexer/PickOneRulesXML.cpp \
platform/lexers/xmllexer/ReqWordRulesXML.cpp \
platform/lexers/xmllexer/ReqEOFRulesXML.cpp \
platform/lexers/xmllexer/ReqNewlineRulesXML.cpp \
platform/lexers/xmllexer/ReqLiteralStringRulesXML.cpp \
platform/lexers/xmllexer/ReqWhitespaceRulesXML.cpp \
platform/lexers/xmllexer/ReqSingleLineCommentRulesXML.cpp \
472
platform/lexers/xmllexer/ReqMultiLineCommentRulesXML.cpp \
473
474
475
476
platform/lexers/xmllexer/ReqNumberRulesXML.cpp \
platform/lexers/xmllexer/ReqWordCharsRulesXML.cpp \
platform/lexers/xmllexer/ReqCharRulesXML.cpp \
platform/lexers/xmllexer/ReqElementRulesXML.cpp
477
478
479
480
481
482
LEXERDIR := xmllexer
valid_lexer_target := true
endif
ifeq ($(strip $(platform_lexer)),static)
LEXERSRCS := platform/lexers/staticlexer/StaticLexer.cpp
483
LEXERSRCS += $(foreach f,$(static_parsers),platform/lexers/staticlexer/Static$(f)Lexer.cpp)
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
LEXERDIR := staticlexer
valid_lexer_target := true
endif
ifeq ($(strip $(platform_lexer)),null)
LEXERSRCS := platform/lexers/nulllexer/NullLexer.cpp
LEXERDIR := nulllexer
valid_lexer_target := true
endif
ifneq ($(strip $(valid_lexer_target)),true)
$(error platform_lexer flag in Makefile is not valid.)
endif
#-----------------------------------------------------------------------------#
# Parser modules.
#-----------------------------------------------------------------------------#
CFLAGS += $(foreach f,$(static_parsers),-DTOBYPARSER_$(shell echo $(f) |tr a-z A-Z))
CFLAGS += $(foreach f,$(dynamic_parsers),-DTOBYPARSER_$(shell echo $(f) |tr a-z A-Z))
PARSERSRCS := $(foreach f,$(static_parsers),parsers/$(f)Parser.cpp)
# (!!! There's no dynamic loading support in the XML parser yet, either.)
ifneq ($(strip $(dynamic_parsers)),)
$(error Can't build dynamic parsers, yet.)
endif
#-----------------------------------------------------------------------------#
# Source and target names.
#-----------------------------------------------------------------------------#
MAINEXE := $(BINDIR)/toby$(strip $(EXE_EXT))
STANDALONEEXE := $(BINDIR)/standalone/toby$(strip $(EXE_EXT))
518
LEXGENEXE := $(BINDIR)/standalone/tobylexgen$(strip $(EXE_EXT))
519
520
EXES := $(STANDALONEEXE) #$(MAINEXE)
521
522
523
524
ifeq ($(strip $(platform_lexer)),xml)
EXES += $(LEXGENEXE)
endif
525
526
527
TESTTOKENIZEREXE := $(BINDIR)/test/tokenizer$(strip $(EXE_EXT))
TESTXMLEXE := $(BINDIR)/test/xml$(strip $(EXE_EXT))
TESTGRAMMAREXE := $(BINDIR)/test/grammar$(strip $(EXE_EXT))
528
TESTLEXEREXE := $(BINDIR)/test/lexer$(strip $(EXE_EXT))
529
530
TESTEXES := $(TESTTOKENIZEREXE) $(TESTLEXEREXE)
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
ifeq ($(strip $(need_xml)),true)
TESTEXES += $(TESTXMLEXE) $(TESTGRAMMAREXE)
XMLSRCS := xml/XMLTree.cpp xml/XMLNode.cpp
endif
UTILSRCS += util/TobyCollection.cpp util/TobyStack.cpp util/TobyString.cpp \
util/TobyLanguage.cpp util/TobyClock.cpp
PARSERSRCS += parsers/Parser.cpp
TURTLESPACESRCS += turtlespace/Turtle.cpp turtlespace/TurtleSpace.cpp
IOSRCS += io/TobyReader.cpp io/FileReader.cpp io/StringReader.cpp \
io/Tokenizer.cpp
546
547
LEXERSRCS += lexer/Lexer.cpp lexer/LexerRules.cpp lexer/LanguageRules.cpp \
lexer/TokenizerRules.cpp lexer/ElementRules.cpp \
548
549
550
551
lexer/RepeatRules.cpp lexer/PickOneRules.cpp \
lexer/ReqEOFRules.cpp lexer/ReqWordRules.cpp \
lexer/ReqNewlineRules.cpp lexer/ReqLiteralStringRules.cpp \
lexer/ReqWhitespaceRules.cpp lexer/ReqMultiLineCommentRules.cpp \
552
553
554
lexer/ReqSingleLineCommentRules.cpp lexer/ReqNumberRules.cpp \
lexer/ReqWordCharsRules.cpp lexer/ReqCharRules.cpp \
lexer/ReqElementRules.cpp
555
556
557
#-----------------------------------------------------------------------------#
# Source and object parsing...
#-----------------------------------------------------------------------------#
558
COMMONSRCS := $(UTILSRCS) $(TURTLESPACESRCS) $(THREADSRCS) $(VIDEOSRCS) \
559
560
$(PARSERSRCS) $(CLOCKSRCS) $(IOSRCS) $(LOADERSRCS) $(XMLSRCS) \
$(LEXERSRCS)
561
562
563
564
565
566
567
# Rule for getting list of objects from source
COMMONOBJS1 := $(COMMONSRCS:.c=.o)
COMMONOBJS2 := $(COMMONOBJS1:.cpp=.o)
COMMONOBJS3 := $(COMMONOBJS2:.asm=.o)
COMMONOBJS := $(foreach f,$(COMMONOBJS3),$(BINDIR)/$(f))
568
COMMONSRCS := $(foreach f,$(COMMONSRCS),$(SRCDIR)/$(f))
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
CLEANUP = $(wildcard *.exe) $(wildcard *.obj) \
$(wildcard $(BINDIR)/*.exe) $(wildcard $(BINDIR)/*.obj) \
$(wildcard *~) $(wildcard *.err) \
$(wildcard .\#*) core
#-----------------------------------------------------------------------------#
# Rules.
#-----------------------------------------------------------------------------#
# Rules for turning source files into .o files
$(BINDIR)/%.o: $(SRCDIR)/%.cpp
$(CC) -c -o $@ $< $(CFLAGS)
$(BINDIR)/%.o: $(SRCDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(BINDIR)/%.o: $(SRCDIR)/%.asm
$(ASM) $(ASMFLAGS) -o $@ $<
590
.PHONY: all tests clean distclean listobjs showcfg showflags
591
592
593
594
595
596
all: $(BINDIR) $(EXES)
$(MAINEXE) : $(BINDIR) $(COMMONOBJS) $(BINDIR)/toby.o
$(LINKER) -o $(MAINEXE) $(LDFLAGS) $(COMMONOBJS) $(BINDIR)/toby.o
597
598
$(STANDALONEEXE) : $(BINDIR) $(COMMONOBJS) $(BINDIR)/standalone/toby.o
$(LINKER) -o $(STANDALONEEXE) $(LDFLAGS) $(COMMONOBJS) $(BINDIR)/standalone/toby.o
599
600
601
602
$(LEXGENEXE) : $(BINDIR) $(COMMONOBJS) $(BINDIR)/standalone/tobylexgen.o
$(LINKER) -o $(LEXGENEXE) $(LDFLAGS) $(COMMONOBJS) $(BINDIR)/standalone/tobylexgen.o $(EFENCELIB)
603
tests: $(BINDIR) $(TESTEXES)
604
605
606
607
$(TESTTOKENIZEREXE) : $(BINDIR) $(COMMONOBJS) $(BINDIR)/test/tokenizer.o
$(LINKER) -o $(TESTTOKENIZEREXE) $(LDFLAGS) $(COMMONOBJS) $(BINDIR)/test/tokenizer.o
608
609
610
$(TESTXMLEXE) : $(BINDIR) $(COMMONOBJS) $(BINDIR)/test/xml.o
$(LINKER) -o $(TESTXMLEXE) $(LDFLAGS) $(COMMONOBJS) $(BINDIR)/test/xml.o
611
612
$(TESTGRAMMAREXE) : $(BINDIR) $(COMMONOBJS) $(BINDIR)/test/grammar.o
$(LINKER) -o $(TESTGRAMMAREXE) $(LDFLAGS) $(COMMONOBJS) $(BINDIR)/test/grammar.o
613
614
615
616
$(TESTLEXEREXE) : $(BINDIR) $(COMMONOBJS) $(BINDIR)/test/lexer.o
$(LINKER) -o $(TESTLEXEREXE) $(LDFLAGS) $(COMMONOBJS) $(BINDIR)/test/lexer.o
617
618
$(BINDIR):
619
mkdir -p $(BINDIR)
620
mkdir -p $(BINDIR)/standalone
621
mkdir -p $(BINDIR)/test
622
623
mkdir -p $(BINDIR)/turtlespace
mkdir -p $(BINDIR)/util
624
mkdir -p $(BINDIR)/io
625
mkdir -p $(BINDIR)/xml
626
627
mkdir -p $(BINDIR)/lexer
mkdir -p $(BINDIR)/parsers
628
mkdir -p $(BINDIR)/platform/renderers/fbrenderer
629
630
631
mkdir -p $(BINDIR)/platform/renderers/$(VIDEODIR)
mkdir -p $(BINDIR)/platform/clocks/$(CLOCKDIR)
mkdir -p $(BINDIR)/platform/threads/$(THREADSDIR)
632
mkdir -p $(BINDIR)/platform/loaders/$(LOADERDIR)
633
mkdir -p $(BINDIR)/platform/lexers/$(LEXERDIR)
634
635
distclean: clean
636
637
638
639
640
641
clean:
rm -f $(CLEANUP)
rm -rf $(BINDIR)
listobjs:
642
643
644
@echo SOURCES:
@echo $(COMMONSRCS)
@echo
645
646
647
648
649
650
651
@echo OBJECTS:
@echo $(COMMONOBJS)
@echo
@echo EXECUTABLES:
@echo $(EXES)
showcfg:
652
@echo "Compiler : $(CC)"
653
@echo "Using CygWin : $(cygwin)"
654
@echo "Debugging : $(debug)"
655
@echo "ASM flag : $(USE_ASM)"
656
@echo "Using ElectricFence : $(use_efence)"
657
658
659
660
@echo "Video module : $(platform_video)"
@echo "Thread module : $(platform_threads)"
@echo "Clock module : $(platform_clock)"
@echo "Loader module : $(platform_loader)"
661
@echo "Lexer module : $(platform_lexer)"
662
@echo "Default i18n language : $(platform_i18n)"
663
@echo "Parser module(s) : $(static_parsers) $(dynamic_parsers)"
664
665
666
667
showflags:
@echo 'CFLAGS : $(CFLAGS)'
@echo 'LDFLAGS : $(LDFLAGS)'
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
#-----------------------------------------------------------------------------#
# This section is pretty much just for Ryan's use to make distributions.
# You Probably Should Not Touch.
#-----------------------------------------------------------------------------#
# These are the files needed in a binary distribution, regardless of what
# platform is being used.
BINSCOMMON = $(MAINEXE) $(STANDALONEEXE)
BINSCOMMON += LICENSE.TXT
.PHONY: package msbins win32bins nocygwin
package: clean
cd .. ; zip -9rz ./toby-src-$(shell date +%m%d%Y).zip toby -x "*CVS*" < toby/FILEID.DIZ
ifeq ($(strip $(cygwin)),true)
msbins: win32bins
win32bins: clean all
ifeq ($(strip $(platform_video)),sdl)
cp $(SDL_LIB_DIR)/SDL.dll .
EXTRAPACKAGELIBS := SDL.dll
endif
692
echo -e "\r\n\r\n\r\nHEY YOU.\r\n\r\n\r\nTake a look at README-win32bins.txt FIRST.\r\n\r\n\r\n--ryan. (icculus@icculus.org)\r\n\r\n" |zip -9rz ../toby-win32bins-$(shell date +%m%d%Y).zip $(EXES) $(EXTRAPACKAGELIBS) README-win32bins.txt
693
694
695
696
697
698
699
700
701
702
703
704
705
706
else
msbins: nocygwin
win32bins: nocygwin
endif
nocygwin:
@echo This must be done on a Windows box in the Cygwin environment.
#-----------------------------------------------------------------------------#
# That's all, folks.
#-----------------------------------------------------------------------------#
# end of Makefile ...