1. Torr_Samaho
  2. skulltag

Source

skulltag / default.cbd

  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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
do ifopt help
  echo "Available options are:
    debug     - Build debug instead of release
    verbose   - Show system commands instead of decorated messages
    clean     - Clean temp files (use with debug to clean debug files)
    zdoom.pk3 - (Re)build just zdoom.pk3, even if it already exists

To use with MinGW, compile cbuild.c into an executable using:
gcc -O2 -W -Wall -Werror -o cbuild.exe cbuild.c

Or if you have a sh-compatible shell, you can run the cbuild.c file
directly or have it automatically compile itself with GCC by passing
--make-compiled
"
  exit 0
done

# Here's the main script. All commands are case in-sensitive.

# 'Ifopt' will check if the following word was passed on the command line, and execute the
# rest of the line if so. The reverse, 'ifnopt', also exists.

ifopt verbose  verbose 1
ifopt debug  CONFIG = Debug

# VAR?=foo will only set the var if it's unset. Note that if you want spaces, put '' or ""
# quotes around the value. VAR+=foo will append foo to the very end of the existing var.
# And, VAR-=foo will remove all occurences of foo from the var.
CONFIG ?= Release

OPTLEVEL ?= 2
ARCH_TYPE ?= pentium
TUNE_TYPE ?= athlon-xp

RELEASETARGET ?= zdoomgcc
DEBUGTARGET ?= zdoomgccd

DEBUGOBJDIR = debugobj
RELEASEOBJDIR = releaseobj


CPPFLAGS = "-DHAVE_FILELENGTH -D__forceinline=inline -Izlib -IFLAC -Isrc -Isrc/sdl -Isrc/g_doom -Isrc/g_heretic -Isrc/g_hexen -Isrc/g_raven -Isrc/g_strife -Isrc/g_shared -Isrc/oplsynth -Isrc/sound"
LDFLAGS = "-lFLAC++ -lFLAC -lz -lfmod `sdl-config --libs`"
CFLAGS = "`sdl-config --cflags` "

do ifopt debug
  OBJDIR = "${DEBUGOBJDIR}"
  CFLAGS += "-Wall -Wno-unused -g3"
  CPPFLAGS += " -D_DEBUG"
  CXXFLAGS = "${CFLAGS}"
  NASMFLAGS = "-g"
  TARGET = "${DEBUGTARGET}"
else
  OBJDIR = "${RELEASEOBJDIR}"
  CFLAGS += "-march=${ARCH_TYPE} -mtune=${TUNE_TYPE} -Wall -Wno-unused -O${OPTLEVEL} -fomit-frame-pointer -ffunction-sections -fno-rtti"
  ifopt gc
    CFLAGS += "-march=${ARCH_TYPE} -mtune=${TUNE_TYPE} -Wall -Wno-unused -O${OPTLEL} -fomit-frame-pointer -fno-rtti"
  done
  CPPFLAGS += " -DNDEBUG"
  CXXFLAGS = "${CFLAGS}"
  LDFLAGS += " -s -Wl,-Map=zdoomgcc.map"
  ifopt gc
    LDFLAGS += " -Wl,--gc-sections"
  done
  TARGET = "${RELEASETARGET}"
done

ifnplat win32  CPPFLAGS += " -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp"

# This is where the object and dependancy files go when compiled
OBJ_DIR = "${OBJDIR}"
DEP_DIR = "${OBJDIR}"

do ifnopt clean
  EVILCLEAN = 0

  ifnexist "${OBJ_DIR}"  mkdir "${OBJ_DIR}"

  ifopt zdoom.pk3  goto makewad

  do if "${NOASM}"=""
    # This sets a custom command to run durring a compile for files with the
    # given extension. <@> is replaced with the output file, <!> is the source,
    # and <*> is the raw name as given to the compile command, without the
    # extension
    do ifplat win32
      associate 'nas' 'nasmw -o <@> -f win32 <!>'
    else ifplat unix
      associate 'nas' 'nasm -o <@> -f elf -DM_TARGET_LINUX <!>'
    else
      echo ''
      echo Disabling assembly for this platform.
      echo ''
      goto no_asm
    done
    CPPFLAGS = "-DUSEASM ${CPPFLAGS}"
  else
#:no_asm
    CPPFLAGS = "-DNOASM ${CPPFLAGS}"
  done

# Set the compile and link commands. 'Compile' will compile the list of sourcefiles and
# store their names until another Compile is encountered (if you wish to add to a previous
# list, use 'Compileadd').
#
# C sources are compiled with:
# ${CC} ${CPPFLAGS} ${CFLAGS} ${DEP_OPT}${DEP_DIR}/file-sans-ext${DEP_EXT} ${OUT_OPT}${OBJ_DIR}/file-sans-ext${OBJ_EXT} ${SRC_OPT}detected-source-path/file-with-ext
#
# and for C++ sources:
# ${CXX} ${CPPFLAGS} ${CXXFLAGS} ${DEP_OPT}${DEP_DIR}/file-sans-ext${DEP_EXT} ${OUT_OPT}${OBJ_DIR}/file-sans-ext${OBJ_EXT} ${SRC_OPT}detected-source-path/file-with-ext
#
# A source file will not be compiled if the object file exists and is newer than the source.
# Or if the associated dependancy file exists, all of the object's dependancies are older
# than the object.
#
# If DEP_OPT is unset, the whole DEP_* section will be removed from the command line. Files
# with unknown extensions are silently ignored (but will still be passed to Linkexec with
# their name "object-ified").
#
# 'Linkexec' executes:
# ${LD} ${OUT_OPT}file${EXE_EXT} <list of objects previously compiled> ${LDFLAGS}
#
# It will not link if the target executable exists and is newer than all of the objects it's
# linking with.

  COMPILER = Compile
  LINK = Linkexec

# This is where it can find the sources.
  src_paths  src src/g_doom src/g_heretic src/g_hexen src/g_raven src/g_strife \
   src/g_shared src/oplsynth src/sound src/sdl

else

# Override the compile and link commands with rmobj and rmexec. A quick way to delete
# the objects and executables while dealing with only one list. No, rmobj will not
# delete the specified source file, but rather the object and dependancy files that would 
# result from compiling the specified source.
  EVILCLEAN = 1
  COMPILER = -rmobj
  LINK = -rmexec

done

# How do you pass -msse2 -mfpmath=sse2 with cbuild when compiling nodebuild_classify_sse2.cpp?
# Since I don't know the answer, that means you won't get an SSE2-supporting nodebuilder if
# you build with cbuild. Use make instead.

${COMPILER} "autostart.cpp \
 a.nas \
 misc.nas \
 tmap.nas \
 tmap2.nas \
 tmap3.nas \
 am_map.cpp \
 b_bot.cpp \
 b_func.cpp \
 b_game.cpp \
 b_move.cpp \
 b_think.cpp \
 bbannouncer.cpp \
 c_bind.cpp \
 c_cmds.cpp \
 c_console.cpp \
 c_cvars.cpp \
 c_dispatch.cpp \
 c_expr.cpp \
 cmdlib.cpp \
 colormatcher.cpp \
 configfile.cpp \
 ct_chat.cpp \
 d_dehacked.cpp \
 d_main.cpp \
 d_net.cpp \
 d_netinfo.cpp \
 d_protocol.cpp \
 decallib.cpp \
 decorations.cpp \
 dobject.cpp \
 dobjtype.cpp \
 doomdef.cpp \
 doomstat.cpp \
 dsectoreffect.cpp \
 dthinker.cpp \
 empty.cpp \
 f_finale.cpp \
 f_wipe.cpp \
 farchive.cpp \
 files.cpp \
 g_game.cpp \
 g_hub.cpp \
 g_level.cpp \
 gameconfigfile.cpp \
 gi.cpp \
 hu_scores.cpp \
 info.cpp \
 infodefaults.cpp \
 lumpconfigfile.cpp \
 m_alloc.cpp \
 m_argv.cpp \
 m_bbox.cpp \
 m_cheat.cpp \
 m_fixed.cpp \
 m_menu.cpp \
 m_misc.cpp \
 m_options.cpp \
 m_png.cpp \
 m_random.cpp \
 mus2midi.cpp \
 nodebuild.cpp \
 nodebuild_classify_nosse2.cpp \
 nodebuild_classify_sse2.cpp \
 nodebuild_events.cpp \
 nodebuild_extract.cpp \
 nodebuild_gl.cpp \
 nodebuild_utility.cpp \
 p_acs.cpp \
 p_buildmap.cpp \
 p_ceiling.cpp \
 p_conversation.cpp \
 p_doors.cpp \
 p_effect.cpp \
 p_enemy.cpp \
 p_floor.cpp \
 p_interaction.cpp \
 p_lights.cpp \
 p_lnspec.cpp \
 p_map.cpp \
 p_maputl.cpp \
 p_mobj.cpp \
 p_pillar.cpp \
 p_plats.cpp \
 p_pspr.cpp \
 p_saveg.cpp \
 p_sectors.cpp \
 p_setup.cpp \
 p_sight.cpp \
 p_spec.cpp \
 p_switch.cpp \
 p_teleport.cpp \
 p_terrain.cpp \
 p_things.cpp \
 p_tick.cpp \
 p_trace.cpp \
 p_user.cpp \
 p_writemap.cpp \
 p_xlat.cpp \
 po_man.cpp \
 r_anim.cpp \
 r_bsp.cpp \
 r_data.cpp \
 r_draw.cpp \
 r_drawt.cpp \
 r_main.cpp \
 r_plane.cpp \
 r_segs.cpp \
 r_sky.cpp \
 r_things.cpp \
 r_polymost.cpp \
 s_advsound.cpp \
 s_environment.cpp \
 s_playlist.cpp \
 s_sndseq.cpp \
 s_sound.cpp \
 sc_man.cpp \
 skins.cpp \
 st_stuff.cpp \
 stats.cpp \
 stringtable.cpp \
 tables.cpp \
 tempfiles.cpp \
 thingdef.cpp \
 thingdef_codeptr.cpp \
 thingdef_exp.cpp \
 v_collection.cpp \
 v_draw.cpp \
 v_font.cpp \
 v_palette.cpp \
 v_pfx.cpp \
 v_text.cpp \
 v_video.cpp \
 vectors.cpp \
 name.cpp \
 zstring.cpp \
 zstrformat.cpp \
 w_wad.cpp \
 wi_stuff.cpp \
 a_arachnotron.cpp \
 a_archvile.cpp \
 a_bossbrain.cpp \
 a_bruiser.cpp \
 a_cacodemon.cpp \
 a_cyberdemon.cpp \
 a_demon.cpp \
 a_doomartifacts.cpp \
 a_doomhealth.cpp \
 a_doomimp.cpp \
 a_doommisc.cpp \
 a_doomplayer.cpp \
 a_doomweaps.cpp \
 a_fatso.cpp \
 a_keen.cpp \
 a_lostsoul.cpp \
 a_painelemental.cpp \
 a_possessed.cpp \
 a_revenant.cpp \
 a_scriptedmarine.cpp \
 a_spidermaster.cpp \
 doom_sbar.cpp \
 a_beast.cpp \
 a_chicken.cpp \
 a_clink.cpp \
 a_dsparil.cpp \
 a_hereticartifacts.cpp \
 a_hereticimp.cpp \
 a_heretickeys.cpp \
 a_hereticmisc.cpp \
 a_hereticplayer.cpp \
 a_hereticweaps.cpp \
 a_ironlich.cpp \
 a_knight.cpp \
 a_mummy.cpp \
 a_snake.cpp \
 a_wizard.cpp \
 heretic_sbar.cpp \
 a_bats.cpp \
 a_bishop.cpp \
 a_blastradius.cpp \
 a_boostarmor.cpp \
 a_centaur.cpp \
 a_clericboss.cpp \
 a_clericflame.cpp \
 a_clericholy.cpp \
 a_clericmace.cpp \
 a_clericplayer.cpp \
 a_clericstaff.cpp \
 a_demons.cpp \
 a_dragon.cpp \
 a_ettin.cpp \
 a_fighteraxe.cpp \
 a_fighterboss.cpp \
 a_fighterhammer.cpp \
 a_fighterplayer.cpp \
 a_fighterquietus.cpp \
 a_firedemon.cpp \
 a_flechette.cpp \
 a_fog.cpp \
 a_healingradius.cpp \
 a_heresiarch.cpp \
 a_hexenspecialdecs.cpp \
 a_iceguy.cpp \
 a_korax.cpp \
 a_mageboss.cpp \
 a_magecone.cpp \
 a_magelightning.cpp \
 a_mageplayer.cpp \
 a_magestaff.cpp \
 a_magewand.cpp \
 a_mana.cpp \
 a_pig.cpp \
 a_puzzleitems.cpp \
 a_serpent.cpp \
 a_spike.cpp \
 a_summon.cpp \
 a_teleportother.cpp \
 a_weaponpieces.cpp \
 a_wraith.cpp \
 hexen_sbar.cpp \
 a_artiegg.cpp \
 a_artitele.cpp \
 a_minotaur.cpp \
 a_ravenambient.cpp \
 a_acolyte.cpp \
 a_alienspectres.cpp \
 a_coin.cpp \
 a_crusader.cpp \
 a_entityboss.cpp \
 a_inquisitor.cpp \
 a_loremaster.cpp \
 a_macil.cpp \
 a_oracle.cpp \
 a_programmer.cpp \
 a_reaver.cpp \
 a_rebels.cpp \
 a_sentinel.cpp \
 a_spectral.cpp \
 a_stalker.cpp \
 a_strifeammo.cpp \
 a_strifebishop.cpp \
 a_strifeitems.cpp \
 a_strifeplayer.cpp \
 a_strifestuff.cpp \
 a_strifeweapons.cpp \
 a_templar.cpp \
 a_thingstoblowup.cpp \
 strife_sbar.cpp \
 a_action.cpp \
 a_artifacts.cpp \
 a_bridge.cpp \
 a_camera.cpp \
 a_debris.cpp \
 a_decals.cpp \
 a_flashfader.cpp \
 a_fountain.cpp \
 a_hatetarget.cpp \
 a_keys.cpp \
 a_lightning.cpp \
 a_movingcamera.cpp \
 a_pickups.cpp \
 a_quake.cpp \
 a_secrettrigger.cpp \
 a_sectoraction.cpp \
 a_sharedmisc.cpp \
 a_skies.cpp \
 a_soundenvironment.cpp \
 a_soundsequence.cpp \
 a_spark.cpp \
 a_waterzone.cpp \
 a_weaponpiece.cpp \
 a_weapons.cpp \
 hudmessages.cpp \
 shared_sbar.cpp \
 fmopl.cpp \
 mlkernel.cpp \
 mlopl.cpp \
 mlopl_io.cpp \
 opl_mus_player.cpp \
 fmodsound.cpp \
 i_music.cpp \
 i_sound.cpp \
 music_cd.cpp \
 music_flac.cpp \
 music_midi_midiout.cpp \
 music_midi_stream.cpp \
 music_midi_timidity.cpp \
 music_mod.cpp \
 music_mus_midiout.cpp \
 music_mus_opl.cpp \
 music_stream.cpp \
 sample_flac.cpp \
 crashcatcher.c \
 i_input.cpp \
 i_net.cpp \
 i_cd.cpp \
 i_main.cpp \
 i_system.cpp \
 hardware.cpp \
 i_movie.cpp \
 sdlvideo.cpp \
 autozend.cpp"

${LINK} "${TARGET}"


# If we're not cleaning and zdoom.pk3 exists, exit now.
if "${EVILCLEAN}"="0" ifexist zdoom.pk3  exit 0
#:makewad

CFLAGS = '-Os -Wall -fomit-frame-pointer'

LDFLAGS = '-s -lz'
src_paths  tools/makewad
${COMPILER} makewad.c ioapi.c zip.c 
${LINK} tools/makewad/makewad

LDFLAGS = '-s'
src_paths  tools/xlatcc
${COMPILER} xlat-parse.tab.c gen.c
${LINK} tools/xlatcc/xlatcc

src_paths  tools/dehsupp
${COMPILER} parse.c scanner.c dehsupp.c
${LINK} tools/dehsupp/dehsupp

do if "${EVILCLEAN}"="1"
  -rm "${OBJ_DIR}"
  -rm "${DEP_DIR}"
  -rm zdoomgcc.map
  -rm zdoom.pk3
else
  chdir wadsrc
  do ifret 0
    -call ../tools/makewad/makewad zdoom.lst
    ifret 0 -copy zdoom.pk3 ../
    chdir ..
  done
done