1#  OpenWatcom makefile to build SDL for Win32
2#
3!ifndef %WATCOM
4!error Environment variable WATCOM is not specified!
5!endif
6
7DLLNAME = SDL
8VERSION = 1.2.52
9
10# change SDL2INC to point to the SDL2 headers
11SDL2INC = include
12INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h" -I"$(SDL2INC)"
13LIBNAME = $(DLLNAME)
14
15DLLFILE = $(LIBNAME).dll
16LIBFILE = $(LIBNAME).lib
17LNKFILE = $(LIBNAME).lnk
18
19CFLAGS =-bt=nt -d0 -zq -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei
20# max warnings:
21CFLAGS+= -wx
22# avoid bogus W200 from cpuid code
23CFLAGS+= -wcd=200
24# newer OpenWatcom versions enable W303 by default
25CFLAGS+= -wcd=303
26# the include paths :
27CFLAGS+= $(INCPATH)
28# building dll:
29CFLAGS+= -bd
30# we override the DECLSPEC define in begin_code.h, because we are using
31# an exports file to remove the _cdecl '_' prefix from the symbol names
32CFLAGS+= -DDECLSPEC=
33# misc
34CFLAGS+= -DNDEBUG -DSDL_DISABLE_IMMINTRIN_H
35
36object_files= SDL12_compat.obj
37resource_obj= version.res
38
39.extensions:
40.extensions: .lib .dll .obj .c .asm .res .rc
41
42.c.obj:
43	wcc386 $(CFLAGS) -fo=$^@ $<
44.rc.res:
45	wrc -q -r -bt=nt -I"$(%WATCOM)/h/nt" -fo=$^@ $<
46
47all: $(DLLFILE) $(LIBFILE) .symbolic
48
49$(DLLFILE): compiling_info $(object_files) $(resource_obj) $(LNKFILE)
50	@echo * Linking: $@
51	@wlink @$(LNKFILE)
52
53$(LIBFILE): $(DLLFILE)
54	@echo * Creating LIB file: $@
55	wlib -q -b -n -c -pa -s -t -zld -ii -io $* @SDL12.lbc
56
57compiling_info : .symbolic
58	@echo * Compiling...
59
60$(LNKFILE):
61	@echo * Creating linker file: $@
62	@%create $@
63	@%append $@ SYSTEM nt_dll INITINSTANCE TERMINSTANCE
64	@%append $@ NAME $(DLLFILE)
65	@for %i in ($(object_files)) do @%append $@ FILE %i
66	@%append $@ EXPORT=SDL12.exports
67	@%append $@ OPTION IMPF=SDL12.lbc
68	@%append $@ OPTION RESOURCE=$(resource_obj)
69	@%append $@ OPTION QUIET
70	@%append $@ OPTION MAP=$^&.map
71	@%append $@ OPTION ELIMINATE
72	@%append $@ OPTION SHOWDEAD
73
74clean: .SYMBOLIC
75	@echo * Clean: $(LIBNAME) $(VERSION)
76	@if exist *.obj rm *.obj
77	@if exist *.res rm *.res
78	@if exist *.map rm *.lbc
79	@if exist *.map rm *.map
80	@if exist $(LNKFILE) rm $(LNKFILE)
81
82distclean: clean .SYMBOLIC
83	@if exist *.err rm *.err
84	@if exist $(DLLFILE) rm $(DLLFILE)
85	@if exist $(LIBFILE) rm $(LIBFILE)
86