Skip to content

Commit

Permalink
added a standalone makefile for OS/2 using Watcom:
Browse files Browse the repository at this point in the history
mp3, vorbis, flac, wav, tracker music all tested to work
using the playsound example program.
  • Loading branch information
sezero committed Mar 15, 2021
1 parent d136a5c commit fc4ea81
Showing 1 changed file with 129 additions and 0 deletions.
129 changes: 129 additions & 0 deletions src/Makefile.os2
@@ -0,0 +1,129 @@
# Open Watcom makefile to build SDL_sound for OS/2
# wmake -f Makefile.os2
#
# Remember to edit DEPS_INC and DEPS_LIB below to meet
# your own environment!.

# change DEPS_INC in order to point to the dependency headers.
DEPS_INC=-IC:\SDL2DEV\h\SDL2
# change DEPS_LIB in order to point to the dependency libraries.
DEPS_LIB=C:\SDL2DEV\lib

LIBNAME = SDL2snd
VERSION = 2.0.0

LIBFILE = $(LIBNAME).lib
DLLFILE = $(LIBNAME).dll
LNKFILE = $(LIBNAME).lnk
MODPLIB = modplug.lib

TITLENAME = $(LIBNAME) $(VERSION)

SRCS = SDL_sound_aiff.c SDL_sound_au.c SDL_sound_raw.c SDL_sound_shn.c &
SDL_sound_voc.c SDL_sound_wav.c SDL_sound_flac.c SDL_sound_modplug.c &
SDL_sound_mp3.c SDL_sound_vorbis.c SDL_sound.c

MODPSRCS = modplug.c sndfile.c fastmix.c snd_dsp.c snd_flt.c snd_fx.c sndmix.c &
load_669.c load_amf.c load_ams.c load_dbm.c load_dmf.c load_dsm.c &
load_far.c load_it.c load_mdl.c load_med.c load_mod.c load_mt2.c &
load_mtm.c load_okt.c load_psm.c load_ptm.c load_s3m.c load_stm.c &
load_ult.c load_umx.c load_xm.c &
load_abc.c load_mid.c load_pat.c

OBJS = $(SRCS:.c=.obj)
MODPOBJS = $(MODPSRCS:.c=.obj)

CFLAGS_BASE = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -j
CFLAGS_BASE+= -DNDEBUG
# warnings:
CFLAGS_BASE+= -wx
# include paths:
CFLAGS_BASE+= -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h"
CFLAGS_BASE+= -I. $(DEPS_INC)
CFLAGS = $(CFLAGS_BASE) -Ilibmodplug
# to build a dll:
CFLAGS+= -bd
# there are _lots_ of lazy declarations:
CFLAGS+= -za99
# for DECLSPEC:
CFLAGS+= -DBUILD_SDL -DSDL_SOUND_DLL_EXPORTS

#this is noted as experimental:
#CFLAGS+= -DSOUND_USE_ALTCVT=1

CFLAGS+= -DSOUND_SUPPORTS_MP3 &
-DSOUND_SUPPORTS_MODPLUG &
-DSOUND_SUPPORTS_WAV &
-DSOUND_SUPPORTS_AIFF &
-DSOUND_SUPPORTS_AU &
-DSOUND_SUPPORTS_VORBIS &
-DSOUND_SUPPORTS_VOC &
-DSOUND_SUPPORTS_RAW &
-DSOUND_SUPPORTS_FLAC

LIBSDL = SDL2.lib
LIBS = $(LIBSDL) $(MODPLIB)

.extensions:
.extensions: .lib .dll .obj .c

all: $(DLLFILE) playsound.exe playsound_simple.exe

.c: decoders
.c: examples

$(LIBFILE): $(DLLFILE)
@echo * Create library: $@...
wlib -b -n -q -c -pa -s -t -zld -ii -io $@ $(DLLFILE)

$(DLLFILE): $(OBJS) $(MODPLIB) $(LNKFILE)
@echo * Link: $@
wlink @$(LNKFILE)

$(LNKFILE):
@%create $@
@%append $@ SYSTEM os2v2_dll INITINSTANCE TERMINSTANCE
@%append $@ NAME $(LIBNAME)
@for %i in ($(OBJS)) do @%append $@ FILE %i
@%append $@ OPTION QUIET
@%append $@ OPTION DESCRIPTION '@$#icculus org:$(VERSION)$#@Simple DirectMedia Layer, abstract soundfile decoder'
@%append $@ LIBPATH $(DEPS_LIB)
@for %i in ($(LIBS)) do @%append $@ LIB %i
@%append $@ OPTION MAP=$^&.map
@%append $@ OPTION ELIMINATE
@%append $@ OPTION MANYAUTODATA
@%append $@ OPTION STACK=0x40000
@%append $@ OPTION OSNAME='OS/2 and eComStation'
@%append $@ OPTION SHOWDEAD

.c.obj:
wcc386 $(CFLAGS) -fo=$^@ $<

playsound.obj: "../examples/playsound.c"
wcc386 $(CFLAGS_BASE) -DHAVE_SIGNAL_H=1 -DHAVE_SETBUF=1 -DHAVE_ASSERT_H=1 -fo=$^@ $<
playsound_simple.obj: "../examples/playsound_simple.c"
wcc386 $(CFLAGS_BASE) -fo=$^@ $<

playsound.exe: $(LIBFILE) playsound.obj
@echo * Link: $@
wlink SYS os2v2 LIBPATH $(DEPS_LIB) LIBR {$(LIBFILE) $(LIBSDL)} op q op el op stack=0x40000 F {playsound.obj} N playsound.exe

playsound_simple.exe: $(LIBFILE) playsound_simple.obj
@echo * Link: $@
wlink SYS os2v2 LIBPATH $(DEPS_LIB) LIBR {$(LIBFILE) $(LIBSDL)} op q op el op stack=0x40000 F {playsound_simple.obj} N playsound_simple.exe

.c: libmodplug;
modplug.lib: $(MODPOBJS)
wlib -b -n -q -c -pa -s -t -zld -ii -io $@ $(MODPOBJS)

clean: .SYMBOLIC
@echo * Clean: $(TITLENAME)
@if exist *.obj rm *.obj
@if exist *.err rm *.err
@if exist $(MODPLIB) rm $(MODPLIB)
@if exist $(LNKFILE) rm $(LNKFILE)
distclean: .SYMBOLIC clean
@if exist $(DLLFILE) rm $(DLLFILE)
@if exist $(LIBFILE) rm $(LIBFILE)
@if exist *.map rm *.map
@if exist *.exe rm *.exe

0 comments on commit fc4ea81

Please sign in to comment.