# Open Watcom makefile to build SDL3.dll for Win32 # wmake -f Makefile.w32 # # To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 LIBNAME = SDL3 MAJOR_VERSION = 3 MINOR_VERSION = 0 MICRO_VERSION = 0 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) LIBHOME = . DLLFILE = $(LIBHOME)/$(LIBNAME).dll LIBFILE = $(LIBHOME)/$(LIBNAME).lib EXPFILE = $(LIBHOME)/$(LIBNAME).exp LNKFILE = $(LIBNAME).lnk INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h/nt/directx" -I"$(%WATCOM)/h" INCPATH+= -Iinclude INCPATH+= -I"src/video/khronos" LIBM = SDL3libm.lib TLIB = SDL3test.lib # user32.lib, gdi32.lib, ole32.lib and oleaut32.lib are actually # among the default libraries in wlink.lnk for nt_dll linkage... LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.lib setupapi.lib version.lib uuid.lib dxguid.lib $(LIBM) CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei # max warnings: CFLAGS+= -wx !ifeq ENABLE_WERROR 1 CFLAGS+= -we !endif # newer OpenWatcom versions enable W303 by default CFLAGS+= -wcd=303 # new vulkan headers result in lots of W202 warnings CFLAGS+= -wcd=202 # the include paths : CFLAGS+= $(INCPATH) CFLAGS_STATIC=$(CFLAGS) # building dll: CFLAGS_DLL =$(CFLAGS) CFLAGS_DLL+= -bd # we override the DECLSPEC define in begin_code.h, because we are using # an exports file to remove the _cdecl '_' prefix from the symbol names CFLAGS_DLL+= -DDECLSPEC= CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) RCFLAGS = -q -r -bt=nt $(INCPATH) SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c SRCS+= SDL_rwops.c SDL_power.c SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & SDL_sensor.c SDL_touch.c SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & SDL_render_sw.c SDL_rotate.c SDL_triangle.c SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c SRCS+= SDL_systimer.c SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c SRCS+= SDL_locale.c SDL_syslocale.c SRCS+= SDL_url.c SDL_sysurl.c SRCS+= SDL_winmm.c SDL_directsound.c SDL_wasapi.c SDL_wasapi_win32.c SRCS+= SDL_hid.c SDL_immdevice.c SDL_windows.c SDL_xinput.c SRCS+= SDL_dinputhaptic.c SDL_windowshaptic.c SDL_xinputhaptic.c SRCS+= SDL_dinputjoystick.c SDL_rawinputjoystick.c SDL_windowsjoystick.c SDL_windows_gaming_input.c SDL_xinputjoystick.c SRCS+= SDL_syspower.c SRCS+= SDL_d3dmath.c SRCS+= SDL_render_d3d.c SDL_shaders_d3d.c SRCS+= SDL_render_d3d11.c SDL_shaders_d3d11.c SRCS+= SDL_render_d3d12.c SDL_shaders_d3d12.c SRCS+= SDL_render_gl.c SDL_shaders_gl.c SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c SRCS+= SDL_windowssensor.c SRCS+= SDL_syscond_cv.c SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c SRCS+= SDL_dynapi.c RCSRCS = version.rc OBJS = $(SRCS:.c=.obj) RCOBJS= $(RCSRCS:.rc=.res) .extensions: .extensions: .lib .dll .obj .res .c .rc .asm .c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; .c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; .c: ./src/core/windows;./src/audio/winmm;./src/audio/directsound;./src/audio/wasapi;./src/loadso/windows;./src/filesystem/windows;./src/haptic/windows;./src/joystick/windows;./src/sensor/windows;./src/thread/windows;./src/timer/windows;./src/video/windows; .c: ./src/locale/;./src/locale/windows;./src/misc;./src/misc/windows;./src/power/windows;./src/joystick/hidapi;./src/hidapi;./src/render/direct3d;./src/render/direct3d11;./src/render/direct3d12;./src/render/opengl;./src/render/opengles2 .rc: ./src/main/windows all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic build_dll: .symbolic @echo * Compiling dll objects $(DLLFILE): build_dll $(OBJS) $(LIBM) $(RCOBJS) $(LNKFILE) @echo * Linking: $@ wlink @$(LNKFILE) $(LIBFILE): $(DLLFILE) @echo * Creating LIB file: $@ wlib -q -b -n -c -pa -s -t -zld -ii -io $* @$(EXPFILE) .c.obj: wcc386 $(CFLAGS_DLL) -fo=$^@ $< .rc.res: wrc $(RCFLAGS) -fo=$^@ $< SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" wcc386 $(CFLAGS_DLL) -fo=$^@ $< SDL_cpuinfo.obj: SDL_cpuinfo.c wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< SDL_wave.obj: SDL_wave.c wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< SDL_blendfillrect.obj: SDL_blendfillrect.c wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< SDL_blendline.obj: SDL_blendline.c wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< SDL_blendpoint.obj: SDL_blendpoint.c wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< SDL_RLEaccel.obj: SDL_RLEaccel.c wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< SDL_malloc.obj: SDL_malloc.c wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< # SDL3libm MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & k_cos.c k_rem_pio2.c k_sin.c k_tan.c & s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c MOBJS= $(MSRCS:.c=.obj) .c: ./src/libm; e_atan2.obj: e_atan2.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< e_exp.obj: e_exp.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< e_fmod.obj: e_fmod.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< e_log10.obj: e_log10.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< e_log.obj: e_log.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< e_pow.obj: e_pow.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< e_rem_pio2.obj: e_rem_pio2.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< e_sqrt.obj: e_sqrt.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< k_cos.obj: k_cos.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< k_rem_pio2.obj: k_rem_pio2.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< k_sin.obj: k_sin.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< k_tan.obj: k_tan.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_atan.obj: s_atan.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_copysign.obj: s_copysign.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_cos.obj: s_cos.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_fabs.obj: s_fabs.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_floor.obj: s_floor.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_scalbn.obj: s_scalbn.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_sin.obj: s_sin.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< s_tan.obj: s_tan.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< build_libm: .symbolic @echo * Compiling libm objects $(LIBM): build_libm $(MOBJS) @echo * Creating: $@ wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) # SDL3test TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c TOBJS= $(TSRCS:.c=.obj) .c: ./src/test; SDL_test_assert.obj: SDL_test_assert.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_common.obj: SDL_test_common.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_compare.obj: SDL_test_compare.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_crc32.obj: SDL_test_crc32.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_font.obj: SDL_test_font.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_fuzzer.obj: SDL_test_fuzzer.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_harness.obj: SDL_test_harness.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_imageBlit.obj: SDL_test_imageBlit.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_imageFace.obj: SDL_test_imageFace.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_log.obj: SDL_test_log.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_md5.obj: SDL_test_md5.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_random.obj: SDL_test_random.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< SDL_test_memory.obj: SDL_test_memory.c wcc386 $(CFLAGS_STATIC) -fo=$^@ $< build_tlib: .symbolic @echo * Compiling testlib objects $(TLIB): build_tlib $(TOBJS) @echo * Creating: $@ wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) $(LNKFILE): Makefile.w32 @echo * Creating linker file: $@ @%create $@ @%append $@ SYSTEM nt_dll INITINSTANCE TERMINSTANCE @%append $@ NAME $(DLLFILE) @for %i in ($(OBJS)) do @%append $@ FILE %i @for %i in ($(LIBS)) do @%append $@ LIB %i @%append $@ OPTION RESOURCE=$(RCOBJS) @%append $@ EXPORT=src/dynapi/SDL3.exports @%append $@ OPTION QUIET @%append $@ OPTION IMPF=$(EXPFILE) @%append $@ OPTION MAP=$(LIBHOME)/$^&.map @%append $@ OPTION ELIMINATE @%append $@ OPTION SHOWDEAD clean: .SYMBOLIC @echo * Clean: $(LIBNAME) @if exist *.obj rm *.obj @if exist *.res rm *.res @if exist *.err rm *.err @if exist $(LNKFILE) rm $(LNKFILE) @if exist $(LIBM) rm $(LIBM) distclean: .SYMBOLIC clean @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map @if exist $(LIBFILE) rm $(LIBFILE) @if exist $(DLLFILE) rm $(DLLFILE) @if exist $(TLIB) rm $(TLIB)